Permalink
Browse files

fixed stuff in syntax highligh plugin

git-svn-id: http://svn.hunch.se/rasmus/wp-plugins@278 98834e0e-571d-0410-bf09-ac0e1acfc769
  • Loading branch information...
rasmus
rasmus committed Jan 3, 2009
1 parent f205c0d commit c9e0032a91a91cb49c288f71813cb490b57537b1
Showing with 4 additions and 4 deletions.
  1. +4 −4 syntax_highlight/syntax_highlight.php
@@ -51,7 +51,7 @@ function &hu_syntax_highlight_filter($content='') {
$start = 0;
while(1) {
if( ($start = strpos($content, ($start == 0 ? '{{{' : "\n{{{"), $start)) !== false) {
- if( ($end = strpos($content, "\n}}}", $start+5)) !== false) {
+ if( ($end = strpos($content, "}}}", $start+5)) !== false) {
$code = trim(substr($content, $start+4, $end-($start+4)));
$lang = null;
if( substr($code, 0, 2) == '#!' ) {
@@ -60,12 +60,12 @@ function &hu_syntax_highlight_filter($content='') {
$code = hu_syntax_highlight(ltrim(substr($code, $nl+1), "\r"), $lang);
}
else {
- $code = '<div class="sourcecode"><pre>'.$code.'</pre></div>';
+ $code = '<div class="sourcecode"><pre>'.htmlentities($code).'</pre></div>';
}
$code_wrapped = base64_encode($code);
$content = substr($content, 0, $start)
. sprintf("{{{!%010d%s",strlen($code_wrapped), $code_wrapped)
- . substr($content, $end+4);
+ . substr($content, $end+3);
$start = $end;
}
else {
@@ -102,4 +102,4 @@ function &hu_syntax_highlight_filter_unwrap($content='') {
add_filter('the_content', 'hu_syntax_highlight_filter', 0, 1);
add_filter('the_content', 'hu_syntax_highlight_filter_unwrap', 999, 1);
-?>
+?>

0 comments on commit c9e0032

Please sign in to comment.