From 0ae5590b0b93c47380fcfd7b6a78e16358ba0dfd Mon Sep 17 00:00:00 2001 From: vargenau Date: Wed, 6 Feb 2013 09:49:04 +0000 Subject: [PATCH] Move comments to pgsrc; highlight.bg no longer exists in PHP 5.4; translate error message git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@8723 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/PhpHighlight.php | 41 ++++++++------------------------- pgsrc/Help%2FPhpHighlightPlugin | 13 +++++++++-- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/lib/plugin/PhpHighlight.php b/lib/plugin/PhpHighlight.php index 9474e0639..fa81255a4 100644 --- a/lib/plugin/PhpHighlight.php +++ b/lib/plugin/PhpHighlight.php @@ -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: - * <> - * - * You do not have to add '' 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 '' in the source, because this - * interferes with PhpWiki, you'll have use '< ?php' and '? >' - * instead. - * - * Author: Martin Geisler . - * - * Added ability to override colors defined in php.ini --Carsten Klapp - * - * Known Problems: - * <> - * will swallow "[somearray]" */ class WikiPlugin_PhpHighlight extends WikiPlugin { - // Four required functions in a WikiPlugin. - function getName() { return _("PhpHighlight"); @@ -75,7 +48,7 @@ class WikiPlugin_PhpHighlight '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 @@ class WikiPlugin_PhpHighlight $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 @@ class WikiPlugin_PhpHighlight $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 @@ class WikiPlugin_PhpHighlight 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); } diff --git a/pgsrc/Help%2FPhpHighlightPlugin b/pgsrc/Help%2FPhpHighlightPlugin index 52d39f4e9..87187f39b 100644 --- a/pgsrc/Help%2FPhpHighlightPlugin +++ b/pgsrc/Help%2FPhpHighlightPlugin @@ -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 @@ getload(void) } >> +== Known Problems == +{{{ +<> +}}} +will swallow "~[somearray~]" + == Authors == * [[mailto:gimpster@gimpster.com|Martin Geisler]] -* [[mailto:carstenklapp@users.sourceforge.net|Carsten Klapp]] +* [[mailto:carstenklapp@users.sourceforge.net|Carsten Klapp]] (added ability to override colors defined in ##php.ini##) == See Also == * [[Help:SyntaxHighlighterPlugin|SyntaxHighlighter]] plugin for highlighting other languages. -- 2.45.0