From 6123674261403dc2f65350b0f97a02f484a618ff Mon Sep 17 00:00:00 2001 From: david Date: Wed, 22 Nov 2023 10:02:55 +0100 Subject: [PATCH] update GeSHI to 1.0.9.1 --- htdocs/libraries/geshi/geshi.php | 718 +++++++++--------- htdocs/libraries/geshi/geshi/4cs.php | 2 +- htdocs/libraries/geshi/geshi/6502acme.php | 2 +- htdocs/libraries/geshi/geshi/6502kickass.php | 2 +- htdocs/libraries/geshi/geshi/6502tasm.php | 2 +- htdocs/libraries/geshi/geshi/68000devpac.php | 2 +- htdocs/libraries/geshi/geshi/abap.php | 2 +- htdocs/libraries/geshi/geshi/actionscript.php | 2 +- .../libraries/geshi/geshi/actionscript3.php | 2 +- htdocs/libraries/geshi/geshi/ada.php | 2 +- htdocs/libraries/geshi/geshi/aimms.php | 2 +- htdocs/libraries/geshi/geshi/algol68.php | 2 +- htdocs/libraries/geshi/geshi/apache.php | 2 +- htdocs/libraries/geshi/geshi/applescript.php | 2 +- htdocs/libraries/geshi/geshi/apt_sources.php | 2 +- htdocs/libraries/geshi/geshi/arm.php | 2 +- htdocs/libraries/geshi/geshi/asm.php | 2 +- htdocs/libraries/geshi/geshi/asp.php | 2 +- htdocs/libraries/geshi/geshi/asymptote.php | 2 +- htdocs/libraries/geshi/geshi/autoconf.php | 2 +- htdocs/libraries/geshi/geshi/autohotkey.php | 2 +- htdocs/libraries/geshi/geshi/autoit.php | 2 +- htdocs/libraries/geshi/geshi/avisynth.php | 2 +- htdocs/libraries/geshi/geshi/awk.php | 2 +- htdocs/libraries/geshi/geshi/bascomavr.php | 2 +- htdocs/libraries/geshi/geshi/bash.php | 25 +- htdocs/libraries/geshi/geshi/basic4gl.php | 2 +- htdocs/libraries/geshi/geshi/batch.php | 2 +- htdocs/libraries/geshi/geshi/bf.php | 2 +- htdocs/libraries/geshi/geshi/biblatex.php | 2 +- htdocs/libraries/geshi/geshi/bibtex.php | 2 +- htdocs/libraries/geshi/geshi/blitzbasic.php | 2 +- htdocs/libraries/geshi/geshi/bnf.php | 2 +- htdocs/libraries/geshi/geshi/boo.php | 2 +- htdocs/libraries/geshi/geshi/c.php | 2 +- htdocs/libraries/geshi/geshi/c_loadrunner.php | 2 +- htdocs/libraries/geshi/geshi/c_mac.php | 2 +- htdocs/libraries/geshi/geshi/c_winapi.php | 2 +- htdocs/libraries/geshi/geshi/caddcl.php | 2 +- htdocs/libraries/geshi/geshi/cadlisp.php | 2 +- htdocs/libraries/geshi/geshi/ceylon.php | 2 +- htdocs/libraries/geshi/geshi/cfdg.php | 2 +- htdocs/libraries/geshi/geshi/cfm.php | 2 +- htdocs/libraries/geshi/geshi/chaiscript.php | 2 +- htdocs/libraries/geshi/geshi/chapel.php | 4 +- htdocs/libraries/geshi/geshi/cil.php | 2 +- htdocs/libraries/geshi/geshi/clojure.php | 2 +- htdocs/libraries/geshi/geshi/cmake.php | 2 +- htdocs/libraries/geshi/geshi/cobol.php | 8 +- htdocs/libraries/geshi/geshi/coffeescript.php | 2 +- htdocs/libraries/geshi/geshi/cpp-qt.php | 2 +- htdocs/libraries/geshi/geshi/cpp-winapi.php | 2 +- htdocs/libraries/geshi/geshi/cpp.php | 2 +- htdocs/libraries/geshi/geshi/csharp.php | 2 +- htdocs/libraries/geshi/geshi/css.php | 2 +- htdocs/libraries/geshi/geshi/cuesheet.php | 2 +- htdocs/libraries/geshi/geshi/d.php | 2 +- htdocs/libraries/geshi/geshi/dart.php | 2 +- htdocs/libraries/geshi/geshi/dcl.php | 2 +- htdocs/libraries/geshi/geshi/dcpu16.php | 2 +- htdocs/libraries/geshi/geshi/dcs.php | 2 +- htdocs/libraries/geshi/geshi/delphi.php | 2 +- htdocs/libraries/geshi/geshi/diff.php | 2 +- htdocs/libraries/geshi/geshi/div.php | 2 +- htdocs/libraries/geshi/geshi/dos.php | 2 +- htdocs/libraries/geshi/geshi/dot.php | 2 +- htdocs/libraries/geshi/geshi/e.php | 2 +- htdocs/libraries/geshi/geshi/ecmascript.php | 2 +- htdocs/libraries/geshi/geshi/eiffel.php | 2 +- htdocs/libraries/geshi/geshi/email.php | 60 +- htdocs/libraries/geshi/geshi/epc.php | 2 +- htdocs/libraries/geshi/geshi/erlang.php | 2 +- htdocs/libraries/geshi/geshi/euphoria.php | 2 +- htdocs/libraries/geshi/geshi/ezt.php | 2 +- htdocs/libraries/geshi/geshi/f1.php | 2 +- htdocs/libraries/geshi/geshi/falcon.php | 2 +- htdocs/libraries/geshi/geshi/fo.php | 2 +- htdocs/libraries/geshi/geshi/fortran.php | 2 +- htdocs/libraries/geshi/geshi/freebasic.php | 2 +- htdocs/libraries/geshi/geshi/freeswitch.php | 2 +- htdocs/libraries/geshi/geshi/fsharp.php | 2 +- htdocs/libraries/geshi/geshi/gambas.php | 2 +- htdocs/libraries/geshi/geshi/gdb.php | 2 +- htdocs/libraries/geshi/geshi/genero.php | 2 +- htdocs/libraries/geshi/geshi/genie.php | 2 +- htdocs/libraries/geshi/geshi/gettext.php | 2 +- htdocs/libraries/geshi/geshi/glsl.php | 2 +- htdocs/libraries/geshi/geshi/gml.php | 2 +- htdocs/libraries/geshi/geshi/gnuplot.php | 2 +- htdocs/libraries/geshi/geshi/go.php | 2 +- htdocs/libraries/geshi/geshi/groovy.php | 2 +- htdocs/libraries/geshi/geshi/gwbasic.php | 2 +- htdocs/libraries/geshi/geshi/haskell.php | 16 +- htdocs/libraries/geshi/geshi/haxe.php | 2 +- htdocs/libraries/geshi/geshi/hicest.php | 2 +- htdocs/libraries/geshi/geshi/hq9plus.php | 2 +- htdocs/libraries/geshi/geshi/html4strict.php | 2 +- htdocs/libraries/geshi/geshi/html5.php | 2 +- htdocs/libraries/geshi/geshi/icon.php | 2 +- htdocs/libraries/geshi/geshi/idl.php | 2 +- htdocs/libraries/geshi/geshi/ini.php | 4 +- htdocs/libraries/geshi/geshi/inno.php | 2 +- htdocs/libraries/geshi/geshi/intercal.php | 2 +- htdocs/libraries/geshi/geshi/io.php | 2 +- htdocs/libraries/geshi/geshi/ispfpanel.php | 2 +- htdocs/libraries/geshi/geshi/j.php | 2 +- htdocs/libraries/geshi/geshi/java.php | 2 +- htdocs/libraries/geshi/geshi/java5.php | 2 +- htdocs/libraries/geshi/geshi/javascript.php | 2 +- htdocs/libraries/geshi/geshi/jcl.php | 2 +- htdocs/libraries/geshi/geshi/jquery.php | 2 +- htdocs/libraries/geshi/geshi/julia.php | 2 +- htdocs/libraries/geshi/geshi/kixtart.php | 2 +- htdocs/libraries/geshi/geshi/klonec.php | 2 +- htdocs/libraries/geshi/geshi/klonecpp.php | 2 +- htdocs/libraries/geshi/geshi/kotlin.php | 2 +- htdocs/libraries/geshi/geshi/latex.php | 2 +- htdocs/libraries/geshi/geshi/lb.php | 2 +- htdocs/libraries/geshi/geshi/ldif.php | 2 +- htdocs/libraries/geshi/geshi/lisp.php | 4 +- htdocs/libraries/geshi/geshi/llvm.php | 2 +- htdocs/libraries/geshi/geshi/locobasic.php | 2 +- htdocs/libraries/geshi/geshi/logtalk.php | 2 +- htdocs/libraries/geshi/geshi/lolcode.php | 2 +- .../libraries/geshi/geshi/lotusformulas.php | 2 +- htdocs/libraries/geshi/geshi/lotusscript.php | 2 +- htdocs/libraries/geshi/geshi/lscript.php | 2 +- htdocs/libraries/geshi/geshi/lsl2.php | 2 +- htdocs/libraries/geshi/geshi/lua.php | 2 +- htdocs/libraries/geshi/geshi/m68k.php | 2 +- htdocs/libraries/geshi/geshi/magiksf.php | 2 +- htdocs/libraries/geshi/geshi/make.php | 2 +- htdocs/libraries/geshi/geshi/mapbasic.php | 2 +- htdocs/libraries/geshi/geshi/mathematica.php | 2 +- htdocs/libraries/geshi/geshi/matlab.php | 45 +- htdocs/libraries/geshi/geshi/mercury.php | 2 +- htdocs/libraries/geshi/geshi/metapost.php | 2 +- htdocs/libraries/geshi/geshi/mirc.php | 2 +- htdocs/libraries/geshi/geshi/mk-61.php | 2 +- htdocs/libraries/geshi/geshi/mmix.php | 2 +- htdocs/libraries/geshi/geshi/modula2.php | 2 +- htdocs/libraries/geshi/geshi/modula3.php | 2 +- htdocs/libraries/geshi/geshi/mpasm.php | 2 +- htdocs/libraries/geshi/geshi/mxml.php | 2 +- htdocs/libraries/geshi/geshi/mysql.php | 20 +- htdocs/libraries/geshi/geshi/nagios.php | 2 +- htdocs/libraries/geshi/geshi/netrexx.php | 2 +- htdocs/libraries/geshi/geshi/newlisp.php | 2 +- htdocs/libraries/geshi/geshi/nginx.php | 9 +- htdocs/libraries/geshi/geshi/nimrod.php | 2 +- htdocs/libraries/geshi/geshi/nsis.php | 2 +- htdocs/libraries/geshi/geshi/oberon2.php | 2 +- htdocs/libraries/geshi/geshi/objc.php | 2 +- htdocs/libraries/geshi/geshi/objeck.php | 2 +- htdocs/libraries/geshi/geshi/ocaml-brief.php | 2 +- htdocs/libraries/geshi/geshi/ocaml.php | 2 +- htdocs/libraries/geshi/geshi/octave.php | 2 +- htdocs/libraries/geshi/geshi/oobas.php | 2 +- htdocs/libraries/geshi/geshi/oorexx.php | 2 +- htdocs/libraries/geshi/geshi/oracle11.php | 2 +- htdocs/libraries/geshi/geshi/oracle8.php | 2 +- htdocs/libraries/geshi/geshi/oxygene.php | 4 +- htdocs/libraries/geshi/geshi/oz.php | 2 +- htdocs/libraries/geshi/geshi/parasail.php | 2 +- htdocs/libraries/geshi/geshi/parigp.php | 4 +- htdocs/libraries/geshi/geshi/pascal.php | 2 +- htdocs/libraries/geshi/geshi/pcre.php | 2 +- htdocs/libraries/geshi/geshi/per.php | 2 +- htdocs/libraries/geshi/geshi/perl.php | 2 +- htdocs/libraries/geshi/geshi/perl6.php | 2 +- htdocs/libraries/geshi/geshi/pf.php | 2 +- htdocs/libraries/geshi/geshi/phix.php | 2 +- htdocs/libraries/geshi/geshi/php-brief.php | 2 +- htdocs/libraries/geshi/geshi/php.php | 2 +- htdocs/libraries/geshi/geshi/pic16.php | 2 +- htdocs/libraries/geshi/geshi/pike.php | 2 +- htdocs/libraries/geshi/geshi/pixelbender.php | 2 +- htdocs/libraries/geshi/geshi/pli.php | 2 +- htdocs/libraries/geshi/geshi/plsql.php | 2 +- htdocs/libraries/geshi/geshi/postgresql.php | 2 +- htdocs/libraries/geshi/geshi/postscript.php | 4 +- htdocs/libraries/geshi/geshi/povray.php | 2 +- htdocs/libraries/geshi/geshi/powerbuilder.php | 2 +- htdocs/libraries/geshi/geshi/powershell.php | 2 +- htdocs/libraries/geshi/geshi/proftpd.php | 2 +- htdocs/libraries/geshi/geshi/progress.php | 2 +- htdocs/libraries/geshi/geshi/prolog.php | 2 +- htdocs/libraries/geshi/geshi/properties.php | 2 +- htdocs/libraries/geshi/geshi/providex.php | 2 +- htdocs/libraries/geshi/geshi/purebasic.php | 2 +- htdocs/libraries/geshi/geshi/pycon.php | 2 +- htdocs/libraries/geshi/geshi/pys60.php | 2 +- htdocs/libraries/geshi/geshi/python.php | 2 +- htdocs/libraries/geshi/geshi/q.php | 2 +- htdocs/libraries/geshi/geshi/qbasic.php | 2 +- htdocs/libraries/geshi/geshi/qml.php | 2 +- htdocs/libraries/geshi/geshi/racket.php | 2 +- htdocs/libraries/geshi/geshi/rails.php | 2 +- htdocs/libraries/geshi/geshi/rbs.php | 2 +- htdocs/libraries/geshi/geshi/rebol.php | 2 +- htdocs/libraries/geshi/geshi/reg.php | 2 +- htdocs/libraries/geshi/geshi/rexx.php | 2 +- htdocs/libraries/geshi/geshi/robots.php | 2 +- htdocs/libraries/geshi/geshi/rpmspec.php | 2 +- htdocs/libraries/geshi/geshi/rsplus.php | 4 +- htdocs/libraries/geshi/geshi/ruby.php | 2 +- htdocs/libraries/geshi/geshi/rust.php | 2 +- htdocs/libraries/geshi/geshi/sas.php | 2 +- htdocs/libraries/geshi/geshi/sass.php | 2 +- htdocs/libraries/geshi/geshi/scala.php | 2 +- htdocs/libraries/geshi/geshi/scheme.php | 2 +- htdocs/libraries/geshi/geshi/scilab.php | 4 +- htdocs/libraries/geshi/geshi/scl.php | 2 +- htdocs/libraries/geshi/geshi/sdlbasic.php | 2 +- htdocs/libraries/geshi/geshi/smalltalk.php | 2 +- htdocs/libraries/geshi/geshi/smarty.php | 2 +- htdocs/libraries/geshi/geshi/spark.php | 2 +- htdocs/libraries/geshi/geshi/sparql.php | 2 +- htdocs/libraries/geshi/geshi/sql.php | 6 +- htdocs/libraries/geshi/geshi/standardml.php | 2 +- htdocs/libraries/geshi/geshi/stonescript.php | 2 +- htdocs/libraries/geshi/geshi/swift.php | 2 +- .../libraries/geshi/geshi/systemverilog.php | 2 +- htdocs/libraries/geshi/geshi/tcl.php | 2 +- htdocs/libraries/geshi/geshi/tclegg.php | 2 +- htdocs/libraries/geshi/geshi/teraterm.php | 2 +- htdocs/libraries/geshi/geshi/texgraph.php | 2 +- htdocs/libraries/geshi/geshi/text.php | 2 +- htdocs/libraries/geshi/geshi/thinbasic.php | 2 +- htdocs/libraries/geshi/geshi/tsql.php | 2 +- htdocs/libraries/geshi/geshi/twig.php | 2 +- htdocs/libraries/geshi/geshi/typoscript.php | 2 +- htdocs/libraries/geshi/geshi/unicon.php | 2 +- htdocs/libraries/geshi/geshi/upc.php | 2 +- htdocs/libraries/geshi/geshi/urbi.php | 2 +- htdocs/libraries/geshi/geshi/uscript.php | 2 +- htdocs/libraries/geshi/geshi/vala.php | 2 +- htdocs/libraries/geshi/geshi/vb.php | 2 +- htdocs/libraries/geshi/geshi/vbnet.php | 2 +- htdocs/libraries/geshi/geshi/vbscript.php | 2 +- htdocs/libraries/geshi/geshi/vedit.php | 2 +- htdocs/libraries/geshi/geshi/verilog.php | 2 +- htdocs/libraries/geshi/geshi/vhdl.php | 2 +- htdocs/libraries/geshi/geshi/vim.php | 2 +- htdocs/libraries/geshi/geshi/visualfoxpro.php | 2 +- htdocs/libraries/geshi/geshi/visualprolog.php | 2 +- htdocs/libraries/geshi/geshi/whitespace.php | 2 +- htdocs/libraries/geshi/geshi/whois.php | 2 +- htdocs/libraries/geshi/geshi/winbatch.php | 2 +- htdocs/libraries/geshi/geshi/xbasic.php | 2 +- htdocs/libraries/geshi/geshi/xml.php | 2 +- htdocs/libraries/geshi/geshi/xojo.php | 2 +- htdocs/libraries/geshi/geshi/xorg_conf.php | 2 +- htdocs/libraries/geshi/geshi/xpp.php | 2 +- htdocs/libraries/geshi/geshi/yaml.php | 2 +- htdocs/libraries/geshi/geshi/z80.php | 2 +- htdocs/libraries/geshi/geshi/zxbasic.php | 2 +- 257 files changed, 721 insertions(+), 698 deletions(-) diff --git a/htdocs/libraries/geshi/geshi.php b/htdocs/libraries/geshi/geshi.php index c6ea4fd4013e..cf5e16329f63 100644 --- a/htdocs/libraries/geshi/geshi.php +++ b/htdocs/libraries/geshi/geshi.php @@ -30,7 +30,6 @@ * @author Nigel McNie , Benny Baumann * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2014 Benny Baumann * @license http://gnu.org/copyleft/gpl.html GNU GPL - * */ // @@ -41,7 +40,7 @@ // /** The version of this GeSHi file */ -define('GESHI_VERSION', '1.0.8.13'); +define('GESHI_VERSION', '1.0.9.1'); // Define the root directory for the GeSHi code tree if (!defined('GESHI_ROOT')) { @@ -149,39 +148,6 @@ /** Used in language files to mark comments */ define('GESHI_COMMENTS', 0); -/** Used to work around missing PHP features **/ -define('GESHI_PHP_PRE_433', !(version_compare(PHP_VERSION, '4.3.3') === 1)); - -/** make sure we can call stripos **/ -if (!function_exists('stripos')) { - // the offset param of preg_match is not supported below PHP 4.3.3 - if (GESHI_PHP_PRE_433) { - /** - * @ignore - */ - function stripos($haystack, $needle, $offset = null) { - if (!is_null($offset)) { - $haystack = substr($haystack, $offset); - } - if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE)) { - return $match[0][1]; - } - return false; - } - } - else { - /** - * @ignore - */ - function stripos($haystack, $needle, $offset = null) { - if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE, $offset)) { - return $match[0][1]; - } - return false; - } - } -} - /** some old PHP / PCRE subpatterns only support up to xxx subpatterns in regular expressions. Set this to false if your PCRE lib is up to date @see GeSHi->optimize_regexp_list() @@ -253,49 +219,48 @@ function stripos($haystack, $needle, $offset = null) { * about how to use this class. * * @package geshi - * @author Nigel McNie , Benny Baumann + * @author Nigel McNie + * @author Benny Baumann * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2014 Benny Baumann */ class GeSHi { - /**#@+ - * @access private - */ + /** * The source code to highlight * @var string */ - var $source = ''; + protected $source = ''; /** * The language to use when highlighting * @var string */ - var $language = ''; + protected $language = ''; /** * The data for the language used * @var array */ - var $language_data = array(); + protected $language_data = array(); /** * The path to the language files * @var string */ - var $language_path = GESHI_LANG_ROOT; + protected $language_path = GESHI_LANG_ROOT; /** * The error message associated with an error * @var string * @todo check err reporting works */ - var $error = false; + protected $error = false; /** * Possible error messages * @var array */ - var $error_messages = array( + protected $error_messages = array( GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})', GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable', GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid', @@ -306,13 +271,13 @@ class GeSHi { * Whether highlighting is strict or not * @var boolean */ - var $strict_mode = false; + protected $strict_mode = false; /** * Whether to use CSS classes in output * @var boolean */ - var $use_classes = false; + protected $use_classes = false; /** * The type of header to use. Can be one of the following @@ -324,13 +289,13 @@ class GeSHi { * * @var int */ - var $header_type = GESHI_HEADER_PRE; + protected $header_type = GESHI_HEADER_PRE; /** * Array of permissions for which lexics should be highlighted * @var array */ - var $lexic_permissions = array( + protected $lexic_permissions = array( 'KEYWORDS' => array(), 'COMMENTS' => array('MULTI' => true), 'REGEXPS' => array(), @@ -347,44 +312,44 @@ class GeSHi { * The time it took to parse the code * @var double */ - var $time = 0; + protected $time = 0; /** * The content of the header block * @var string */ - var $header_content = ''; + protected $header_content = ''; /** * The content of the footer block * @var string */ - var $footer_content = ''; + protected $footer_content = ''; /** * The style of the header block * @var string */ - var $header_content_style = ''; + protected $header_content_style = ''; /** * The style of the footer block * @var string */ - var $footer_content_style = ''; + protected $footer_content_style = ''; /** * Tells if a block around the highlighted source should be forced * if not using line numbering * @var boolean */ - var $force_code_block = false; + protected $force_code_block = false; /** * The styles for hyperlinks in the code * @var array */ - var $link_styles = array(); + protected $link_styles = array(); /** * Whether important blocks should be recognised or not @@ -392,7 +357,7 @@ class GeSHi { * @deprecated * @todo REMOVE THIS FUNCTIONALITY! */ - var $enable_important_blocks = false; + protected $enable_important_blocks = false; /** * Styles for important parts of the code @@ -401,31 +366,31 @@ class GeSHi { * @todo As above - rethink the whole idea of important blocks as it is buggy and * will be hard to implement in 1.2 */ - var $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code + protected $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code /** * Whether CSS IDs should be added to the code * @var boolean */ - var $add_ids = false; + protected $add_ids = false; /** * Lines that should be highlighted extra * @var array */ - var $highlight_extra_lines = array(); + protected $highlight_extra_lines = array(); /** * Styles of lines that should be highlighted extra * @var array */ - var $highlight_extra_lines_styles = array(); + protected $highlight_extra_lines_styles = array(); /** * Styles of extra-highlighted lines * @var string */ - var $highlight_extra_lines_style = 'background-color: #ffc;'; + protected $highlight_extra_lines_style = 'background-color: #ffc;'; /** * The line ending @@ -433,120 +398,120 @@ class GeSHi { * Otherwise, all instances of \n will be replaced with $line_ending * @var string */ - var $line_ending = null; + protected $line_ending = null; /** * Number at which line numbers should start at * @var int */ - var $line_numbers_start = 1; + protected $line_numbers_start = 1; /** * The overall style for this code block * @var string */ - var $overall_style = 'font-family:monospace;'; + protected $overall_style = 'font-family:monospace;'; /** * The style for the actual code * @var string */ - var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'; + protected $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'; /** * The overall class for this code block * @var string */ - var $overall_class = ''; + protected $overall_class = ''; /** * The overall ID for this code block * @var string */ - var $overall_id = ''; + protected $overall_id = ''; /** * Line number styles * @var string */ - var $line_style1 = 'font-weight: normal; vertical-align:top;'; + protected $line_style1 = 'font-weight: normal; vertical-align:top;'; /** * Line number styles for fancy lines * @var string */ - var $line_style2 = 'font-weight: bold; vertical-align:top;'; + protected $line_style2 = 'font-weight: bold; vertical-align:top;'; /** * Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen * @var string */ - var $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'; + protected $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'; /** * Flag for how line numbers are displayed * @var boolean */ - var $line_numbers = GESHI_NO_LINE_NUMBERS; + protected $line_numbers = GESHI_NO_LINE_NUMBERS; /** * Flag to decide if multi line spans are allowed. Set it to false to make sure * each tag is closed before and reopened after each linefeed. * @var boolean */ - var $allow_multiline_span = true; + protected $allow_multiline_span = true; /** * The "nth" value for fancy line highlighting * @var int */ - var $line_nth_row = 0; + protected $line_nth_row = 0; /** * The size of tab stops * @var int */ - var $tab_width = 8; + protected $tab_width = 8; /** * Should we use language-defined tab stop widths? * @var int */ - var $use_language_tab_width = false; + protected $use_language_tab_width = false; /** * Default target for keyword links * @var string */ - var $link_target = ''; + protected $link_target = ''; /** * The encoding to use for entity encoding * NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598) * @var string */ - var $encoding = 'utf-8'; + protected $encoding = 'utf-8'; /** * Should keywords be linked? * @var boolean */ - var $keyword_links = true; + protected $keyword_links = true; /** * Currently loaded language file - * @var string + * @var string * @since 1.0.7.22 */ - var $loaded_language = ''; + protected $loaded_language = ''; /** * Wether the caches needed for parsing are built or not * - * @var bool + * @var bool * @since 1.0.8 */ - var $parse_cache_built = false; + protected $parse_cache_built = false; /** * Work around for Suhosin Patch with disabled /e modifier @@ -560,32 +525,30 @@ class GeSHi { * use preg_replace_callback() instead * * - * @var array + * @var array * @since 1.0.8 */ - var $_kw_replace_group = 0; - var $_rx_key = 0; + protected $_kw_replace_group = 0; + protected $_rx_key = 0; /** * some "callback parameters" for handle_multiline_regexps * - * @since 1.0.8 + * @since 1.0.8 * @access private - * @var string + * @var string */ - var $_hmr_before = ''; - var $_hmr_replace = ''; - var $_hmr_after = ''; - var $_hmr_key = 0; - - /**#@-*/ + protected $_hmr_before = ''; + protected $_hmr_replace = ''; + protected $_hmr_after = ''; + protected $_hmr_key = 0; /** * Creates a new GeSHi object, with source and language * - * @param string The source code to highlight - * @param string The language to highlight the source with - * @param string The path to the language file directory. This + * @param string $source The source code to highlight + * @param string $language The language to highlight the source with + * @param string $path The path to the language file directory. This * is deprecated! I've backported the auto path * detection from the 1.1.X dev branch, so now it * should be automatically set correctly. If you have @@ -594,7 +557,7 @@ class GeSHi { * {@link GeSHi->set_language_path()} * @since 1.0.0 */ - function __construct($source = '', $language = '', $path = '') { + public function __construct($source = '', $language = '', $path = '') { if ( is_string($source) && ($source !== '') ) { $this->set_source($source); } @@ -608,9 +571,9 @@ function __construct($source = '', $language = '', $path = '') { * Returns the version of GeSHi * * @return string - * @since 1 0.8.11 + * @since 1.0.8.11 */ - function get_version() + public function get_version() { return GESHI_VERSION; } @@ -622,7 +585,7 @@ function get_version() * @return string|false An error message if there has been an error, else false * @since 1.0.0 */ - function error() { + public function error() { if ($this->error) { //Put some template variables for debugging here ... $debug_tpl_vars = array( @@ -646,7 +609,7 @@ function error() { * @return string The name for the current language * @since 1.0.2 */ - function get_language_name() { + public function get_language_name() { if (GESHI_ERROR_NO_SUCH_LANG == $this->error) { return $this->language_data['LANG_NAME'] . ' (Unknown Language)'; } @@ -656,24 +619,38 @@ function get_language_name() { /** * Sets the source code for this object * - * @param string The source code to highlight + * @param string $source The source code to highlight * @since 1.0.0 */ - function set_source($source) { + public function set_source($source) { $this->source = $source; $this->highlight_extra_lines = array(); } + /** + * Clean up the language name to prevent malicious code injection + * + * @param string $language The name of the language to strip + * @since 1.0.9.1 + */ + public function strip_language_name($language) { + $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); + $language = strtolower($language); + + return $language; + } + /** * Sets the language for this object * * @note since 1.0.8 this function won't reset language-settings by default anymore! * if you need this set $force_reset = true * - * @param string The name of the language to use + * @param string $language The name of the language to use + * @param bool $force_reset * @since 1.0.0 */ - function set_language($language, $force_reset = false) { + public function set_language($language, $force_reset = false) { $this->error = false; $this->strict_mode = GESHI_NEVER; @@ -682,9 +659,7 @@ function set_language($language, $force_reset = false) { } //Clean up the language name to prevent malicious code injection - $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); - - $language = strtolower($language); + $language = $this->strip_language_name($language); //Retreive the full filename $file_name = $this->language_path . $language . '.php'; @@ -710,14 +685,14 @@ function set_language($language, $force_reset = false) { * that this path is relative to the directory of the script that included * geshi.php, NOT geshi.php itself. * - * @param string The path to the language directory + * @param string $path The path to the language directory * @since 1.0.0 * @deprecated The path to the language files should now be automatically * detected, so this method should no longer be needed. The * 1.1.X branch handles manual setting of the path differently * so this method will disappear in 1.2.0. */ - function set_language_path($path) { + public function set_language_path($path) { if(strpos($path,':')) { //Security Fix to prevent external directories using fopen wrappers. if(DIRECTORY_SEPARATOR == "\\") { @@ -748,10 +723,10 @@ function set_language_path($path) { /** * Get supported langs or an associative array lang=>full_name. - * @param boolean $longnames + * @param boolean $full_names * @return array */ - function get_supported_languages($full_names=false) + public function get_supported_languages($full_names=false) { // return array $back = array(); @@ -802,7 +777,7 @@ function get_supported_languages($full_names=false) * @param string $language short langname (html4strict for example) * @return mixed */ - function get_language_fullname($language) + public function get_language_fullname($language) { //Clean up the language name to prevent malicious code injection $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); @@ -839,10 +814,10 @@ function get_language_fullname($language) * From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code * should be outputted. * - * @param int The type of header to be used + * @param int $type The type of header to be used * @since 1.0.0 */ - function set_header_type($type) { + public function set_header_type($type) { //Check if we got a valid header type if (!in_array($type, array(GESHI_HEADER_NONE, GESHI_HEADER_DIV, GESHI_HEADER_PRE, GESHI_HEADER_PRE_VALID, GESHI_HEADER_PRE_TABLE))) { @@ -859,11 +834,11 @@ function set_header_type($type) { * when this object is parsed. The style should be a * string of valid stylesheet declarations * - * @param string The overall style for the outputted code block - * @param boolean Whether to merge the styles with the current styles or not + * @param string $style The overall style for the outputted code block + * @param boolean $preserve_defaults Whether to merge the styles with the current styles or not * @since 1.0.0 */ - function set_overall_style($style, $preserve_defaults = false) { + public function set_overall_style($style, $preserve_defaults = false) { if (!$preserve_defaults) { $this->overall_style = $style; } else { @@ -876,10 +851,10 @@ function set_overall_style($style, $preserve_defaults = false) { * class can then be used in a stylesheet to style this object's * output * - * @param string The class name to use for this block of code + * @param string $class The class name to use for this block of code * @since 1.0.0 */ - function set_overall_class($class) { + public function set_overall_class($class) { $this->overall_class = $class; } @@ -887,10 +862,10 @@ function set_overall_class($class) { * Sets the overall id for this block of code. This id can then * be used in a stylesheet to style this object's output * - * @param string The ID to use for this block of code + * @param string $id The ID to use for this block of code * @since 1.0.0 */ - function set_overall_id($id) { + public function set_overall_id($id) { $this->overall_id = $id; } @@ -898,10 +873,10 @@ function set_overall_id($id) { * Sets whether CSS classes should be used to highlight the source. Default * is off, calling this method with no arguments will turn it on * - * @param boolean Whether to turn classes on or not + * @param boolean $flag Whether to turn classes on or not * @since 1.0.0 */ - function enable_classes($flag = true) { + public function enable_classes($flag = true) { $this->use_classes = ($flag) ? true : false; } @@ -916,11 +891,11 @@ function enable_classes($flag = true) { * code will have the same style as the line number! Consult the * GeSHi documentation for more information about this. * - * @param string The style to use for actual code - * @param boolean Whether to merge the current styles with the new styles + * @param string $style The style to use for actual code + * @param boolean $preserve_defaults Whether to merge the current styles with the new styles * @since 1.0.2 */ - function set_code_style($style, $preserve_defaults = false) { + public function set_code_style($style, $preserve_defaults = false) { if (!$preserve_defaults) { $this->code_style = $style; } else { @@ -931,16 +906,16 @@ function set_code_style($style, $preserve_defaults = false) { /** * Sets the styles for the line numbers. * - * @param string The style for the line numbers that are "normal" - * @param string|boolean If a string, this is the style of the line + * @param string $style1 The style for the line numbers that are "normal" + * @param string|boolean $style2 If a string, this is the style of the line * numbers that are "fancy", otherwise if boolean then this * defines whether the normal styles should be merged with the * new normal styles or not - * @param boolean If set, is the flag for whether to merge the "fancy" + * @param boolean $preserve_defaults If set, is the flag for whether to merge the "fancy" * styles with the current styles or not * @since 1.0.2 */ - function set_line_style($style1, $style2 = '', $preserve_defaults = false) { + public function set_line_style($style1, $style2 = '', $preserve_defaults = false) { //Check if we got 2 or three parameters if (is_bool($style2)) { $preserve_defaults = $style2; @@ -970,11 +945,11 @@ function set_line_style($style1, $style2 = '', $preserve_defaults = false) { * are to be fancy. For example, if the value of this parameter is 5 then every * 5th line will be fancy. * - * @param int How line numbers should be displayed - * @param int Defines which lines are fancy + * @param int $flag How line numbers should be displayed + * @param int $nth_row Defines which lines are fancy * @since 1.0.0 */ - function enable_line_numbers($flag, $nth_row = 5) { + public function enable_line_numbers($flag, $nth_row = 5) { if (GESHI_NO_LINE_NUMBERS != $flag && GESHI_NORMAL_LINE_NUMBERS != $flag && GESHI_FANCY_LINE_NUMBERS != $flag) { $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE; @@ -989,10 +964,10 @@ function enable_line_numbers($flag, $nth_row = 5) { * Set it to false if you want to manipulate the output or manually display * the code in an ordered list. * - * @param boolean Wether multiline spans are allowed or not + * @param boolean $flag Wether multiline spans are allowed or not * @since 1.0.7.22 */ - function enable_multiline_span($flag) { + public function enable_multiline_span($flag) { $this->allow_multiline_span = (bool) $flag; } @@ -1002,7 +977,7 @@ function enable_multiline_span($flag) { * @see enable_multiline_span * @return bool */ - function get_multiline_span() { + public function get_multiline_span() { return $this->allow_multiline_span; } @@ -1011,13 +986,13 @@ function get_multiline_span() { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param int The key of the keyword group to change the styles of - * @param string The style to make the keywords - * @param boolean Whether to merge the new styles with the old or just + * @param int $key The key of the keyword group to change the styles of + * @param string $style The style to make the keywords + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just * to overwrite them * @since 1.0.0 */ - function set_keyword_group_style($key, $style, $preserve_defaults = false) { + public function set_keyword_group_style($key, $style, $preserve_defaults = false) { //Set the style for this keyword group if('*' == $key) { foreach($this->language_data['STYLES']['KEYWORDS'] as $_key => $_value) { @@ -1044,11 +1019,11 @@ function set_keyword_group_style($key, $style, $preserve_defaults = false) { /** * Turns highlighting on/off for a keyword group * - * @param int The key of the keyword group to turn on or off - * @param boolean Whether to turn highlighting for that group on or off + * @param int $key The key of the keyword group to turn on or off + * @param boolean $flag Whether to turn highlighting for that group on or off * @since 1.0.0 */ - function set_keyword_group_highlighting($key, $flag = true) { + public function set_keyword_group_highlighting($key, $flag = true) { $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false; } @@ -1057,13 +1032,13 @@ function set_keyword_group_highlighting($key, $flag = true) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param int The key of the comment group to change the styles of - * @param string The style to make the comments - * @param boolean Whether to merge the new styles with the old or just + * @param int $key The key of the comment group to change the styles of + * @param string $style The style to make the comments + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just * to overwrite them * @since 1.0.0 */ - function set_comments_style($key, $style, $preserve_defaults = false) { + public function set_comments_style($key, $style, $preserve_defaults = false) { if('*' == $key) { foreach($this->language_data['STYLES']['COMMENTS'] as $_key => $_value) { if (!$preserve_defaults) { @@ -1084,11 +1059,11 @@ function set_comments_style($key, $style, $preserve_defaults = false) { /** * Turns highlighting on/off for comment groups * - * @param int The key of the comment group to turn on or off - * @param boolean Whether to turn highlighting for that group on or off + * @param int $key The key of the comment group to turn on or off + * @param boolean $flag Whether to turn highlighting for that group on or off * @since 1.0.0 */ - function set_comments_highlighting($key, $flag = true) { + public function set_comments_highlighting($key, $flag = true) { $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false; } @@ -1097,12 +1072,13 @@ function set_comments_highlighting($key, $flag = true) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the escape characters - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them + * @param string $style The style to make the escape characters + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them + * @param int $group Tells the group of symbols for which style should be set. * @since 1.0.0 */ - function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) { + public function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) { if (!$preserve_defaults) { $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style; } else { @@ -1113,10 +1089,10 @@ function set_escape_characters_style($style, $preserve_defaults = false, $group /** * Turns highlighting on/off for escaped characters * - * @param boolean Whether to turn highlighting for escape characters on or off + * @param boolean $flag Whether to turn highlighting for escape characters on or off * @since 1.0.0 */ - function set_escape_characters_highlighting($flag = true) { + public function set_escape_characters_highlighting($flag = true) { $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false; } @@ -1128,13 +1104,13 @@ function set_escape_characters_highlighting($flag = true) { * This method is DEPRECATED: use set_symbols_style instead. * This method will be removed in 1.2.X * - * @param string The style to make the brackets - * @param boolean Whether to merge the new styles with the old or just + * @param string $style The style to make the brackets + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just * to overwrite them * @since 1.0.0 * @deprecated In favour of set_symbols_style */ - function set_brackets_style($style, $preserve_defaults = false) { + public function set_brackets_style($style, $preserve_defaults = false) { if (!$preserve_defaults) { $this->language_data['STYLES']['BRACKETS'][0] = $style; } else { @@ -1148,11 +1124,11 @@ function set_brackets_style($style, $preserve_defaults = false) { * This method is DEPRECATED: use set_symbols_highlighting instead. * This method will be remove in 1.2.X * - * @param boolean Whether to turn highlighting for brackets on or off + * @param boolean $flag Whether to turn highlighting for brackets on or off * @since 1.0.0 * @deprecated In favour of set_symbols_highlighting */ - function set_brackets_highlighting($flag) { + public function set_brackets_highlighting($flag) { $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false; } @@ -1161,13 +1137,13 @@ function set_brackets_highlighting($flag) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the symbols - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of symbols for which style should be set. + * @param string $style The style to make the symbols + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them + * @param int $group Tells the group of symbols for which style should be set. * @since 1.0.1 */ - function set_symbols_style($style, $preserve_defaults = false, $group = 0) { + public function set_symbols_style($style, $preserve_defaults = false, $group = 0) { // Update the style of symbols if (!$preserve_defaults) { $this->language_data['STYLES']['SYMBOLS'][$group] = $style; @@ -1184,10 +1160,10 @@ function set_symbols_style($style, $preserve_defaults = false, $group = 0) { /** * Turns highlighting on/off for symbols * - * @param boolean Whether to turn highlighting for symbols on or off + * @param boolean $flag Whether to turn highlighting for symbols on or off * @since 1.0.0 */ - function set_symbols_highlighting($flag) { + public function set_symbols_highlighting($flag) { // Update lexic permissions for this symbol group $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false; @@ -1200,13 +1176,13 @@ function set_symbols_highlighting($flag) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the escape characters - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of strings for which style should be set. + * @param string $style The style to make the escape characters + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them + * @param int $group Tells the group of strings for which style should be set. * @since 1.0.0 */ - function set_strings_style($style, $preserve_defaults = false, $group = 0) { + public function set_strings_style($style, $preserve_defaults = false, $group = 0) { if (!$preserve_defaults) { $this->language_data['STYLES']['STRINGS'][$group] = $style; } else { @@ -1217,10 +1193,10 @@ function set_strings_style($style, $preserve_defaults = false, $group = 0) { /** * Turns highlighting on/off for strings * - * @param boolean Whether to turn highlighting for strings on or off + * @param boolean $flag Whether to turn highlighting for strings on or off * @since 1.0.0 */ - function set_strings_highlighting($flag) { + public function set_strings_highlighting($flag) { $this->lexic_permissions['STRINGS'] = ($flag) ? true : false; } @@ -1229,13 +1205,13 @@ function set_strings_highlighting($flag) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the script blocks - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of script blocks for which style should be set. + * @param string $style The style to make the script blocks + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them + * @param int $group Tells the group of script blocks for which style should be set. * @since 1.0.8.4 */ - function set_script_style($style, $preserve_defaults = false, $group = 0) { + public function set_script_style($style, $preserve_defaults = false, $group = 0) { // Update the style of symbols if (!$preserve_defaults) { $this->language_data['STYLES']['SCRIPT'][$group] = $style; @@ -1249,13 +1225,13 @@ function set_script_style($style, $preserve_defaults = false, $group = 0) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the numbers - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of numbers for which style should be set. + * @param string $style The style to make the numbers + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them + * @param int $group Tells the group of numbers for which style should be set. * @since 1.0.0 */ - function set_numbers_style($style, $preserve_defaults = false, $group = 0) { + public function set_numbers_style($style, $preserve_defaults = false, $group = 0) { if (!$preserve_defaults) { $this->language_data['STYLES']['NUMBERS'][$group] = $style; } else { @@ -1266,10 +1242,10 @@ function set_numbers_style($style, $preserve_defaults = false, $group = 0) { /** * Turns highlighting on/off for numbers * - * @param boolean Whether to turn highlighting for numbers on or off + * @param boolean $flag Whether to turn highlighting for numbers on or off * @since 1.0.0 */ - function set_numbers_highlighting($flag) { + public function set_numbers_highlighting($flag) { $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false; } @@ -1280,13 +1256,13 @@ function set_numbers_highlighting($flag) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param int The key of the object splitter to change the styles of - * @param string The style to make the methods - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them + * @param int $key The key of the object splitter to change the styles of + * @param string $style The style to make the methods + * @param boolean $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them * @since 1.0.0 */ - function set_methods_style($key, $style, $preserve_defaults = false) { + public function set_methods_style($key, $style, $preserve_defaults = false) { if (!$preserve_defaults) { $this->language_data['STYLES']['METHODS'][$key] = $style; } else { @@ -1297,10 +1273,10 @@ function set_methods_style($key, $style, $preserve_defaults = false) { /** * Turns highlighting on/off for methods * - * @param boolean Whether to turn highlighting for methods on or off + * @param boolean $flag Whether to turn highlighting for methods on or off * @since 1.0.0 */ - function set_methods_highlighting($flag) { + public function set_methods_highlighting($flag) { $this->lexic_permissions['METHODS'] = ($flag) ? true : false; } @@ -1309,12 +1285,14 @@ function set_methods_highlighting($flag) { * true, then styles are merged with the default styles, with the * user defined styles having priority * - * @param string The style to make the regular expression matches - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them + * @param string $key The style to make the regular expression matches + * @param boolean $style Whether to merge the new styles with the old or just + * to overwrite them + * @param bool $preserve_defaults Whether to merge the new styles with the old or just + * to overwrite them * @since 1.0.0 */ - function set_regexps_style($key, $style, $preserve_defaults = false) { + public function set_regexps_style($key, $style, $preserve_defaults = false) { if (!$preserve_defaults) { $this->language_data['STYLES']['REGEXPS'][$key] = $style; } else { @@ -1325,22 +1303,22 @@ function set_regexps_style($key, $style, $preserve_defaults = false) { /** * Turns highlighting on/off for regexps * - * @param int The key of the regular expression group to turn on or off - * @param boolean Whether to turn highlighting for the regular expression group on or off + * @param int $key The key of the regular expression group to turn on or off + * @param boolean $flag Whether to turn highlighting for the regular expression group on or off * @since 1.0.0 */ - function set_regexps_highlighting($key, $flag) { + public function set_regexps_highlighting($key, $flag) { $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false; } /** * Sets whether a set of keywords are checked for in a case sensitive manner * - * @param int The key of the keyword group to change the case sensitivity of - * @param boolean Whether to check in a case sensitive manner or not + * @param int $key The key of the keyword group to change the case sensitivity of + * @param boolean $case Whether to check in a case sensitive manner or not * @since 1.0.0 */ - function set_case_sensitivity($key, $case) { + public function set_case_sensitivity($key, $case) { $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false; } @@ -1351,10 +1329,10 @@ function set_case_sensitivity($key, $case) { * - GESHI_CAPS_UPPER: convert all keywords to uppercase where found * - GESHI_CAPS_LOWER: convert all keywords to lowercase where found * - * @param int A constant specifying what to do with matched keywords + * @param int $case A constant specifying what to do with matched keywords * @since 1.0.1 */ - function set_case_keywords($case) { + public function set_case_keywords($case) { if (in_array($case, array( GESHI_CAPS_NO_CHANGE, GESHI_CAPS_UPPER, GESHI_CAPS_LOWER))) { $this->language_data['CASE_KEYWORDS'] = $case; @@ -1366,10 +1344,10 @@ function set_case_keywords($case) { * * Widths below zero are ignored * - * @param int The tab width + * @param int $width The tab width * @since 1.0.0 */ - function set_tab_width($width) { + public function set_tab_width($width) { $this->tab_width = intval($width); //Check if it fit's the constraints: @@ -1382,10 +1360,10 @@ function set_tab_width($width) { /** * Sets whether or not to use tab-stop width specifed by language * - * @param boolean Whether to use language-specific tab-stop widths + * @param boolean $use Whether to use language-specific tab-stop widths * @since 1.0.7.20 */ - function set_use_language_tab_width($use) { + public function set_use_language_tab_width($use) { $this->use_language_tab_width = (bool) $use; } @@ -1396,7 +1374,7 @@ function set_use_language_tab_width($use) { * @return int Tab width * @since 1.0.7.20 */ - function get_real_tab_width() { + public function get_real_tab_width() { if (!$this->use_language_tab_width || !isset($this->language_data['TAB_WIDTH'])) { return $this->tab_width; @@ -1410,10 +1388,10 @@ function get_real_tab_width() { * method without parameters will turn it on. See documentation * for more details on strict mode and where to use it. * - * @param boolean Whether to enable strict mode or not + * @param boolean $mode Whether to enable strict mode or not * @since 1.0.0 */ - function enable_strict_mode($mode = true) { + public function enable_strict_mode($mode = true) { if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) { $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER; } @@ -1426,7 +1404,7 @@ function enable_strict_mode($mode = true) { * @todo Rewrite with array traversal * @deprecated In favour of enable_highlighting */ - function disable_highlighting() { + public function disable_highlighting() { $this->enable_highlighting(false); } @@ -1437,10 +1415,10 @@ function disable_highlighting() { * to enable (true) or disable (false) all highlighting. * * @since 1.0.0 - * @param boolean A flag specifying whether to enable or disable all highlighting + * @param boolean $flag A flag specifying whether to enable or disable all highlighting * @todo Rewrite with array traversal */ - function enable_highlighting($flag = true) { + public function enable_highlighting($flag = true) { $flag = $flag ? true : false; foreach ($this->lexic_permissions as $key => $value) { if (is_array($value)) { @@ -1460,13 +1438,14 @@ function enable_highlighting($flag = true) { * Given a file extension, this method returns either a valid geshi language * name, or the empty string if it couldn't be found * - * @param string The extension to get a language name for - * @param array A lookup array to use instead of the default one + * @param string $extension The extension to get a language name for + * @param array $lookup A lookup array to use instead of the default one * @since 1.0.5 * @todo Re-think about how this method works (maybe make it private and/or make it * a extension->lang lookup?) + * @return int|string */ - static function get_language_name_from_extension( $extension, $lookup = array() ) { + public static function get_language_name_from_extension( $extension, $lookup = array() ) { $extension = strtolower($extension); if ( !is_array($lookup) || empty($lookup)) { @@ -1504,7 +1483,7 @@ static function get_language_name_from_extension( $extension, $lookup = array() 'haskell' => array('hs'), 'haxe' => array('hx'), 'html4strict' => array('html', 'htm'), - 'ini' => array('ini', 'desktop'), + 'ini' => array('ini', 'desktop', 'vbp'), 'java' => array('java'), 'javascript' => array('js'), 'klonec' => array('kl1'), @@ -1538,11 +1517,11 @@ static function get_language_name_from_extension( $extension, $lookup = array() 'smarty' => array(), 'tcl' => array('tcl'), 'text' => array('txt'), - 'vb' => array('bas'), - 'vbnet' => array(), + 'vb' => array('bas', 'ctl', 'frm'), + 'vbnet' => array('vb', 'sln'), 'visualfoxpro' => array(), 'whitespace' => array('ws'), - 'xml' => array('xml', 'svg', 'xrc'), + 'xml' => array('xml', 'svg', 'xrc', 'vbproj', 'csproj', 'userprefs', 'resx', 'stetic', 'settings', 'manifest', 'myapp'), 'z80' => array('z80', 'asm', 'inc') ); } @@ -1568,12 +1547,12 @@ static function get_language_name_from_extension( $extension, $lookup = array() * 'lang_name' ... * ); * - * @param string The filename to load the source from - * @param array A lookup array to use instead of the default one + * @param string $file_name The filename to load the source from + * @param array $lookup A lookup array to use instead of the default one * @todo Complete rethink of this and above method * @since 1.0.5 */ - function load_from_file($file_name, $lookup = array()) { + public function load_from_file($file_name, $lookup = array()) { if (is_readable($file_name)) { $this->set_source(file_get_contents($file_name)); $this->set_language(self::get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $lookup)); @@ -1585,11 +1564,11 @@ function load_from_file($file_name, $lookup = array()) { /** * Adds a keyword to a keyword group for highlighting * - * @param int The key of the keyword group to add the keyword to - * @param string The word to add to the keyword group + * @param int $key The key of the keyword group to add the keyword to + * @param string $word The word to add to the keyword group * @since 1.0.0 */ - function add_keyword($key, $word) { + public function add_keyword($key, $word) { if (!is_array($this->language_data['KEYWORDS'][$key])) { $this->language_data['KEYWORDS'][$key] = array(); } @@ -1607,9 +1586,9 @@ function add_keyword($key, $word) { /** * Removes a keyword from a keyword group * - * @param int The key of the keyword group to remove the keyword from - * @param string The word to remove from the keyword group - * @param bool Wether to automatically recompile the optimized regexp list or not. + * @param int $key The key of the keyword group to remove the keyword from + * @param string $word The word to remove from the keyword group + * @param bool $recompile Wether to automatically recompile the optimized regexp list or not. * Note: if you set this to false and @see GeSHi->parse_code() was already called once, * for the current language, you have to manually call @see GeSHi->optimize_keyword_group() * or the removed keyword will stay in cache and still be highlighted! On the other hand @@ -1617,7 +1596,7 @@ function add_keyword($key, $word) { * remove a lot of keywords. * @since 1.0.0 */ - function remove_keyword($key, $word, $recompile = true) { + public function remove_keyword($key, $word, $recompile = true) { $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]); if ($key_to_remove !== false) { unset($this->language_data['KEYWORDS'][$key][$key_to_remove]); @@ -1632,13 +1611,14 @@ function remove_keyword($key, $word, $recompile = true) { /** * Creates a new keyword group * - * @param int The key of the keyword group to create - * @param string The styles for the keyword group - * @param boolean Whether the keyword group is case sensitive ornot - * @param array The words to use for the keyword group + * @param int $key The key of the keyword group to create + * @param string $styles The styles for the keyword group + * @param boolean $case_sensitive Whether the keyword group is case sensitive ornot + * @param array $words The words to use for the keyword group * @since 1.0.0 + * @return bool */ - function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) { + public function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) { $words = (array) $words; if (empty($words)) { // empty word lists mess up highlighting @@ -1655,15 +1635,16 @@ function add_keyword_group($key, $styles, $case_sensitive = true, $words = array if ($this->parse_cache_built) { $this->optimize_keyword_group($key); } + return true; } /** * Removes a keyword group * - * @param int The key of the keyword group to remove + * @param int $key The key of the keyword group to remove * @since 1.0.0 */ - function remove_keyword_group ($key) { + public function remove_keyword_group ($key) { //Remove the keyword group internally unset($this->language_data['KEYWORDS'][$key]); unset($this->lexic_permissions['KEYWORDS'][$key]); @@ -1677,10 +1658,10 @@ function remove_keyword_group ($key) { /** * compile optimized regexp list for keyword group * - * @param int The key of the keyword group to compile & optimize + * @param int $key The key of the keyword group to compile & optimize * @since 1.0.8 */ - function optimize_keyword_group($key) { + public function optimize_keyword_group($key) { $this->language_data['CACHED_KEYWORD_LISTS'][$key] = $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]); $space_as_whitespace = false; @@ -1707,40 +1688,40 @@ function optimize_keyword_group($key) { /** * Sets the content of the header block * - * @param string The content of the header block + * @param string $content The content of the header block * @since 1.0.2 */ - function set_header_content($content) { + public function set_header_content($content) { $this->header_content = $content; } /** * Sets the content of the footer block * - * @param string The content of the footer block + * @param string $content The content of the footer block * @since 1.0.2 */ - function set_footer_content($content) { + public function set_footer_content($content) { $this->footer_content = $content; } /** * Sets the style for the header content * - * @param string The style for the header content + * @param string $style The style for the header content * @since 1.0.2 */ - function set_header_content_style($style) { + public function set_header_content_style($style) { $this->header_content_style = $style; } /** * Sets the style for the footer content * - * @param string The style for the footer content + * @param string $style The style for the footer content * @since 1.0.2 */ - function set_footer_content_style($style) { + public function set_footer_content_style($style) { $this->footer_content_style = $style; } @@ -1748,45 +1729,45 @@ function set_footer_content_style($style) { * Sets whether to force a surrounding block around * the highlighted code or not * - * @param boolean Tells whether to enable or disable this feature + * @param boolean $flag Tells whether to enable or disable this feature * @since 1.0.7.20 */ - function enable_inner_code_block($flag) { + public function enable_inner_code_block($flag) { $this->force_code_block = (bool)$flag; } /** * Sets the base URL to be used for keywords * - * @param int The key of the keyword group to set the URL for - * @param string The URL to set for the group. If {FNAME} is in - * the url somewhere, it is replaced by the keyword - * that the URL is being made for + * @param int $group The key of the keyword group to set the URL for + * @param string $url The URL to set for the group. If {FNAME} is in + * the url somewhere, it is replaced by the keyword + * that the URL is being made for * @since 1.0.2 */ - function set_url_for_keyword_group($group, $url) { + public function set_url_for_keyword_group($group, $url) { $this->language_data['URLS'][$group] = $url; } /** * Sets styles for links in code * - * @param int A constant that specifies what state the style is being - * set for - e.g. :hover or :visited - * @param string The styles to use for that state + * @param int $type A constant that specifies what state the style is being + * set for - e.g. :hover or :visited + * @param string $styles The styles to use for that state * @since 1.0.2 */ - function set_link_styles($type, $styles) { + public function set_link_styles($type, $styles) { $this->link_styles[$type] = $styles; } /** * Sets the target for links in code * - * @param string The target for links in the code, e.g. _blank + * @param string $target The target for links in the code, e.g. _blank * @since 1.0.3 */ - function set_link_target($target) { + public function set_link_target($target) { if (!$target) { $this->link_target = ''; } else { @@ -1797,32 +1778,32 @@ function set_link_target($target) { /** * Sets styles for important parts of the code * - * @param string The styles to use on important parts of the code + * @param string $styles The styles to use on important parts of the code * @since 1.0.2 */ - function set_important_styles($styles) { + public function set_important_styles($styles) { $this->important_styles = $styles; } /** * Sets whether context-important blocks are highlighted * - * @param boolean Tells whether to enable or disable highlighting of important blocks + * @param boolean $flag Tells whether to enable or disable highlighting of important blocks * @todo REMOVE THIS SHIZ FROM GESHI! * @deprecated * @since 1.0.2 */ - function enable_important_blocks($flag) { + public function enable_important_blocks($flag) { $this->enable_important_blocks = ( $flag ) ? true : false; } /** * Whether CSS IDs should be added to each line * - * @param boolean If true, IDs will be added to each line. + * @param boolean $flag If true, IDs will be added to each line. * @since 1.0.2 */ - function enable_ids($flag = true) { + public function enable_ids($flag = true) { $this->add_ids = ($flag) ? true : false; } @@ -1831,16 +1812,16 @@ function enable_ids($flag = true) { * * The extra style parameter was added in 1.0.7.21. * - * @param mixed An array of line numbers to highlight, or just a line - * number on its own. - * @param string A string specifying the style to use for this line. - * If null is specified, the default style is used. - * If false is specified, the line will be removed from - * special highlighting + * @param mixed $lines An array of line numbers to highlight, or just a line + * number on its own. + * @param string $style A string specifying the style to use for this line. + * If null is specified, the default style is used. + * If false is specified, the line will be removed from + * special highlighting * @since 1.0.2 * @todo Some data replication here that could be cut down on */ - function highlight_lines_extra($lines, $style = null) { + public function highlight_lines_extra($lines, $style = null) { if (is_array($lines)) { //Split up the job using single lines at a time foreach ($lines as $line) { @@ -1866,20 +1847,20 @@ function highlight_lines_extra($lines, $style = null) { /** * Sets the style for extra-highlighted lines * - * @param string The style for extra-highlighted lines + * @param string $styles The style for extra-highlighted lines * @since 1.0.2 */ - function set_highlight_lines_extra_style($styles) { + public function set_highlight_lines_extra_style($styles) { $this->highlight_extra_lines_style = $styles; } /** * Sets the line-ending * - * @param string The new line-ending + * @param string $line_ending The new line-ending * @since 1.0.2 */ - function set_line_ending($line_ending) { + public function set_line_ending($line_ending) { $this->line_ending = (string)$line_ending; } @@ -1895,10 +1876,10 @@ function set_line_ending($line_ending) { * has support for the CSS method, but (of course) IE doesn't * so it's not worth doing it the CSS way yet. * - * @param int The number to start line numbers at + * @param int $number The number to start line numbers at * @since 1.0.2 */ - function start_line_numbers_at($number) { + public function start_line_numbers_at($number) { $this->line_numbers_start = abs(intval($number)); } @@ -1911,10 +1892,10 @@ function start_line_numbers_at($number) { * Maybe in a future version it may make a return for speed reasons, but * I doubt it. * - * @param string The encoding to use for the source + * @param string $encoding The encoding to use for the source * @since 1.0.3 */ - function set_encoding($encoding) { + public function set_encoding($encoding) { if ($encoding) { $this->encoding = strtolower($encoding); } @@ -1923,10 +1904,10 @@ function set_encoding($encoding) { /** * Turns linking of keywords on or off. * - * @param boolean If true, links will be added to keywords + * @param boolean $enable If true, links will be added to keywords * @since 1.0.2 */ - function enable_keyword_links($enable = true) { + public function enable_keyword_links($enable = true) { $this->keyword_links = (bool) $enable; } @@ -1937,9 +1918,8 @@ function enable_keyword_links($enable = true) { * preprocessed * * @since 1.0.8 - * @access private */ - function build_style_cache() { + protected function build_style_cache() { //Build the style cache needed to highlight numbers appropriate if($this->lexic_permissions['NUMBERS']) { //First check what way highlighting information for numbers are given @@ -1988,9 +1968,13 @@ function build_style_cache() { * This function makes stylesheet generators much faster as they do not need these caches. * * @since 1.0.8 - * @access private */ - function build_parse_cache() { + protected function build_parse_cache() { + // check whether language_data is available + if (empty($this->language_data)) { + return false; + } + // cache symbol regexp //As this is a costy operation, we avoid doing it for multiple groups ... //Instead we perform it for all symbols at once. @@ -2172,7 +2156,7 @@ function build_parse_cache() { * * @since 1.0.0 */ - function parse_code () { + public function parse_code() { // Start the timer $start_time = microtime(); @@ -2180,6 +2164,11 @@ function parse_code () { $code = str_replace("\r\n", "\n", $this->source); $code = str_replace("\r", "\n", $code); + // check whether language_data is available + if (empty($this->language_data)) { + $this->error = GESHI_ERROR_NO_SUCH_LANG; + } + // Firstly, if there is an error, we won't highlight if ($this->error) { //Escape the source for output @@ -2268,8 +2257,7 @@ function parse_code () { * - Group 1 is the opener * - Group 2 is the closer */ - if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work. - preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) { + if(preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) { //We got a match ... if(isset($matches_rx['start']) && isset($matches_rx['end'])) { @@ -2516,15 +2504,8 @@ function parse_code () { continue; } $match_i = $comment_regexp_cache_per_key[$comment_key]['pos']; - } elseif ( - //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible - (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $i), $match, PREG_OFFSET_CAPTURE)) || - (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i)) - ) { + } elseif (preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i)) { $match_i = $match[0][1]; - if (GESHI_PHP_PRE_433) { - $match_i += $i; - } $comment_regexp_cache_per_key[$comment_key] = array( 'key' => $comment_key, @@ -2624,15 +2605,8 @@ function parse_code () { continue; } $match_i = $escape_regexp_cache_per_key[$escape_key]['pos']; - } elseif ( - //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible - (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $start), $match, PREG_OFFSET_CAPTURE)) || - (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start)) - ) { + } elseif (preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start)) { $match_i = $match[0][1]; - if (GESHI_PHP_PRE_433) { - $match_i += $start; - } $escape_regexp_cache_per_key[$escape_key] = array( 'key' => $escape_key, @@ -2700,7 +2674,7 @@ function parse_code () { if(function_exists('mb_substr')) { $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding); $string .= $es_char_m . ''; - } elseif (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) { + } elseif ('utf-8' == $this->encoding) { if(preg_match("/[\xC2-\xDF][\x80-\xBF]". "|\xE0[\xA0-\xBF][\x80-\xBF]". "|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}". @@ -3141,11 +3115,10 @@ function parse_code () { * Swaps out spaces and tabs for HTML indentation. Not needed if * the code is in a pre block... * - * @param string The source to indent (reference!) + * @param string $result The source to indent (reference!) * @since 1.0.0 - * @access private */ - function indent(&$result) { + protected function indent(&$result) { /// Replace tabs with the correct number of spaces if (false !== strpos($result, "\t")) { $lines = explode("\n", $result); @@ -3240,12 +3213,11 @@ function indent(&$result) { /** * Changes the case of a keyword for those languages where a change is asked for * - * @param string The keyword to change the case of + * @param string $instr The keyword to change the case of * @return string The keyword with its case changed * @since 1.0.0 - * @access private */ - function change_case($instr) { + protected function change_case($instr) { switch ($this->language_data['CASE_KEYWORDS']) { case GESHI_CAPS_UPPER: return strtoupper($instr); @@ -3259,14 +3231,13 @@ function change_case($instr) { /** * Handles replacements of keywords to include markup and links if requested * - * @param string The keyword to add the Markup to - * @return The HTML for the match found + * @param string $match The keyword to add the Markup to + * @return string The HTML for the match found * @since 1.0.8 - * @access private * * @todo Get rid of ender in keyword links */ - function handle_keyword_replace($match) { + protected function handle_keyword_replace($match) { $k = $this->_kw_replace_group; $keyword = $match[0]; $keyword_match = $match[1]; @@ -3323,12 +3294,11 @@ function handle_keyword_replace($match) { * * @note this is a callback, don't use it directly * - * @param array the matches array - * @return The highlighted string + * @param array $matches the matches array + * @return string The highlighted string * @since 1.0.8 - * @access private */ - function handle_regexps_callback($matches) { + protected function handle_regexps_callback($matches) { // before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'", return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>'; } @@ -3338,12 +3308,11 @@ function handle_regexps_callback($matches) { * * @note this is a callback, don't use it directly * - * @param array the matches array + * @param array $matches the matches array * @return string * @since 1.0.8 - * @access private */ - function handle_multiline_regexps($matches) { + protected function handle_multiline_regexps($matches) { $before = $this->_hmr_before; $after = $this->_hmr_after; if ($this->_hmr_replace) { @@ -3371,12 +3340,12 @@ function handle_multiline_regexps($matches) { * Takes a string that has no strings or comments in it, and highlights * stuff like keywords, numbers and methods. * - * @param string The string to parse for keyword, numbers etc. + * @param string $stuff_to_parse The string to parse for keyword, numbers etc. * @since 1.0.0 - * @access private * @todo BUGGY! Why? Why not build string and return? + * @return string */ - function parse_non_string_part($stuff_to_parse) { + protected function parse_non_string_part($stuff_to_parse) { $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse); // Highlight keywords @@ -3692,12 +3661,11 @@ function parse_non_string_part($stuff_to_parse) { /** * Sets the time taken to parse the code * - * @param microtime The time when parsing started - * @param microtime The time when parsing ended + * @param string $start_time The time when parsing started as returned by @see microtime() + * @param string $end_time The time when parsing ended as returned by @see microtime() * @since 1.0.2 - * @access private */ - function set_time($start_time, $end_time) { + protected function set_time($start_time, $end_time) { $start = explode(' ', $start_time); $end = explode(' ', $end_time); $this->time = $end[0] + $end[1] - $start[0] - $start[1]; @@ -3709,7 +3677,7 @@ function set_time($start_time, $end_time) { * @return double The time taken to parse the code * @since 1.0.2 */ - function get_time() { + public function get_time() { return $this->time; } @@ -3717,9 +3685,8 @@ function get_time() { * Merges arrays recursively, overwriting values of the first array with values of later arrays * * @since 1.0.8 - * @access private */ - function merge_arrays() { + protected function merge_arrays() { $arrays = func_get_args(); $narrays = count($arrays); @@ -3755,12 +3722,11 @@ function merge_arrays() { /** * Gets language information and stores it for later use * - * @param string The filename of the language file you want to load + * @param string $file_name The filename of the language file you want to load * @since 1.0.0 - * @access private * @todo Needs to load keys for lexic permissions for keywords, regexps etc */ - function load_language($file_name) { + protected function load_language($file_name) { if ($file_name == $this->loaded_language) { // this file is already loaded! return; @@ -3855,11 +3821,10 @@ function load_language($file_name) { * Takes the parsed code and various options, and creates the HTML * surrounding it to make it look nice. * - * @param string The code already parsed (reference!) + * @param string $parsed_code The code already parsed (reference!) * @since 1.0.0 - * @access private */ - function finalise(&$parsed_code) { + protected function finalise(&$parsed_code) { // Remove end parts of important declarations // This is BUGGY!! My fault for bad code: fix coming in 1.2 // @todo Remove this crap @@ -4102,9 +4067,8 @@ function finalise(&$parsed_code) { * * @return string The header for the code block * @since 1.0.0 - * @access private */ - function header() { + protected function header() { // Get attributes needed /** * @todo Document behaviour change - class is outputted regardless of whether @@ -4182,9 +4146,8 @@ function header() { * * @return string The footer for the code block * @since 1.0.0 - * @access private */ - function footer() { + protected function footer() { $footer = $this->footer_content; if ($footer) { if ($this->header_type == GESHI_HEADER_PRE) { @@ -4235,12 +4198,11 @@ function footer() { * Replaces certain keywords in the header and footer with * certain configuration values * - * @param string The header or footer content to do replacement on + * @param string $instr The header or footer content to do replacement on * @return string The header or footer with replaced keywords * @since 1.0.2 - * @access private */ - function replace_keywords($instr) { + protected function replace_keywords($instr) { $keywords = $replacements = array(); $keywords[] = '