PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/files/syntaxhighlighter/2.1.364/scripts/shBrushPhp.js

https://gitlab.com/Mirros/jsdelivr
JavaScript | 91 lines | 57 code | 5 blank | 29 comment | 5 complexity | 5b74062e54f0b7ddd968073d1b105a9b MD5 | raw file
  1. /**
  2. * SyntaxHighlighter
  3. * http://alexgorbatchev.com/
  4. *
  5. * SyntaxHighlighter is donationware. If you are using it, please donate.
  6. * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
  7. *
  8. * @version
  9. * 2.1.364 (October 15 2009)
  10. *
  11. * @copyright
  12. * Copyright (C) 2004-2009 Alex Gorbatchev.
  13. *
  14. * @license
  15. * This file is part of SyntaxHighlighter.
  16. *
  17. * SyntaxHighlighter is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Lesser General Public License as published by
  19. * the Free Software Foundation, either version 3 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * SyntaxHighlighter is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
  29. */
  30. SyntaxHighlighter.brushes.Php = function()
  31. {
  32. var funcs = 'abs acos acosh addcslashes addslashes ' +
  33. 'array_change_key_case array_chunk array_combine array_count_values array_diff '+
  34. 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
  35. 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
  36. 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
  37. 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
  38. 'array_push array_rand array_reduce array_reverse array_search array_shift '+
  39. 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
  40. 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
  41. 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
  42. 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
  43. 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
  44. 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
  45. 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
  46. 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
  47. 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
  48. 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
  49. 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
  50. 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
  51. 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
  52. 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
  53. 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
  54. 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
  55. 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
  56. 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
  57. 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
  58. 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
  59. 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
  60. 'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+
  61. 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
  62. 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
  63. 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
  64. 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
  65. 'strtoupper strtr strval substr substr_compare';
  66. var keywords = 'and or xor array as break case ' +
  67. 'cfunction class const continue declare default die do else ' +
  68. 'elseif enddeclare endfor endforeach endif endswitch endwhile ' +
  69. 'extends for foreach function include include_once global if ' +
  70. 'new old_function return static switch use require require_once ' +
  71. 'var while abstract interface public implements extends private protected throw';
  72. var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
  73. this.regexList = [
  74. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  75. { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
  76. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
  77. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
  78. { regex: /\$\w+/g, css: 'variable' }, // variables
  79. { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
  80. { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
  81. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
  82. ];
  83. this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
  84. };
  85. SyntaxHighlighter.brushes.Php.prototype = new SyntaxHighlighter.Highlighter();
  86. SyntaxHighlighter.brushes.Php.aliases = ['php'];