From: <var...@us...> - 2012-11-23 20:46:49
|
Revision: 8532 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8532&view=rev Author: vargenau Date: 2012-11-23 20:46:41 +0000 (Fri, 23 Nov 2012) Log Message: ----------- highlight_string does not return <font> in PHP 5 Modified Paths: -------------- trunk/lib/plugin/PhpHighlight.php Modified: trunk/lib/plugin/PhpHighlight.php =================================================================== --- trunk/lib/plugin/PhpHighlight.php 2012-11-23 20:17:48 UTC (rev 8531) +++ trunk/lib/plugin/PhpHighlight.php 2012-11-23 20:46:41 UTC (rev 8532) @@ -91,8 +91,7 @@ $this->set_colors($string, $comment, $keyword, $bg, $default, $html); if ($wrap) { - /* Wrap with "<?php\n" and "\n?>" required by - * highlight_string(): */ + /* Wrap with "<?php\n" and "\n?>" required by highlight_string(): */ $source = "<?php\n" . $source . "\n?>"; } else { $source = str_replace(array('< ?php', '? >'), @@ -101,23 +100,18 @@ $str = highlight_string($source, true); - if ($wrap) + if ($wrap) { /* Remove "<?php\n" and "\n?>" again: */ $str = str_replace(array('<?php<br />', '?>'), '', $str); + } - /* We might have made some empty font tags. */ + /* Remove empty span tags. */ foreach (array($string, $comment, $keyword, $bg, $default, $html) as $color) { - $search = "<font color=\"$color\"></font>"; - $str = str_replace($search, '', $str); - } - /* Remove also empty span tags. */ - foreach (array($string, $comment, $keyword, $bg, $default, $html) as $color) { $search = "<span style=\"color: $color\"></span>"; $str = str_replace($search, '', $str); } - /* restore default colors in case of multiple invocations of - this plugin on one page */ + /* restore default colors in case of multiple invocations of this plugin on one page */ $this->restore_colors(); return new RawXml($str); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |