📄 php-f.js
字号:
/*===============================================================================Chili is the jQuery code highlighter plugin...............................................................................LICENSE: http://www.opensource.org/licenses/mit-license.phpWEBSITE: http://noteslog.com/chili/ Copyright 2008 / Andrea Ercolino===============================================================================*//* ---------------------------------------------------------------------------- * this recipe uses a little trick for highlighting php code * 1: replace each php snippet with a placeholder * 2: highlight html without php and php snippets apart * 3: replace each placeholder with its highlighted php snippet * * the trick is not perfect only if the html without php is broken * however, in such a case many highlighters get fooled but Chili does not * * --- * this recipe has been adapted for working with Safari * in fact, Safari cannot match more than 101236 characters with a lazy star * --------------------------------------------------------------------------*/{ _name: "php" , _case: true , _main: { all: { _match: /[\w\W]*/ , _replace: function( all ) { var placeholder = String.fromCharCode(0); var blocks = []; var that = this; var no_php_1 = all.replace( /<\?[^?]*\?+(?:[^>][^?]*\?+)*>/g, function( block ) { blocks.push( that.x( block, '/block/php_1' ) ); return placeholder; } ); var no_php_2 = no_php_1.replace( /^[^?]*\?+(?:[^>][^?]*\?+)*>|<\?[\w\W]*$/g, function( block ) { blocks.push( that.x( block, '/block/php_2' ) ); return placeholder; } ); if( blocks.length ) { var html = this.x( no_php_2, 'html' ); var count = 0; return html.replace( new RegExp( placeholder, "g" ), function() { return blocks[ count++ ]; } );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -