From: <var...@us...> - 2013-02-06 09:49:06
|
Revision: 8723 http://sourceforge.net/p/phpwiki/code/8723 Author: vargenau Date: 2013-02-06 09:49:04 +0000 (Wed, 06 Feb 2013) Log Message: ----------- Move comments to pgsrc; highlight.bg no longer exists in PHP 5.4; translate error message Modified Paths: -------------- trunk/lib/plugin/PhpHighlight.php trunk/pgsrc/Help%2FPhpHighlightPlugin Modified: trunk/lib/plugin/PhpHighlight.php =================================================================== --- trunk/lib/plugin/PhpHighlight.php 2013-02-04 10:15:01 UTC (rev 8722) +++ trunk/lib/plugin/PhpHighlight.php 2013-02-06 09:49:04 UTC (rev 8723) @@ -22,40 +22,13 @@ */ /** - * A plugin that runs the highlight_string() function in PHP on it's + * A plugin that runs the highlight_string() function in PHP on its * arguments to pretty-print PHP code. - * - * Usage: - * <<PhpHighlight default='#FF0000' comment='#0000CC' - * code that should be highlighted - * >> - * - * You do not have to add '<?php' and '?>' to the code - the plugin - * does this automatically if you do not set wrap to 0. - * - * If you do set wrap to 0, then you'll have to start and stop PHP - * mode in the source yourself, or you wont see any highlighting. But - * you cannot use '<?php' and '?>' in the source, because this - * interferes with PhpWiki, you'll have use '< ?php' and '? >' - * instead. - * - * Author: Martin Geisler <gim...@gi...>. - * - * Added ability to override colors defined in php.ini --Carsten Klapp - * - * Known Problems: - * <<PhpHighlight - * testing[somearray]; - * testing~[badworkaround~]; - * >> - * will swallow "[somearray]" */ class WikiPlugin_PhpHighlight extends WikiPlugin { - // Four required functions in a WikiPlugin. - function getName() { return _("PhpHighlight"); @@ -75,7 +48,7 @@ 'string' => ini_get("highlight.string"), //'#00CC00', 'comment' => ini_get("highlight.comment"), //'#FF9900', 'keyword' => ini_get("highlight.keyword"), //'#006600', - 'bg' => ini_get("highlight.bg"), //'#FFFFFF', + 'bg' => (version_compare(PHP_VERSION, '5.4', '<')) ? ini_get("highlight.bg") : '#FFFFFF', 'default' => ini_get("highlight.default"), //'#0000CC', 'html' => ini_get("highlight.html") //'#000000' ); @@ -88,7 +61,7 @@ $source =& $this->source; if (empty($source)) { return HTML::div(array('class' => "error"), - "Please provide source code to PhpHighlight plugin"); + _("Please provide source code to PhpHighlight plugin")); } $this->sanify_colors($string, $comment, $keyword, $bg, $default, $html); @@ -162,7 +135,9 @@ $this->oldstring = ini_set('highlight.string', $string); $this->oldcomment = ini_set('highlight.comment', $comment); $this->oldkeyword = ini_set('highlight.keyword', $keyword); - $this->oldbg = ini_set('highlight.bg', $bg); + if (version_compare(PHP_VERSION, '5.4', '<')) { + $this->oldbg = ini_set('highlight.bg', $bg); + } $this->olddefault = ini_set('highlight.default', $default); $this->oldhtml = ini_set('highlight.html', $html); } @@ -173,7 +148,9 @@ ini_set('highlight.string', $this->oldstring); ini_set('highlight.comment', $this->oldcomment); ini_set('highlight.keyword', $this->oldkeyword); - ini_set('highlight.bg', $this->oldbg); + if (version_compare(PHP_VERSION, '5.4', '<')) { + ini_set('highlight.bg', $this->oldbg); + } ini_set('highlight.default', $this->olddefault); ini_set('highlight.html', $this->oldhtml); } Modified: trunk/pgsrc/Help%2FPhpHighlightPlugin =================================================================== --- trunk/pgsrc/Help%2FPhpHighlightPlugin 2013-02-04 10:15:01 UTC (rev 8722) +++ trunk/pgsrc/Help%2FPhpHighlightPlugin 2013-02-06 09:49:04 UTC (rev 8723) @@ -1,4 +1,4 @@ -Date: Thu, 23 Nov 2012 19:30:39 +0000 +Date: Tue, 5 Feb 2013 15:49:31 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0) Content-Type: application/x-phpwiki; pagename=Help%2FPhpHighlightPlugin; @@ -99,9 +99,18 @@ } >> +== Known Problems == +{{{ +<<PhpHighlight + testing[somearray]; + testing~[badworkaround~]; +>> +}}} +will swallow "~[somearray~]" + == Authors == * [[mailto:gim...@gi...|Martin Geisler]] -* [[mailto:car...@us...|Carsten Klapp]] +* [[mailto:car...@us...|Carsten Klapp]] (added ability to override colors defined in ##php.ini##) == See Also == * [[Help:SyntaxHighlighterPlugin|SyntaxHighlighter]] plugin for highlighting other languages. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |