PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/syntaxhighlighter_3.0.83/scripts/shBrushPhp.js

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