PageRenderTime 25ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/assets/javascripts/shBrushPhp.js

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