[Plugin: WP-Syntax] [PATCH] Add "include" parameter
-
I use this plugin on my blog and I like it. Recently I improved it by adding new parameter “include” to the
<pre>
tag. It allows you to include code from filesystem and highlight it as well. It is very handy when you have working example on the site and want to show the source code on the blog.patch is below
$ diff wp-syntax.php.orig wp-syntax.php 62c62 < $ext = 'pre[id|name|class|style|lang|line|escaped|hightlight|src]'; --- > $ext = 'pre[id|name|class|style|lang|line|escaped|hightlight|src|include]'; 169c169,178 < $code = wp_syntax_code_trim($match[6]); --- > $include_file = wp_syntax_code_trim($match[6]); > $code = wp_syntax_code_trim($match[7]); > > if (!empty($include_file)) { > if (substr($include_file,0,4) == 'http') > $code = file_get_contents($include_file); > elseif (file_exists(ABSPATH.$include_file)) > $code = file_get_contents(ABSPATH.$include_file); > } > 217c226 < "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|highlight=[\"']((?:\d+[,-])*\d+)[\"']|src=[\"']([^\"']+)[\"']|\s)+>(.*)<\/pre>\s*/siU", --- > "/\s*<pre(?:lang=[\"']([\w-]+)[\"']|line=[\"'](\d*)[\"']|escaped=[\"'](true|false)?[\"']|highlight=[\"']((?:\d+[,-])*\d+)[\"']|src=[\"']([^\"']+)[\"']|include=[\"']([^\"']+)[\"']|\s)+>(.*)<\/pre>\s*/siU",
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WP-Syntax] [PATCH] Add "include" parameter’ is closed to new replies.