summaryrefslogtreecommitdiff
path: root/framework/3rdParty
diff options
context:
space:
mode:
Diffstat (limited to 'framework/3rdParty')
-rw-r--r--framework/3rdParty/PhpShell/PHP/Shell.php2182
-rw-r--r--framework/3rdParty/PhpShell/php-shell-init.php174
-rw-r--r--framework/3rdParty/SafeHtml/HTMLSax3.php1388
-rw-r--r--framework/3rdParty/SafeHtml/HTMLSax3/Decorators.php724
-rw-r--r--framework/3rdParty/SafeHtml/HTMLSax3/States.php574
-rw-r--r--framework/3rdParty/SafeHtml/TSafeHtmlParser.php1344
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter.php792
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/ABAP.php98
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/CPP.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/CSS.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/DIFF.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/DTD.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Generator.php2508
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/HTML.php98
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/JAVA.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/JAVASCRIPT.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/MYSQL.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/PERL.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/PHP.php2176
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/PRADO.php506
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/PYTHON.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/RUBY.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php302
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Array.php396
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/BB.php474
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Console.php414
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Html.php890
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/HtmlTags.php372
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/JSON.php170
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/XML.php204
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/SQL.php90
-rw-r--r--framework/3rdParty/TextHighlighter/Text/Highlighter/XML.php90
32 files changed, 8433 insertions, 8433 deletions
diff --git a/framework/3rdParty/PhpShell/PHP/Shell.php b/framework/3rdParty/PhpShell/PHP/Shell.php
index bf8c86c3..8012475e 100644
--- a/framework/3rdParty/PhpShell/PHP/Shell.php
+++ b/framework/3rdParty/PhpShell/PHP/Shell.php
@@ -1,1091 +1,1091 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/*
-(c) 2006 Jan Kneschke <jan@kneschke.de>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
-* A interactive PHP Shell
-*
-* The more I work with other languages like python and ruby I like their way how they
-* work on problems. While PHP is very forgiving on errors, it is weak on the debugging
-* side. It was missing a simple to use interactive shell for years. Python and Ruby have
-* their ipython and iruby shell which give you a direct way to interact with the objects.
-* No need to write a script and execute it afterwards.
-*
-* Starting the Shell:
-*
-* The package contains a shell wrapper for windows and unix:
-* <pre>
-* sh> php-shell.sh
-* win> php-shell
-* </pre>
-*
-* Both are calling the wrapper script <code>php -q php-shell-cmd.php</code>
-*
-* Inline Help
-*
-* <pre>
-* PHP-Shell - Version 0.2.0, with readline() support
-* (c) 2006, Jan Kneschke <jan@kneschke.de>
-*
-* >> use '?' to open the inline help
-*
-* >> ?
-* "inline help for the PHP-shell
-*
-* >> ?
-* print this help
-* >> ? <topic>
-* get the doccomment for a class, method, property or function
-* >> p <var>
-* execute a verbose print (if implemented)
-* >> quit
-* leave shell
-* "
-* >> ? PHP_Shell
-* </pre>
-* Alternatives
-*
-* - http://david.acz.org/phpa/
-* - http://www.hping.org/phpinteractive/
-* - the embedded interactive php-shell: $ php -a
-*
-* @package PHP
-*/
-
-/**
-* PHP_Shell
-*
-* a interactive PHP Shell with tab-completion and history
-* it can catch FATAL errors before executing the code
-*
-* Extensions are provided through three side-classes:
-*
-* - PHP_Shell_Commands
-* - PHP_Shell_Options
-* - PHP_Shell_Extensions
-*
-* @package PHP
-*/
-
-require_once(dirname(__FILE__)."/Shell/Commands.php");
-require_once(dirname(__FILE__)."/Shell/Options.php"); /* for the tab-complete */
-
-class PHP_Shell {
- /**
- * current code-buffer
- * @var string
- */
- protected $code;
-
- /**
- * set if readline support is enabled
- * @var bool
- */
- protected $have_readline;
-
- /**
- * current version of the class
- * @var string
- */
- protected $version = '0.3.1';
-
- /**
- *
- */
- protected $stdin;
-
- protected $code_buffer;
-
- public $has_semicolon=false;
-
- /**
- * init the shell and change if readline support is available
- */
- public function __construct() {
- $this->code = '';
-
- $this->stdin = null;
-
- $this->have_readline = function_exists('readline');
-
- if ($this->have_readline) {
- readline_completion_function('__shell_readline_complete');
- }
-
- $this->use_readline = true;
-
- $cmd = PHP_Shell_Commands::getInstance();
-
- $cmd->registerCommand('#^quit$#', $this, 'cmdQuit', 'quit', 'leaves the shell');
- $cmd->registerCommand('#^\?$#', $this, 'cmdHelp', '?', 'show this help');
- $cmd->registerCommand('#^\?\s+license$#', $this, 'cmdLicense', '? license', 'show license of the shell');
- }
-
-
- /**
- * parse the PHP code
- *
- * we parse before we eval() the code to
- * - fetch fatal errors before they come up
- * - know about where we have to wait for closing braces
- *
- * @return int 0 if a executable statement is in the code-buffer, non-zero otherwise
- */
- public function parse() {
- ## remove empty lines
- if (trim($this->code) == '') return 1;
-
- $t = token_get_all('<?php '.$this->code.' ?>');
-
- $need_semicolon = 1; /* do we need a semicolon to complete the statement ? */
- $need_return = 1; /* can we prepend a return to the eval-string ? */
- $open_comment = 0; /* a open multi-line comment */
- $eval = ''; /* code to be eval()'ed later */
- $braces = array(); /* to track if we need more closing braces */
-
- $methods = array(); /* to track duplicate methods in a class declaration */
- $ts = array(); /* tokens without whitespaces */
-
- foreach ($t as $ndx => $token) {
- if (is_array($token)) {
- $ignore = 0;
-
- switch($token[0]) {
- case T_WHITESPACE:
- case T_OPEN_TAG:
- case T_CLOSE_TAG:
- $ignore = 1;
- break;
- case T_FOREACH:
- case T_DO:
- case T_WHILE:
- case T_FOR:
-
- case T_IF:
- case T_RETURN:
-
- case T_CLASS:
- case T_FUNCTION:
- case T_INTERFACE:
-
- case T_PRINT:
- case T_ECHO:
-
- case T_COMMENT:
- case T_UNSET:
-
- case T_INCLUDE:
- case T_REQUIRE:
- case T_INCLUDE_ONCE:
- case T_REQUIRE_ONCE:
- case T_TRY:
- case T_SWITCH:
- case T_DEFAULT:
- case T_CASE:
- case T_BREAK:
- case T_DOC_COMMENT:
- $need_return = 0;
- break;
- case T_EMPTY:
- case T_ISSET:
- case T_EVAL:
- case T_EXIT:
-
- case T_VARIABLE:
- case T_STRING:
- case T_NEW:
- case T_EXTENDS:
- case T_IMPLEMENTS:
- case T_OBJECT_OPERATOR:
- case T_DOUBLE_COLON:
- case T_INSTANCEOF:
-
- case T_CATCH:
- case T_THROW:
-
- case T_ELSE:
- case T_AS:
- case T_LNUMBER:
- case T_DNUMBER:
- case T_CONSTANT_ENCAPSED_STRING:
- case T_ENCAPSED_AND_WHITESPACE:
- case T_CHARACTER:
- case T_ARRAY:
- case T_DOUBLE_ARROW:
-
- case T_CONST:
- case T_PUBLIC:
- case T_PROTECTED:
- case T_PRIVATE:
- case T_ABSTRACT:
- case T_STATIC:
- case T_VAR:
-
- case T_INC:
- case T_DEC:
- case T_SL:
- case T_SL_EQUAL:
- case T_SR:
- case T_SR_EQUAL:
-
- case T_IS_EQUAL:
- case T_IS_IDENTICAL:
- case T_IS_GREATER_OR_EQUAL:
- case T_IS_SMALLER_OR_EQUAL:
-
- case T_BOOLEAN_OR:
- case T_LOGICAL_OR:
- case T_BOOLEAN_AND:
- case T_LOGICAL_AND:
- case T_LOGICAL_XOR:
- case T_MINUS_EQUAL:
- case T_PLUS_EQUAL:
- case T_MUL_EQUAL:
- case T_DIV_EQUAL:
- case T_MOD_EQUAL:
- case T_XOR_EQUAL:
- case T_AND_EQUAL:
- case T_OR_EQUAL:
-
- case T_FUNC_C:
- case T_CLASS_C:
- case T_LINE:
- case T_FILE:
-
- case T_BOOL_CAST:
- case T_INT_CAST:
- case T_STRING_CAST:
-
- /* just go on */
- break;
- default:
- /* debug unknown tags*/
- error_log(sprintf("unknown tag: %d (%s): %s".PHP_EOL, $token[0], token_name($token[0]), $token[1]));
-
- break;
- }
- if (!$ignore) {
- $eval .= $token[1]." ";
- $ts[] = array("token" => $token[0], "value" => $token[1]);
- }
- } else {
- $ts[] = array("token" => $token, "value" => '');
-
- $last = count($ts) - 1;
-
- switch ($token) {
- case '(':
- /* walk backwards through the tokens */
-
- if ($last >= 4 &&
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
- $ts[$last - 3]['token'] == ')' ) {
- /* func()->method()
- *
- * we can't know what func() is return, so we can't
- * say if the method() exists or not
- *
- */
- } else if ($last >= 3 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
- $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
- $ts[$last - 3]['token'] == T_VARIABLE ) {
-
- /* $object->method( */
-
- /* catch (Exception $e) does not set $e in $GLOBALS[] */
- $in_catch = 0;
-
- foreach ($ts as $v) {
- if ($v['token'] == T_CATCH) {
- $in_catch = 1;
- }
- }
-
- if (!$in_catch) {
- /* $object has to exist and has to be a object */
- $objname = $ts[$last - 3]['value'];
-
- if (!isset($GLOBALS[ltrim($objname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
- }
- $object = $GLOBALS[ltrim($objname, '$')];
-
- if (!is_object($object)) {
- throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
- }
-
- $method = $ts[$last - 1]['value'];
-
- /* obj */
-
- if (!method_exists($object, $method)) {
- throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
- $objname, get_class($object), $method));
- }
- }
- } else if ($last >= 3 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_VARIABLE &&
- $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
- $ts[$last - 3]['token'] == T_VARIABLE ) {
-
- /* $object->$method( */
-
- /* $object has to exist and has to be a object */
- $objname = $ts[$last - 3]['value'];
-
- if (!isset($GLOBALS[ltrim($objname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
- }
- $object = $GLOBALS[ltrim($objname, '$')];
-
- if (!is_object($object)) {
- throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
- }
-
- $methodname = $ts[$last - 1]['value'];
-
- if (!isset($GLOBALS[ltrim($methodname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $methodname));
- }
- $method = $GLOBALS[ltrim($methodname, '$')];
-
- /* obj */
-
- if (!method_exists($object, $method)) {
- throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
- $objname, get_class($object), $method));
- }
-
- } else if ($last >= 6 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
- $ts[$last - 3]['token'] == ']' &&
- /* might be anything as index */
- $ts[$last - 5]['token'] == '[' &&
- $ts[$last - 6]['token'] == T_VARIABLE ) {
-
- /* $object[...]->method( */
-
- /* $object has to exist and has to be a object */
- $objname = $ts[$last - 6]['value'];
-
- if (!isset($GLOBALS[ltrim($objname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
- }
- $array = $GLOBALS[ltrim($objname, '$')];
-
- if (!is_array($array)) {
- throw new Exception(sprintf('Variable \'%s\' is not a array', $objname));
- }
-
- $andx = $ts[$last - 4]['value'];
-
- if (!isset($array[$andx])) {
- throw new Exception(sprintf('%s[\'%s\'] is not set', $objname, $andx));
- }
-
- $object = $array[$andx];
-
- if (!is_object($object)) {
- throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
- }
-
- $method = $ts[$last - 1]['value'];
-
- /* obj */
-
- if (!method_exists($object, $method)) {
- throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
- $objname, get_class($object), $method));
- }
-
- } else if ($last >= 3 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_DOUBLE_COLON &&
- $ts[$last - 3]['token'] == T_STRING ) {
-
- /* Class::method() */
-
- /* $object has to exist and has to be a object */
- $classname = $ts[$last - 3]['value'];
-
- if (!class_exists($classname)) {
- throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
- }
-
- $method = $ts[$last - 1]['value'];
-
- if (!in_array($method, get_class_methods($classname))) {
- throw new Exception(sprintf("Class '%s' doesn't have a method named '%s'",
- $classname, $method));
- }
- } else if ($last >= 3 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_VARIABLE &&
- $ts[$last - 2]['token'] == T_DOUBLE_COLON &&
- $ts[$last - 3]['token'] == T_STRING ) {
-
- /* $var::method() */
-
- /* $object has to exist and has to be a object */
- $classname = $ts[$last - 3]['value'];
-
- if (!class_exists($classname)) {
- throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
- }
-
- $methodname = $ts[$last - 1]['value'];
-
- if (!isset($GLOBALS[ltrim($methodname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $methodname));
- }
- $method = $GLOBALS[ltrim($methodname, '$')];
-
- if (!in_array($method, get_class_methods($classname))) {
- throw new Exception(sprintf("Class '%s' doesn't have a method named '%s'",
- $classname, $method));
- }
-
- } else if ($last >= 2 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_NEW ) {
-
- /* new Class() */
-
- /* don't care about this in a class ... { ... } */
-
- $classname = $ts[$last - 1]['value'];
-
- if (!class_exists($classname)) {
- throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
- }
-
- $r = new ReflectionClass($classname);
-
- if ($r->isAbstract()) {
- throw new Exception(sprintf("Can't instantiate abstract Class '%s'", $classname));
- }
-
- if (!$r->isInstantiable()) {
- throw new Exception(sprintf('Class \'%s\' can\'t be instantiated. Is the class abstract ?', $classname));
- }
-
- } else if ($last >= 2 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_FUNCTION ) {
-
- /* make sure we are not a in class definition */
-
- /* function a() */
-
- $func = $ts[$last - 1]['value'];
-
- if (function_exists($func)) {
- throw new Exception(sprintf('Function \'%s\' is already defined', $func));
- }
- } else if ($last >= 4 &&
- $ts[0]['token'] == T_CLASS &&
- $ts[1]['token'] == T_STRING &&
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_FUNCTION ) {
-
- /* make sure we are not a in class definition */
-
- /* class a { .. function a() ... } */
-
- $func = $ts[$last - 1]['value'];
- $classname = $ts[1]['value'];
-
- if (isset($methods[$func])) {
- throw new Exception(sprintf("Can't redeclare method '%s' in Class '%s'", $func, $classname));
- }
-
- $methods[$func] = 1;
-
- } else if ($last >= 1 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
- $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_STRING ) {
- /* func() */
- $funcname = $ts[$last - 1]['value'];
-
- if (!function_exists($funcname)) {
- throw new Exception(sprintf("Function %s() doesn't exist", $funcname));
- }
- } else if ($last >= 1 &&
- $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_VARIABLE ) {
-
- /* $object has to exist and has to be a object */
- $funcname = $ts[$last - 1]['value'];
-
- if (!isset($GLOBALS[ltrim($funcname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $funcname));
- }
- $func = $GLOBALS[ltrim($funcname, '$')];
-
- if (!function_exists($func)) {
- throw new Exception(sprintf("Function %s() doesn't exist", $func));
- }
-
- }
-
- array_push($braces, $token);
- break;
- case '{':
- $need_return = 0;
-
- if ($last >= 2 &&
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_CLASS ) {
-
- /* class name { */
-
- $classname = $ts[$last - 1]['value'];
-
- if (class_exists($classname, false)) {
- throw new Exception(sprintf("Class '%s' can't be redeclared", $classname));
- }
- } else if ($last >= 4 &&
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_EXTENDS &&
- $ts[$last - 3]['token'] == T_STRING &&
- $ts[$last - 4]['token'] == T_CLASS ) {
-
- /* class classname extends classname { */
-
- $classname = $ts[$last - 3]['value'];
- $extendsname = $ts[$last - 1]['value'];
-
- if (class_exists($classname, false)) {
- throw new Exception(sprintf("Class '%s' can't be redeclared",
- $classname));
- }
- if (!class_exists($extendsname, true)) {
- throw new Exception(sprintf("Can't extend '%s' ... from not existing Class '%s'",
- $classname, $extendsname));
- }
- } else if ($last >= 4 &&
- $ts[$last - 1]['token'] == T_STRING &&
- $ts[$last - 2]['token'] == T_IMPLEMENTS &&
- $ts[$last - 3]['token'] == T_STRING &&
- $ts[$last - 4]['token'] == T_CLASS ) {
-
- /* class name implements interface { */
-
- $classname = $ts[$last - 3]['value'];
- $implements = $ts[$last - 1]['value'];
-
- if (class_exists($classname, false)) {
- throw new Exception(sprintf("Class '%s' can't be redeclared",
- $classname));
- }
- if (!interface_exists($implements, false)) {
- throw new Exception(sprintf("Can't implement not existing Interface '%s' for Class '%s'",
- $implements, $classname));
- }
- }
-
- array_push($braces, $token);
- break;
- case '}':
- $need_return = 0;
- case ')':
- array_pop($braces);
- break;
- case '[':
- if ($ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
- $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
- $ts[$last - 1]['token'] == T_VARIABLE) {
- /* $a[] only works on array and string */
-
- /* $object has to exist and has to be a object */
- $objname = $ts[$last - 1]['value'];
-
- if (!isset($GLOBALS[ltrim($objname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
- }
- $obj = $GLOBALS[ltrim($objname, '$')];
-
- if (is_object($obj)) {
- throw new Exception(sprintf('Objects (%s) don\'t support array access operators', $objname));
- }
- }
- break;
- }
-
- $eval .= $token;
- }
- }
-
- $last = count($ts) - 1;
- if ($last >= 2 &&
- $ts[$last - 0]['token'] == T_STRING &&
- $ts[$last - 1]['token'] == T_DOUBLE_COLON &&
- $ts[$last - 2]['token'] == T_STRING ) {
-
- /* Class::constant */
-
- /* $object has to exist and has to be a object */
- $classname = $ts[$last - 2]['value'];
-
- if (!class_exists($classname)) {
- throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
- }
-
- $constname = $ts[$last - 0]['value'];
-
- $c = new ReflectionClass($classname);
- if (!$c->hasConstant($constname)) {
- throw new Exception(sprintf("Class '%s' doesn't have a constant named '%s'",
- $classname, $constname));
- }
- } else if ($last == 0 &&
- $ts[$last - 0]['token'] == T_VARIABLE ) {
-
- /* $var */
-
- $varname = $ts[$last - 0]['value'];
-
- if (!isset($GLOBALS[ltrim($varname, '$')])) {
- throw new Exception(sprintf('Variable \'%s\' is not set', $varname));
- }
- }
-
-
- $need_more = (count($braces) > 0) || $open_comment;
-
- if ($need_more || ';' === $token) {
- $need_semicolon = 0;
- }
-
- if ($need_return) {
- $eval = "return ".$eval;
- }
-
- /* add a traling ; if necessary */
- if ($need_semicolon)
- {
- $this->has_semicolon = preg_match('/;\s*$/', $eval);
- $eval .= ';';
- }
-
- if (!$need_more) {
- $this->code = $eval;
- }
-
- return $need_more;
- }
-
- /**
- * show the prompt and fetch a single line
- *
- * uses readline() if avaialbe
- *
- * @return string a input-line
- */
- public function readline() {
- if (empty($this->code)) print PHP_EOL;
-
- $prompt = (empty($this->code)) ? '>> ' : '.. ';
-
- if (count($this->code_buffer) > 0) {
- print $prompt;
-
- $line = array_shift($this->code_buffer);
-
- print $line.PHP_EOL;
-
- return $line.PHP_EOL;
- }
-
- if ($this->have_readline) {
- $l = readline($prompt);
-
- readline_add_history($l);
- } else {
- print $prompt;
-
- if (is_null($this->stdin)) {
- if (false === ($this->stdin = fopen("php://stdin", "r"))) {
- return false;
- }
- }
- $l = fgets($this->stdin);
- }
- return $l;
- }
-
- /**
- * get the inline help
- *
- * @return string the inline help as string
- */
- public function cmdHelp($l) {
- $o = 'Inline Help:'.PHP_EOL;
-
- $cmds = PHP_Shell_Commands::getInstance()->getCommands();
-
- $help = array();
- foreach ($cmds as $cmd) {
- $help[] = sprintf(' >> %s'.PHP_EOL.' %s'.PHP_EOL,
- $cmd['command'],
- $cmd['description']
- );
- }
-
- return var_export(implode("\n", $help), 1);
- }
-
- /**
- * get the license string
- *
- * @return string the inline help as string
- */
- public function cmdLicense($l) {
- $o = <<<EOF
-(c) 2006 Jan Kneschke <jan@kneschke.de>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-EOF;
-
- return var_export($o, 1);
- }
-
- /**
- * handle the 'quit' command
- *
- * @return bool false to leave the input() call
- * @see input
- */
- protected function cmdQuit($l) {
- return false;
- }
-
- /**
- * handle the input line
- *
- * read the input and handle the commands of the shell
- *
- * @return bool false on 'quit' or EOF, true otherwise
- */
- public function input() {
- $l = $this->readline();
-
- /* got EOF ? */
- if (false === $l) return false;
-
- $l = trim($l);
-
- if (empty($this->code)) {
- $this->verbose = 0;
-
- $cmds = PHP_Shell_Commands::getInstance()->getCommands();
-
- foreach ($cmds as $cmd) {
- if (preg_match($cmd['regex'], $l)) {
- $obj = $cmd['obj'];
- $func = $cmd['method'];
-
- if (false === ($l = $obj->$func($l))) {
- ## quit
- return false;
- }
-
- if (is_array($l)) {
- $this->code_buffer = $l;
- $l = '';
- }
- break;
- }
- }
- }
-
- $this->appendCode($l);
-
- return true;
- }
-
- /**
- * get the code-buffer
- *
- * @return string the code-buffer
- */
- public function getCode() {
- return $this->code;
- return $code;
- }
-
- /**
- * reset the code-buffer
- */
- public function resetCode() {
- $this->has_semicolon=false;
- $this->code = '';
- }
-
- /**
- * append code to the code-buffer
- *
- * @param string $code input buffer
- */
- public function appendCode($code) {
- if (strlen($code)) $code .= PHP_EOL;
-
- $this->code .= $code;
- }
-
- /**
- * check if readline support is enabled
- *
- * @return bool true if enabled, false otherwise
- */
- public function hasReadline() {
- return $this->have_readline;
- }
-
- /**
- * get version of the class
- *
- * @return string version-string
- */
- public function getVersion() {
- return $this->version;
- }
-}
-
-/**
-* a readline completion callback
-*
-* @param string $str linebuffer
-* @param integer $pos position in linebuffer
-* @return array list of possible matches
-*/
-function __shell_readline_complete($str, $pos) {
- $in = readline_info('line_buffer');
-
- /**
- * parse the line-buffer backwards to see if we have a
- * - constant
- * - function
- * - variable
- */
-
- $m = array();
-
- if (preg_match('#\$([A-Za-z0-9_]+)->#', $in, $a)) {
- /* check for $o->... */
- $name = $a[1];
-
- if (isset($GLOBALS[$name]) && is_object($GLOBALS[$name])) {
- $c = get_class_methods($GLOBALS[$name]);
-
- foreach ($c as $v) {
- $m[] = $v.'(';
- }
- $c = get_class_vars(get_class($GLOBALS[$name]));
-
- foreach ($c as $k => $v) {
- $m[] = $k;
- }
-
- return $m;
- }
- } else if (preg_match('#\$([A-Za-z0-9_]+)\[([^\]]+)\]->#', $in, $a)) {
- /* check for $o[...]->... */
- $name = $a[1];
-
- if (isset($GLOBALS[$name]) &&
- is_array($GLOBALS[$name]) &&
- isset($GLOBALS[$name][$a[2]])) {
-
- $c = get_class_methods($GLOBALS[$name][$a[2]]);
-
- foreach ($c as $v) {
- $m[] = $v.'(';
- }
- $c = get_class_vars(get_class($GLOBALS[$name][$a[2]]));
-
- foreach ($c as $k => $v) {
- $m[] = $k;
- }
- return $m;
- }
-
- } else if (preg_match('#([A-Za-z0-9_]+)::#', $in, $a)) {
- /* check for Class:: */
- $name = $a[1];
-
- if (class_exists($name, false)) {
- $c = get_class_methods($name);
-
- foreach ($c as $v) {
- $m[] = sprintf('%s::%s(', $name, $v);
- }
-
- $cl = new ReflectionClass($name);
- $c = $cl->getConstants();
-
- foreach ($c as $k => $v) {
- $m[] = sprintf('%s::%s', $name, $k);
- }
-
- return $m;
- }
- } else if (preg_match('#\$([a-zA-Z]?[a-zA-Z0-9_]*)$#', $in)) {
- $m = array_keys($GLOBALS);
-
- return $m;
- } else if (preg_match('#new #', $in)) {
- $c = get_declared_classes();
-
- foreach ($c as $v) {
- $m[] = $v.'(';
- }
-
- return $m;
- } else if (preg_match('#^:set #', $in)) {
- foreach (PHP_Shell_Options::getInstance()->getOptions() as $v) {
- $m[] = $v;
- }
-
- return $m;
- }
-
- $f = get_defined_functions();
-
- foreach ($f['internal'] as $v) {
- $m[] = $v.'(';
- }
-
- foreach ($f['user'] as $v) {
- $m[] = $v.'(';
- }
-
- $c = get_declared_classes();
-
- foreach ($c as $v) {
- $m[] = $v.'::';
- }
-
- $c = get_defined_constants();
-
- foreach ($c as $k => $v) {
- $m[] = $k;
- }
-
- /* taken from http://de3.php.net/manual/en/reserved.php */
- $m[] = 'abstract';
- $m[] = 'and';
- $m[] = 'array(';
- $m[] = 'as';
- $m[] = 'break';
- $m[] = 'case';
- $m[] = 'catch';
- $m[] = 'class';
- $m[] = 'const';
- $m[] = 'continue';
- # $m[] = 'declare';
- $m[] = 'default';
- $m[] = 'die(';
- $m[] = 'do';
- $m[] = 'echo(';
- $m[] = 'else';
- $m[] = 'elseif';
- $m[] = 'empty(';
- # $m[] = 'enddeclare';
- $m[] = 'eval(';
- $m[] = 'exception';
- $m[] = 'extends';
- $m[] = 'exit(';
- $m[] = 'extends';
- $m[] = 'final';
- $m[] = 'for (';
- $m[] = 'foreach (';
- $m[] = 'function';
- $m[] = 'global';
- $m[] = 'if';
- $m[] = 'implements';
- $m[] = 'include "';
- $m[] = 'include_once "';
- $m[] = 'interface';
- $m[] = 'isset(';
- $m[] = 'list(';
- $m[] = 'new';
- $m[] = 'or';
- $m[] = 'print(';
- $m[] = 'private';
- $m[] = 'protected';
- $m[] = 'public';
- $m[] = 'require "';
- $m[] = 'require_once "';
- $m[] = 'return';
- $m[] = 'static';
- $m[] = 'switch (';
- $m[] = 'throw';
- $m[] = 'try';
- $m[] = 'unset(';
- # $m[] = 'use';
- $m[] = 'var';
- $m[] = 'while';
- $m[] = 'xor';
- $m[] = '__FILE__';
- $m[] = '__FUNCTION__';
- $m[] = '__CLASS__';
- $m[] = '__LINE__';
- $m[] = '__METHOD__';
-
- # printf("%s ... %s\n", $str, $pos);
- return $m;
-}
-
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/*
+(c) 2006 Jan Kneschke <jan@kneschke.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/**
+* A interactive PHP Shell
+*
+* The more I work with other languages like python and ruby I like their way how they
+* work on problems. While PHP is very forgiving on errors, it is weak on the debugging
+* side. It was missing a simple to use interactive shell for years. Python and Ruby have
+* their ipython and iruby shell which give you a direct way to interact with the objects.
+* No need to write a script and execute it afterwards.
+*
+* Starting the Shell:
+*
+* The package contains a shell wrapper for windows and unix:
+* <pre>
+* sh> php-shell.sh
+* win> php-shell
+* </pre>
+*
+* Both are calling the wrapper script <code>php -q php-shell-cmd.php</code>
+*
+* Inline Help
+*
+* <pre>
+* PHP-Shell - Version 0.2.0, with readline() support
+* (c) 2006, Jan Kneschke <jan@kneschke.de>
+*
+* >> use '?' to open the inline help
+*
+* >> ?
+* "inline help for the PHP-shell
+*
+* >> ?
+* print this help
+* >> ? <topic>
+* get the doccomment for a class, method, property or function
+* >> p <var>
+* execute a verbose print (if implemented)
+* >> quit
+* leave shell
+* "
+* >> ? PHP_Shell
+* </pre>
+* Alternatives
+*
+* - http://david.acz.org/phpa/
+* - http://www.hping.org/phpinteractive/
+* - the embedded interactive php-shell: $ php -a
+*
+* @package PHP
+*/
+
+/**
+* PHP_Shell
+*
+* a interactive PHP Shell with tab-completion and history
+* it can catch FATAL errors before executing the code
+*
+* Extensions are provided through three side-classes:
+*
+* - PHP_Shell_Commands
+* - PHP_Shell_Options
+* - PHP_Shell_Extensions
+*
+* @package PHP
+*/
+
+require_once(dirname(__FILE__)."/Shell/Commands.php");
+require_once(dirname(__FILE__)."/Shell/Options.php"); /* for the tab-complete */
+
+class PHP_Shell {
+ /**
+ * current code-buffer
+ * @var string
+ */
+ protected $code;
+
+ /**
+ * set if readline support is enabled
+ * @var bool
+ */
+ protected $have_readline;
+
+ /**
+ * current version of the class
+ * @var string
+ */
+ protected $version = '0.3.1';
+
+ /**
+ *
+ */
+ protected $stdin;
+
+ protected $code_buffer;
+
+ public $has_semicolon=false;
+
+ /**
+ * init the shell and change if readline support is available
+ */
+ public function __construct() {
+ $this->code = '';
+
+ $this->stdin = null;
+
+ $this->have_readline = function_exists('readline');
+
+ if ($this->have_readline) {
+ readline_completion_function('__shell_readline_complete');
+ }
+
+ $this->use_readline = true;
+
+ $cmd = PHP_Shell_Commands::getInstance();
+
+ $cmd->registerCommand('#^quit$#', $this, 'cmdQuit', 'quit', 'leaves the shell');
+ $cmd->registerCommand('#^\?$#', $this, 'cmdHelp', '?', 'show this help');
+ $cmd->registerCommand('#^\?\s+license$#', $this, 'cmdLicense', '? license', 'show license of the shell');
+ }
+
+
+ /**
+ * parse the PHP code
+ *
+ * we parse before we eval() the code to
+ * - fetch fatal errors before they come up
+ * - know about where we have to wait for closing braces
+ *
+ * @return int 0 if a executable statement is in the code-buffer, non-zero otherwise
+ */
+ public function parse() {
+ ## remove empty lines
+ if (trim($this->code) == '') return 1;
+
+ $t = token_get_all('<?php '.$this->code.' ?>');
+
+ $need_semicolon = 1; /* do we need a semicolon to complete the statement ? */
+ $need_return = 1; /* can we prepend a return to the eval-string ? */
+ $open_comment = 0; /* a open multi-line comment */
+ $eval = ''; /* code to be eval()'ed later */
+ $braces = array(); /* to track if we need more closing braces */
+
+ $methods = array(); /* to track duplicate methods in a class declaration */
+ $ts = array(); /* tokens without whitespaces */
+
+ foreach ($t as $ndx => $token) {
+ if (is_array($token)) {
+ $ignore = 0;
+
+ switch($token[0]) {
+ case T_WHITESPACE:
+ case T_OPEN_TAG:
+ case T_CLOSE_TAG:
+ $ignore = 1;
+ break;
+ case T_FOREACH:
+ case T_DO:
+ case T_WHILE:
+ case T_FOR:
+
+ case T_IF:
+ case T_RETURN:
+
+ case T_CLASS:
+ case T_FUNCTION:
+ case T_INTERFACE:
+
+ case T_PRINT:
+ case T_ECHO:
+
+ case T_COMMENT:
+ case T_UNSET:
+
+ case T_INCLUDE:
+ case T_REQUIRE:
+ case T_INCLUDE_ONCE:
+ case T_REQUIRE_ONCE:
+ case T_TRY:
+ case T_SWITCH:
+ case T_DEFAULT:
+ case T_CASE:
+ case T_BREAK:
+ case T_DOC_COMMENT:
+ $need_return = 0;
+ break;
+ case T_EMPTY:
+ case T_ISSET:
+ case T_EVAL:
+ case T_EXIT:
+
+ case T_VARIABLE:
+ case T_STRING:
+ case T_NEW:
+ case T_EXTENDS:
+ case T_IMPLEMENTS:
+ case T_OBJECT_OPERATOR:
+ case T_DOUBLE_COLON:
+ case T_INSTANCEOF:
+
+ case T_CATCH:
+ case T_THROW:
+
+ case T_ELSE:
+ case T_AS:
+ case T_LNUMBER:
+ case T_DNUMBER:
+ case T_CONSTANT_ENCAPSED_STRING:
+ case T_ENCAPSED_AND_WHITESPACE:
+ case T_CHARACTER:
+ case T_ARRAY:
+ case T_DOUBLE_ARROW:
+
+ case T_CONST:
+ case T_PUBLIC:
+ case T_PROTECTED:
+ case T_PRIVATE:
+ case T_ABSTRACT:
+ case T_STATIC:
+ case T_VAR:
+
+ case T_INC:
+ case T_DEC:
+ case T_SL:
+ case T_SL_EQUAL:
+ case T_SR:
+ case T_SR_EQUAL:
+
+ case T_IS_EQUAL:
+ case T_IS_IDENTICAL:
+ case T_IS_GREATER_OR_EQUAL:
+ case T_IS_SMALLER_OR_EQUAL:
+
+ case T_BOOLEAN_OR:
+ case T_LOGICAL_OR:
+ case T_BOOLEAN_AND:
+ case T_LOGICAL_AND:
+ case T_LOGICAL_XOR:
+ case T_MINUS_EQUAL:
+ case T_PLUS_EQUAL:
+ case T_MUL_EQUAL:
+ case T_DIV_EQUAL:
+ case T_MOD_EQUAL:
+ case T_XOR_EQUAL:
+ case T_AND_EQUAL:
+ case T_OR_EQUAL:
+
+ case T_FUNC_C:
+ case T_CLASS_C:
+ case T_LINE:
+ case T_FILE:
+
+ case T_BOOL_CAST:
+ case T_INT_CAST:
+ case T_STRING_CAST:
+
+ /* just go on */
+ break;
+ default:
+ /* debug unknown tags*/
+ error_log(sprintf("unknown tag: %d (%s): %s".PHP_EOL, $token[0], token_name($token[0]), $token[1]));
+
+ break;
+ }
+ if (!$ignore) {
+ $eval .= $token[1]." ";
+ $ts[] = array("token" => $token[0], "value" => $token[1]);
+ }
+ } else {
+ $ts[] = array("token" => $token, "value" => '');
+
+ $last = count($ts) - 1;
+
+ switch ($token) {
+ case '(':
+ /* walk backwards through the tokens */
+
+ if ($last >= 4 &&
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
+ $ts[$last - 3]['token'] == ')' ) {
+ /* func()->method()
+ *
+ * we can't know what func() is return, so we can't
+ * say if the method() exists or not
+ *
+ */
+ } else if ($last >= 3 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
+ $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
+ $ts[$last - 3]['token'] == T_VARIABLE ) {
+
+ /* $object->method( */
+
+ /* catch (Exception $e) does not set $e in $GLOBALS[] */
+ $in_catch = 0;
+
+ foreach ($ts as $v) {
+ if ($v['token'] == T_CATCH) {
+ $in_catch = 1;
+ }
+ }
+
+ if (!$in_catch) {
+ /* $object has to exist and has to be a object */
+ $objname = $ts[$last - 3]['value'];
+
+ if (!isset($GLOBALS[ltrim($objname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
+ }
+ $object = $GLOBALS[ltrim($objname, '$')];
+
+ if (!is_object($object)) {
+ throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
+ }
+
+ $method = $ts[$last - 1]['value'];
+
+ /* obj */
+
+ if (!method_exists($object, $method)) {
+ throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
+ $objname, get_class($object), $method));
+ }
+ }
+ } else if ($last >= 3 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_VARIABLE &&
+ $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
+ $ts[$last - 3]['token'] == T_VARIABLE ) {
+
+ /* $object->$method( */
+
+ /* $object has to exist and has to be a object */
+ $objname = $ts[$last - 3]['value'];
+
+ if (!isset($GLOBALS[ltrim($objname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
+ }
+ $object = $GLOBALS[ltrim($objname, '$')];
+
+ if (!is_object($object)) {
+ throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
+ }
+
+ $methodname = $ts[$last - 1]['value'];
+
+ if (!isset($GLOBALS[ltrim($methodname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $methodname));
+ }
+ $method = $GLOBALS[ltrim($methodname, '$')];
+
+ /* obj */
+
+ if (!method_exists($object, $method)) {
+ throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
+ $objname, get_class($object), $method));
+ }
+
+ } else if ($last >= 6 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
+ $ts[$last - 3]['token'] == ']' &&
+ /* might be anything as index */
+ $ts[$last - 5]['token'] == '[' &&
+ $ts[$last - 6]['token'] == T_VARIABLE ) {
+
+ /* $object[...]->method( */
+
+ /* $object has to exist and has to be a object */
+ $objname = $ts[$last - 6]['value'];
+
+ if (!isset($GLOBALS[ltrim($objname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
+ }
+ $array = $GLOBALS[ltrim($objname, '$')];
+
+ if (!is_array($array)) {
+ throw new Exception(sprintf('Variable \'%s\' is not a array', $objname));
+ }
+
+ $andx = $ts[$last - 4]['value'];
+
+ if (!isset($array[$andx])) {
+ throw new Exception(sprintf('%s[\'%s\'] is not set', $objname, $andx));
+ }
+
+ $object = $array[$andx];
+
+ if (!is_object($object)) {
+ throw new Exception(sprintf('Variable \'%s\' is not a class', $objname));
+ }
+
+ $method = $ts[$last - 1]['value'];
+
+ /* obj */
+
+ if (!method_exists($object, $method)) {
+ throw new Exception(sprintf("Variable %s (Class '%s') doesn't have a method named '%s'",
+ $objname, get_class($object), $method));
+ }
+
+ } else if ($last >= 3 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_DOUBLE_COLON &&
+ $ts[$last - 3]['token'] == T_STRING ) {
+
+ /* Class::method() */
+
+ /* $object has to exist and has to be a object */
+ $classname = $ts[$last - 3]['value'];
+
+ if (!class_exists($classname)) {
+ throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
+ }
+
+ $method = $ts[$last - 1]['value'];
+
+ if (!in_array($method, get_class_methods($classname))) {
+ throw new Exception(sprintf("Class '%s' doesn't have a method named '%s'",
+ $classname, $method));
+ }
+ } else if ($last >= 3 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_VARIABLE &&
+ $ts[$last - 2]['token'] == T_DOUBLE_COLON &&
+ $ts[$last - 3]['token'] == T_STRING ) {
+
+ /* $var::method() */
+
+ /* $object has to exist and has to be a object */
+ $classname = $ts[$last - 3]['value'];
+
+ if (!class_exists($classname)) {
+ throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
+ }
+
+ $methodname = $ts[$last - 1]['value'];
+
+ if (!isset($GLOBALS[ltrim($methodname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $methodname));
+ }
+ $method = $GLOBALS[ltrim($methodname, '$')];
+
+ if (!in_array($method, get_class_methods($classname))) {
+ throw new Exception(sprintf("Class '%s' doesn't have a method named '%s'",
+ $classname, $method));
+ }
+
+ } else if ($last >= 2 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_NEW ) {
+
+ /* new Class() */
+
+ /* don't care about this in a class ... { ... } */
+
+ $classname = $ts[$last - 1]['value'];
+
+ if (!class_exists($classname)) {
+ throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
+ }
+
+ $r = new ReflectionClass($classname);
+
+ if ($r->isAbstract()) {
+ throw new Exception(sprintf("Can't instantiate abstract Class '%s'", $classname));
+ }
+
+ if (!$r->isInstantiable()) {
+ throw new Exception(sprintf('Class \'%s\' can\'t be instantiated. Is the class abstract ?', $classname));
+ }
+
+ } else if ($last >= 2 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_FUNCTION ) {
+
+ /* make sure we are not a in class definition */
+
+ /* function a() */
+
+ $func = $ts[$last - 1]['value'];
+
+ if (function_exists($func)) {
+ throw new Exception(sprintf('Function \'%s\' is already defined', $func));
+ }
+ } else if ($last >= 4 &&
+ $ts[0]['token'] == T_CLASS &&
+ $ts[1]['token'] == T_STRING &&
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_FUNCTION ) {
+
+ /* make sure we are not a in class definition */
+
+ /* class a { .. function a() ... } */
+
+ $func = $ts[$last - 1]['value'];
+ $classname = $ts[1]['value'];
+
+ if (isset($methods[$func])) {
+ throw new Exception(sprintf("Can't redeclare method '%s' in Class '%s'", $func, $classname));
+ }
+
+ $methods[$func] = 1;
+
+ } else if ($last >= 1 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
+ $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_STRING ) {
+ /* func() */
+ $funcname = $ts[$last - 1]['value'];
+
+ if (!function_exists($funcname)) {
+ throw new Exception(sprintf("Function %s() doesn't exist", $funcname));
+ }
+ } else if ($last >= 1 &&
+ $ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_VARIABLE ) {
+
+ /* $object has to exist and has to be a object */
+ $funcname = $ts[$last - 1]['value'];
+
+ if (!isset($GLOBALS[ltrim($funcname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $funcname));
+ }
+ $func = $GLOBALS[ltrim($funcname, '$')];
+
+ if (!function_exists($func)) {
+ throw new Exception(sprintf("Function %s() doesn't exist", $func));
+ }
+
+ }
+
+ array_push($braces, $token);
+ break;
+ case '{':
+ $need_return = 0;
+
+ if ($last >= 2 &&
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_CLASS ) {
+
+ /* class name { */
+
+ $classname = $ts[$last - 1]['value'];
+
+ if (class_exists($classname, false)) {
+ throw new Exception(sprintf("Class '%s' can't be redeclared", $classname));
+ }
+ } else if ($last >= 4 &&
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_EXTENDS &&
+ $ts[$last - 3]['token'] == T_STRING &&
+ $ts[$last - 4]['token'] == T_CLASS ) {
+
+ /* class classname extends classname { */
+
+ $classname = $ts[$last - 3]['value'];
+ $extendsname = $ts[$last - 1]['value'];
+
+ if (class_exists($classname, false)) {
+ throw new Exception(sprintf("Class '%s' can't be redeclared",
+ $classname));
+ }
+ if (!class_exists($extendsname, true)) {
+ throw new Exception(sprintf("Can't extend '%s' ... from not existing Class '%s'",
+ $classname, $extendsname));
+ }
+ } else if ($last >= 4 &&
+ $ts[$last - 1]['token'] == T_STRING &&
+ $ts[$last - 2]['token'] == T_IMPLEMENTS &&
+ $ts[$last - 3]['token'] == T_STRING &&
+ $ts[$last - 4]['token'] == T_CLASS ) {
+
+ /* class name implements interface { */
+
+ $classname = $ts[$last - 3]['value'];
+ $implements = $ts[$last - 1]['value'];
+
+ if (class_exists($classname, false)) {
+ throw new Exception(sprintf("Class '%s' can't be redeclared",
+ $classname));
+ }
+ if (!interface_exists($implements, false)) {
+ throw new Exception(sprintf("Can't implement not existing Interface '%s' for Class '%s'",
+ $implements, $classname));
+ }
+ }
+
+ array_push($braces, $token);
+ break;
+ case '}':
+ $need_return = 0;
+ case ')':
+ array_pop($braces);
+ break;
+ case '[':
+ if ($ts[0]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[0]['token'] != T_ABSTRACT && /* if we are not in a class definition */
+ $ts[1]['token'] != T_CLASS && /* if we are not in a class definition */
+ $ts[$last - 1]['token'] == T_VARIABLE) {
+ /* $a[] only works on array and string */
+
+ /* $object has to exist and has to be a object */
+ $objname = $ts[$last - 1]['value'];
+
+ if (!isset($GLOBALS[ltrim($objname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $objname));
+ }
+ $obj = $GLOBALS[ltrim($objname, '$')];
+
+ if (is_object($obj)) {
+ throw new Exception(sprintf('Objects (%s) don\'t support array access operators', $objname));
+ }
+ }
+ break;
+ }
+
+ $eval .= $token;
+ }
+ }
+
+ $last = count($ts) - 1;
+ if ($last >= 2 &&
+ $ts[$last - 0]['token'] == T_STRING &&
+ $ts[$last - 1]['token'] == T_DOUBLE_COLON &&
+ $ts[$last - 2]['token'] == T_STRING ) {
+
+ /* Class::constant */
+
+ /* $object has to exist and has to be a object */
+ $classname = $ts[$last - 2]['value'];
+
+ if (!class_exists($classname)) {
+ throw new Exception(sprintf('Class \'%s\' doesn\'t exist', $classname));
+ }
+
+ $constname = $ts[$last - 0]['value'];
+
+ $c = new ReflectionClass($classname);
+ if (!$c->hasConstant($constname)) {
+ throw new Exception(sprintf("Class '%s' doesn't have a constant named '%s'",
+ $classname, $constname));
+ }
+ } else if ($last == 0 &&
+ $ts[$last - 0]['token'] == T_VARIABLE ) {
+
+ /* $var */
+
+ $varname = $ts[$last - 0]['value'];
+
+ if (!isset($GLOBALS[ltrim($varname, '$')])) {
+ throw new Exception(sprintf('Variable \'%s\' is not set', $varname));
+ }
+ }
+
+
+ $need_more = (count($braces) > 0) || $open_comment;
+
+ if ($need_more || ';' === $token) {
+ $need_semicolon = 0;
+ }
+
+ if ($need_return) {
+ $eval = "return ".$eval;
+ }
+
+ /* add a traling ; if necessary */
+ if ($need_semicolon)
+ {
+ $this->has_semicolon = preg_match('/;\s*$/', $eval);
+ $eval .= ';';
+ }
+
+ if (!$need_more) {
+ $this->code = $eval;
+ }
+
+ return $need_more;
+ }
+
+ /**
+ * show the prompt and fetch a single line
+ *
+ * uses readline() if avaialbe
+ *
+ * @return string a input-line
+ */
+ public function readline() {
+ if (empty($this->code)) print PHP_EOL;
+
+ $prompt = (empty($this->code)) ? '>> ' : '.. ';
+
+ if (count($this->code_buffer) > 0) {
+ print $prompt;
+
+ $line = array_shift($this->code_buffer);
+
+ print $line.PHP_EOL;
+
+ return $line.PHP_EOL;
+ }
+
+ if ($this->have_readline) {
+ $l = readline($prompt);
+
+ readline_add_history($l);
+ } else {
+ print $prompt;
+
+ if (is_null($this->stdin)) {
+ if (false === ($this->stdin = fopen("php://stdin", "r"))) {
+ return false;
+ }
+ }
+ $l = fgets($this->stdin);
+ }
+ return $l;
+ }
+
+ /**
+ * get the inline help
+ *
+ * @return string the inline help as string
+ */
+ public function cmdHelp($l) {
+ $o = 'Inline Help:'.PHP_EOL;
+
+ $cmds = PHP_Shell_Commands::getInstance()->getCommands();
+
+ $help = array();
+ foreach ($cmds as $cmd) {
+ $help[] = sprintf(' >> %s'.PHP_EOL.' %s'.PHP_EOL,
+ $cmd['command'],
+ $cmd['description']
+ );
+ }
+
+ return var_export(implode("\n", $help), 1);
+ }
+
+ /**
+ * get the license string
+ *
+ * @return string the inline help as string
+ */
+ public function cmdLicense($l) {
+ $o = <<<EOF
+(c) 2006 Jan Kneschke <jan@kneschke.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+EOF;
+
+ return var_export($o, 1);
+ }
+
+ /**
+ * handle the 'quit' command
+ *
+ * @return bool false to leave the input() call
+ * @see input
+ */
+ protected function cmdQuit($l) {
+ return false;
+ }
+
+ /**
+ * handle the input line
+ *
+ * read the input and handle the commands of the shell
+ *
+ * @return bool false on 'quit' or EOF, true otherwise
+ */
+ public function input() {
+ $l = $this->readline();
+
+ /* got EOF ? */
+ if (false === $l) return false;
+
+ $l = trim($l);
+
+ if (empty($this->code)) {
+ $this->verbose = 0;
+
+ $cmds = PHP_Shell_Commands::getInstance()->getCommands();
+
+ foreach ($cmds as $cmd) {
+ if (preg_match($cmd['regex'], $l)) {
+ $obj = $cmd['obj'];
+ $func = $cmd['method'];
+
+ if (false === ($l = $obj->$func($l))) {
+ ## quit
+ return false;
+ }
+
+ if (is_array($l)) {
+ $this->code_buffer = $l;
+ $l = '';
+ }
+ break;
+ }
+ }
+ }
+
+ $this->appendCode($l);
+
+ return true;
+ }
+
+ /**
+ * get the code-buffer
+ *
+ * @return string the code-buffer
+ */
+ public function getCode() {
+ return $this->code;
+ return $code;
+ }
+
+ /**
+ * reset the code-buffer
+ */
+ public function resetCode() {
+ $this->has_semicolon=false;
+ $this->code = '';
+ }
+
+ /**
+ * append code to the code-buffer
+ *
+ * @param string $code input buffer
+ */
+ public function appendCode($code) {
+ if (strlen($code)) $code .= PHP_EOL;
+
+ $this->code .= $code;
+ }
+
+ /**
+ * check if readline support is enabled
+ *
+ * @return bool true if enabled, false otherwise
+ */
+ public function hasReadline() {
+ return $this->have_readline;
+ }
+
+ /**
+ * get version of the class
+ *
+ * @return string version-string
+ */
+ public function getVersion() {
+ return $this->version;
+ }
+}
+
+/**
+* a readline completion callback
+*
+* @param string $str linebuffer
+* @param integer $pos position in linebuffer
+* @return array list of possible matches
+*/
+function __shell_readline_complete($str, $pos) {
+ $in = readline_info('line_buffer');
+
+ /**
+ * parse the line-buffer backwards to see if we have a
+ * - constant
+ * - function
+ * - variable
+ */
+
+ $m = array();
+
+ if (preg_match('#\$([A-Za-z0-9_]+)->#', $in, $a)) {
+ /* check for $o->... */
+ $name = $a[1];
+
+ if (isset($GLOBALS[$name]) && is_object($GLOBALS[$name])) {
+ $c = get_class_methods($GLOBALS[$name]);
+
+ foreach ($c as $v) {
+ $m[] = $v.'(';
+ }
+ $c = get_class_vars(get_class($GLOBALS[$name]));
+
+ foreach ($c as $k => $v) {
+ $m[] = $k;
+ }
+
+ return $m;
+ }
+ } else if (preg_match('#\$([A-Za-z0-9_]+)\[([^\]]+)\]->#', $in, $a)) {
+ /* check for $o[...]->... */
+ $name = $a[1];
+
+ if (isset($GLOBALS[$name]) &&
+ is_array($GLOBALS[$name]) &&
+ isset($GLOBALS[$name][$a[2]])) {
+
+ $c = get_class_methods($GLOBALS[$name][$a[2]]);
+
+ foreach ($c as $v) {
+ $m[] = $v.'(';
+ }
+ $c = get_class_vars(get_class($GLOBALS[$name][$a[2]]));
+
+ foreach ($c as $k => $v) {
+ $m[] = $k;
+ }
+ return $m;
+ }
+
+ } else if (preg_match('#([A-Za-z0-9_]+)::#', $in, $a)) {
+ /* check for Class:: */
+ $name = $a[1];
+
+ if (class_exists($name, false)) {
+ $c = get_class_methods($name);
+
+ foreach ($c as $v) {
+ $m[] = sprintf('%s::%s(', $name, $v);
+ }
+
+ $cl = new ReflectionClass($name);
+ $c = $cl->getConstants();
+
+ foreach ($c as $k => $v) {
+ $m[] = sprintf('%s::%s', $name, $k);
+ }
+
+ return $m;
+ }
+ } else if (preg_match('#\$([a-zA-Z]?[a-zA-Z0-9_]*)$#', $in)) {
+ $m = array_keys($GLOBALS);
+
+ return $m;
+ } else if (preg_match('#new #', $in)) {
+ $c = get_declared_classes();
+
+ foreach ($c as $v) {
+ $m[] = $v.'(';
+ }
+
+ return $m;
+ } else if (preg_match('#^:set #', $in)) {
+ foreach (PHP_Shell_Options::getInstance()->getOptions() as $v) {
+ $m[] = $v;
+ }
+
+ return $m;
+ }
+
+ $f = get_defined_functions();
+
+ foreach ($f['internal'] as $v) {
+ $m[] = $v.'(';
+ }
+
+ foreach ($f['user'] as $v) {
+ $m[] = $v.'(';
+ }
+
+ $c = get_declared_classes();
+
+ foreach ($c as $v) {
+ $m[] = $v.'::';
+ }
+
+ $c = get_defined_constants();
+
+ foreach ($c as $k => $v) {
+ $m[] = $k;
+ }
+
+ /* taken from http://de3.php.net/manual/en/reserved.php */
+ $m[] = 'abstract';
+ $m[] = 'and';
+ $m[] = 'array(';
+ $m[] = 'as';
+ $m[] = 'break';
+ $m[] = 'case';
+ $m[] = 'catch';
+ $m[] = 'class';
+ $m[] = 'const';
+ $m[] = 'continue';
+ # $m[] = 'declare';
+ $m[] = 'default';
+ $m[] = 'die(';
+ $m[] = 'do';
+ $m[] = 'echo(';
+ $m[] = 'else';
+ $m[] = 'elseif';
+ $m[] = 'empty(';
+ # $m[] = 'enddeclare';
+ $m[] = 'eval(';
+ $m[] = 'exception';
+ $m[] = 'extends';
+ $m[] = 'exit(';
+ $m[] = 'extends';
+ $m[] = 'final';
+ $m[] = 'for (';
+ $m[] = 'foreach (';
+ $m[] = 'function';
+ $m[] = 'global';
+ $m[] = 'if';
+ $m[] = 'implements';
+ $m[] = 'include "';
+ $m[] = 'include_once "';
+ $m[] = 'interface';
+ $m[] = 'isset(';
+ $m[] = 'list(';
+ $m[] = 'new';
+ $m[] = 'or';
+ $m[] = 'print(';
+ $m[] = 'private';
+ $m[] = 'protected';
+ $m[] = 'public';
+ $m[] = 'require "';
+ $m[] = 'require_once "';
+ $m[] = 'return';
+ $m[] = 'static';
+ $m[] = 'switch (';
+ $m[] = 'throw';
+ $m[] = 'try';
+ $m[] = 'unset(';
+ # $m[] = 'use';
+ $m[] = 'var';
+ $m[] = 'while';
+ $m[] = 'xor';
+ $m[] = '__FILE__';
+ $m[] = '__FUNCTION__';
+ $m[] = '__CLASS__';
+ $m[] = '__LINE__';
+ $m[] = '__METHOD__';
+
+ # printf("%s ... %s\n", $str, $pos);
+ return $m;
+}
+
+
diff --git a/framework/3rdParty/PhpShell/php-shell-init.php b/framework/3rdParty/PhpShell/php-shell-init.php
index 20c6af75..6ae8e8fe 100644
--- a/framework/3rdParty/PhpShell/php-shell-init.php
+++ b/framework/3rdParty/PhpShell/php-shell-init.php
@@ -1,88 +1,88 @@
-<?php
-@ob_end_clean();
-error_reporting(E_ALL);
-set_time_limit(0);
-
-/**
-* the wrapper around the PHP_Shell class
-*
-* - load extensions
-* - set default error-handler
-* - add exec-hooks for the extensions
-*
-* To keep the namespace clashing between shell and your program
-* as small as possible all public variables and functions from
-* the shell are prefixed with __shell:
-*
-* - $__shell is the object of the shell
-* can be read, this is the shell object itself, don't touch it
-* - $__shell_retval is the return value of the eval() before
-* it is printed
-* can't be read, but overwrites existing vars with this name
-* - $__shell_exception is the catched Exception on Warnings, Notices, ..
-* can't be read, but overwrites existing vars with this name
-*/
-
-//try loading it from PEAR
-@require_once('PHP/Shell.php');
-if(class_exists('PHP_Shell', false))
-{
- require_once "PHP/Shell/Extensions/Autoload.php";
- require_once "PHP/Shell/Extensions/AutoloadDebug.php";
- require_once "PHP/Shell/Extensions/Colour.php";
- require_once "PHP/Shell/Extensions/ExecutionTime.php";
- require_once "PHP/Shell/Extensions/InlineHelp.php";
- require_once "PHP/Shell/Extensions/VerbosePrint.php";
- require_once "PHP/Shell/Extensions/LoadScript.php";
-}
-else
-{
- require_once(dirname(__FILE__)."/PHP/Shell.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/Autoload.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/AutoloadDebug.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/Colour.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/ExecutionTime.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/InlineHelp.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/VerbosePrint.php");
- require_once(dirname(__FILE__)."/PHP/Shell/Extensions/LoadScript.php");
-}
-
-/**
-* default error-handler
-*
-* Instead of printing the NOTICE or WARNING from php we wan't the turn non-FATAL
-* messages into exceptions and handle them in our own way.
-*
-* you can set your own error-handler by createing a function named
-* __shell_error_handler
-*
-* @param integer $errno Error-Number
-* @param string $errstr Error-Message
-* @param string $errfile Filename where the error was raised
-* @param interger $errline Line-Number in the File
-* @param mixed $errctx ...
-*/
-function __shell_default_error_handler($errno, $errstr, $errfile, $errline, $errctx) {
- ## ... what is this errno again ?
- if ($errno == 2048) return;
-
- throw new Exception(sprintf("%s:%d\r\n%s", $errfile, $errline, $errstr));
-}
-
-//set_error_handler("__shell_default_error_handler");
-
-$__shell = new PHP_Shell();
-$__shell_exts = PHP_Shell_Extensions::getInstance();
-$__shell_exts->registerExtensions(array(
- "options" => PHP_Shell_Options::getInstance(), /* the :set command */
-
- "autoload" => new PHP_Shell_Extensions_Autoload(),
- "autoload_debug" => new PHP_Shell_Extensions_AutoloadDebug(),
- "colour" => new PHP_Shell_Extensions_Colour(),
- "exectime" => new PHP_Shell_Extensions_ExecutionTime(),
- "inlinehelp" => new PHP_Shell_Extensions_InlineHelp(),
- "verboseprint" => new PHP_Shell_Extensions_VerbosePrint()
- // "loadscript" => new PHP_Shell_Extensions_LoadScript()
-));
-
+<?php
+@ob_end_clean();
+error_reporting(E_ALL);
+set_time_limit(0);
+
+/**
+* the wrapper around the PHP_Shell class
+*
+* - load extensions
+* - set default error-handler
+* - add exec-hooks for the extensions
+*
+* To keep the namespace clashing between shell and your program
+* as small as possible all public variables and functions from
+* the shell are prefixed with __shell:
+*
+* - $__shell is the object of the shell
+* can be read, this is the shell object itself, don't touch it
+* - $__shell_retval is the return value of the eval() before
+* it is printed
+* can't be read, but overwrites existing vars with this name
+* - $__shell_exception is the catched Exception on Warnings, Notices, ..
+* can't be read, but overwrites existing vars with this name
+*/
+
+//try loading it from PEAR
+@require_once('PHP/Shell.php');
+if(class_exists('PHP_Shell', false))
+{
+ require_once "PHP/Shell/Extensions/Autoload.php";
+ require_once "PHP/Shell/Extensions/AutoloadDebug.php";
+ require_once "PHP/Shell/Extensions/Colour.php";
+ require_once "PHP/Shell/Extensions/ExecutionTime.php";
+ require_once "PHP/Shell/Extensions/InlineHelp.php";
+ require_once "PHP/Shell/Extensions/VerbosePrint.php";
+ require_once "PHP/Shell/Extensions/LoadScript.php";
+}
+else
+{
+ require_once(dirname(__FILE__)."/PHP/Shell.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/Autoload.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/AutoloadDebug.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/Colour.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/ExecutionTime.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/InlineHelp.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/VerbosePrint.php");
+ require_once(dirname(__FILE__)."/PHP/Shell/Extensions/LoadScript.php");
+}
+
+/**
+* default error-handler
+*
+* Instead of printing the NOTICE or WARNING from php we wan't the turn non-FATAL
+* messages into exceptions and handle them in our own way.
+*
+* you can set your own error-handler by createing a function named
+* __shell_error_handler
+*
+* @param integer $errno Error-Number
+* @param string $errstr Error-Message
+* @param string $errfile Filename where the error was raised
+* @param interger $errline Line-Number in the File
+* @param mixed $errctx ...
+*/
+function __shell_default_error_handler($errno, $errstr, $errfile, $errline, $errctx) {
+ ## ... what is this errno again ?
+ if ($errno == 2048) return;
+
+ throw new Exception(sprintf("%s:%d\r\n%s", $errfile, $errline, $errstr));
+}
+
+//set_error_handler("__shell_default_error_handler");
+
+$__shell = new PHP_Shell();
+$__shell_exts = PHP_Shell_Extensions::getInstance();
+$__shell_exts->registerExtensions(array(
+ "options" => PHP_Shell_Options::getInstance(), /* the :set command */
+
+ "autoload" => new PHP_Shell_Extensions_Autoload(),
+ "autoload_debug" => new PHP_Shell_Extensions_AutoloadDebug(),
+ "colour" => new PHP_Shell_Extensions_Colour(),
+ "exectime" => new PHP_Shell_Extensions_ExecutionTime(),
+ "inlinehelp" => new PHP_Shell_Extensions_InlineHelp(),
+ "verboseprint" => new PHP_Shell_Extensions_VerbosePrint()
+ // "loadscript" => new PHP_Shell_Extensions_LoadScript()
+));
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/SafeHtml/HTMLSax3.php b/framework/3rdParty/SafeHtml/HTMLSax3.php
index 1be7aede..80d166e9 100644
--- a/framework/3rdParty/SafeHtml/HTMLSax3.php
+++ b/framework/3rdParty/SafeHtml/HTMLSax3.php
@@ -1,695 +1,695 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
-// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
-// | Authors: Many @ Sitepointforums Advanced PHP Forums |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-/**
-* Main parser components
-* @package System.Security.SafeHtml
-* @version $Id$
-*/
-/**
-* Required classes
-*/
-
-require_once(dirname(__FILE__).'/HTMLSax3/States.php');
-require_once(dirname(__FILE__).'/HTMLSax3/Decorators.php');
-
-/**
-* Base State Parser
-* @package System.Security.SafeHtml
-* @access protected
-* @abstract
-*/
-class TSax3_StateParser {
- /**
- * Instance of user front end class to be passed to callbacks
- * @var TSax3
- * @access private
- */
- public $htmlsax;
- /**
- * User defined object for handling elements
- * @var object
- * @access private
- */
- public $handler_object_element;
- /**
- * User defined open tag handler method
- * @var string
- * @access private
- */
- public $handler_method_opening;
- /**
- * User defined close tag handler method
- * @var string
- * @access private
- */
- public $handler_method_closing;
- /**
- * User defined object for handling data in elements
- * @var object
- * @access private
- */
- public $handler_object_data;
- /**
- * User defined data handler method
- * @var string
- * @access private
- */
- public $handler_method_data;
- /**
- * User defined object for handling processing instructions
- * @var object
- * @access private
- */
- public $handler_object_pi;
- /**
- * User defined processing instruction handler method
- * @var string
- * @access private
- */
- public $handler_method_pi;
- /**
- * User defined object for handling JSP/ASP tags
- * @var object
- * @access private
- */
- public $handler_object_jasp;
- /**
- * User defined JSP/ASP handler method
- * @var string
- * @access private
- */
- public $handler_method_jasp;
- /**
- * User defined object for handling XML escapes
- * @var object
- * @access private
- */
- public $handler_object_escape;
- /**
- * User defined XML escape handler method
- * @var string
- * @access private
- */
- public $handler_method_escape;
- /**
- * User defined handler object or NullHandler
- * @var object
- * @access private
- */
- public $handler_default;
- /**
- * Parser options determining parsing behavior
- * @var array
- * @access private
- */
- protected $parser_options = array();
- /**
- * XML document being parsed
- * @var string
- * @access private
- */
- protected $rawtext;
- /**
- * Position in XML document relative to start (0)
- * @var int
- * @access private
- */
- protected $position;
- /**
- * Length of the XML document in characters
- * @var int
- * @access private
- */
- protected $length;
- /**
- * Array of state objects
- * @var array
- * @access private
- */
- protected $State = array();
-
- const TSAX3_STATE_STOP = 0;
- const TSAX3_STATE_START = 1;
- const TSAX3_STATE_TAG = 2;
- const TSAX3_STATE_OPENING_TAG = 3;
- const TSAX3_STATE_CLOSING_TAG = 4;
- const TSAX3_STATE_ESCAPE = 6;
- const TSAX3_STATE_JASP = 7;
- const TSAX3_STATE_PI = 8;
-
- /**
- * Constructs TSax3_StateParser setting up states
- * @var TSax3 instance of user front end class
- * @access protected
- */
- protected function __construct($htmlsax) {
- $this->htmlsax = $htmlsax;
- $this->State[self::TSAX3_STATE_START] = new TSax3_StartingState();
-
- $this->State[self::TSAX3_STATE_CLOSING_TAG] = new TSax3_ClosingTagState();
- $this->State[self::TSAX3_STATE_TAG] = new TSax3_TagState();
- $this->State[self::TSAX3_STATE_OPENING_TAG] = new TSax3_OpeningTagState();
-
- $this->State[self::TSAX3_STATE_PI] = new TSax3_PiState();
- $this->State[self::TSAX3_STATE_JASP] = new TSax3_JaspState();
- $this->State[self::TSAX3_STATE_ESCAPE] = new TSax3_EscapeState();
- }
-
- /**
- * Moves the position back one character
- * @access protected
- * @return void
- */
- function unscanCharacter() {
- $this->position -= 1;
- }
-
- /**
- * Moves the position forward one character
- * @access protected
- * @return void
- */
- function ignoreCharacter() {
- $this->position += 1;
- }
-
- /**
- * Returns the next character from the XML document or void if at end
- * @access protected
- * @return mixed
- */
- function scanCharacter() {
- if ($this->position < $this->length) {
- return $this->rawtext{$this->position++};
- }
- }
-
- /**
- * Returns a string from the current position to the next occurance
- * of the supplied string
- * @param string string to search until
- * @access protected
- * @return string
- */
- function scanUntilString($string) {
- $start = $this->position;
- $this->position = strpos($this->rawtext, $string, $start);
- if ($this->position === FALSE) {
- $this->position = $this->length;
- }
- return substr($this->rawtext, $start, $this->position - $start);
- }
-
- /**
- * Returns a string from the current position until the first instance of
- * one of the characters in the supplied string argument
- * @param string string to search until
- * @access protected
- * @return string
- * @abstract
- */
- function scanUntilCharacters($string) {}
-
- /**
- * Moves the position forward past any whitespace characters
- * @access protected
- * @return void
- * @abstract
- */
- function ignoreWhitespace() {}
-
- /**
- * Begins the parsing operation, setting up any decorators, depending on
- * parse options invoking _parse() to execute parsing
- * @param string XML document to parse
- * @access protected
- * @return void
- */
- function parse($data) {
- if ($this->parser_options['XML_OPTION_TRIM_DATA_NODES']==1) {
- $decorator = new TSax3_Trim(
- $this->handler_object_data,
- $this->handler_method_data);
- $this->handler_object_data =& $decorator;
- $this->handler_method_data = 'trimData';
- }
- if ($this->parser_options['XML_OPTION_CASE_FOLDING']==1) {
- $open_decor = new TSax3_CaseFolding(
- $this->handler_object_element,
- $this->handler_method_opening,
- $this->handler_method_closing);
- $this->handler_object_element =& $open_decor;
- $this->handler_method_opening ='foldOpen';
- $this->handler_method_closing ='foldClose';
- }
- if ($this->parser_options['XML_OPTION_LINEFEED_BREAK']==1) {
- $decorator = new TSax3_Linefeed(
- $this->handler_object_data,
- $this->handler_method_data);
- $this->handler_object_data =& $decorator;
- $this->handler_method_data = 'breakData';
- }
- if ($this->parser_options['XML_OPTION_TAB_BREAK']==1) {
- $decorator = new TSax3_Tab(
- $this->handler_object_data,
- $this->handler_method_data);
- $this->handler_object_data =& $decorator;
- $this->handler_method_data = 'breakData';
- }
- if ($this->parser_options['XML_OPTION_ENTITIES_UNPARSED']==1) {
- $decorator = new TSax3_Entities_Unparsed(
- $this->handler_object_data,
- $this->handler_method_data);
- $this->handler_object_data =& $decorator;
- $this->handler_method_data = 'breakData';
- }
- if ($this->parser_options['XML_OPTION_ENTITIES_PARSED']==1) {
- $decorator = new TSax3_Entities_Parsed(
- $this->handler_object_data,
- $this->handler_method_data);
- $this->handler_object_data =& $decorator;
- $this->handler_method_data = 'breakData';
- }
- // Note switched on by default
- if ($this->parser_options['XML_OPTION_STRIP_ESCAPES']==1) {
- $decorator = new TSax3_Escape_Stripper(
- $this->handler_object_escape,
- $this->handler_method_escape);
- $this->handler_object_escape =& $decorator;
- $this->handler_method_escape = 'strip';
- }
- $this->rawtext = $data;
- $this->length = strlen($data);
- $this->position = 0;
- $this->_parse();
- }
-
- /**
- * Performs the parsing itself, delegating calls to a specific parser
- * state
- * @param constant state object to parse with
- * @access protected
- * @return void
- */
- function _parse($state = self::TSAX3_STATE_START) {
- do {
- $state = $this->State[$state]->parse($this);
- } while ($state != self::TSAX3_STATE_STOP &&
- $this->position < $this->length);
- }
-}
-
-/**
-* Parser for PHP Versions below 4.3.0. Uses a slower parsing mechanism than
-* the equivalent PHP 4.3.0+ subclass of StateParser
-* @package System.Security.SafeHtml
-* @access protected
-* @see TSax3_StateParser_Gtet430
-*/
-class TSax3_StateParser_Lt430 extends TSax3_StateParser {
- /**
- * Constructs TSax3_StateParser_Lt430 defining available
- * parser options
- * @var TSax3 instance of user front end class
- * @access protected
- */
- function __construct(& $htmlsax) {
- parent::__construct($htmlsax);
- $this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
- $this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
- $this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
- $this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
- $this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
- $this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
- $this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
- //var_dump($this->parser_options);
- }
-
- /**
- * Returns a string from the current position until the first instance of
- * one of the characters in the supplied string argument
- * @param string string to search until
- * @access protected
- * @return string
- */
- function scanUntilCharacters($string) {
- $startpos = $this->position;
- while ($this->position < $this->length && strpos($string, $this->rawtext{$this->position}) === FALSE) {
- $this->position++;
- }
- return substr($this->rawtext, $startpos, $this->position - $startpos);
- }
-
- /**
- * Moves the position forward past any whitespace characters
- * @access protected
- * @return void
- */
- function ignoreWhitespace() {
- while ($this->position < $this->length &&
- strpos(" \n\r\t", $this->rawtext{$this->position}) !== FALSE) {
- $this->position++;
- }
- }
-
- /**
- * Begins the parsing operation, setting up the unparsed XML entities
- * decorator if necessary then delegating further work to parent
- * @param string XML document to parse
- * @access protected
- * @return void
- */
- function parse($data) {
- parent::parse($data);
- }
-}
-
-/**
-* Parser for PHP Versions equal to or greater than 4.3.0. Uses a faster
-* parsing mechanism than the equivalent PHP < 4.3.0 subclass of StateParser
-* @package System.Security.SafeHtml
-* @access protected
-* @see TSax3_StateParser_Lt430
-*/
-class TSax3_StateParser_Gtet430 extends TSax3_StateParser {
- /**
- * Constructs TSax3_StateParser_Gtet430 defining available
- * parser options
- * @var TSax3 instance of user front end class
- * @access protected
- */
- function __construct(& $htmlsax) {
- parent::__construct($htmlsax);
- $this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
- $this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
- $this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
- $this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
- $this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
- $this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
- $this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
- }
- /**
- * Returns a string from the current position until the first instance of
- * one of the characters in the supplied string argument.
- * @param string string to search until
- * @access protected
- * @return string
- */
- function scanUntilCharacters($string) {
- $startpos = $this->position;
- $length = strcspn($this->rawtext, $string, $startpos);
- $this->position += $length;
- return substr($this->rawtext, $startpos, $length);
- }
-
- /**
- * Moves the position forward past any whitespace characters
- * @access protected
- * @return void
- */
- function ignoreWhitespace() {
- $this->position += strspn($this->rawtext, " \n\r\t", $this->position);
- }
-
- /**
- * Begins the parsing operation, setting up the parsed and unparsed
- * XML entity decorators if necessary then delegating further work
- * to parent
- * @param string XML document to parse
- * @access protected
- * @return void
- */
- function parse($data) {
- parent::parse($data);
- }
-}
-
-/**
-* Default NullHandler for methods which were not set by user
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_NullHandler {
- /**
- * Generic handler method which does nothing
- * @access protected
- * @return void
- */
- function DoNothing() {
- }
-}
-
-/**
-* User interface class. All user calls should only be made to this class
-* @package System.Security.SafeHtml
-* @access public
-*/
-class TSax3 {
- /**
- * Instance of concrete subclass of TSax3_StateParser
- * @var TSax3_StateParser
- * @access private
- */
- private $state_parser;
-
- /**
- * Constructs TSax3 selecting concrete StateParser subclass
- * depending on PHP version being used as well as setting the default
- * NullHandler for all callbacks<br />
- * <b>Example:</b>
- * <pre>
- * $myHandler = & new MyHandler();
- * $parser = new TSax3();
- * $parser->set_object($myHandler);
- * $parser->set_option('XML_OPTION_CASE_FOLDING');
- * $parser->set_element_handler('myOpenHandler','myCloseHandler');
- * $parser->set_data_handler('myDataHandler');
- * $parser->parser($xml);
- * </pre>
- * @access public
- */
- function __construct() {
- if (version_compare(phpversion(), '4.3', 'ge')) {
- $this->state_parser = new TSax3_StateParser_Gtet430($this);
- } else {
- $this->state_parser = new TSax3_StateParser_Lt430($this);
- }
- $nullhandler = new TSax3_NullHandler();
- $this->set_object($nullhandler);
- $this->set_element_handler('DoNothing', 'DoNothing');
- $this->set_data_handler('DoNothing');
- $this->set_pi_handler('DoNothing');
- $this->set_jasp_handler('DoNothing');
- $this->set_escape_handler('DoNothing');
- }
-
- /**
- * Sets the user defined handler object. Returns a PEAR Error
- * if supplied argument is not an object.
- * @param object handler object containing SAX callback methods
- * @access public
- * @return mixed
- */
- function set_object(&$object) {
- if ( is_object($object) ) {
- $this->state_parser->handler_default =& $object;
- return true;
- } else {
- require_once('PEAR.php');
- PEAR::raiseError('TSax3::set_object requires '.
- 'an object instance');
- }
- }
-
- /**
- * Sets a parser option. By default all options are switched off.
- * Returns a PEAR Error if option is invalid<br />
- * <b>Available options:</b>
- * <ul>
- * <li>XML_OPTION_TRIM_DATA_NODES: trim whitespace off the beginning
- * and end of data passed to the data handler</li>
- * <li>XML_OPTION_LINEFEED_BREAK: linefeeds result in additional data
- * handler calls</li>
- * <li>XML_OPTION_TAB_BREAK: tabs result in additional data handler
- * calls</li>
- * <li>XML_OPTION_ENTITIES_UNPARSED: XML entities are returned as
- * seperate data handler calls in unparsed form</li>
- * <li>XML_OPTION_ENTITIES_PARSED: (PHP 4.3.0+ only) XML entities are
- * returned as seperate data handler calls and are parsed with
- * PHP's html_entity_decode() function</li>
- * <li>XML_OPTION_STRIP_ESCAPES: strips out the -- -- comment markers
- * or CDATA markup inside an XML escape, if found.</li>
- * </ul>
- * To get HTMLSax to behave in the same way as the native PHP SAX parser,
- * using it's default state, you need to switch on XML_OPTION_LINEFEED_BREAK,
- * XML_OPTION_ENTITIES_PARSED and XML_OPTION_CASE_FOLDING
- * @param string name of parser option
- * @param int (optional) 1 to switch on, 0 for off
- * @access public
- * @return boolean
- */
- function set_option($name, $value=1) {
- if ( array_key_exists($name,$this->state_parser->parser_options) ) {
- $this->state_parser->parser_options[$name] = $value;
- return true;
- } else {
- require_once('PEAR.php');
- PEAR::raiseError('TSax3::set_option('.$name.') illegal');
- }
- }
-
- /**
- * Sets the data handler method which deals with the contents of XML
- * elements.<br />
- * The handler method must accept two arguments, the first being an
- * instance of TSax3 and the second being the contents of an
- * XML element e.g.
- * <pre>
- * function myDataHander(& $parser,$data){}
- * </pre>
- * @param string name of method
- * @access public
- * @return void
- * @see set_object
- */
- function set_data_handler($data_method) {
- $this->state_parser->handler_object_data =& $this->state_parser->handler_default;
- $this->state_parser->handler_method_data = $data_method;
- }
-
- /**
- * Sets the open and close tag handlers
- * <br />The open handler method must accept three arguments; the parser,
- * the tag name and an array of attributes e.g.
- * <pre>
- * function myOpenHander(& $parser,$tagname,$attrs=array()){}
- * </pre>
- * The close handler method must accept two arguments; the parser and
- * the tag name e.g.
- * <pre>
- * function myCloseHander(& $parser,$tagname){}
- * </pre>
- * @param string name of open method
- * @param string name of close method
- * @access public
- * @return void
- * @see set_object
- */
- function set_element_handler($opening_method, $closing_method) {
- $this->state_parser->handler_object_element =& $this->state_parser->handler_default;
- $this->state_parser->handler_method_opening = $opening_method;
- $this->state_parser->handler_method_closing = $closing_method;
- }
-
- /**
- * Sets the processing instruction handler method e.g. for PHP open
- * and close tags<br />
- * The handler method must accept three arguments; the parser, the
- * PI target and data inside the PI
- * <pre>
- * function myPIHander(& $parser,$target, $data){}
- * </pre>
- * @param string name of method
- * @access public
- * @return void
- * @see set_object
- */
- function set_pi_handler($pi_method) {
- $this->state_parser->handler_object_pi =& $this->state_parser->handler_default;
- $this->state_parser->handler_method_pi = $pi_method;
- }
-
- /**
- * Sets the XML escape handler method e.g. for comments and doctype
- * declarations<br />
- * The handler method must accept two arguments; the parser and the
- * contents of the escaped section
- * <pre>
- * function myEscapeHander(& $parser, $data){}
- * </pre>
- * @param string name of method
- * @access public
- * @return void
- * @see set_object
- */
- function set_escape_handler($escape_method) {
- $this->state_parser->handler_object_escape =& $this->state_parser->handler_default;
- $this->state_parser->handler_method_escape = $escape_method;
- }
-
- /**
- * Sets the JSP/ASP markup handler<br />
- * The handler method must accept two arguments; the parser and
- * body of the JASP tag
- * <pre>
- * function myJaspHander(& $parser, $data){}
- * </pre>
- * @param string name of method
- * @access public
- * @return void
- * @see set_object
- */
- function set_jasp_handler ($jasp_method) {
- $this->state_parser->handler_object_jasp =& $this->state_parser->handler_default;
- $this->state_parser->handler_method_jasp = $jasp_method;
- }
-
- /**
- * Returns the current string position of the "cursor" inside the XML
- * document
- * <br />Intended for use from within a user defined handler called
- * via the $parser reference e.g.
- * <pre>
- * function myDataHandler(& $parser,$data) {
- * echo( 'Current position: '.$parser->get_current_position() );
- * }
- * </pre>
- * @access public
- * @return int
- * @see get_length
- */
- function get_current_position() {
- return $this->state_parser->position;
- }
-
- /**
- * Returns the string length of the XML document being parsed
- * @access public
- * @return int
- */
- function get_length() {
- return $this->state_parser->length;
- }
-
- /**
- * Start parsing some XML
- * @param string XML document
- * @access public
- * @return void
- */
- function parse($data) {
- $this->state_parser->parse($data);
- }
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/3_0.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
+// | Authors: Many @ Sitepointforums Advanced PHP Forums |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+/**
+* Main parser components
+* @package System.Security.SafeHtml
+* @version $Id$
+*/
+/**
+* Required classes
+*/
+
+require_once(dirname(__FILE__).'/HTMLSax3/States.php');
+require_once(dirname(__FILE__).'/HTMLSax3/Decorators.php');
+
+/**
+* Base State Parser
+* @package System.Security.SafeHtml
+* @access protected
+* @abstract
+*/
+class TSax3_StateParser {
+ /**
+ * Instance of user front end class to be passed to callbacks
+ * @var TSax3
+ * @access private
+ */
+ public $htmlsax;
+ /**
+ * User defined object for handling elements
+ * @var object
+ * @access private
+ */
+ public $handler_object_element;
+ /**
+ * User defined open tag handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_opening;
+ /**
+ * User defined close tag handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_closing;
+ /**
+ * User defined object for handling data in elements
+ * @var object
+ * @access private
+ */
+ public $handler_object_data;
+ /**
+ * User defined data handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_data;
+ /**
+ * User defined object for handling processing instructions
+ * @var object
+ * @access private
+ */
+ public $handler_object_pi;
+ /**
+ * User defined processing instruction handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_pi;
+ /**
+ * User defined object for handling JSP/ASP tags
+ * @var object
+ * @access private
+ */
+ public $handler_object_jasp;
+ /**
+ * User defined JSP/ASP handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_jasp;
+ /**
+ * User defined object for handling XML escapes
+ * @var object
+ * @access private
+ */
+ public $handler_object_escape;
+ /**
+ * User defined XML escape handler method
+ * @var string
+ * @access private
+ */
+ public $handler_method_escape;
+ /**
+ * User defined handler object or NullHandler
+ * @var object
+ * @access private
+ */
+ public $handler_default;
+ /**
+ * Parser options determining parsing behavior
+ * @var array
+ * @access private
+ */
+ protected $parser_options = array();
+ /**
+ * XML document being parsed
+ * @var string
+ * @access private
+ */
+ protected $rawtext;
+ /**
+ * Position in XML document relative to start (0)
+ * @var int
+ * @access private
+ */
+ protected $position;
+ /**
+ * Length of the XML document in characters
+ * @var int
+ * @access private
+ */
+ protected $length;
+ /**
+ * Array of state objects
+ * @var array
+ * @access private
+ */
+ protected $State = array();
+
+ const TSAX3_STATE_STOP = 0;
+ const TSAX3_STATE_START = 1;
+ const TSAX3_STATE_TAG = 2;
+ const TSAX3_STATE_OPENING_TAG = 3;
+ const TSAX3_STATE_CLOSING_TAG = 4;
+ const TSAX3_STATE_ESCAPE = 6;
+ const TSAX3_STATE_JASP = 7;
+ const TSAX3_STATE_PI = 8;
+
+ /**
+ * Constructs TSax3_StateParser setting up states
+ * @var TSax3 instance of user front end class
+ * @access protected
+ */
+ protected function __construct($htmlsax) {
+ $this->htmlsax = $htmlsax;
+ $this->State[self::TSAX3_STATE_START] = new TSax3_StartingState();
+
+ $this->State[self::TSAX3_STATE_CLOSING_TAG] = new TSax3_ClosingTagState();
+ $this->State[self::TSAX3_STATE_TAG] = new TSax3_TagState();
+ $this->State[self::TSAX3_STATE_OPENING_TAG] = new TSax3_OpeningTagState();
+
+ $this->State[self::TSAX3_STATE_PI] = new TSax3_PiState();
+ $this->State[self::TSAX3_STATE_JASP] = new TSax3_JaspState();
+ $this->State[self::TSAX3_STATE_ESCAPE] = new TSax3_EscapeState();
+ }
+
+ /**
+ * Moves the position back one character
+ * @access protected
+ * @return void
+ */
+ function unscanCharacter() {
+ $this->position -= 1;
+ }
+
+ /**
+ * Moves the position forward one character
+ * @access protected
+ * @return void
+ */
+ function ignoreCharacter() {
+ $this->position += 1;
+ }
+
+ /**
+ * Returns the next character from the XML document or void if at end
+ * @access protected
+ * @return mixed
+ */
+ function scanCharacter() {
+ if ($this->position < $this->length) {
+ return $this->rawtext{$this->position++};
+ }
+ }
+
+ /**
+ * Returns a string from the current position to the next occurance
+ * of the supplied string
+ * @param string string to search until
+ * @access protected
+ * @return string
+ */
+ function scanUntilString($string) {
+ $start = $this->position;
+ $this->position = strpos($this->rawtext, $string, $start);
+ if ($this->position === FALSE) {
+ $this->position = $this->length;
+ }
+ return substr($this->rawtext, $start, $this->position - $start);
+ }
+
+ /**
+ * Returns a string from the current position until the first instance of
+ * one of the characters in the supplied string argument
+ * @param string string to search until
+ * @access protected
+ * @return string
+ * @abstract
+ */
+ function scanUntilCharacters($string) {}
+
+ /**
+ * Moves the position forward past any whitespace characters
+ * @access protected
+ * @return void
+ * @abstract
+ */
+ function ignoreWhitespace() {}
+
+ /**
+ * Begins the parsing operation, setting up any decorators, depending on
+ * parse options invoking _parse() to execute parsing
+ * @param string XML document to parse
+ * @access protected
+ * @return void
+ */
+ function parse($data) {
+ if ($this->parser_options['XML_OPTION_TRIM_DATA_NODES']==1) {
+ $decorator = new TSax3_Trim(
+ $this->handler_object_data,
+ $this->handler_method_data);
+ $this->handler_object_data =& $decorator;
+ $this->handler_method_data = 'trimData';
+ }
+ if ($this->parser_options['XML_OPTION_CASE_FOLDING']==1) {
+ $open_decor = new TSax3_CaseFolding(
+ $this->handler_object_element,
+ $this->handler_method_opening,
+ $this->handler_method_closing);
+ $this->handler_object_element =& $open_decor;
+ $this->handler_method_opening ='foldOpen';
+ $this->handler_method_closing ='foldClose';
+ }
+ if ($this->parser_options['XML_OPTION_LINEFEED_BREAK']==1) {
+ $decorator = new TSax3_Linefeed(
+ $this->handler_object_data,
+ $this->handler_method_data);
+ $this->handler_object_data =& $decorator;
+ $this->handler_method_data = 'breakData';
+ }
+ if ($this->parser_options['XML_OPTION_TAB_BREAK']==1) {
+ $decorator = new TSax3_Tab(
+ $this->handler_object_data,
+ $this->handler_method_data);
+ $this->handler_object_data =& $decorator;
+ $this->handler_method_data = 'breakData';
+ }
+ if ($this->parser_options['XML_OPTION_ENTITIES_UNPARSED']==1) {
+ $decorator = new TSax3_Entities_Unparsed(
+ $this->handler_object_data,
+ $this->handler_method_data);
+ $this->handler_object_data =& $decorator;
+ $this->handler_method_data = 'breakData';
+ }
+ if ($this->parser_options['XML_OPTION_ENTITIES_PARSED']==1) {
+ $decorator = new TSax3_Entities_Parsed(
+ $this->handler_object_data,
+ $this->handler_method_data);
+ $this->handler_object_data =& $decorator;
+ $this->handler_method_data = 'breakData';
+ }
+ // Note switched on by default
+ if ($this->parser_options['XML_OPTION_STRIP_ESCAPES']==1) {
+ $decorator = new TSax3_Escape_Stripper(
+ $this->handler_object_escape,
+ $this->handler_method_escape);
+ $this->handler_object_escape =& $decorator;
+ $this->handler_method_escape = 'strip';
+ }
+ $this->rawtext = $data;
+ $this->length = strlen($data);
+ $this->position = 0;
+ $this->_parse();
+ }
+
+ /**
+ * Performs the parsing itself, delegating calls to a specific parser
+ * state
+ * @param constant state object to parse with
+ * @access protected
+ * @return void
+ */
+ function _parse($state = self::TSAX3_STATE_START) {
+ do {
+ $state = $this->State[$state]->parse($this);
+ } while ($state != self::TSAX3_STATE_STOP &&
+ $this->position < $this->length);
+ }
+}
+
+/**
+* Parser for PHP Versions below 4.3.0. Uses a slower parsing mechanism than
+* the equivalent PHP 4.3.0+ subclass of StateParser
+* @package System.Security.SafeHtml
+* @access protected
+* @see TSax3_StateParser_Gtet430
+*/
+class TSax3_StateParser_Lt430 extends TSax3_StateParser {
+ /**
+ * Constructs TSax3_StateParser_Lt430 defining available
+ * parser options
+ * @var TSax3 instance of user front end class
+ * @access protected
+ */
+ function __construct(& $htmlsax) {
+ parent::__construct($htmlsax);
+ $this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
+ $this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
+ $this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
+ $this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
+ $this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
+ $this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
+ $this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
+ //var_dump($this->parser_options);
+ }
+
+ /**
+ * Returns a string from the current position until the first instance of
+ * one of the characters in the supplied string argument
+ * @param string string to search until
+ * @access protected
+ * @return string
+ */
+ function scanUntilCharacters($string) {
+ $startpos = $this->position;
+ while ($this->position < $this->length && strpos($string, $this->rawtext{$this->position}) === FALSE) {
+ $this->position++;
+ }
+ return substr($this->rawtext, $startpos, $this->position - $startpos);
+ }
+
+ /**
+ * Moves the position forward past any whitespace characters
+ * @access protected
+ * @return void
+ */
+ function ignoreWhitespace() {
+ while ($this->position < $this->length &&
+ strpos(" \n\r\t", $this->rawtext{$this->position}) !== FALSE) {
+ $this->position++;
+ }
+ }
+
+ /**
+ * Begins the parsing operation, setting up the unparsed XML entities
+ * decorator if necessary then delegating further work to parent
+ * @param string XML document to parse
+ * @access protected
+ * @return void
+ */
+ function parse($data) {
+ parent::parse($data);
+ }
+}
+
+/**
+* Parser for PHP Versions equal to or greater than 4.3.0. Uses a faster
+* parsing mechanism than the equivalent PHP < 4.3.0 subclass of StateParser
+* @package System.Security.SafeHtml
+* @access protected
+* @see TSax3_StateParser_Lt430
+*/
+class TSax3_StateParser_Gtet430 extends TSax3_StateParser {
+ /**
+ * Constructs TSax3_StateParser_Gtet430 defining available
+ * parser options
+ * @var TSax3 instance of user front end class
+ * @access protected
+ */
+ function __construct(& $htmlsax) {
+ parent::__construct($htmlsax);
+ $this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
+ $this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
+ $this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
+ $this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
+ $this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
+ $this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
+ $this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
+ }
+ /**
+ * Returns a string from the current position until the first instance of
+ * one of the characters in the supplied string argument.
+ * @param string string to search until
+ * @access protected
+ * @return string
+ */
+ function scanUntilCharacters($string) {
+ $startpos = $this->position;
+ $length = strcspn($this->rawtext, $string, $startpos);
+ $this->position += $length;
+ return substr($this->rawtext, $startpos, $length);
+ }
+
+ /**
+ * Moves the position forward past any whitespace characters
+ * @access protected
+ * @return void
+ */
+ function ignoreWhitespace() {
+ $this->position += strspn($this->rawtext, " \n\r\t", $this->position);
+ }
+
+ /**
+ * Begins the parsing operation, setting up the parsed and unparsed
+ * XML entity decorators if necessary then delegating further work
+ * to parent
+ * @param string XML document to parse
+ * @access protected
+ * @return void
+ */
+ function parse($data) {
+ parent::parse($data);
+ }
+}
+
+/**
+* Default NullHandler for methods which were not set by user
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_NullHandler {
+ /**
+ * Generic handler method which does nothing
+ * @access protected
+ * @return void
+ */
+ function DoNothing() {
+ }
+}
+
+/**
+* User interface class. All user calls should only be made to this class
+* @package System.Security.SafeHtml
+* @access public
+*/
+class TSax3 {
+ /**
+ * Instance of concrete subclass of TSax3_StateParser
+ * @var TSax3_StateParser
+ * @access private
+ */
+ private $state_parser;
+
+ /**
+ * Constructs TSax3 selecting concrete StateParser subclass
+ * depending on PHP version being used as well as setting the default
+ * NullHandler for all callbacks<br />
+ * <b>Example:</b>
+ * <pre>
+ * $myHandler = & new MyHandler();
+ * $parser = new TSax3();
+ * $parser->set_object($myHandler);
+ * $parser->set_option('XML_OPTION_CASE_FOLDING');
+ * $parser->set_element_handler('myOpenHandler','myCloseHandler');
+ * $parser->set_data_handler('myDataHandler');
+ * $parser->parser($xml);
+ * </pre>
+ * @access public
+ */
+ function __construct() {
+ if (version_compare(phpversion(), '4.3', 'ge')) {
+ $this->state_parser = new TSax3_StateParser_Gtet430($this);
+ } else {
+ $this->state_parser = new TSax3_StateParser_Lt430($this);
+ }
+ $nullhandler = new TSax3_NullHandler();
+ $this->set_object($nullhandler);
+ $this->set_element_handler('DoNothing', 'DoNothing');
+ $this->set_data_handler('DoNothing');
+ $this->set_pi_handler('DoNothing');
+ $this->set_jasp_handler('DoNothing');
+ $this->set_escape_handler('DoNothing');
+ }
+
+ /**
+ * Sets the user defined handler object. Returns a PEAR Error
+ * if supplied argument is not an object.
+ * @param object handler object containing SAX callback methods
+ * @access public
+ * @return mixed
+ */
+ function set_object(&$object) {
+ if ( is_object($object) ) {
+ $this->state_parser->handler_default =& $object;
+ return true;
+ } else {
+ require_once('PEAR.php');
+ PEAR::raiseError('TSax3::set_object requires '.
+ 'an object instance');
+ }
+ }
+
+ /**
+ * Sets a parser option. By default all options are switched off.
+ * Returns a PEAR Error if option is invalid<br />
+ * <b>Available options:</b>
+ * <ul>
+ * <li>XML_OPTION_TRIM_DATA_NODES: trim whitespace off the beginning
+ * and end of data passed to the data handler</li>
+ * <li>XML_OPTION_LINEFEED_BREAK: linefeeds result in additional data
+ * handler calls</li>
+ * <li>XML_OPTION_TAB_BREAK: tabs result in additional data handler
+ * calls</li>
+ * <li>XML_OPTION_ENTITIES_UNPARSED: XML entities are returned as
+ * seperate data handler calls in unparsed form</li>
+ * <li>XML_OPTION_ENTITIES_PARSED: (PHP 4.3.0+ only) XML entities are
+ * returned as seperate data handler calls and are parsed with
+ * PHP's html_entity_decode() function</li>
+ * <li>XML_OPTION_STRIP_ESCAPES: strips out the -- -- comment markers
+ * or CDATA markup inside an XML escape, if found.</li>
+ * </ul>
+ * To get HTMLSax to behave in the same way as the native PHP SAX parser,
+ * using it's default state, you need to switch on XML_OPTION_LINEFEED_BREAK,
+ * XML_OPTION_ENTITIES_PARSED and XML_OPTION_CASE_FOLDING
+ * @param string name of parser option
+ * @param int (optional) 1 to switch on, 0 for off
+ * @access public
+ * @return boolean
+ */
+ function set_option($name, $value=1) {
+ if ( array_key_exists($name,$this->state_parser->parser_options) ) {
+ $this->state_parser->parser_options[$name] = $value;
+ return true;
+ } else {
+ require_once('PEAR.php');
+ PEAR::raiseError('TSax3::set_option('.$name.') illegal');
+ }
+ }
+
+ /**
+ * Sets the data handler method which deals with the contents of XML
+ * elements.<br />
+ * The handler method must accept two arguments, the first being an
+ * instance of TSax3 and the second being the contents of an
+ * XML element e.g.
+ * <pre>
+ * function myDataHander(& $parser,$data){}
+ * </pre>
+ * @param string name of method
+ * @access public
+ * @return void
+ * @see set_object
+ */
+ function set_data_handler($data_method) {
+ $this->state_parser->handler_object_data =& $this->state_parser->handler_default;
+ $this->state_parser->handler_method_data = $data_method;
+ }
+
+ /**
+ * Sets the open and close tag handlers
+ * <br />The open handler method must accept three arguments; the parser,
+ * the tag name and an array of attributes e.g.
+ * <pre>
+ * function myOpenHander(& $parser,$tagname,$attrs=array()){}
+ * </pre>
+ * The close handler method must accept two arguments; the parser and
+ * the tag name e.g.
+ * <pre>
+ * function myCloseHander(& $parser,$tagname){}
+ * </pre>
+ * @param string name of open method
+ * @param string name of close method
+ * @access public
+ * @return void
+ * @see set_object
+ */
+ function set_element_handler($opening_method, $closing_method) {
+ $this->state_parser->handler_object_element =& $this->state_parser->handler_default;
+ $this->state_parser->handler_method_opening = $opening_method;
+ $this->state_parser->handler_method_closing = $closing_method;
+ }
+
+ /**
+ * Sets the processing instruction handler method e.g. for PHP open
+ * and close tags<br />
+ * The handler method must accept three arguments; the parser, the
+ * PI target and data inside the PI
+ * <pre>
+ * function myPIHander(& $parser,$target, $data){}
+ * </pre>
+ * @param string name of method
+ * @access public
+ * @return void
+ * @see set_object
+ */
+ function set_pi_handler($pi_method) {
+ $this->state_parser->handler_object_pi =& $this->state_parser->handler_default;
+ $this->state_parser->handler_method_pi = $pi_method;
+ }
+
+ /**
+ * Sets the XML escape handler method e.g. for comments and doctype
+ * declarations<br />
+ * The handler method must accept two arguments; the parser and the
+ * contents of the escaped section
+ * <pre>
+ * function myEscapeHander(& $parser, $data){}
+ * </pre>
+ * @param string name of method
+ * @access public
+ * @return void
+ * @see set_object
+ */
+ function set_escape_handler($escape_method) {
+ $this->state_parser->handler_object_escape =& $this->state_parser->handler_default;
+ $this->state_parser->handler_method_escape = $escape_method;
+ }
+
+ /**
+ * Sets the JSP/ASP markup handler<br />
+ * The handler method must accept two arguments; the parser and
+ * body of the JASP tag
+ * <pre>
+ * function myJaspHander(& $parser, $data){}
+ * </pre>
+ * @param string name of method
+ * @access public
+ * @return void
+ * @see set_object
+ */
+ function set_jasp_handler ($jasp_method) {
+ $this->state_parser->handler_object_jasp =& $this->state_parser->handler_default;
+ $this->state_parser->handler_method_jasp = $jasp_method;
+ }
+
+ /**
+ * Returns the current string position of the "cursor" inside the XML
+ * document
+ * <br />Intended for use from within a user defined handler called
+ * via the $parser reference e.g.
+ * <pre>
+ * function myDataHandler(& $parser,$data) {
+ * echo( 'Current position: '.$parser->get_current_position() );
+ * }
+ * </pre>
+ * @access public
+ * @return int
+ * @see get_length
+ */
+ function get_current_position() {
+ return $this->state_parser->position;
+ }
+
+ /**
+ * Returns the string length of the XML document being parsed
+ * @access public
+ * @return int
+ */
+ function get_length() {
+ return $this->state_parser->length;
+ }
+
+ /**
+ * Start parsing some XML
+ * @param string XML document
+ * @access public
+ * @return void
+ */
+ function parse($data) {
+ $this->state_parser->parse($data);
+ }
+}
?> \ No newline at end of file
diff --git a/framework/3rdParty/SafeHtml/HTMLSax3/Decorators.php b/framework/3rdParty/SafeHtml/HTMLSax3/Decorators.php
index ac82d073..2e2b6590 100644
--- a/framework/3rdParty/SafeHtml/HTMLSax3/Decorators.php
+++ b/framework/3rdParty/SafeHtml/HTMLSax3/Decorators.php
@@ -1,363 +1,363 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
-// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
-// | Authors: Many @ Sitepointforums Advanced PHP Forums |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-/**
-* Decorators for dealing with parser options
-* @package System.Security.SafeHtml
-* @version $Id$
-* @see TSax3::set_option
-*/
-/**
-* Trims the contents of element data from whitespace at start and end
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Trim {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_Trim
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Trims the data
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function trimData(&$parser, $data) {
- $data = trim($data);
- if ($data != '') {
- $this->orig_obj->{$this->orig_method}($parser, $data);
- }
- }
-}
-/**
-* Coverts tag names to upper case
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_CaseFolding {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original open handler method
- * @var string
- * @access private
- */
- private $orig_open_method;
- /**
- * Original close handler method
- * @var string
- * @access private
- */
- private $orig_close_method;
- /**
- * Constructs TSax3_CaseFolding
- * @param object handler object being decorated
- * @param string original open handler method
- * @param string original close handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_open_method, $orig_close_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_open_method = $orig_open_method;
- $this->orig_close_method = $orig_close_method;
- }
- /**
- * Folds up open tag callbacks
- * @param TSax3
- * @param string tag name
- * @param array tag attributes
- * @access protected
- */
- function foldOpen(&$parser, $tag, $attrs=array(), $empty = FALSE) {
- $this->orig_obj->{$this->orig_open_method}($parser, strtoupper($tag), $attrs, $empty);
- }
- /**
- * Folds up close tag callbacks
- * @param TSax3
- * @param string tag name
- * @access protected
- */
- function foldClose(&$parser, $tag, $empty = FALSE) {
- $this->orig_obj->{$this->orig_close_method}($parser, strtoupper($tag), $empty);
- }
-}
-/**
-* Breaks up data by linefeed characters, resulting in additional
-* calls to the data handler
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Linefeed {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_LineFeed
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Breaks the data up by linefeeds
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function breakData(&$parser, $data) {
- $data = explode("\n",$data);
- foreach ( $data as $chunk ) {
- $this->orig_obj->{$this->orig_method}($parser, $chunk);
- }
- }
-}
-/**
-* Breaks up data by tab characters, resulting in additional
-* calls to the data handler
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Tab {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_Tab
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Breaks the data up by linefeeds
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function breakData(&$parser, $data) {
- $data = explode("\t",$data);
- foreach ( $data as $chunk ) {
- $this->orig_obj->{$this->orig_method}($this, $chunk);
- }
- }
-}
-/**
-* Breaks up data by XML entities and parses them with html_entity_decode(),
-* resulting in additional calls to the data handler<br />
-* Requires PHP 4.3.0+
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Entities_Parsed {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_Entities_Parsed
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Breaks the data up by XML entities
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function breakData(&$parser, $data) {
- $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
- foreach ( $data as $chunk ) {
- $chunk = html_entity_decode($chunk,ENT_NOQUOTES);
- $this->orig_obj->{$this->orig_method}($this, $chunk);
- }
- }
-}
-/**
-* Compatibility with older PHP versions
-*/
-if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) {
- function html_entity_decode($str, $style=ENT_NOQUOTES) {
- return strtr($str,
- array_flip(get_html_translation_table(HTML_ENTITIES,$style)));
- }
-}
-/**
-* Breaks up data by XML entities but leaves them unparsed,
-* resulting in additional calls to the data handler<br />
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Entities_Unparsed {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_Entities_Unparsed
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Breaks the data up by XML entities
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function breakData(&$parser, $data) {
- $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
- foreach ( $data as $chunk ) {
- $this->orig_obj->{$this->orig_method}($this, $chunk);
- }
- }
-}
-
-/**
-* Strips the HTML comment markers or CDATA sections from an escape.
-* If XML_OPTIONS_FULL_ESCAPES is on, this decorator is not used.<br />
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_Escape_Stripper {
- /**
- * Original handler object
- * @var object
- * @access private
- */
- private $orig_obj;
- /**
- * Original handler method
- * @var string
- * @access private
- */
- private $orig_method;
- /**
- * Constructs TSax3_Entities_Unparsed
- * @param object handler object being decorated
- * @param string original handler method
- * @access protected
- */
- function __construct(&$orig_obj, $orig_method) {
- $this->orig_obj =& $orig_obj;
- $this->orig_method = $orig_method;
- }
- /**
- * Breaks the data up by XML entities
- * @param TSax3
- * @param string element data
- * @access protected
- */
- function strip(&$parser, $data) {
- // Check for HTML comments first
- if ( substr($data,0,2) == '--' ) {
- $patterns = array(
- '/^\-\-/', // Opening comment: --
- '/\-\-$/', // Closing comment: --
- );
- $data = preg_replace($patterns,'',$data);
-
- // Check for XML CDATA sections (note: don't do both!)
- } else if ( substr($data,0,1) == '[' ) {
- $patterns = array(
- '/^\[.*CDATA.*\[/s', // Opening CDATA
- '/\].*\]$/s', // Closing CDATA
- );
- $data = preg_replace($patterns,'',$data);
- }
-
- $this->orig_obj->{$this->orig_method}($this, $data);
- }
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/3_0.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
+// | Authors: Many @ Sitepointforums Advanced PHP Forums |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+/**
+* Decorators for dealing with parser options
+* @package System.Security.SafeHtml
+* @version $Id$
+* @see TSax3::set_option
+*/
+/**
+* Trims the contents of element data from whitespace at start and end
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Trim {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_Trim
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Trims the data
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function trimData(&$parser, $data) {
+ $data = trim($data);
+ if ($data != '') {
+ $this->orig_obj->{$this->orig_method}($parser, $data);
+ }
+ }
+}
+/**
+* Coverts tag names to upper case
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_CaseFolding {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original open handler method
+ * @var string
+ * @access private
+ */
+ private $orig_open_method;
+ /**
+ * Original close handler method
+ * @var string
+ * @access private
+ */
+ private $orig_close_method;
+ /**
+ * Constructs TSax3_CaseFolding
+ * @param object handler object being decorated
+ * @param string original open handler method
+ * @param string original close handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_open_method, $orig_close_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_open_method = $orig_open_method;
+ $this->orig_close_method = $orig_close_method;
+ }
+ /**
+ * Folds up open tag callbacks
+ * @param TSax3
+ * @param string tag name
+ * @param array tag attributes
+ * @access protected
+ */
+ function foldOpen(&$parser, $tag, $attrs=array(), $empty = FALSE) {
+ $this->orig_obj->{$this->orig_open_method}($parser, strtoupper($tag), $attrs, $empty);
+ }
+ /**
+ * Folds up close tag callbacks
+ * @param TSax3
+ * @param string tag name
+ * @access protected
+ */
+ function foldClose(&$parser, $tag, $empty = FALSE) {
+ $this->orig_obj->{$this->orig_close_method}($parser, strtoupper($tag), $empty);
+ }
+}
+/**
+* Breaks up data by linefeed characters, resulting in additional
+* calls to the data handler
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Linefeed {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_LineFeed
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Breaks the data up by linefeeds
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function breakData(&$parser, $data) {
+ $data = explode("\n",$data);
+ foreach ( $data as $chunk ) {
+ $this->orig_obj->{$this->orig_method}($parser, $chunk);
+ }
+ }
+}
+/**
+* Breaks up data by tab characters, resulting in additional
+* calls to the data handler
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Tab {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_Tab
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Breaks the data up by linefeeds
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function breakData(&$parser, $data) {
+ $data = explode("\t",$data);
+ foreach ( $data as $chunk ) {
+ $this->orig_obj->{$this->orig_method}($this, $chunk);
+ }
+ }
+}
+/**
+* Breaks up data by XML entities and parses them with html_entity_decode(),
+* resulting in additional calls to the data handler<br />
+* Requires PHP 4.3.0+
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Entities_Parsed {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_Entities_Parsed
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Breaks the data up by XML entities
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function breakData(&$parser, $data) {
+ $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ foreach ( $data as $chunk ) {
+ $chunk = html_entity_decode($chunk,ENT_NOQUOTES);
+ $this->orig_obj->{$this->orig_method}($this, $chunk);
+ }
+ }
+}
+/**
+* Compatibility with older PHP versions
+*/
+if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) {
+ function html_entity_decode($str, $style=ENT_NOQUOTES) {
+ return strtr($str,
+ array_flip(get_html_translation_table(HTML_ENTITIES,$style)));
+ }
+}
+/**
+* Breaks up data by XML entities but leaves them unparsed,
+* resulting in additional calls to the data handler<br />
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Entities_Unparsed {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_Entities_Unparsed
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Breaks the data up by XML entities
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function breakData(&$parser, $data) {
+ $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ foreach ( $data as $chunk ) {
+ $this->orig_obj->{$this->orig_method}($this, $chunk);
+ }
+ }
+}
+
+/**
+* Strips the HTML comment markers or CDATA sections from an escape.
+* If XML_OPTIONS_FULL_ESCAPES is on, this decorator is not used.<br />
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_Escape_Stripper {
+ /**
+ * Original handler object
+ * @var object
+ * @access private
+ */
+ private $orig_obj;
+ /**
+ * Original handler method
+ * @var string
+ * @access private
+ */
+ private $orig_method;
+ /**
+ * Constructs TSax3_Entities_Unparsed
+ * @param object handler object being decorated
+ * @param string original handler method
+ * @access protected
+ */
+ function __construct(&$orig_obj, $orig_method) {
+ $this->orig_obj =& $orig_obj;
+ $this->orig_method = $orig_method;
+ }
+ /**
+ * Breaks the data up by XML entities
+ * @param TSax3
+ * @param string element data
+ * @access protected
+ */
+ function strip(&$parser, $data) {
+ // Check for HTML comments first
+ if ( substr($data,0,2) == '--' ) {
+ $patterns = array(
+ '/^\-\-/', // Opening comment: --
+ '/\-\-$/', // Closing comment: --
+ );
+ $data = preg_replace($patterns,'',$data);
+
+ // Check for XML CDATA sections (note: don't do both!)
+ } else if ( substr($data,0,1) == '[' ) {
+ $patterns = array(
+ '/^\[.*CDATA.*\[/s', // Opening CDATA
+ '/\].*\]$/s', // Closing CDATA
+ );
+ $data = preg_replace($patterns,'',$data);
+ }
+
+ $this->orig_obj->{$this->orig_method}($this, $data);
+ }
+}
?> \ No newline at end of file
diff --git a/framework/3rdParty/SafeHtml/HTMLSax3/States.php b/framework/3rdParty/SafeHtml/HTMLSax3/States.php
index 6dfead17..7d7b9b34 100644
--- a/framework/3rdParty/SafeHtml/HTMLSax3/States.php
+++ b/framework/3rdParty/SafeHtml/HTMLSax3/States.php
@@ -1,288 +1,288 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
-// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
-// | Authors: Many @ Sitepointforums Advanced PHP Forums |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-/**
-* Parsing states.
-* @package System.Security.SafeHtml
-* @version $Id$
-*/
-/**
-* Define parser states
-*/
-/*define('TSAX3_STATE_STOP', 0);
-define('TSAX3_STATE_START', 1);
-define('TSAX3_STATE_TAG', 2);
-define('TSAX3_STATE_OPENING_TAG', 3);
-define('TSAX3_STATE_CLOSING_TAG', 4);
-define('TSAX3_STATE_ESCAPE', 6);
-define('TSAX3_STATE_JASP', 7);
-define('TSAX3_STATE_PI', 8);
-*/
-/**
-* StartingState searches for the start of any XML tag
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_StartingState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_TAG
- * @access protected
- */
- function parse(&$context) {
- $data = $context->scanUntilString('<');
- if ($data != '') {
- $context->handler_object_data->
- {$context->handler_method_data}($context->htmlsax, $data);
- }
- $context->IgnoreCharacter();
- return TSax3_StateParser::TSAX3_STATE_TAG;
- }
-}
-/**
-* Decides which state to move one from after StartingState
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_TagState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant the next state to move into
- * @access protected
- */
- function parse(&$context) {
- switch($context->ScanCharacter()) {
- case '/':
- return TSax3_StateParser::TSAX3_STATE_CLOSING_TAG;
- break;
- case '?':
- return TSax3_StateParser::TSAX3_STATE_PI;
- break;
- case '%':
- return TSax3_StateParser::TSAX3_STATE_JASP;
- break;
- case '!':
- return TSax3_StateParser::TSAX3_STATE_ESCAPE;
- break;
- default:
- $context->unscanCharacter();
- return TSax3_StateParser::TSAX3_STATE_OPENING_TAG;
- }
- }
-}
-/**
-* Dealing with closing XML tags
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_ClosingTagState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_START
- * @access protected
- */
- function parse(&$context) {
- $tag = $context->scanUntilCharacters('/>');
- if ($tag != '') {
- $char = $context->scanCharacter();
- if ($char == '/') {
- $char = $context->scanCharacter();
- if ($char != '>') {
- $context->unscanCharacter();
- }
- }
- $context->handler_object_element->
- {$context->handler_method_closing}($context->htmlsax, $tag, FALSE);
- }
- return TSax3_StateParser::TSAX3_STATE_START;
- }
-}
-/**
-* Dealing with opening XML tags
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_OpeningTagState {
- /**
- * Handles attributes
- * @param string attribute name
- * @param string attribute value
- * @return void
- * @access protected
- * @see TSax3_AttributeStartState
- */
- function parseAttributes(&$context) {
- $Attributes = array();
-
- $context->ignoreWhitespace();
- $attributename = $context->scanUntilCharacters("=/> \n\r\t");
- while ($attributename != '') {
- $attributevalue = NULL;
- $context->ignoreWhitespace();
- $char = $context->scanCharacter();
- if ($char == '=') {
- $context->ignoreWhitespace();
- $char = $context->ScanCharacter();
- if ($char == '"') {
- $attributevalue= $context->scanUntilString('"');
- $context->IgnoreCharacter();
- } else if ($char == "'") {
- $attributevalue = $context->scanUntilString("'");
- $context->IgnoreCharacter();
- } else {
- $context->unscanCharacter();
- $attributevalue =
- $context->scanUntilCharacters("> \n\r\t");
- }
- } else if ($char !== NULL) {
- $attributevalue = NULL;
- $context->unscanCharacter();
- }
- $Attributes[$attributename] = $attributevalue;
-
- $context->ignoreWhitespace();
- $attributename = $context->scanUntilCharacters("=/> \n\r\t");
- }
- return $Attributes;
- }
-
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_START
- * @access protected
- */
- function parse(&$context) {
- $tag = $context->scanUntilCharacters("/> \n\r\t");
- if ($tag != '') {
- $this->attrs = array();
- $Attributes = $this->parseAttributes($context);
- $char = $context->scanCharacter();
- if ($char == '/') {
- $char = $context->scanCharacter();
- if ($char != '>') {
- $context->unscanCharacter();
- }
- $context->handler_object_element->
- {$context->handler_method_opening}($context->htmlsax, $tag,
- $Attributes, TRUE);
- $context->handler_object_element->
- {$context->handler_method_closing}($context->htmlsax, $tag,
- TRUE);
- } else {
- $context->handler_object_element->
- {$context->handler_method_opening}($context->htmlsax, $tag,
- $Attributes, FALSE);
- }
- }
- return TSax3_StateParser::TSAX3_STATE_START;
- }
-}
-
-/**
-* Deals with XML escapes handling comments and CDATA correctly
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_EscapeState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_START
- * @access protected
- */
- function parse(&$context) {
- $char = $context->ScanCharacter();
- if ($char == '-') {
- $char = $context->ScanCharacter();
- if ($char == '-') {
- $context->unscanCharacter();
- $context->unscanCharacter();
- $text = $context->scanUntilString('-->');
- $text .= $context->scanCharacter();
- $text .= $context->scanCharacter();
- } else {
- $context->unscanCharacter();
- $text = $context->scanUntilString('>');
- }
- } else if ( $char == '[') {
- $context->unscanCharacter();
- $text = $context->scanUntilString(']>');
- $text.= $context->scanCharacter();
- } else {
- $context->unscanCharacter();
- $text = $context->scanUntilString('>');
- }
-
- $context->IgnoreCharacter();
- if ($text != '') {
- $context->handler_object_escape->
- {$context->handler_method_escape}($context->htmlsax, $text);
- }
- return TSax3_StateParser::TSAX3_STATE_START;
- }
-}
-/**
-* Deals with JASP/ASP markup
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_JaspState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_START
- * @access protected
- */
- function parse(&$context) {
- $text = $context->scanUntilString('%>');
- if ($text != '') {
- $context->handler_object_jasp->
- {$context->handler_method_jasp}($context->htmlsax, $text);
- }
- $context->IgnoreCharacter();
- $context->IgnoreCharacter();
- return TSax3_StateParser::TSAX3_STATE_START;
- }
-}
-/**
-* Deals with XML processing instructions
-* @package System.Security.SafeHtml
-* @access protected
-*/
-class TSax3_PiState {
- /**
- * @param TSax3_StateParser subclass
- * @return constant TSAX3_STATE_START
- * @access protected
- */
- function parse(&$context) {
- $target = $context->scanUntilCharacters(" \n\r\t");
- $data = $context->scanUntilString('?>');
- if ($data != '') {
- $context->handler_object_pi->
- {$context->handler_method_pi}($context->htmlsax, $target, $data);
- }
- $context->IgnoreCharacter();
- $context->IgnoreCharacter();
- return TSax3_StateParser::TSAX3_STATE_START;
- }
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/3_0.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
+// | Authors: Many @ Sitepointforums Advanced PHP Forums |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+/**
+* Parsing states.
+* @package System.Security.SafeHtml
+* @version $Id$
+*/
+/**
+* Define parser states
+*/
+/*define('TSAX3_STATE_STOP', 0);
+define('TSAX3_STATE_START', 1);
+define('TSAX3_STATE_TAG', 2);
+define('TSAX3_STATE_OPENING_TAG', 3);
+define('TSAX3_STATE_CLOSING_TAG', 4);
+define('TSAX3_STATE_ESCAPE', 6);
+define('TSAX3_STATE_JASP', 7);
+define('TSAX3_STATE_PI', 8);
+*/
+/**
+* StartingState searches for the start of any XML tag
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_StartingState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_TAG
+ * @access protected
+ */
+ function parse(&$context) {
+ $data = $context->scanUntilString('<');
+ if ($data != '') {
+ $context->handler_object_data->
+ {$context->handler_method_data}($context->htmlsax, $data);
+ }
+ $context->IgnoreCharacter();
+ return TSax3_StateParser::TSAX3_STATE_TAG;
+ }
+}
+/**
+* Decides which state to move one from after StartingState
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_TagState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant the next state to move into
+ * @access protected
+ */
+ function parse(&$context) {
+ switch($context->ScanCharacter()) {
+ case '/':
+ return TSax3_StateParser::TSAX3_STATE_CLOSING_TAG;
+ break;
+ case '?':
+ return TSax3_StateParser::TSAX3_STATE_PI;
+ break;
+ case '%':
+ return TSax3_StateParser::TSAX3_STATE_JASP;
+ break;
+ case '!':
+ return TSax3_StateParser::TSAX3_STATE_ESCAPE;
+ break;
+ default:
+ $context->unscanCharacter();
+ return TSax3_StateParser::TSAX3_STATE_OPENING_TAG;
+ }
+ }
+}
+/**
+* Dealing with closing XML tags
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_ClosingTagState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_START
+ * @access protected
+ */
+ function parse(&$context) {
+ $tag = $context->scanUntilCharacters('/>');
+ if ($tag != '') {
+ $char = $context->scanCharacter();
+ if ($char == '/') {
+ $char = $context->scanCharacter();
+ if ($char != '>') {
+ $context->unscanCharacter();
+ }
+ }
+ $context->handler_object_element->
+ {$context->handler_method_closing}($context->htmlsax, $tag, FALSE);
+ }
+ return TSax3_StateParser::TSAX3_STATE_START;
+ }
+}
+/**
+* Dealing with opening XML tags
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_OpeningTagState {
+ /**
+ * Handles attributes
+ * @param string attribute name
+ * @param string attribute value
+ * @return void
+ * @access protected
+ * @see TSax3_AttributeStartState
+ */
+ function parseAttributes(&$context) {
+ $Attributes = array();
+
+ $context->ignoreWhitespace();
+ $attributename = $context->scanUntilCharacters("=/> \n\r\t");
+ while ($attributename != '') {
+ $attributevalue = NULL;
+ $context->ignoreWhitespace();
+ $char = $context->scanCharacter();
+ if ($char == '=') {
+ $context->ignoreWhitespace();
+ $char = $context->ScanCharacter();
+ if ($char == '"') {
+ $attributevalue= $context->scanUntilString('"');
+ $context->IgnoreCharacter();
+ } else if ($char == "'") {
+ $attributevalue = $context->scanUntilString("'");
+ $context->IgnoreCharacter();
+ } else {
+ $context->unscanCharacter();
+ $attributevalue =
+ $context->scanUntilCharacters("> \n\r\t");
+ }
+ } else if ($char !== NULL) {
+ $attributevalue = NULL;
+ $context->unscanCharacter();
+ }
+ $Attributes[$attributename] = $attributevalue;
+
+ $context->ignoreWhitespace();
+ $attributename = $context->scanUntilCharacters("=/> \n\r\t");
+ }
+ return $Attributes;
+ }
+
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_START
+ * @access protected
+ */
+ function parse(&$context) {
+ $tag = $context->scanUntilCharacters("/> \n\r\t");
+ if ($tag != '') {
+ $this->attrs = array();
+ $Attributes = $this->parseAttributes($context);
+ $char = $context->scanCharacter();
+ if ($char == '/') {
+ $char = $context->scanCharacter();
+ if ($char != '>') {
+ $context->unscanCharacter();
+ }
+ $context->handler_object_element->
+ {$context->handler_method_opening}($context->htmlsax, $tag,
+ $Attributes, TRUE);
+ $context->handler_object_element->
+ {$context->handler_method_closing}($context->htmlsax, $tag,
+ TRUE);
+ } else {
+ $context->handler_object_element->
+ {$context->handler_method_opening}($context->htmlsax, $tag,
+ $Attributes, FALSE);
+ }
+ }
+ return TSax3_StateParser::TSAX3_STATE_START;
+ }
+}
+
+/**
+* Deals with XML escapes handling comments and CDATA correctly
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_EscapeState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_START
+ * @access protected
+ */
+ function parse(&$context) {
+ $char = $context->ScanCharacter();
+ if ($char == '-') {
+ $char = $context->ScanCharacter();
+ if ($char == '-') {
+ $context->unscanCharacter();
+ $context->unscanCharacter();
+ $text = $context->scanUntilString('-->');
+ $text .= $context->scanCharacter();
+ $text .= $context->scanCharacter();
+ } else {
+ $context->unscanCharacter();
+ $text = $context->scanUntilString('>');
+ }
+ } else if ( $char == '[') {
+ $context->unscanCharacter();
+ $text = $context->scanUntilString(']>');
+ $text.= $context->scanCharacter();
+ } else {
+ $context->unscanCharacter();
+ $text = $context->scanUntilString('>');
+ }
+
+ $context->IgnoreCharacter();
+ if ($text != '') {
+ $context->handler_object_escape->
+ {$context->handler_method_escape}($context->htmlsax, $text);
+ }
+ return TSax3_StateParser::TSAX3_STATE_START;
+ }
+}
+/**
+* Deals with JASP/ASP markup
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_JaspState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_START
+ * @access protected
+ */
+ function parse(&$context) {
+ $text = $context->scanUntilString('%>');
+ if ($text != '') {
+ $context->handler_object_jasp->
+ {$context->handler_method_jasp}($context->htmlsax, $text);
+ }
+ $context->IgnoreCharacter();
+ $context->IgnoreCharacter();
+ return TSax3_StateParser::TSAX3_STATE_START;
+ }
+}
+/**
+* Deals with XML processing instructions
+* @package System.Security.SafeHtml
+* @access protected
+*/
+class TSax3_PiState {
+ /**
+ * @param TSax3_StateParser subclass
+ * @return constant TSAX3_STATE_START
+ * @access protected
+ */
+ function parse(&$context) {
+ $target = $context->scanUntilCharacters(" \n\r\t");
+ $data = $context->scanUntilString('?>');
+ if ($data != '') {
+ $context->handler_object_pi->
+ {$context->handler_method_pi}($context->htmlsax, $target, $data);
+ }
+ $context->IgnoreCharacter();
+ $context->IgnoreCharacter();
+ return TSax3_StateParser::TSAX3_STATE_START;
+ }
+}
?> \ No newline at end of file
diff --git a/framework/3rdParty/SafeHtml/TSafeHtmlParser.php b/framework/3rdParty/SafeHtml/TSafeHtmlParser.php
index b80f31a6..ad14baf9 100644
--- a/framework/3rdParty/SafeHtml/TSafeHtmlParser.php
+++ b/framework/3rdParty/SafeHtml/TSafeHtmlParser.php
@@ -1,673 +1,673 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * SafeHTML Parser
- *
- * PHP versions 4 and 5
- *
- * @category HTML
- * @package System.Security
- * @author Roman Ivanov <thingol@mail.ru>
- * @copyright 2004-2005 Roman Ivanov
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version 1.3.7
- * @link http://pixel-apes.com/safehtml/
- */
-
-
-/**
- * This package requires HTMLSax3 package
- */
-Prado::using('System.3rdParty.SafeHtml.HTMLSax3');
-
-
-/**
- *
- * TSafeHtmlParser
- *
- * This parser strips down all potentially dangerous content within HTML:
- * <ul>
- * <li>opening tag without its closing tag</li>
- * <li>closing tag without its opening tag</li>
- * <li>any of these tags: "base", "basefont", "head", "html", "body", "applet",
- * "object", "iframe", "frame", "frameset", "script", "layer", "ilayer", "embed",
- * "bgsound", "link", "meta", "style", "title", "blink", "xml" etc.</li>
- * <li>any of these attributes: on*, data*, dynsrc</li>
- * <li>javascript:/vbscript:/about: etc. protocols</li>
- * <li>expression/behavior etc. in styles</li>
- * <li>any other active content</li>
- * </ul>
- * It also tries to convert code to XHTML valid, but htmltidy is far better
- * solution for this task.
- *
- * <b>Example:</b>
- * <pre>
- * $parser = Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
- * $result = $parser->parse($doc);
- * </pre>
- *
- * @category HTML
- * @package System.Security
- * @author Roman Ivanov <thingol@mail.ru>
- * @copyright 1997-2005 Roman Ivanov
- * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
- * @version Release: @package_version@
- * @link http://pear.php.net/package/SafeHTML
- */
-class TSafeHtmlParser
-{
- /**
- * Storage for resulting HTML output
- *
- * @var string
- * @access private
- */
- private $_xhtml = '';
-
- /**
- * Array of counters for each tag
- *
- * @var array
- * @access private
- */
- private $_counter = array();
-
- /**
- * Stack of unclosed tags
- *
- * @var array
- * @access private
- */
- private $_stack = array();
-
- /**
- * Array of counters for tags that must be deleted with all content
- *
- * @var array
- * @access private
- */
- private $_dcCounter = array();
-
- /**
- * Stack of unclosed tags that must be deleted with all content
- *
- * @var array
- * @access private
- */
- private $_dcStack = array();
-
- /**
- * Stores level of list (ol/ul) nesting
- *
- * @var int
- * @access private
- */
- private $_listScope = 0;
-
- /**
- * Stack of unclosed list tags
- *
- * @var array
- * @access private
- */
- private $_liStack = array();
-
- /**
- * Array of prepared regular expressions for protocols (schemas) matching
- *
- * @var array
- * @access private
- */
- private $_protoRegexps = array();
-
- /**
- * Array of prepared regular expressions for CSS matching
- *
- * @var array
- * @access private
- */
- private $_cssRegexps = array();
-
- /**
- * List of single tags ("<tag />")
- *
- * @var array
- * @access public
- */
- public $singleTags = array('area', 'br', 'img', 'input', 'hr', 'wbr', );
-
- /**
- * List of dangerous tags (such tags will be deleted)
- *
- * @var array
- * @access public
- */
- public $deleteTags = array(
- 'applet', 'base', 'basefont', 'bgsound', 'blink', 'body',
- 'embed', 'frame', 'frameset', 'head', 'html', 'ilayer',
- 'iframe', 'layer', 'link', 'meta', 'object', 'style',
- 'title', 'script',
- );
-
- /**
- * List of dangerous tags (such tags will be deleted, and all content
- * inside this tags will be also removed)
- *
- * @var array
- * @access public
- */
- public $deleteTagsContent = array('script', 'style', 'title', 'xml', );
-
- /**
- * Type of protocols filtering ('white' or 'black')
- *
- * @var string
- * @access public
- */
- public $protocolFiltering = 'white';
-
- /**
- * List of "dangerous" protocols (used for blacklist-filtering)
- *
- * @var array
- * @access public
- */
- public $blackProtocols = array(
- 'about', 'chrome', 'data', 'disk', 'hcp',
- 'help', 'javascript', 'livescript', 'lynxcgi', 'lynxexec',
- 'ms-help', 'ms-its', 'mhtml', 'mocha', 'opera',
- 'res', 'resource', 'shell', 'vbscript', 'view-source',
- 'vnd.ms.radio', 'wysiwyg',
- );
-
- /**
- * List of "safe" protocols (used for whitelist-filtering)
- *
- * @var array
- * @access public
- */
- public $whiteProtocols = array(
- 'ed2k', 'file', 'ftp', 'gopher', 'http', 'https',
- 'irc', 'mailto', 'news', 'nntp', 'telnet', 'webcal',
- 'xmpp', 'callto',
- );
-
- /**
- * List of attributes that can contain protocols
- *
- * @var array
- * @access public
- */
- public $protocolAttributes = array(
- 'action', 'background', 'codebase', 'dynsrc', 'href', 'lowsrc', 'src',
- );
-
- /**
- * List of dangerous CSS keywords
- *
- * Whole style="" attribute will be removed, if parser will find one of
- * these keywords
- *
- * @var array
- * @access public
- */
- public $cssKeywords = array(
- 'absolute', 'behavior', 'behaviour', 'content', 'expression',
- 'fixed', 'include-source', 'moz-binding',
- );
-
- /**
- * List of tags that can have no "closing tag"
- *
- * @var array
- * @access public
- * @deprecated XHTML does not allow such tags
- */
- public $noClose = array();
-
- /**
- * List of block-level tags that terminates paragraph
- *
- * Paragraph will be closed when this tags opened
- *
- * @var array
- * @access public
- */
- public $closeParagraph = array(
- 'address', 'blockquote', 'center', 'dd', 'dir', 'div',
- 'dl', 'dt', 'h1', 'h2', 'h3', 'h4',
- 'h5', 'h6', 'hr', 'isindex', 'listing', 'marquee',
- 'menu', 'multicol', 'ol', 'p', 'plaintext', 'pre',
- 'table', 'ul', 'xmp',
- );
-
- /**
- * List of table tags, all table tags outside a table will be removed
- *
- * @var array
- * @access public
- */
- public $tableTags = array(
- 'caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th',
- 'thead', 'tr',
- );
-
- /**
- * List of list tags
- *
- * @var array
- * @access public
- */
- public $listTags = array('dir', 'menu', 'ol', 'ul', 'dl', );
-
- /**
- * List of dangerous attributes
- *
- * @var array
- * @access public
- */
- public $attributes = array('dynsrc');
- //public $attributes = array('dynsrc', 'id', 'name', ); //id and name are dangerous?
-
- /**
- * List of allowed "namespaced" attributes
- *
- * @var array
- * @access public
- */
- public $attributesNS = array('xml:lang', );
-
- /**
- * Constructs class
- *
- * @access public
- */
- public function __construct()
- {
- //making regular expressions based on Proto & CSS arrays
- foreach ($this->blackProtocols as $proto) {
- $preg = "/[\s\x01-\x1F]*";
- for ($i=0; $i<strlen($proto); $i++) {
- $preg .= $proto{$i} . "[\s\x01-\x1F]*";
- }
- $preg .= ":/i";
- $this->_protoRegexps[] = $preg;
- }
-
- foreach ($this->cssKeywords as $css) {
- $this->_cssRegexps[] = '/' . $css . '/i';
- }
- return true;
- }
-
- /**
- * Handles the writing of attributes - called from $this->_openHandler()
- *
- * @param array $attrs array of attributes $name => $value
- * @return boolean
- * @access private
- */
- private function _writeAttrs ($attrs)
- {
- if (is_array($attrs)) {
- foreach ($attrs as $name => $value) {
-
- $name = strtolower($name);
-
- if (strpos($name, 'on') === 0) {
- continue;
- }
- if (strpos($name, 'data') === 0) {
- continue;
- }
- if (in_array($name, $this->attributes)) {
- continue;
- }
- if (!preg_match("/^[a-z0-9]+$/i", $name)) {
- if (!in_array($name, $this->attributesNS))
- {
- continue;
- }
- }
-
- if (($value === TRUE) || (is_null($value))) {
- $value = $name;
- }
-
- if ($name == 'style') {
-
- // removes insignificant backslahes
- $value = str_replace("\\", '', $value);
-
- // removes CSS comments
- while (1)
- {
- $_value = preg_replace("!/\*.*?\*/!s", '', $value);
- if ($_value == $value) break;
- $value = $_value;
- }
-
- // replace all & to &amp;
- $value = str_replace('&amp;', '&', $value);
- $value = str_replace('&', '&amp;', $value);
-
- foreach ($this->_cssRegexps as $css) {
- if (preg_match($css, $value)) {
- continue 2;
- }
- }
- foreach ($this->_protoRegexps as $proto) {
- if (preg_match($proto, $value)) {
- continue 2;
- }
- }
- }
-
- $tempval = preg_replace('/&#(\d+);?/me', "chr('\\1')", $value); //"'
- $tempval = preg_replace('/&#x([0-9a-f]+);?/mei', "chr(hexdec('\\1'))", $tempval);
-
- if ((in_array($name, $this->protocolAttributes)) &&
- (strpos($tempval, ':') !== false))
- {
- if ($this->protocolFiltering == 'black') {
- foreach ($this->_protoRegexps as $proto) {
- if (preg_match($proto, $tempval)) continue 2;
- }
- } else {
- $_tempval = explode(':', $tempval);
- $proto = $_tempval[0];
- if (!in_array($proto, $this->whiteProtocols)) {
- continue;
- }
- }
- }
-
- $value = str_replace("\"", "&quot;", $value);
- $this->_xhtml .= ' ' . $name . '="' . $value . '"';
- }
- }
- return true;
- }
-
- /**
- * Opening tag handler - called from HTMLSax
- *
- * @param object $parser HTML Parser
- * @param string $name tag name
- * @param array $attrs tag attributes
- * @return boolean
- * @access private
- */
- public function _openHandler(&$parser, $name, $attrs)
- {
- $name = strtolower($name);
-
- if (in_array($name, $this->deleteTagsContent)) {
- array_push($this->_dcStack, $name);
- $this->_dcCounter[$name] = isset($this->_dcCounter[$name]) ? $this->_dcCounter[$name]+1 : 1;
- }
- if (count($this->_dcStack) != 0) {
- return true;
- }
-
- if (in_array($name, $this->deleteTags)) {
- return true;
- }
-
- if (!preg_match("/^[a-z0-9]+$/i", $name)) {
- if (preg_match("!(?:\@|://)!i", $name)) {
- $this->_xhtml .= '&lt;' . $name . '&gt;';
- }
- return true;
- }
-
- if (in_array($name, $this->singleTags)) {
- $this->_xhtml .= '<' . $name;
- $this->_writeAttrs($attrs);
- $this->_xhtml .= ' />';
- return true;
- }
-
- // TABLES: cannot open table elements when we are not inside table
- if ((isset($this->_counter['table'])) && ($this->_counter['table'] <= 0)
- && (in_array($name, $this->tableTags)))
- {
- return true;
- }
-
- // PARAGRAPHS: close paragraph when closeParagraph tags opening
- if ((in_array($name, $this->closeParagraph)) && (in_array('p', $this->_stack))) {
- $this->_closeHandler($parser, 'p');
- }
-
- // LISTS: we should close <li> if <li> of the same level opening
- if ($name == 'li' && count($this->_liStack) &&
- $this->_listScope == $this->_liStack[count($this->_liStack)-1])
- {
- $this->_closeHandler($parser, 'li');
- }
-
- // LISTS: we want to know on what nesting level of lists we are
- if (in_array($name, $this->listTags)) {
- $this->_listScope++;
- }
- if ($name == 'li') {
- array_push($this->_liStack, $this->_listScope);
- }
-
- $this->_xhtml .= '<' . $name;
- $this->_writeAttrs($attrs);
- $this->_xhtml .= '>';
- array_push($this->_stack,$name);
- $this->_counter[$name] = isset($this->_counter[$name]) ? $this->_counter[$name]+1 : 1;
- return true;
- }
-
- /**
- * Closing tag handler - called from HTMLSax
- *
- * @param object $parsers HTML parser
- * @param string $name tag name
- * @return boolean
- * @access private
- */
- public function _closeHandler(&$parser, $name)
- {
-
- $name = strtolower($name);
-
- if (isset($this->_dcCounter[$name]) && ($this->_dcCounter[$name] > 0) &&
- (in_array($name, $this->deleteTagsContent)))
- {
- while ($name != ($tag = array_pop($this->_dcStack))) {
- $this->_dcCounter[$tag]--;
- }
-
- $this->_dcCounter[$name]--;
- }
-
- if (count($this->_dcStack) != 0) {
- return true;
- }
-
- if ((isset($this->_counter[$name])) && ($this->_counter[$name] > 0)) {
- while ($name != ($tag = array_pop($this->_stack))) {
- $this->_closeTag($tag);
- }
-
- $this->_closeTag($name);
- }
- return true;
- }
-
- /**
- * Closes tag
- *
- * @param string $tag tag name
- * @return boolean
- * @access private
- */
- public function _closeTag($tag)
- {
- if (!in_array($tag, $this->noClose)) {
- $this->_xhtml .= '</' . $tag . '>';
- }
-
- $this->_counter[$tag]--;
-
- if (in_array($tag, $this->listTags)) {
- $this->_listScope--;
- }
-
- if ($tag == 'li') {
- array_pop($this->_liStack);
- }
- return true;
- }
-
- /**
- * Character data handler - called from HTMLSax
- *
- * @param object $parser HTML parser
- * @param string $data textual data
- * @return boolean
- * @access private
- */
- public function _dataHandler(&$parser, $data)
- {
- if (count($this->_dcStack) == 0) {
- $this->_xhtml .= $data;
- }
- return true;
- }
-
- /**
- * Escape handler - called from HTMLSax
- *
- * @param object $parser HTML parser
- * @param string $data comments or other type of data
- * @return boolean
- * @access private
- */
- public function _escapeHandler(&$parser, $data)
- {
- return true;
- }
-
- /**
- * Returns the XHTML document
- *
- * @return string Processed (X)HTML document
- * @access public
- */
- public function getXHTML ()
- {
- while ($tag = array_pop($this->_stack)) {
- $this->_closeTag($tag);
- }
-
- return $this->_xhtml;
- }
-
- /**
- * Clears current document data
- *
- * @return boolean
- * @access public
- */
- public function clear()
- {
- $this->_xhtml = '';
- return true;
- }
-
- /**
- * Main parsing fuction
- *
- * @param string $doc HTML document for processing
- * @return string Processed (X)HTML document
- * @access public
- */
- public function parse($doc, $isUTF7=false)
- {
- $this->clear();
-
- // Save all '<' symbols
- $doc = preg_replace("/<(?=[^a-zA-Z\/\!\?\%])/", '&lt;', (string)$doc);
-
- // Web documents shouldn't contains \x00 symbol
- $doc = str_replace("\x00", '', $doc);
-
- // Opera6 bug workaround
- $doc = str_replace("\xC0\xBC", '&lt;', $doc);
-
- // UTF-7 encoding ASCII decode
- if($isUTF7)
- $doc = $this->repackUTF7($doc);
-
- // Instantiate the parser
- $parser= new TSax3();
-
- // Set up the parser
- $parser->set_object($this);
-
- $parser->set_element_handler('_openHandler','_closeHandler');
- $parser->set_data_handler('_dataHandler');
- $parser->set_escape_handler('_escapeHandler');
-
- $parser->parse($doc);
-
- return $this->getXHTML();
-
- }
-
-
- /**
- * UTF-7 decoding fuction
- *
- * @param string $str HTML document for recode ASCII part of UTF-7 back to ASCII
- * @return string Decoded document
- * @access private
- */
- private function repackUTF7($str)
- {
- return preg_replace_callback('!\+([0-9a-zA-Z/]+)\-!', array($this, 'repackUTF7Callback'), $str);
- }
-
- /**
- * Additional UTF-7 decoding fuction
- *
- * @param string $str String for recode ASCII part of UTF-7 back to ASCII
- * @return string Recoded string
- * @access private
- */
- private function repackUTF7Callback($str)
- {
- $str = base64_decode($str[1]);
- $str = preg_replace_callback('/^((?:\x00.)*)((?:[^\x00].)+)/', array($this, 'repackUTF7Back'), $str);
- return preg_replace('/\x00(.)/', '$1', $str);
- }
-
- /**
- * Additional UTF-7 encoding fuction
- *
- * @param string $str String for recode ASCII part of UTF-7 back to ASCII
- * @return string Recoded string
- * @access private
- */
- private function repackUTF7Back($str)
- {
- return $str[1].'+'.rtrim(base64_encode($str[2]), '=').'-';
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * SafeHTML Parser
+ *
+ * PHP versions 4 and 5
+ *
+ * @category HTML
+ * @package System.Security
+ * @author Roman Ivanov <thingol@mail.ru>
+ * @copyright 2004-2005 Roman Ivanov
+ * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
+ * @version 1.3.7
+ * @link http://pixel-apes.com/safehtml/
+ */
+
+
+/**
+ * This package requires HTMLSax3 package
+ */
+Prado::using('System.3rdParty.SafeHtml.HTMLSax3');
+
+
+/**
+ *
+ * TSafeHtmlParser
+ *
+ * This parser strips down all potentially dangerous content within HTML:
+ * <ul>
+ * <li>opening tag without its closing tag</li>
+ * <li>closing tag without its opening tag</li>
+ * <li>any of these tags: "base", "basefont", "head", "html", "body", "applet",
+ * "object", "iframe", "frame", "frameset", "script", "layer", "ilayer", "embed",
+ * "bgsound", "link", "meta", "style", "title", "blink", "xml" etc.</li>
+ * <li>any of these attributes: on*, data*, dynsrc</li>
+ * <li>javascript:/vbscript:/about: etc. protocols</li>
+ * <li>expression/behavior etc. in styles</li>
+ * <li>any other active content</li>
+ * </ul>
+ * It also tries to convert code to XHTML valid, but htmltidy is far better
+ * solution for this task.
+ *
+ * <b>Example:</b>
+ * <pre>
+ * $parser = Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
+ * $result = $parser->parse($doc);
+ * </pre>
+ *
+ * @category HTML
+ * @package System.Security
+ * @author Roman Ivanov <thingol@mail.ru>
+ * @copyright 1997-2005 Roman Ivanov
+ * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/SafeHTML
+ */
+class TSafeHtmlParser
+{
+ /**
+ * Storage for resulting HTML output
+ *
+ * @var string
+ * @access private
+ */
+ private $_xhtml = '';
+
+ /**
+ * Array of counters for each tag
+ *
+ * @var array
+ * @access private
+ */
+ private $_counter = array();
+
+ /**
+ * Stack of unclosed tags
+ *
+ * @var array
+ * @access private
+ */
+ private $_stack = array();
+
+ /**
+ * Array of counters for tags that must be deleted with all content
+ *
+ * @var array
+ * @access private
+ */
+ private $_dcCounter = array();
+
+ /**
+ * Stack of unclosed tags that must be deleted with all content
+ *
+ * @var array
+ * @access private
+ */
+ private $_dcStack = array();
+
+ /**
+ * Stores level of list (ol/ul) nesting
+ *
+ * @var int
+ * @access private
+ */
+ private $_listScope = 0;
+
+ /**
+ * Stack of unclosed list tags
+ *
+ * @var array
+ * @access private
+ */
+ private $_liStack = array();
+
+ /**
+ * Array of prepared regular expressions for protocols (schemas) matching
+ *
+ * @var array
+ * @access private
+ */
+ private $_protoRegexps = array();
+
+ /**
+ * Array of prepared regular expressions for CSS matching
+ *
+ * @var array
+ * @access private
+ */
+ private $_cssRegexps = array();
+
+ /**
+ * List of single tags ("<tag />")
+ *
+ * @var array
+ * @access public
+ */
+ public $singleTags = array('area', 'br', 'img', 'input', 'hr', 'wbr', );
+
+ /**
+ * List of dangerous tags (such tags will be deleted)
+ *
+ * @var array
+ * @access public
+ */
+ public $deleteTags = array(
+ 'applet', 'base', 'basefont', 'bgsound', 'blink', 'body',
+ 'embed', 'frame', 'frameset', 'head', 'html', 'ilayer',
+ 'iframe', 'layer', 'link', 'meta', 'object', 'style',
+ 'title', 'script',
+ );
+
+ /**
+ * List of dangerous tags (such tags will be deleted, and all content
+ * inside this tags will be also removed)
+ *
+ * @var array
+ * @access public
+ */
+ public $deleteTagsContent = array('script', 'style', 'title', 'xml', );
+
+ /**
+ * Type of protocols filtering ('white' or 'black')
+ *
+ * @var string
+ * @access public
+ */
+ public $protocolFiltering = 'white';
+
+ /**
+ * List of "dangerous" protocols (used for blacklist-filtering)
+ *
+ * @var array
+ * @access public
+ */
+ public $blackProtocols = array(
+ 'about', 'chrome', 'data', 'disk', 'hcp',
+ 'help', 'javascript', 'livescript', 'lynxcgi', 'lynxexec',
+ 'ms-help', 'ms-its', 'mhtml', 'mocha', 'opera',
+ 'res', 'resource', 'shell', 'vbscript', 'view-source',
+ 'vnd.ms.radio', 'wysiwyg',
+ );
+
+ /**
+ * List of "safe" protocols (used for whitelist-filtering)
+ *
+ * @var array
+ * @access public
+ */
+ public $whiteProtocols = array(
+ 'ed2k', 'file', 'ftp', 'gopher', 'http', 'https',
+ 'irc', 'mailto', 'news', 'nntp', 'telnet', 'webcal',
+ 'xmpp', 'callto',
+ );
+
+ /**
+ * List of attributes that can contain protocols
+ *
+ * @var array
+ * @access public
+ */
+ public $protocolAttributes = array(
+ 'action', 'background', 'codebase', 'dynsrc', 'href', 'lowsrc', 'src',
+ );
+
+ /**
+ * List of dangerous CSS keywords
+ *
+ * Whole style="" attribute will be removed, if parser will find one of
+ * these keywords
+ *
+ * @var array
+ * @access public
+ */
+ public $cssKeywords = array(
+ 'absolute', 'behavior', 'behaviour', 'content', 'expression',
+ 'fixed', 'include-source', 'moz-binding',
+ );
+
+ /**
+ * List of tags that can have no "closing tag"
+ *
+ * @var array
+ * @access public
+ * @deprecated XHTML does not allow such tags
+ */
+ public $noClose = array();
+
+ /**
+ * List of block-level tags that terminates paragraph
+ *
+ * Paragraph will be closed when this tags opened
+ *
+ * @var array
+ * @access public
+ */
+ public $closeParagraph = array(
+ 'address', 'blockquote', 'center', 'dd', 'dir', 'div',
+ 'dl', 'dt', 'h1', 'h2', 'h3', 'h4',
+ 'h5', 'h6', 'hr', 'isindex', 'listing', 'marquee',
+ 'menu', 'multicol', 'ol', 'p', 'plaintext', 'pre',
+ 'table', 'ul', 'xmp',
+ );
+
+ /**
+ * List of table tags, all table tags outside a table will be removed
+ *
+ * @var array
+ * @access public
+ */
+ public $tableTags = array(
+ 'caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th',
+ 'thead', 'tr',
+ );
+
+ /**
+ * List of list tags
+ *
+ * @var array
+ * @access public
+ */
+ public $listTags = array('dir', 'menu', 'ol', 'ul', 'dl', );
+
+ /**
+ * List of dangerous attributes
+ *
+ * @var array
+ * @access public
+ */
+ public $attributes = array('dynsrc');
+ //public $attributes = array('dynsrc', 'id', 'name', ); //id and name are dangerous?
+
+ /**
+ * List of allowed "namespaced" attributes
+ *
+ * @var array
+ * @access public
+ */
+ public $attributesNS = array('xml:lang', );
+
+ /**
+ * Constructs class
+ *
+ * @access public
+ */
+ public function __construct()
+ {
+ //making regular expressions based on Proto & CSS arrays
+ foreach ($this->blackProtocols as $proto) {
+ $preg = "/[\s\x01-\x1F]*";
+ for ($i=0; $i<strlen($proto); $i++) {
+ $preg .= $proto{$i} . "[\s\x01-\x1F]*";
+ }
+ $preg .= ":/i";
+ $this->_protoRegexps[] = $preg;
+ }
+
+ foreach ($this->cssKeywords as $css) {
+ $this->_cssRegexps[] = '/' . $css . '/i';
+ }
+ return true;
+ }
+
+ /**
+ * Handles the writing of attributes - called from $this->_openHandler()
+ *
+ * @param array $attrs array of attributes $name => $value
+ * @return boolean
+ * @access private
+ */
+ private function _writeAttrs ($attrs)
+ {
+ if (is_array($attrs)) {
+ foreach ($attrs as $name => $value) {
+
+ $name = strtolower($name);
+
+ if (strpos($name, 'on') === 0) {
+ continue;
+ }
+ if (strpos($name, 'data') === 0) {
+ continue;
+ }
+ if (in_array($name, $this->attributes)) {
+ continue;
+ }
+ if (!preg_match("/^[a-z0-9]+$/i", $name)) {
+ if (!in_array($name, $this->attributesNS))
+ {
+ continue;
+ }
+ }
+
+ if (($value === TRUE) || (is_null($value))) {
+ $value = $name;
+ }
+
+ if ($name == 'style') {
+
+ // removes insignificant backslahes
+ $value = str_replace("\\", '', $value);
+
+ // removes CSS comments
+ while (1)
+ {
+ $_value = preg_replace("!/\*.*?\*/!s", '', $value);
+ if ($_value == $value) break;
+ $value = $_value;
+ }
+
+ // replace all & to &amp;
+ $value = str_replace('&amp;', '&', $value);
+ $value = str_replace('&', '&amp;', $value);
+
+ foreach ($this->_cssRegexps as $css) {
+ if (preg_match($css, $value)) {
+ continue 2;
+ }
+ }
+ foreach ($this->_protoRegexps as $proto) {
+ if (preg_match($proto, $value)) {
+ continue 2;
+ }
+ }
+ }
+
+ $tempval = preg_replace('/&#(\d+);?/me', "chr('\\1')", $value); //"'
+ $tempval = preg_replace('/&#x([0-9a-f]+);?/mei', "chr(hexdec('\\1'))", $tempval);
+
+ if ((in_array($name, $this->protocolAttributes)) &&
+ (strpos($tempval, ':') !== false))
+ {
+ if ($this->protocolFiltering == 'black') {
+ foreach ($this->_protoRegexps as $proto) {
+ if (preg_match($proto, $tempval)) continue 2;
+ }
+ } else {
+ $_tempval = explode(':', $tempval);
+ $proto = $_tempval[0];
+ if (!in_array($proto, $this->whiteProtocols)) {
+ continue;
+ }
+ }
+ }
+
+ $value = str_replace("\"", "&quot;", $value);
+ $this->_xhtml .= ' ' . $name . '="' . $value . '"';
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Opening tag handler - called from HTMLSax
+ *
+ * @param object $parser HTML Parser
+ * @param string $name tag name
+ * @param array $attrs tag attributes
+ * @return boolean
+ * @access private
+ */
+ public function _openHandler(&$parser, $name, $attrs)
+ {
+ $name = strtolower($name);
+
+ if (in_array($name, $this->deleteTagsContent)) {
+ array_push($this->_dcStack, $name);
+ $this->_dcCounter[$name] = isset($this->_dcCounter[$name]) ? $this->_dcCounter[$name]+1 : 1;
+ }
+ if (count($this->_dcStack) != 0) {
+ return true;
+ }
+
+ if (in_array($name, $this->deleteTags)) {
+ return true;
+ }
+
+ if (!preg_match("/^[a-z0-9]+$/i", $name)) {
+ if (preg_match("!(?:\@|://)!i", $name)) {
+ $this->_xhtml .= '&lt;' . $name . '&gt;';
+ }
+ return true;
+ }
+
+ if (in_array($name, $this->singleTags)) {
+ $this->_xhtml .= '<' . $name;
+ $this->_writeAttrs($attrs);
+ $this->_xhtml .= ' />';
+ return true;
+ }
+
+ // TABLES: cannot open table elements when we are not inside table
+ if ((isset($this->_counter['table'])) && ($this->_counter['table'] <= 0)
+ && (in_array($name, $this->tableTags)))
+ {
+ return true;
+ }
+
+ // PARAGRAPHS: close paragraph when closeParagraph tags opening
+ if ((in_array($name, $this->closeParagraph)) && (in_array('p', $this->_stack))) {
+ $this->_closeHandler($parser, 'p');
+ }
+
+ // LISTS: we should close <li> if <li> of the same level opening
+ if ($name == 'li' && count($this->_liStack) &&
+ $this->_listScope == $this->_liStack[count($this->_liStack)-1])
+ {
+ $this->_closeHandler($parser, 'li');
+ }
+
+ // LISTS: we want to know on what nesting level of lists we are
+ if (in_array($name, $this->listTags)) {
+ $this->_listScope++;
+ }
+ if ($name == 'li') {
+ array_push($this->_liStack, $this->_listScope);
+ }
+
+ $this->_xhtml .= '<' . $name;
+ $this->_writeAttrs($attrs);
+ $this->_xhtml .= '>';
+ array_push($this->_stack,$name);
+ $this->_counter[$name] = isset($this->_counter[$name]) ? $this->_counter[$name]+1 : 1;
+ return true;
+ }
+
+ /**
+ * Closing tag handler - called from HTMLSax
+ *
+ * @param object $parsers HTML parser
+ * @param string $name tag name
+ * @return boolean
+ * @access private
+ */
+ public function _closeHandler(&$parser, $name)
+ {
+
+ $name = strtolower($name);
+
+ if (isset($this->_dcCounter[$name]) && ($this->_dcCounter[$name] > 0) &&
+ (in_array($name, $this->deleteTagsContent)))
+ {
+ while ($name != ($tag = array_pop($this->_dcStack))) {
+ $this->_dcCounter[$tag]--;
+ }
+
+ $this->_dcCounter[$name]--;
+ }
+
+ if (count($this->_dcStack) != 0) {
+ return true;
+ }
+
+ if ((isset($this->_counter[$name])) && ($this->_counter[$name] > 0)) {
+ while ($name != ($tag = array_pop($this->_stack))) {
+ $this->_closeTag($tag);
+ }
+
+ $this->_closeTag($name);
+ }
+ return true;
+ }
+
+ /**
+ * Closes tag
+ *
+ * @param string $tag tag name
+ * @return boolean
+ * @access private
+ */
+ public function _closeTag($tag)
+ {
+ if (!in_array($tag, $this->noClose)) {
+ $this->_xhtml .= '</' . $tag . '>';
+ }
+
+ $this->_counter[$tag]--;
+
+ if (in_array($tag, $this->listTags)) {
+ $this->_listScope--;
+ }
+
+ if ($tag == 'li') {
+ array_pop($this->_liStack);
+ }
+ return true;
+ }
+
+ /**
+ * Character data handler - called from HTMLSax
+ *
+ * @param object $parser HTML parser
+ * @param string $data textual data
+ * @return boolean
+ * @access private
+ */
+ public function _dataHandler(&$parser, $data)
+ {
+ if (count($this->_dcStack) == 0) {
+ $this->_xhtml .= $data;
+ }
+ return true;
+ }
+
+ /**
+ * Escape handler - called from HTMLSax
+ *
+ * @param object $parser HTML parser
+ * @param string $data comments or other type of data
+ * @return boolean
+ * @access private
+ */
+ public function _escapeHandler(&$parser, $data)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the XHTML document
+ *
+ * @return string Processed (X)HTML document
+ * @access public
+ */
+ public function getXHTML ()
+ {
+ while ($tag = array_pop($this->_stack)) {
+ $this->_closeTag($tag);
+ }
+
+ return $this->_xhtml;
+ }
+
+ /**
+ * Clears current document data
+ *
+ * @return boolean
+ * @access public
+ */
+ public function clear()
+ {
+ $this->_xhtml = '';
+ return true;
+ }
+
+ /**
+ * Main parsing fuction
+ *
+ * @param string $doc HTML document for processing
+ * @return string Processed (X)HTML document
+ * @access public
+ */
+ public function parse($doc, $isUTF7=false)
+ {
+ $this->clear();
+
+ // Save all '<' symbols
+ $doc = preg_replace("/<(?=[^a-zA-Z\/\!\?\%])/", '&lt;', (string)$doc);
+
+ // Web documents shouldn't contains \x00 symbol
+ $doc = str_replace("\x00", '', $doc);
+
+ // Opera6 bug workaround
+ $doc = str_replace("\xC0\xBC", '&lt;', $doc);
+
+ // UTF-7 encoding ASCII decode
+ if($isUTF7)
+ $doc = $this->repackUTF7($doc);
+
+ // Instantiate the parser
+ $parser= new TSax3();
+
+ // Set up the parser
+ $parser->set_object($this);
+
+ $parser->set_element_handler('_openHandler','_closeHandler');
+ $parser->set_data_handler('_dataHandler');
+ $parser->set_escape_handler('_escapeHandler');
+
+ $parser->parse($doc);
+
+ return $this->getXHTML();
+
+ }
+
+
+ /**
+ * UTF-7 decoding fuction
+ *
+ * @param string $str HTML document for recode ASCII part of UTF-7 back to ASCII
+ * @return string Decoded document
+ * @access private
+ */
+ private function repackUTF7($str)
+ {
+ return preg_replace_callback('!\+([0-9a-zA-Z/]+)\-!', array($this, 'repackUTF7Callback'), $str);
+ }
+
+ /**
+ * Additional UTF-7 decoding fuction
+ *
+ * @param string $str String for recode ASCII part of UTF-7 back to ASCII
+ * @return string Recoded string
+ * @access private
+ */
+ private function repackUTF7Callback($str)
+ {
+ $str = base64_decode($str[1]);
+ $str = preg_replace_callback('/^((?:\x00.)*)((?:[^\x00].)+)/', array($this, 'repackUTF7Back'), $str);
+ return preg_replace('/\x00(.)/', '$1', $str);
+ }
+
+ /**
+ * Additional UTF-7 encoding fuction
+ *
+ * @param string $str String for recode ASCII part of UTF-7 back to ASCII
+ * @return string Recoded string
+ * @access private
+ */
+ private function repackUTF7Back($str)
+ {
+ return $str[1].'+'.rtrim(base64_encode($str[2]), '=').'-';
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter.php b/framework/3rdParty/TextHighlighter/Text/Highlighter.php
index b597b909..9ec09cdb 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter.php
@@ -1,397 +1,397 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * Highlighter base class
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Andrey Demenev <demenev@gmail.com>
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: Highlighter.php,v 1.1 2007/06/03 02:35:28 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-// {{{ BC constants
-
-// BC trick : define constants related to default
-// renderer if needed
-if (!defined('HL_NUMBERS_LI')) {
- /**#@+
- * Constant for use with $options['numbers']
- * @see Text_Highlighter_Renderer_Html::_init()
- */
- /**
- * use numbered list
- */
- define ('HL_NUMBERS_LI' , 1);
- /**
- * Use 2-column table with line numbers in left column and code in right column.
- * Forces $options['tag'] = HL_TAG_PRE
- */
- define ('HL_NUMBERS_TABLE' , 2);
- /**#@-*/
-}
-
-// }}}
-// {{{ constants
-/**
- * for our purpose, it is infinity
- */
-define ('HL_INFINITY', 1000000000);
-
-// }}}
-
-/**
- * Text highlighter base class
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-// {{{ Text_Highlighter
-
-/**
- * Text highlighter base class
- *
- * This class implements all functions necessary for highlighting,
- * but it does not contain highlighting rules. Actual highlighting is
- * done using a descendent of this class.
- *
- * One is not supposed to manually create descendent classes.
- * Instead, describe highlighting rules in XML format and
- * use {@link Text_Highlighter_Generator} to create descendent class.
- * Alternatively, an instance of a descendent class can be created
- * directly.
- *
- * Use {@link Text_Highlighter::factory()} to create an
- * object for particular language highlighter
- *
- * Usage example
- * <code>
- *require_once 'Text/Highlighter.php';
- *$hlSQL =& Text_Highlighter::factory('SQL',array('numbers'=>true));
- *echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12');
- * </code>
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @package Text_Highlighter
- * @access public
- */
-
-class Text_Highlighter
-{
- // {{{ members
-
- /**
- * Syntax highlighting rules.
- * Auto-generated classes set this var
- *
- * @access protected
- * @see _init
- * @var array
- */
- var $_syntax;
-
- /**
- * Renderer object.
- *
- * @access private
- * @var array
- */
- var $_renderer;
-
- /**
- * Options. Keeped for BC
- *
- * @access protected
- * @var array
- */
- var $_options = array();
-
- /**
- * Conditionds
- *
- * @access protected
- * @var array
- */
- var $_conditions = array();
-
- /**
- * Disabled keywords
- *
- * @access protected
- * @var array
- */
- var $_disabled = array();
-
- /**
- * Language
- *
- * @access protected
- * @var string
- */
- var $_language = '';
-
- // }}}
- // {{{ _checkDefines
-
- /**
- * Called by subclssses' constructors to enable/disable
- * optional highlighter rules
- *
- * @param array $defines Conditional defines
- *
- * @access protected
- */
- function _checkDefines()
- {
- if (isset($this->_options['defines'])) {
- $defines = $this->_options['defines'];
- } else {
- $defines = array();
- }
- foreach ($this->_conditions as $name => $actions) {
- foreach($actions as $action) {
- $present = in_array($name, $defines);
- if (!$action[1]) {
- $present = !$present;
- }
- if ($present) {
- unset($this->_disabled[$action[0]]);
- } else {
- $this->_disabled[$action[0]] = true;
- }
- }
- }
- }
-
- // }}}
- // {{{ factory
-
- /**
- * Create a new Highlighter object for specified language
- *
- * @param string $lang language, for example "SQL"
- * @param array $options Rendering options. This
- * parameter is only keeped for BC reasons, use
- * {@link Text_Highlighter::setRenderer()} instead
- *
- * @return mixed a newly created Highlighter object, or
- * a PEAR error object on error
- *
- * @static
- * @access public
- */
- public static function factory($lang, $options = array())
- {
- $lang = strtoupper($lang);
- $langFile = dirname(__FILE__)."/Highlighter/$lang.php";
- if (is_file($langFile))
- include_once $langFile;
- else
- return false;
-
- $classname = 'Text_Highlighter_' . $lang;
-
- if (!class_exists($classname))
- return false;
-
- return new $classname($options);
- }
-
- // }}}
- // {{{ setRenderer
-
- /**
- * Set renderer object
- *
- * @param object $renderer Text_Highlighter_Renderer
- *
- * @access public
- */
- function setRenderer($renderer)
- {
- $this->_renderer = $renderer;
- }
-
- // }}}
-
- /**
- * Helper function to find matching brackets
- *
- * @access private
- */
- function _matchingBrackets($str)
- {
- return strtr($str, '()<>[]{}', ')(><][}{');
- }
-
-
-
-
- function _getToken()
- {
- if (!empty($this->_tokenStack)) {
- return array_pop($this->_tokenStack);
- }
- if ($this->_pos >= $this->_len) {
- return NULL;
- }
-
- if ($this->_state != -1 && preg_match($this->_endpattern, $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos)) {
- $endpos = $m[0][1];
- $endmatch = $m[0][0];
- } else {
- $endpos = -1;
- }
- preg_match ($this->_regs[$this->_state], $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos);
- $n = 1;
-
-
- foreach ($this->_counts[$this->_state] as $i=>$count) {
- if (!isset($m[$n])) {
- break;
- }
- if ($m[$n][1]>-1 && ($endpos == -1 || $m[$n][1] < $endpos)) {
- if ($this->_states[$this->_state][$i] != -1) {
- $this->_tokenStack[] = array($this->_delim[$this->_state][$i], $m[$n][0]);
- } else {
- $inner = $this->_inner[$this->_state][$i];
- if (isset($this->_parts[$this->_state][$i])) {
- $parts = array();
- $partpos = $m[$n][1];
- for ($j=1; $j<=$count; $j++) {
- if ($m[$j+$n][1] < 0) {
- continue;
- }
- if (isset($this->_parts[$this->_state][$i][$j])) {
- if ($m[$j+$n][1] > $partpos) {
- array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$j+$n][1]-$partpos)));
- }
- array_unshift($parts, array($this->_parts[$this->_state][$i][$j], $m[$j+$n][0]));
- }
- $partpos = $m[$j+$n][1] + strlen($m[$j+$n][0]);
- }
- if ($partpos < $m[$n][1] + strlen($m[$n][0])) {
- array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$n][1] - $partpos + strlen($m[$n][0]))));
- }
- $this->_tokenStack = array_merge($this->_tokenStack, $parts);
- } else {
- foreach ($this->_keywords[$this->_state][$i] as $g => $re) {
- if (isset($this->_disabled[$g])) {
- continue;
- }
- if (preg_match($re, $m[$n][0])) {
- $inner = $this->_kwmap[$g];
- break;
- }
- }
- $this->_tokenStack[] = array($inner, $m[$n][0]);
- }
- }
- if ($m[$n][1] > $this->_pos) {
- $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $m[$n][1]-$this->_pos));
- }
- $this->_pos = $m[$n][1] + strlen($m[$n][0]);
- if ($this->_states[$this->_state][$i] != -1) {
- $this->_stack[] = array($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern);
- $this->_lastinner = $this->_inner[$this->_state][$i];
- $this->_lastdelim = $this->_delim[$this->_state][$i];
- $l = $this->_state;
- $this->_state = $this->_states[$this->_state][$i];
- $this->_endpattern = $this->_end[$this->_state];
- if ($this->_subst[$l][$i]) {
- for ($k=0; $k<=$this->_counts[$l][$i]; $k++) {
- if (!isset($m[$i+$k])) {
- break;
- }
- $quoted = preg_quote($m[$n+$k][0], '/');
- $this->_endpattern = str_replace('%'.$k.'%', $quoted, $this->_endpattern);
- $this->_endpattern = str_replace('%b'.$k.'%', $this->_matchingBrackets($quoted), $this->_endpattern);
- }
- }
- }
- return array_pop($this->_tokenStack);
- }
- $n += $count + 1;
- }
-
- if ($endpos > -1) {
- $this->_tokenStack[] = array($this->_lastdelim, $endmatch);
- if ($endpos > $this->_pos) {
- $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $endpos-$this->_pos));
- }
- list($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern) = array_pop($this->_stack);
- $this->_pos = $endpos + strlen($endmatch);
- return array_pop($this->_tokenStack);
- }
- $p = $this->_pos;
- $this->_pos = HL_INFINITY;
- return array($this->_lastinner, substr($this->_str, $p));
- }
-
-
-
-
- // {{{ highlight
-
- /**
- * Highlights code
- *
- * @param string $str Code to highlight
- * @access public
- * @return string Highlighted text
- *
- */
-
- function highlight($str)
- {
- if (!($this->_renderer)) {
- include_once('Text/Highlighter/Renderer/Html.php');
- $this->_renderer = new Text_Highlighter_Renderer_Html($this->_options);
- }
- $this->_state = -1;
- $this->_pos = 0;
- $this->_stack = array();
- $this->_tokenStack = array();
- $this->_lastinner = $this->_defClass;
- $this->_lastdelim = $this->_defClass;
- $this->_endpattern = '';
- $this->_renderer->reset();
- $this->_renderer->setCurrentLanguage($this->_language);
- $this->_str = $this->_renderer->preprocess($str);
- $this->_len = strlen($this->_str);
- while ($token = $this->_getToken()) {
- $this->_renderer->acceptToken($token[0], $token[1]);
- }
- $this->_renderer->finalize();
- return $this->_renderer->getOutput();
- }
-
- // }}}
-
-}
-
-// }}}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Highlighter base class
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: Highlighter.php,v 1.1 2007/06/03 02:35:28 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+// {{{ BC constants
+
+// BC trick : define constants related to default
+// renderer if needed
+if (!defined('HL_NUMBERS_LI')) {
+ /**#@+
+ * Constant for use with $options['numbers']
+ * @see Text_Highlighter_Renderer_Html::_init()
+ */
+ /**
+ * use numbered list
+ */
+ define ('HL_NUMBERS_LI' , 1);
+ /**
+ * Use 2-column table with line numbers in left column and code in right column.
+ * Forces $options['tag'] = HL_TAG_PRE
+ */
+ define ('HL_NUMBERS_TABLE' , 2);
+ /**#@-*/
+}
+
+// }}}
+// {{{ constants
+/**
+ * for our purpose, it is infinity
+ */
+define ('HL_INFINITY', 1000000000);
+
+// }}}
+
+/**
+ * Text highlighter base class
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+// {{{ Text_Highlighter
+
+/**
+ * Text highlighter base class
+ *
+ * This class implements all functions necessary for highlighting,
+ * but it does not contain highlighting rules. Actual highlighting is
+ * done using a descendent of this class.
+ *
+ * One is not supposed to manually create descendent classes.
+ * Instead, describe highlighting rules in XML format and
+ * use {@link Text_Highlighter_Generator} to create descendent class.
+ * Alternatively, an instance of a descendent class can be created
+ * directly.
+ *
+ * Use {@link Text_Highlighter::factory()} to create an
+ * object for particular language highlighter
+ *
+ * Usage example
+ * <code>
+ *require_once 'Text/Highlighter.php';
+ *$hlSQL =& Text_Highlighter::factory('SQL',array('numbers'=>true));
+ *echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12');
+ * </code>
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @package Text_Highlighter
+ * @access public
+ */
+
+class Text_Highlighter
+{
+ // {{{ members
+
+ /**
+ * Syntax highlighting rules.
+ * Auto-generated classes set this var
+ *
+ * @access protected
+ * @see _init
+ * @var array
+ */
+ var $_syntax;
+
+ /**
+ * Renderer object.
+ *
+ * @access private
+ * @var array
+ */
+ var $_renderer;
+
+ /**
+ * Options. Keeped for BC
+ *
+ * @access protected
+ * @var array
+ */
+ var $_options = array();
+
+ /**
+ * Conditionds
+ *
+ * @access protected
+ * @var array
+ */
+ var $_conditions = array();
+
+ /**
+ * Disabled keywords
+ *
+ * @access protected
+ * @var array
+ */
+ var $_disabled = array();
+
+ /**
+ * Language
+ *
+ * @access protected
+ * @var string
+ */
+ var $_language = '';
+
+ // }}}
+ // {{{ _checkDefines
+
+ /**
+ * Called by subclssses' constructors to enable/disable
+ * optional highlighter rules
+ *
+ * @param array $defines Conditional defines
+ *
+ * @access protected
+ */
+ function _checkDefines()
+ {
+ if (isset($this->_options['defines'])) {
+ $defines = $this->_options['defines'];
+ } else {
+ $defines = array();
+ }
+ foreach ($this->_conditions as $name => $actions) {
+ foreach($actions as $action) {
+ $present = in_array($name, $defines);
+ if (!$action[1]) {
+ $present = !$present;
+ }
+ if ($present) {
+ unset($this->_disabled[$action[0]]);
+ } else {
+ $this->_disabled[$action[0]] = true;
+ }
+ }
+ }
+ }
+
+ // }}}
+ // {{{ factory
+
+ /**
+ * Create a new Highlighter object for specified language
+ *
+ * @param string $lang language, for example "SQL"
+ * @param array $options Rendering options. This
+ * parameter is only keeped for BC reasons, use
+ * {@link Text_Highlighter::setRenderer()} instead
+ *
+ * @return mixed a newly created Highlighter object, or
+ * a PEAR error object on error
+ *
+ * @static
+ * @access public
+ */
+ public static function factory($lang, $options = array())
+ {
+ $lang = strtoupper($lang);
+ $langFile = dirname(__FILE__)."/Highlighter/$lang.php";
+ if (is_file($langFile))
+ include_once $langFile;
+ else
+ return false;
+
+ $classname = 'Text_Highlighter_' . $lang;
+
+ if (!class_exists($classname))
+ return false;
+
+ return new $classname($options);
+ }
+
+ // }}}
+ // {{{ setRenderer
+
+ /**
+ * Set renderer object
+ *
+ * @param object $renderer Text_Highlighter_Renderer
+ *
+ * @access public
+ */
+ function setRenderer($renderer)
+ {
+ $this->_renderer = $renderer;
+ }
+
+ // }}}
+
+ /**
+ * Helper function to find matching brackets
+ *
+ * @access private
+ */
+ function _matchingBrackets($str)
+ {
+ return strtr($str, '()<>[]{}', ')(><][}{');
+ }
+
+
+
+
+ function _getToken()
+ {
+ if (!empty($this->_tokenStack)) {
+ return array_pop($this->_tokenStack);
+ }
+ if ($this->_pos >= $this->_len) {
+ return NULL;
+ }
+
+ if ($this->_state != -1 && preg_match($this->_endpattern, $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos)) {
+ $endpos = $m[0][1];
+ $endmatch = $m[0][0];
+ } else {
+ $endpos = -1;
+ }
+ preg_match ($this->_regs[$this->_state], $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos);
+ $n = 1;
+
+
+ foreach ($this->_counts[$this->_state] as $i=>$count) {
+ if (!isset($m[$n])) {
+ break;
+ }
+ if ($m[$n][1]>-1 && ($endpos == -1 || $m[$n][1] < $endpos)) {
+ if ($this->_states[$this->_state][$i] != -1) {
+ $this->_tokenStack[] = array($this->_delim[$this->_state][$i], $m[$n][0]);
+ } else {
+ $inner = $this->_inner[$this->_state][$i];
+ if (isset($this->_parts[$this->_state][$i])) {
+ $parts = array();
+ $partpos = $m[$n][1];
+ for ($j=1; $j<=$count; $j++) {
+ if ($m[$j+$n][1] < 0) {
+ continue;
+ }
+ if (isset($this->_parts[$this->_state][$i][$j])) {
+ if ($m[$j+$n][1] > $partpos) {
+ array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$j+$n][1]-$partpos)));
+ }
+ array_unshift($parts, array($this->_parts[$this->_state][$i][$j], $m[$j+$n][0]));
+ }
+ $partpos = $m[$j+$n][1] + strlen($m[$j+$n][0]);
+ }
+ if ($partpos < $m[$n][1] + strlen($m[$n][0])) {
+ array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$n][1] - $partpos + strlen($m[$n][0]))));
+ }
+ $this->_tokenStack = array_merge($this->_tokenStack, $parts);
+ } else {
+ foreach ($this->_keywords[$this->_state][$i] as $g => $re) {
+ if (isset($this->_disabled[$g])) {
+ continue;
+ }
+ if (preg_match($re, $m[$n][0])) {
+ $inner = $this->_kwmap[$g];
+ break;
+ }
+ }
+ $this->_tokenStack[] = array($inner, $m[$n][0]);
+ }
+ }
+ if ($m[$n][1] > $this->_pos) {
+ $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $m[$n][1]-$this->_pos));
+ }
+ $this->_pos = $m[$n][1] + strlen($m[$n][0]);
+ if ($this->_states[$this->_state][$i] != -1) {
+ $this->_stack[] = array($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern);
+ $this->_lastinner = $this->_inner[$this->_state][$i];
+ $this->_lastdelim = $this->_delim[$this->_state][$i];
+ $l = $this->_state;
+ $this->_state = $this->_states[$this->_state][$i];
+ $this->_endpattern = $this->_end[$this->_state];
+ if ($this->_subst[$l][$i]) {
+ for ($k=0; $k<=$this->_counts[$l][$i]; $k++) {
+ if (!isset($m[$i+$k])) {
+ break;
+ }
+ $quoted = preg_quote($m[$n+$k][0], '/');
+ $this->_endpattern = str_replace('%'.$k.'%', $quoted, $this->_endpattern);
+ $this->_endpattern = str_replace('%b'.$k.'%', $this->_matchingBrackets($quoted), $this->_endpattern);
+ }
+ }
+ }
+ return array_pop($this->_tokenStack);
+ }
+ $n += $count + 1;
+ }
+
+ if ($endpos > -1) {
+ $this->_tokenStack[] = array($this->_lastdelim, $endmatch);
+ if ($endpos > $this->_pos) {
+ $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $endpos-$this->_pos));
+ }
+ list($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern) = array_pop($this->_stack);
+ $this->_pos = $endpos + strlen($endmatch);
+ return array_pop($this->_tokenStack);
+ }
+ $p = $this->_pos;
+ $this->_pos = HL_INFINITY;
+ return array($this->_lastinner, substr($this->_str, $p));
+ }
+
+
+
+
+ // {{{ highlight
+
+ /**
+ * Highlights code
+ *
+ * @param string $str Code to highlight
+ * @access public
+ * @return string Highlighted text
+ *
+ */
+
+ function highlight($str)
+ {
+ if (!($this->_renderer)) {
+ include_once('Text/Highlighter/Renderer/Html.php');
+ $this->_renderer = new Text_Highlighter_Renderer_Html($this->_options);
+ }
+ $this->_state = -1;
+ $this->_pos = 0;
+ $this->_stack = array();
+ $this->_tokenStack = array();
+ $this->_lastinner = $this->_defClass;
+ $this->_lastdelim = $this->_defClass;
+ $this->_endpattern = '';
+ $this->_renderer->reset();
+ $this->_renderer->setCurrentLanguage($this->_language);
+ $this->_str = $this->_renderer->preprocess($str);
+ $this->_len = strlen($this->_str);
+ while ($token = $this->_getToken()) {
+ $this->_renderer->acceptToken($token[0], $token[1]);
+ }
+ $this->_renderer->finalize();
+ return $this->_renderer->getOutput();
+ }
+
+ // }}}
+
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/ABAP.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/ABAP.php
index adeaabf9..153ce9fe 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/ABAP.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/ABAP.php
@@ -1,53 +1,53 @@
-<?php
-/**
- * Auto-generated class. ABAP syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. ABAP syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : abap.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Stoyan Stefanov <ssttoo@gmail.com>
- *
- */
-
-/**
- * @ignore
- */
-
-/**
- * Auto-generated class. ABAP syntax highlighting
- *
+ *
+ */
+
+/**
+ * @ignore
+ */
+
+/**
+ * Auto-generated class. ABAP syntax highlighting
+ *
* @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_ABAP extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_ABAP extends Text_Highlighter
+{
var $_language = 'abap';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)^\\*|")|((?i)\')|((?i)[a-z_\\-]\\w*)/',
@@ -498,8 +498,8 @@ class Text_Highlighter_ABAP extends Text_Highlighter
'reserved' => 'reserved',
'constants' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/CPP.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/CPP.php
index 7be6add9..761297ac 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/CPP.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/CPP.php
@@ -1,56 +1,56 @@
-<?php
-/**
+<?php
+/**
* Auto-generated class. CPP syntax highlighting
*
*
* Thanks to Aaron Kalin for initial
* implementation of this highlighter
- *
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+ *
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : cpp.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Aaron Kalin
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. CPP syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. CPP syntax highlighting
+ *
* @author Aaron Kalin
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_CPP extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_CPP extends Text_Highlighter
+{
var $_language = 'cpp';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/',
@@ -833,8 +833,8 @@ class Text_Highlighter_CPP extends Text_Highlighter
'types' => 'types',
'Common Macros' => 'prepro',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/CSS.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/CSS.php
index 04705ff6..28f92f34 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/CSS.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/CSS.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. CSS syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. CSS syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : css.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. CSS syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. CSS syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_CSS extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_CSS extends Text_Highlighter
+{
var $_language = 'css';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)(@[a-z\\d]+))|((?i)(((\\.|#)?[a-z]+[a-z\\d\\-]*(?![a-z\\d\\-]))|(\\*))(?!\\s*:\\s*[\\s\\{]))|((?i):[a-z][a-z\\d\\-]*)|((?i)\\[)|((?i)\\{)/',
@@ -376,8 +376,8 @@ class Text_Highlighter_CSS extends Text_Highlighter
'propertyValue' => 'string',
'namedcolor' => 'var',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/DIFF.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/DIFF.php
index c27301f5..21e97087 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/DIFF.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/DIFF.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. DIFF syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. DIFF syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : diff.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. DIFF syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. DIFF syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_DIFF extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_DIFF extends Text_Highlighter
+{
var $_language = 'diff';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?m)^\\\\\\sNo\\snewline.+$)|((?m)^\\-\\-\\-$)|((?m)^(diff\\s+\\-|Only\\s+|Index).*$)|((?m)^(\\-\\-\\-|\\+\\+\\+)\\s.+$)|((?m)^\\*.*$)|((?m)^\\+.*$)|((?m)^!.*$)|((?m)^\\<\\s.*$)|((?m)^\\>\\s.*$)|((?m)^\\d+(\\,\\d+)?[acd]\\d+(,\\d+)?$)|((?m)^\\-.*$)|((?m)^\\+.*$)|((?m)^@@.+@@$)|((?m)^d\\d+\\s\\d+$)|((?m)^a\\d+\\s\\d+$)|((?m)^(\\d+)(,\\d+)?(a)$)|((?m)^(\\d+)(,\\d+)?(c)$)|((?m)^(\\d+)(,\\d+)?(d)$)|((?m)^a(\\d+)(\\s\\d+)?$)|((?m)^c(\\d+)(\\s\\d+)?$)|((?m)^d(\\d+)(\\s\\d+)?$)/',
@@ -359,8 +359,8 @@ class Text_Highlighter_DIFF extends Text_Highlighter
);
$this->_kwmap = array (
);
- $this->_defClass = 'default';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'default';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/DTD.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/DTD.php
index ad33e528..1d4a403e 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/DTD.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/DTD.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. DTD syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. DTD syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : dtd.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. DTD syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. DTD syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_DTD extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_DTD extends Text_Highlighter
+{
var $_language = 'dtd';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/(\\<!--)|(\\<\\!\\[)|((\\&|\\%)[\\w\\-\\.]+;)/',
@@ -401,8 +401,8 @@ class Text_Highlighter_DTD extends Text_Highlighter
);
$this->_kwmap = array (
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Generator.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Generator.php
index 896af078..c9bca6aa 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Generator.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Generator.php
@@ -1,1254 +1,1254 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
-* Syntax highlighter class generator
-*
-* To simplify the process of creating new syntax highlighters
-* for different languages, {@link Text_Highlighter_Generator} class is
-* provided. It takes highlighting rules from XML file and generates
-* a code of a class inherited from {@link Text_Highlighter}.
-*
-* PHP versions 4 and 5
-*
-* LICENSE: This source file is subject to version 3.0 of the PHP license
-* that is available through the world-wide-web at the following URI:
-* http://www.php.net/license/3_0.txt. If you did not receive a copy of
-* the PHP License and are unable to obtain it through the web, please
-* send a note to license@php.net so we can mail you a copy immediately.
-*
-* @category Text
-* @package Text_Highlighter
-* @author Andrey Demenev <demenev@gmail.com>
-* @copyright 2004-2006 Andrey Demenev
-* @license http://www.php.net/license/3_0.txt PHP License
-* @version CVS: $Id: Generator.php,v 1.1 2007/06/03 02:36:35 ssttoo Exp $
-* @link http://pear.php.net/package/Text_Highlighter
-*/
-
-// {{{ error codes
-
-define ('TEXT_HIGHLIGHTER_EMPTY_RE', 1);
-define ('TEXT_HIGHLIGHTER_INVALID_RE', 2);
-define ('TEXT_HIGHLIGHTER_EMPTY_OR_MISSING', 3);
-define ('TEXT_HIGHLIGHTER_EMPTY', 4);
-define ('TEXT_HIGHLIGHTER_REGION_REGION', 5);
-define ('TEXT_HIGHLIGHTER_REGION_BLOCK', 6);
-define ('TEXT_HIGHLIGHTER_BLOCK_REGION', 7);
-define ('TEXT_HIGHLIGHTER_KEYWORD_BLOCK', 8);
-define ('TEXT_HIGHLIGHTER_KEYWORD_INHERITS', 9);
-define ('TEXT_HIGHLIGHTER_PARSE', 10);
-define ('TEXT_HIGHLIGHTER_FILE_WRITE', 11);
-define ('TEXT_HIGHLIGHTER_FILE_READ', 12);
-// }}}
-
-/**
-* Syntax highliter class generator class
-*
-* This class is used to generate PHP classes
-* from XML files with highlighting rules
-*
-* Usage example
-* <code>
-*require_once 'Text/Highlighter/Generator.php';
-*$generator =& new Text_Highlighter_Generator('php.xml');
-*$generator->generate();
-*$generator->saveCode('PHP.php');
-* </code>
-*
-* A command line script <b>generate</b> is provided for
-* class generation (installs in scripts/Text/Highlighter).
-*
-* @author Andrey Demenev <demenev@gmail.com>
-* @copyright 2004-2006 Andrey Demenev
-* @license http://www.php.net/license/3_0.txt PHP License
-* @version Release: 0.7.0
-* @link http://pear.php.net/package/Text_Highlighter
-*/
-
-class Text_Highlighter_Generator extends XML_Parser
-{
- // {{{ properties
- /**
- * Whether to do case folding.
- * We have to declare it here, because XML_Parser
- * sets case folding in constructor
- *
- * @var boolean
- */
- var $folding = false;
-
- /**
- * Holds name of file with highlighting rules
- *
- * @var string
- * @access private
- */
- var $_syntaxFile;
-
- /**
- * Current element being processed
- *
- * @var array
- * @access private
- */
- var $_element;
-
- /**
- * List of regions
- *
- * @var array
- * @access private
- */
- var $_regions = array();
-
- /**
- * List of blocks
- *
- * @var array
- * @access private
- */
- var $_blocks = array();
-
- /**
- * List of keyword groups
- *
- * @var array
- * @access private
- */
- var $_keywords = array();
-
- /**
- * List of authors
- *
- * @var array
- * @access private
- */
- var $_authors = array();
-
- /**
- * Name of language
- *
- * @var string
- * @access public
- */
- var $language = '';
-
- /**
- * Generated code
- *
- * @var string
- * @access private
- */
- var $_code = '';
-
- /**
- * Default class
- *
- * @var string
- * @access private
- */
- var $_defClass = 'default';
-
- /**
- * Comment
- *
- * @var string
- * @access private
- */
- var $_comment = '';
-
- /**
- * Flag for comment processing
- *
- * @var boolean
- * @access private
- */
- var $_inComment = false;
-
- /**
- * Sorting order of current block/region
- *
- * @var integer
- * @access private
- */
- var $_blockOrder = 0;
-
- /**
- * Generation errors
- *
- * @var array
- * @access private
- */
- var $_errors;
-
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- *
- * @param string $syntaxFile Name of XML file
- * with syntax highlighting rules
- *
- * @access public
- */
-
- function __construct($syntaxFile = '')
- {
- XML_Parser::XML_Parser(null, 'func');
- $this->_errors = array();
- $this->_declareErrorMessages();
- if ($syntaxFile) {
- $this->setInputFile($syntaxFile);
- }
- }
-
- // }}}
- // {{{ _formatError
-
- /**
- * Format error message
- *
- * @param int $code error code
- * @param string $params parameters
- * @param string $fileName file name
- * @param int $lineNo line number
- * @return array
- * @access public
- */
- function _formatError($code, $params, $fileName, $lineNo)
- {
- $template = $this->_templates[$code];
- $ret = call_user_func_array('sprintf', array_merge(array($template), $params));
- if ($fileName) {
- $ret = '[' . $fileName . '] ' . $ret;
- }
- if ($lineNo) {
- $ret .= ' (line ' . $lineNo . ')';
- }
- return $ret;
- }
-
- // }}}
- // {{{ declareErrorMessages
-
- /**
- * Set up error message templates
- *
- * @access private
- */
- function _declareErrorMessages()
- {
- $this->_templates = array (
- TEXT_HIGHLIGHTER_EMPTY_RE => 'Empty regular expression',
- TEXT_HIGHLIGHTER_INVALID_RE => 'Invalid regular expression : %s',
- TEXT_HIGHLIGHTER_EMPTY_OR_MISSING => 'Empty or missing %s',
- TEXT_HIGHLIGHTER_EMPTY => 'Empty %s',
- TEXT_HIGHLIGHTER_REGION_REGION => 'Region %s refers undefined region %s',
- TEXT_HIGHLIGHTER_REGION_BLOCK => 'Region %s refers undefined block %s',
- TEXT_HIGHLIGHTER_BLOCK_REGION => 'Block %s refers undefined region %s',
- TEXT_HIGHLIGHTER_KEYWORD_BLOCK => 'Keyword group %s refers undefined block %s',
- TEXT_HIGHLIGHTER_KEYWORD_INHERITS => 'Keyword group %s inherits undefined block %s',
- TEXT_HIGHLIGHTER_PARSE => '%s',
- TEXT_HIGHLIGHTER_FILE_WRITE => 'Error writing file %s',
- TEXT_HIGHLIGHTER_FILE_READ => '%s'
- );
- }
-
- // }}}
- // {{{ setInputFile
-
- /**
- * Sets the input xml file to be parsed
- *
- * @param string Filename (full path)
- * @return boolean
- * @access public
- */
- function setInputFile($file)
- {
- $this->_syntaxFile = $file;
- $ret = parent::setInputFile($file);
- if (PEAR::isError($ret)) {
- $this->_error(TEXT_HIGHLIGHTER_FILE_READ, $ret->message);
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ generate
-
- /**
- * Generates class code
- *
- * @access public
- */
-
- function generate()
- {
- $this->_regions = array();
- $this->_blocks = array();
- $this->_keywords = array();
- $this->language = '';
- $this->_code = '';
- $this->_defClass = 'default';
- $this->_comment = '';
- $this->_inComment = false;
- $this->_authors = array();
- $this->_blockOrder = 0;
- $this->_errors = array();
-
- $ret = $this->parse();
- if (PEAR::isError($ret)) {
- $this->_error(TEXT_HIGHLIGHTER_PARSE, $ret->message);
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ getCode
-
- /**
- * Returns generated code as a string.
- *
- * @return string Generated code
- * @access public
- */
-
- function getCode()
- {
- return $this->_code;
- }
-
- // }}}
- // {{{ saveCode
-
- /**
- * Saves generated class to file. Note that {@link Text_Highlighter::factory()}
- * assumes that filename is uppercase (SQL.php, DTD.php, etc), and file
- * is located in Text/Highlighter
- *
- * @param string $filename Name of file to write the code to
- * @return boolean true on success, false on failure
- * @access public
- */
-
- function saveCode($filename)
- {
- $f = @fopen($filename, 'wb');
- if (!$f) {
- $this->_error(TEXT_HIGHLIGHTER_FILE_WRITE, array('outfile'=>$filename));
- return false;
- }
- fwrite ($f, $this->_code);
- fclose($f);
- return true;
- }
-
- // }}}
- // {{{ hasErrors
-
- /**
- * Reports if there were errors
- *
- * @return boolean
- * @access public
- */
-
- function hasErrors()
- {
- return count($this->_errors) > 0;
- }
-
- // }}}
- // {{{ getErrors
-
- /**
- * Returns errors
- *
- * @return array
- * @access public
- */
-
- function getErrors()
- {
- return $this->_errors;
- }
-
- // }}}
- // {{{ _sortBlocks
-
- /**
- * Sorts blocks
- *
- * @access private
- */
-
- function _sortBlocks($b1, $b2) {
- return $b1['order'] - $b2['order'];
- }
-
- // }}}
- // {{{ _sortLookFor
- /**
- * Sort 'look for' list
- * @return int
- * @param string $b1
- * @param string $b2
- */
- function _sortLookFor($b1, $b2) {
- $o1 = isset($this->_blocks[$b1]) ? $this->_blocks[$b1]['order'] : $this->_regions[$b1]['order'];
- $o2 = isset($this->_blocks[$b2]) ? $this->_blocks[$b2]['order'] : $this->_regions[$b2]['order'];
- return $o1 - $o2;
- }
-
- // }}}
- // {{{ _makeRE
-
- /**
- * Adds delimiters and modifiers to regular expression if necessary
- *
- * @param string $text Original RE
- * @return string Final RE
- * @access private
- */
- function _makeRE($text, $case = false)
- {
- if (!strlen($text)) {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_RE);
- }
- if (!strlen($text) || $text{0} != '/') {
- $text = '/' . $text . '/';
- }
- if (!$case) {
- $text .= 'i';
- }
- $php_errormsg = '';
- @preg_match($text, '');
- if ($php_errormsg) {
- $this->_error(TEXT_HIGHLIGHTER_INVALID_RE, $php_errormsg);
- }
- preg_match ('#^/(.+)/(.*)$#', $text, $m);
- if (@$m[2]) {
- $text = '(?' . $m[2] . ')' . $m[1];
- } else {
- $text = $m[1];
- }
- return $text;
- }
-
- // }}}
- // {{{ _exportArray
-
- /**
- * Exports array as PHP code
- *
- * @param array $array
- * @return string Code
- * @access private
- */
- function _exportArray($array)
- {
- $array = var_export($array, true);
- return trim(preg_replace('~^(\s*)~m',' \1\1',$array));
- }
-
- // }}}
- // {{{ _countSubpatterns
- /**
- * Find number of capturing suppaterns in regular expression
- * @return int
- * @param string $re Regular expression (without delimiters)
- */
- function _countSubpatterns($re)
- {
- preg_match_all('/' . $re . '/', '', $m);
- return count($m)-1;
- }
-
- // }}}
-
- /**#@+
- * @access private
- * @param resource $xp XML parser resource
- * @param string $elem XML element name
- * @param array $attribs XML element attributes
- */
-
- // {{{ xmltag_Default
-
- /**
- * start handler for <default> element
- */
- function xmltag_Default($xp, $elem, $attribs)
- {
- $this->_aliasAttributes($attribs);
- if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
- }
- $this->_defClass = @$attribs['innerGroup'];
- }
-
- // }}}
- // {{{ xmltag_Region
-
- /**
- * start handler for <region> element
- */
- function xmltag_Region($xp, $elem, $attribs)
- {
- $this->_aliasAttributes($attribs);
- if (!isset($attribs['name']) || $attribs['name'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'region name');
- }
- if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
- }
- $this->_element = array('name' => $attribs['name']);
- $this->_element['line'] = xml_get_current_line_number($this->parser);
- if (isset($attribs['case'])) {
- $this->_element['case'] = $attribs['case'] == 'yes';
- } else {
- $this->_element['case'] = $this->_case;
- }
- $this->_element['innerGroup'] = $attribs['innerGroup'];
- $this->_element['delimGroup'] = isset($attribs['delimGroup']) ?
- $attribs['delimGroup'] :
- $attribs['innerGroup'];
- $this->_element['start'] = $this->_makeRE(@$attribs['start'], $this->_element['case']);
- $this->_element['end'] = $this->_makeRE(@$attribs['end'], $this->_element['case']);
- $this->_element['contained'] = @$attribs['contained'] == 'yes';
- $this->_element['never-contained'] = @$attribs['never-contained'] == 'yes';
- $this->_element['remember'] = @$attribs['remember'] == 'yes';
- if (isset($attribs['startBOL']) && $attribs['startBOL'] == 'yes') {
- $this->_element['startBOL'] = true;
- }
- if (isset($attribs['endBOL']) && $attribs['endBOL'] == 'yes') {
- $this->_element['endBOL'] = true;
- }
- if (isset($attribs['neverAfter'])) {
- $this->_element['neverafter'] = $this->_makeRE($attribs['neverAfter']);
- }
- }
-
- // }}}
- // {{{ xmltag_Block
-
- /**
- * start handler for <block> element
- */
- function xmltag_Block($xp, $elem, $attribs)
- {
- $this->_aliasAttributes($attribs);
- if (!isset($attribs['name']) || $attribs['name'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'block name');
- }
- if (isset($attribs['innerGroup']) && $attribs['innerGroup'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY, 'innerGroup');
- }
- $this->_element = array('name' => $attribs['name']);
- $this->_element['line'] = xml_get_current_line_number($this->parser);
- if (isset($attribs['case'])) {
- $this->_element['case'] = $attribs['case'] == 'yes';
- } else {
- $this->_element['case'] = $this->_case;
- }
- if (isset($attribs['innerGroup'])) {
- $this->_element['innerGroup'] = @$attribs['innerGroup'];
- }
- $this->_element['match'] = $this->_makeRE($attribs['match'], $this->_element['case']);
- $this->_element['contained'] = @$attribs['contained'] == 'yes';
- $this->_element['multiline'] = @$attribs['multiline'] == 'yes';
- if (isset($attribs['BOL']) && $attribs['BOL'] == 'yes') {
- $this->_element['BOL'] = true;
- }
- if (isset($attribs['neverAfter'])) {
- $this->_element['neverafter'] = $this->_makeRE($attribs['neverAfter']);
- }
- }
-
- // }}}
- // {{{ cdataHandler
-
- /**
- * Character data handler. Used for comment
- */
- function cdataHandler($xp, $cdata)
- {
- if ($this->_inComment) {
- $this->_comment .= $cdata;
- }
- }
-
- // }}}
- // {{{ xmltag_Comment
-
- /**
- * start handler for <comment> element
- */
- function xmltag_Comment($xp, $elem, $attribs)
- {
- $this->_comment = '';
- $this->_inComment = true;
- }
-
- // }}}
- // {{{ xmltag_PartGroup
-
- /**
- * start handler for <partgroup> element
- */
- function xmltag_PartGroup($xp, $elem, $attribs)
- {
- $this->_aliasAttributes($attribs);
- if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
- }
- $this->_element['partClass'][$attribs['index']] = @$attribs['innerGroup'];
- }
-
- // }}}
- // {{{ xmltag_PartClass
-
- /**
- * start handler for <partclass> element
- */
- function xmltag_PartClass($xp, $elem, $attribs)
- {
- $this->xmltag_PartGroup($xp, $elem, $attribs);
- }
-
- // }}}
- // {{{ xmltag_Keywords
-
- /**
- * start handler for <keywords> element
- */
- function xmltag_Keywords($xp, $elem, $attribs)
- {
- $this->_aliasAttributes($attribs);
- if (!isset($attribs['name']) || $attribs['name'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'keyword group name');
- }
- if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
- }
- if (!isset($attribs['inherits']) || $attribs['inherits'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'inherits');
- }
- $this->_element = array('name'=>@$attribs['name']);
- $this->_element['line'] = xml_get_current_line_number($this->parser);
- $this->_element['innerGroup'] = @$attribs['innerGroup'];
- if (isset($attribs['case'])) {
- $this->_element['case'] = $attribs['case'] == 'yes';
- } else {
- $this->_element['case'] = $this->_case;
- }
- $this->_element['inherits'] = @$attribs['inherits'];
- if (isset($attribs['otherwise'])) {
- $this->_element['otherwise'] = $attribs['otherwise'];
- }
- if (isset($attribs['ifdef'])) {
- $this->_element['ifdef'] = $attribs['ifdef'];
- }
- if (isset($attribs['ifndef'])) {
- $this->_element['ifndef'] = $attribs['ifndef'];
- }
- }
-
- // }}}
- // {{{ xmltag_Keyword
-
- /**
- * start handler for <keyword> element
- */
- function xmltag_Keyword($xp, $elem, $attribs)
- {
- if (!isset($attribs['match']) || $attribs['match'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'match');
- }
- $keyword = @$attribs['match'];
- if (!$this->_element['case']) {
- $keyword = strtolower($keyword);
- }
- $this->_element['match'][$keyword] = true;
- }
-
- // }}}
- // {{{ xmltag_Contains
-
- /**
- * start handler for <contains> element
- */
- function xmltag_Contains($xp, $elem, $attribs)
- {
- $this->_element['contains-all'] = @$attribs['all'] == 'yes';
- if (isset($attribs['region'])) {
- $this->_element['contains']['region'][$attribs['region']] =
- xml_get_current_line_number($this->parser);
- }
- if (isset($attribs['block'])) {
- $this->_element['contains']['block'][$attribs['block']] =
- xml_get_current_line_number($this->parser);
- }
- }
-
- // }}}
- // {{{ xmltag_But
-
- /**
- * start handler for <but> element
- */
- function xmltag_But($xp, $elem, $attribs)
- {
- if (isset($attribs['region'])) {
- $this->_element['not-contains']['region'][$attribs['region']] = true;
- }
- if (isset($attribs['block'])) {
- $this->_element['not-contains']['block'][$attribs['block']] = true;
- }
- }
-
- // }}}
- // {{{ xmltag_Onlyin
-
- /**
- * start handler for <onlyin> element
- */
- function xmltag_Onlyin($xp, $elem, $attribs)
- {
- if (!isset($attribs['region']) || $attribs['region'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'region');
- }
- $this->_element['onlyin'][$attribs['region']] = xml_get_current_line_number($this->parser);
- }
-
- // }}}
- // {{{ xmltag_Author
-
- /**
- * start handler for <author> element
- */
- function xmltag_Author($xp, $elem, $attribs)
- {
- if (!isset($attribs['name']) || $attribs['name'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'author name');
- }
- $this->_authors[] = array(
- 'name' => @$attribs['name'],
- 'email' => (string)@$attribs['email']
- );
- }
-
- // }}}
- // {{{ xmltag_Highlight
-
- /**
- * start handler for <highlight> element
- */
- function xmltag_Highlight($xp, $elem, $attribs)
- {
- if (!isset($attribs['lang']) || $attribs['lang'] === '') {
- $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'language name');
- }
- $this->_code = '';
- $this->language = strtoupper(@$attribs['lang']);
- $this->_case = @$attribs['case'] == 'yes';
- }
-
- // }}}
-
- /**#@-*/
-
- // {{{ _error
-
- /**
- * Add an error message
- *
- * @param integer $code Error code
- * @param mixed $message Error message or array with error message parameters
- * @param integer $lineNo Source code line number
- * @access private
- */
- function _error($code, $params = array(), $lineNo = 0)
- {
- if (!$lineNo && !empty($this->parser)) {
- $lineNo = xml_get_current_line_number($this->parser);
- }
- $this->_errors[] = $this->_formatError($code, $params, $this->_syntaxFile, $lineNo);
- }
-
- // }}}
- // {{{ _aliasAttributes
-
- /**
- * BC trick
- *
- * @param array $attrs attributes
- */
- function _aliasAttributes(&$attrs)
- {
- if (isset($attrs['innerClass']) && !isset($attrs['innerGroup'])) {
- $attrs['innerGroup'] = $attrs['innerClass'];
- }
- if (isset($attrs['delimClass']) && !isset($attrs['delimGroup'])) {
- $attrs['delimGroup'] = $attrs['delimClass'];
- }
- if (isset($attrs['partClass']) && !isset($attrs['partGroup'])) {
- $attrs['partGroup'] = $attrs['partClass'];
- }
- }
-
- // }}}
-
- /**#@+
- * @access private
- * @param resource $xp XML parser resource
- * @param string $elem XML element name
- */
-
- // {{{ xmltag_Comment_
-
- /**
- * end handler for <comment> element
- */
- function xmltag_Comment_($xp, $elem)
- {
- $this->_inComment = false;
- }
-
- // }}}
- // {{{ xmltag_Region_
-
- /**
- * end handler for <region> element
- */
- function xmltag_Region_($xp, $elem)
- {
- $this->_element['type'] = 'region';
- $this->_element['order'] = $this->_blockOrder ++;
- $this->_regions[$this->_element['name']] = $this->_element;
- }
-
- // }}}
- // {{{ xmltag_Keywords_
-
- /**
- * end handler for <keywords> element
- */
- function xmltag_Keywords_($xp, $elem)
- {
- $this->_keywords[$this->_element['name']] = $this->_element;
- }
-
- // }}}
- // {{{ xmltag_Block_
-
- /**
- * end handler for <block> element
- */
- function xmltag_Block_($xp, $elem)
- {
- $this->_element['type'] = 'block';
- $this->_element['order'] = $this->_blockOrder ++;
- $this->_blocks[$this->_element['name']] = $this->_element;
- }
-
- // }}}
- // {{{ xmltag_Highlight_
-
- /**
- * end handler for <highlight> element
- */
- function xmltag_Highlight_($xp, $elem)
- {
- $conditions = array();
- $toplevel = array();
- foreach ($this->_blocks as $i => $current) {
- if (!$current['contained'] && !isset($current['onlyin'])) {
- $toplevel[] = $i;
- }
- foreach ((array)@$current['onlyin'] as $region => $lineNo) {
- if (!isset($this->_regions[$region])) {
- $this->_error(TEXT_HIGHLIGHTER_BLOCK_REGION,
- array(
- 'block' => $current['name'],
- 'region' => $region
- ));
- }
- }
- }
- foreach ($this->_regions as $i=>$current) {
- if (!$current['contained'] && !isset($current['onlyin'])) {
- $toplevel[] = $i;
- }
- foreach ((array)@$current['contains']['region'] as $region => $lineNo) {
- if (!isset($this->_regions[$region])) {
- $this->_error(TEXT_HIGHLIGHTER_REGION_REGION,
- array(
- 'region1' => $current['name'],
- 'region2' => $region
- ));
- }
- }
- foreach ((array)@$current['contains']['block'] as $region => $lineNo) {
- if (!isset($this->_blocks[$region])) {
- $this->_error(TEXT_HIGHLIGHTER_REGION_BLOCK,
- array(
- 'block' => $current['name'],
- 'region' => $region
- ));
- }
- }
- foreach ((array)@$current['onlyin'] as $region => $lineNo) {
- if (!isset($this->_regions[$region])) {
- $this->_error(TEXT_HIGHLIGHTER_REGION_REGION,
- array(
- 'region1' => $current['name'],
- 'region2' => $region
- ));
- }
- }
- foreach ($this->_regions as $j => $region) {
- if (isset($region['onlyin'])) {
- $suits = isset($region['onlyin'][$current['name']]);
- } elseif (isset($current['not-contains']['region'][$region['name']])) {
- $suits = false;
- } elseif (isset($current['contains']['region'][$region['name']])) {
- $suits = true;
- } else {
- $suits = @$current['contains-all'] && @!$region['never-contained'];
- }
- if ($suits) {
- $this->_regions[$i]['lookfor'][] = $j;
- }
- }
- foreach ($this->_blocks as $j=>$region) {
- if (isset($region['onlyin'])) {
- $suits = isset($region['onlyin'][$current['name']]);
- } elseif (isset($current['not-contains']['block'][$region['name']])) {
- $suits = false;
- } elseif (isset($current['contains']['block'][$region['name']])) {
- $suits = true;
- } else {
- $suits = @$current['contains-all'] && @!$region['never-contained'];
- }
- if ($suits) {
- $this->_regions[$i]['lookfor'][] = $j;
- }
- }
- }
- foreach ($this->_blocks as $i=>$current) {
- unset ($this->_blocks[$i]['never-contained']);
- unset ($this->_blocks[$i]['contained']);
- unset ($this->_blocks[$i]['contains-all']);
- unset ($this->_blocks[$i]['contains']);
- unset ($this->_blocks[$i]['onlyin']);
- unset ($this->_blocks[$i]['line']);
- }
-
- foreach ($this->_regions as $i=>$current) {
- unset ($this->_regions[$i]['never-contained']);
- unset ($this->_regions[$i]['contained']);
- unset ($this->_regions[$i]['contains-all']);
- unset ($this->_regions[$i]['contains']);
- unset ($this->_regions[$i]['onlyin']);
- unset ($this->_regions[$i]['line']);
- }
-
- foreach ($this->_keywords as $name => $keyword) {
- if (isset($keyword['ifdef'])) {
- $conditions[$keyword['ifdef']][] = array($name, true);
- }
- if (isset($keyword['ifndef'])) {
- $conditions[$keyword['ifndef']][] = array($name, false);
- }
- unset($this->_keywords[$name]['line']);
- if (!isset($this->_blocks[$keyword['inherits']])) {
- $this->_error(TEXT_HIGHLIGHTER_KEYWORD_INHERITS,
- array(
- 'keyword' => $keyword['name'],
- 'block' => $keyword['inherits']
- ));
- }
- if (isset($keyword['otherwise']) && !isset($this->_blocks[$keyword['otherwise']]) ) {
- $this->_error(TEXT_HIGHLIGHTER_KEYWORD_BLOCK,
- array(
- 'keyword' => $keyword['name'],
- 'block' => $keyword['inherits']
- ));
- }
- }
-
- $syntax=array(
- 'keywords' => $this->_keywords,
- 'blocks' => array_merge($this->_blocks, $this->_regions),
- 'toplevel' => $toplevel,
- );
- uasort($syntax['blocks'], array(&$this, '_sortBlocks'));
- foreach ($syntax['blocks'] as $name => $block) {
- if ($block['type'] == 'block') {
- continue;
- }
- if (is_array(@$syntax['blocks'][$name]['lookfor'])) {
- usort($syntax['blocks'][$name]['lookfor'], array(&$this, '_sortLookFor'));
- }
- }
- usort($syntax['toplevel'], array(&$this, '_sortLookFor'));
- $syntax['case'] = $this->_case;
- $this->_code = <<<CODE
-<?php
-/**
- * Auto-generated class. {$this->language} syntax highlighting
-CODE;
-
- if ($this->_comment) {
- $comment = preg_replace('~^~m',' * ',$this->_comment);
- $this->_code .= "\n * \n" . $comment;
- }
-
- $this->_code .= <<<CODE
-
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
- * @version generated from: $this->_syntaxFile
-
-CODE;
-
- foreach ($this->_authors as $author) {
- $this->_code .= ' * @author ' . $author['name'];
- if ($author['email']) {
- $this->_code .= ' <' . $author['email'] . '>';
- }
- $this->_code .= "\n";
- }
-
- $this->_code .= <<<CODE
- *
- */
-
-/**
- * Auto-generated class. {$this->language} syntax highlighting
- *
-
-CODE;
- foreach ($this->_authors as $author) {
- $this->_code .= ' * @author ' . $author['name'];
- if ($author['email']) {
- $this->_code .= ' <' . $author['email']. '>';
- }
- $this->_code .= "\n";
- }
-
-
- $this->_code .= <<<CODE
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_{$this->language} extends Text_Highlighter
-{
-
-CODE;
- $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n";
- $array = var_export($syntax, true);
- $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array));
- // \$this->_syntax = $array;
- $this->_code .= <<<CODE
-
- /**
- * Constructor
- *
- * @param array \$options
- * @access public
- */
- function __construct(\$options=array())
- {
-
-CODE;
- $this->_code .= <<<CODE
-
- \$this->_options = \$options;
-CODE;
- $states = array();
- $i = 0;
- foreach ($syntax['blocks'] as $name => $block) {
- if ($block['type'] == 'region') {
- $states[$name] = $i++;
- }
- }
- $regs = array();
- $counts = array();
- $delim = array();
- $inner = array();
- $end = array();
- $stat = array();
- $keywords = array();
- $parts = array();
- $kwmap = array();
- $subst = array();
- $re = array();
- $ce = array();
- $rd = array();
- $in = array();
- $st = array();
- $kw = array();
- $sb = array();
- foreach ($syntax['toplevel'] as $name) {
- $block = $syntax['blocks'][$name];
- if ($block['type'] == 'block') {
- $kwm = array();
- $re[] = '(' . $block['match'] . ')';
- $ce[] = $this->_countSubpatterns($block['match']);
- $rd[] = '';
- $sb[] = false;;
- $st[] = -1;
- foreach ($syntax['keywords'] as $kwname => $kwgroup) {
- if ($kwgroup['inherits'] != $name) {
- continue;
- }
- $gre = implode('|', array_keys($kwgroup['match']));
- if (!$kwgroup['case']) {
- $gre = '(?i)' . $gre;
- }
- $kwm[$kwname][] = $gre;
- $kwmap[$kwname] = $kwgroup['innerGroup'];
- }
- foreach ($kwm as $g => $ma) {
- $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/';
- }
- $kw[] = $kwm;
- } else {
- $kw[] = -1;
- $re[] = '(' . $block['start'] . ')';
- $ce[] = $this->_countSubpatterns($block['start']);
- $rd[] = $block['delimGroup'];
- $st[] = $states[$name];
- $sb[] = $block['remember'];
- }
- $in[] = $block['innerGroup'];
- }
- $re = implode('|', $re);
- $regs[-1] = '/' . $re . '/';
- $counts[-1] = $ce;
- $delim[-1] = $rd;
- $inner[-1] = $in;
- $stat[-1] = $st;
- $keywords[-1] = $kw;
- $subst[-1] = $sb;
-
- foreach ($syntax['blocks'] as $ablock) {
- if ($ablock['type'] != 'region') {
- continue;
- }
- $end[] = '/' . $ablock['end'] . '/';
- $re = array();
- $ce = array();
- $rd = array();
- $in = array();
- $st = array();
- $kw = array();
- $pc = array();
- $sb = array();
- foreach ((array)@$ablock['lookfor'] as $name) {
- $block = $syntax['blocks'][$name];
- if (isset($block['partClass'])) {
- $pc[] = $block['partClass'];
- } else {
- $pc[] = null;
- }
- if ($block['type'] == 'block') {
- $kwm = array();;
- $re[] = '(' . $block['match'] . ')';
- $ce[] = $this->_countSubpatterns($block['match']);
- $rd[] = '';
- $sb[] = false;
- $st[] = -1;
- foreach ($syntax['keywords'] as $kwname => $kwgroup) {
- if ($kwgroup['inherits'] != $name) {
- continue;
- }
- $gre = implode('|', array_keys($kwgroup['match']));
- if (!$kwgroup['case']) {
- $gre = '(?i)' . $gre;
- }
- $kwm[$kwname][] = $gre;
- $kwmap[$kwname] = $kwgroup['innerGroup'];
- }
- foreach ($kwm as $g => $ma) {
- $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/';
- }
- $kw[] = $kwm;
- } else {
- $sb[] = $block['remember'];
- $kw[] = -1;
- $re[] = '(' . $block['start'] . ')';
- $ce[] = $this->_countSubpatterns($block['start']);
- $rd[] = $block['delimGroup'];
- $st[] = $states[$name];
- }
- $in[] = $block['innerGroup'];
- }
- $re = implode('|', $re);
- $regs[] = '/' . $re . '/';
- $counts[] = $ce;
- $delim[] = $rd;
- $inner[] = $in;
- $stat[] = $st;
- $keywords[] = $kw;
- $parts[] = $pc;
- $subst[] = $sb;
- }
-
-
- $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs);
- $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts);
- $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim);
- $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner);
- $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end);
- $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat);
- $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords);
- $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts);
- $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst);
- $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions);
- $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap);
- $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\'';
- $this->_code .= <<<CODE
-;
- \$this->_checkDefines();
- }
-
-}
-CODE;
-}
-
-// }}}
-}
-
-
-/*
-* Local variables:
-* tab-width: 4
-* c-basic-offset: 4
-* c-hanging-comment-ender-p: nil
-* End:
-*/
-
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+* Syntax highlighter class generator
+*
+* To simplify the process of creating new syntax highlighters
+* for different languages, {@link Text_Highlighter_Generator} class is
+* provided. It takes highlighting rules from XML file and generates
+* a code of a class inherited from {@link Text_Highlighter}.
+*
+* PHP versions 4 and 5
+*
+* LICENSE: This source file is subject to version 3.0 of the PHP license
+* that is available through the world-wide-web at the following URI:
+* http://www.php.net/license/3_0.txt. If you did not receive a copy of
+* the PHP License and are unable to obtain it through the web, please
+* send a note to license@php.net so we can mail you a copy immediately.
+*
+* @category Text
+* @package Text_Highlighter
+* @author Andrey Demenev <demenev@gmail.com>
+* @copyright 2004-2006 Andrey Demenev
+* @license http://www.php.net/license/3_0.txt PHP License
+* @version CVS: $Id: Generator.php,v 1.1 2007/06/03 02:36:35 ssttoo Exp $
+* @link http://pear.php.net/package/Text_Highlighter
+*/
+
+// {{{ error codes
+
+define ('TEXT_HIGHLIGHTER_EMPTY_RE', 1);
+define ('TEXT_HIGHLIGHTER_INVALID_RE', 2);
+define ('TEXT_HIGHLIGHTER_EMPTY_OR_MISSING', 3);
+define ('TEXT_HIGHLIGHTER_EMPTY', 4);
+define ('TEXT_HIGHLIGHTER_REGION_REGION', 5);
+define ('TEXT_HIGHLIGHTER_REGION_BLOCK', 6);
+define ('TEXT_HIGHLIGHTER_BLOCK_REGION', 7);
+define ('TEXT_HIGHLIGHTER_KEYWORD_BLOCK', 8);
+define ('TEXT_HIGHLIGHTER_KEYWORD_INHERITS', 9);
+define ('TEXT_HIGHLIGHTER_PARSE', 10);
+define ('TEXT_HIGHLIGHTER_FILE_WRITE', 11);
+define ('TEXT_HIGHLIGHTER_FILE_READ', 12);
+// }}}
+
+/**
+* Syntax highliter class generator class
+*
+* This class is used to generate PHP classes
+* from XML files with highlighting rules
+*
+* Usage example
+* <code>
+*require_once 'Text/Highlighter/Generator.php';
+*$generator =& new Text_Highlighter_Generator('php.xml');
+*$generator->generate();
+*$generator->saveCode('PHP.php');
+* </code>
+*
+* A command line script <b>generate</b> is provided for
+* class generation (installs in scripts/Text/Highlighter).
+*
+* @author Andrey Demenev <demenev@gmail.com>
+* @copyright 2004-2006 Andrey Demenev
+* @license http://www.php.net/license/3_0.txt PHP License
+* @version Release: 0.7.0
+* @link http://pear.php.net/package/Text_Highlighter
+*/
+
+class Text_Highlighter_Generator extends XML_Parser
+{
+ // {{{ properties
+ /**
+ * Whether to do case folding.
+ * We have to declare it here, because XML_Parser
+ * sets case folding in constructor
+ *
+ * @var boolean
+ */
+ var $folding = false;
+
+ /**
+ * Holds name of file with highlighting rules
+ *
+ * @var string
+ * @access private
+ */
+ var $_syntaxFile;
+
+ /**
+ * Current element being processed
+ *
+ * @var array
+ * @access private
+ */
+ var $_element;
+
+ /**
+ * List of regions
+ *
+ * @var array
+ * @access private
+ */
+ var $_regions = array();
+
+ /**
+ * List of blocks
+ *
+ * @var array
+ * @access private
+ */
+ var $_blocks = array();
+
+ /**
+ * List of keyword groups
+ *
+ * @var array
+ * @access private
+ */
+ var $_keywords = array();
+
+ /**
+ * List of authors
+ *
+ * @var array
+ * @access private
+ */
+ var $_authors = array();
+
+ /**
+ * Name of language
+ *
+ * @var string
+ * @access public
+ */
+ var $language = '';
+
+ /**
+ * Generated code
+ *
+ * @var string
+ * @access private
+ */
+ var $_code = '';
+
+ /**
+ * Default class
+ *
+ * @var string
+ * @access private
+ */
+ var $_defClass = 'default';
+
+ /**
+ * Comment
+ *
+ * @var string
+ * @access private
+ */
+ var $_comment = '';
+
+ /**
+ * Flag for comment processing
+ *
+ * @var boolean
+ * @access private
+ */
+ var $_inComment = false;
+
+ /**
+ * Sorting order of current block/region
+ *
+ * @var integer
+ * @access private
+ */
+ var $_blockOrder = 0;
+
+ /**
+ * Generation errors
+ *
+ * @var array
+ * @access private
+ */
+ var $_errors;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Constructor
+ *
+ * @param string $syntaxFile Name of XML file
+ * with syntax highlighting rules
+ *
+ * @access public
+ */
+
+ function __construct($syntaxFile = '')
+ {
+ XML_Parser::XML_Parser(null, 'func');
+ $this->_errors = array();
+ $this->_declareErrorMessages();
+ if ($syntaxFile) {
+ $this->setInputFile($syntaxFile);
+ }
+ }
+
+ // }}}
+ // {{{ _formatError
+
+ /**
+ * Format error message
+ *
+ * @param int $code error code
+ * @param string $params parameters
+ * @param string $fileName file name
+ * @param int $lineNo line number
+ * @return array
+ * @access public
+ */
+ function _formatError($code, $params, $fileName, $lineNo)
+ {
+ $template = $this->_templates[$code];
+ $ret = call_user_func_array('sprintf', array_merge(array($template), $params));
+ if ($fileName) {
+ $ret = '[' . $fileName . '] ' . $ret;
+ }
+ if ($lineNo) {
+ $ret .= ' (line ' . $lineNo . ')';
+ }
+ return $ret;
+ }
+
+ // }}}
+ // {{{ declareErrorMessages
+
+ /**
+ * Set up error message templates
+ *
+ * @access private
+ */
+ function _declareErrorMessages()
+ {
+ $this->_templates = array (
+ TEXT_HIGHLIGHTER_EMPTY_RE => 'Empty regular expression',
+ TEXT_HIGHLIGHTER_INVALID_RE => 'Invalid regular expression : %s',
+ TEXT_HIGHLIGHTER_EMPTY_OR_MISSING => 'Empty or missing %s',
+ TEXT_HIGHLIGHTER_EMPTY => 'Empty %s',
+ TEXT_HIGHLIGHTER_REGION_REGION => 'Region %s refers undefined region %s',
+ TEXT_HIGHLIGHTER_REGION_BLOCK => 'Region %s refers undefined block %s',
+ TEXT_HIGHLIGHTER_BLOCK_REGION => 'Block %s refers undefined region %s',
+ TEXT_HIGHLIGHTER_KEYWORD_BLOCK => 'Keyword group %s refers undefined block %s',
+ TEXT_HIGHLIGHTER_KEYWORD_INHERITS => 'Keyword group %s inherits undefined block %s',
+ TEXT_HIGHLIGHTER_PARSE => '%s',
+ TEXT_HIGHLIGHTER_FILE_WRITE => 'Error writing file %s',
+ TEXT_HIGHLIGHTER_FILE_READ => '%s'
+ );
+ }
+
+ // }}}
+ // {{{ setInputFile
+
+ /**
+ * Sets the input xml file to be parsed
+ *
+ * @param string Filename (full path)
+ * @return boolean
+ * @access public
+ */
+ function setInputFile($file)
+ {
+ $this->_syntaxFile = $file;
+ $ret = parent::setInputFile($file);
+ if (PEAR::isError($ret)) {
+ $this->_error(TEXT_HIGHLIGHTER_FILE_READ, $ret->message);
+ return false;
+ }
+ return true;
+ }
+
+ // }}}
+ // {{{ generate
+
+ /**
+ * Generates class code
+ *
+ * @access public
+ */
+
+ function generate()
+ {
+ $this->_regions = array();
+ $this->_blocks = array();
+ $this->_keywords = array();
+ $this->language = '';
+ $this->_code = '';
+ $this->_defClass = 'default';
+ $this->_comment = '';
+ $this->_inComment = false;
+ $this->_authors = array();
+ $this->_blockOrder = 0;
+ $this->_errors = array();
+
+ $ret = $this->parse();
+ if (PEAR::isError($ret)) {
+ $this->_error(TEXT_HIGHLIGHTER_PARSE, $ret->message);
+ return false;
+ }
+ return true;
+ }
+
+ // }}}
+ // {{{ getCode
+
+ /**
+ * Returns generated code as a string.
+ *
+ * @return string Generated code
+ * @access public
+ */
+
+ function getCode()
+ {
+ return $this->_code;
+ }
+
+ // }}}
+ // {{{ saveCode
+
+ /**
+ * Saves generated class to file. Note that {@link Text_Highlighter::factory()}
+ * assumes that filename is uppercase (SQL.php, DTD.php, etc), and file
+ * is located in Text/Highlighter
+ *
+ * @param string $filename Name of file to write the code to
+ * @return boolean true on success, false on failure
+ * @access public
+ */
+
+ function saveCode($filename)
+ {
+ $f = @fopen($filename, 'wb');
+ if (!$f) {
+ $this->_error(TEXT_HIGHLIGHTER_FILE_WRITE, array('outfile'=>$filename));
+ return false;
+ }
+ fwrite ($f, $this->_code);
+ fclose($f);
+ return true;
+ }
+
+ // }}}
+ // {{{ hasErrors
+
+ /**
+ * Reports if there were errors
+ *
+ * @return boolean
+ * @access public
+ */
+
+ function hasErrors()
+ {
+ return count($this->_errors) > 0;
+ }
+
+ // }}}
+ // {{{ getErrors
+
+ /**
+ * Returns errors
+ *
+ * @return array
+ * @access public
+ */
+
+ function getErrors()
+ {
+ return $this->_errors;
+ }
+
+ // }}}
+ // {{{ _sortBlocks
+
+ /**
+ * Sorts blocks
+ *
+ * @access private
+ */
+
+ function _sortBlocks($b1, $b2) {
+ return $b1['order'] - $b2['order'];
+ }
+
+ // }}}
+ // {{{ _sortLookFor
+ /**
+ * Sort 'look for' list
+ * @return int
+ * @param string $b1
+ * @param string $b2
+ */
+ function _sortLookFor($b1, $b2) {
+ $o1 = isset($this->_blocks[$b1]) ? $this->_blocks[$b1]['order'] : $this->_regions[$b1]['order'];
+ $o2 = isset($this->_blocks[$b2]) ? $this->_blocks[$b2]['order'] : $this->_regions[$b2]['order'];
+ return $o1 - $o2;
+ }
+
+ // }}}
+ // {{{ _makeRE
+
+ /**
+ * Adds delimiters and modifiers to regular expression if necessary
+ *
+ * @param string $text Original RE
+ * @return string Final RE
+ * @access private
+ */
+ function _makeRE($text, $case = false)
+ {
+ if (!strlen($text)) {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_RE);
+ }
+ if (!strlen($text) || $text{0} != '/') {
+ $text = '/' . $text . '/';
+ }
+ if (!$case) {
+ $text .= 'i';
+ }
+ $php_errormsg = '';
+ @preg_match($text, '');
+ if ($php_errormsg) {
+ $this->_error(TEXT_HIGHLIGHTER_INVALID_RE, $php_errormsg);
+ }
+ preg_match ('#^/(.+)/(.*)$#', $text, $m);
+ if (@$m[2]) {
+ $text = '(?' . $m[2] . ')' . $m[1];
+ } else {
+ $text = $m[1];
+ }
+ return $text;
+ }
+
+ // }}}
+ // {{{ _exportArray
+
+ /**
+ * Exports array as PHP code
+ *
+ * @param array $array
+ * @return string Code
+ * @access private
+ */
+ function _exportArray($array)
+ {
+ $array = var_export($array, true);
+ return trim(preg_replace('~^(\s*)~m',' \1\1',$array));
+ }
+
+ // }}}
+ // {{{ _countSubpatterns
+ /**
+ * Find number of capturing suppaterns in regular expression
+ * @return int
+ * @param string $re Regular expression (without delimiters)
+ */
+ function _countSubpatterns($re)
+ {
+ preg_match_all('/' . $re . '/', '', $m);
+ return count($m)-1;
+ }
+
+ // }}}
+
+ /**#@+
+ * @access private
+ * @param resource $xp XML parser resource
+ * @param string $elem XML element name
+ * @param array $attribs XML element attributes
+ */
+
+ // {{{ xmltag_Default
+
+ /**
+ * start handler for <default> element
+ */
+ function xmltag_Default($xp, $elem, $attribs)
+ {
+ $this->_aliasAttributes($attribs);
+ if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
+ }
+ $this->_defClass = @$attribs['innerGroup'];
+ }
+
+ // }}}
+ // {{{ xmltag_Region
+
+ /**
+ * start handler for <region> element
+ */
+ function xmltag_Region($xp, $elem, $attribs)
+ {
+ $this->_aliasAttributes($attribs);
+ if (!isset($attribs['name']) || $attribs['name'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'region name');
+ }
+ if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
+ }
+ $this->_element = array('name' => $attribs['name']);
+ $this->_element['line'] = xml_get_current_line_number($this->parser);
+ if (isset($attribs['case'])) {
+ $this->_element['case'] = $attribs['case'] == 'yes';
+ } else {
+ $this->_element['case'] = $this->_case;
+ }
+ $this->_element['innerGroup'] = $attribs['innerGroup'];
+ $this->_element['delimGroup'] = isset($attribs['delimGroup']) ?
+ $attribs['delimGroup'] :
+ $attribs['innerGroup'];
+ $this->_element['start'] = $this->_makeRE(@$attribs['start'], $this->_element['case']);
+ $this->_element['end'] = $this->_makeRE(@$attribs['end'], $this->_element['case']);
+ $this->_element['contained'] = @$attribs['contained'] == 'yes';
+ $this->_element['never-contained'] = @$attribs['never-contained'] == 'yes';
+ $this->_element['remember'] = @$attribs['remember'] == 'yes';
+ if (isset($attribs['startBOL']) && $attribs['startBOL'] == 'yes') {
+ $this->_element['startBOL'] = true;
+ }
+ if (isset($attribs['endBOL']) && $attribs['endBOL'] == 'yes') {
+ $this->_element['endBOL'] = true;
+ }
+ if (isset($attribs['neverAfter'])) {
+ $this->_element['neverafter'] = $this->_makeRE($attribs['neverAfter']);
+ }
+ }
+
+ // }}}
+ // {{{ xmltag_Block
+
+ /**
+ * start handler for <block> element
+ */
+ function xmltag_Block($xp, $elem, $attribs)
+ {
+ $this->_aliasAttributes($attribs);
+ if (!isset($attribs['name']) || $attribs['name'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'block name');
+ }
+ if (isset($attribs['innerGroup']) && $attribs['innerGroup'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY, 'innerGroup');
+ }
+ $this->_element = array('name' => $attribs['name']);
+ $this->_element['line'] = xml_get_current_line_number($this->parser);
+ if (isset($attribs['case'])) {
+ $this->_element['case'] = $attribs['case'] == 'yes';
+ } else {
+ $this->_element['case'] = $this->_case;
+ }
+ if (isset($attribs['innerGroup'])) {
+ $this->_element['innerGroup'] = @$attribs['innerGroup'];
+ }
+ $this->_element['match'] = $this->_makeRE($attribs['match'], $this->_element['case']);
+ $this->_element['contained'] = @$attribs['contained'] == 'yes';
+ $this->_element['multiline'] = @$attribs['multiline'] == 'yes';
+ if (isset($attribs['BOL']) && $attribs['BOL'] == 'yes') {
+ $this->_element['BOL'] = true;
+ }
+ if (isset($attribs['neverAfter'])) {
+ $this->_element['neverafter'] = $this->_makeRE($attribs['neverAfter']);
+ }
+ }
+
+ // }}}
+ // {{{ cdataHandler
+
+ /**
+ * Character data handler. Used for comment
+ */
+ function cdataHandler($xp, $cdata)
+ {
+ if ($this->_inComment) {
+ $this->_comment .= $cdata;
+ }
+ }
+
+ // }}}
+ // {{{ xmltag_Comment
+
+ /**
+ * start handler for <comment> element
+ */
+ function xmltag_Comment($xp, $elem, $attribs)
+ {
+ $this->_comment = '';
+ $this->_inComment = true;
+ }
+
+ // }}}
+ // {{{ xmltag_PartGroup
+
+ /**
+ * start handler for <partgroup> element
+ */
+ function xmltag_PartGroup($xp, $elem, $attribs)
+ {
+ $this->_aliasAttributes($attribs);
+ if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
+ }
+ $this->_element['partClass'][$attribs['index']] = @$attribs['innerGroup'];
+ }
+
+ // }}}
+ // {{{ xmltag_PartClass
+
+ /**
+ * start handler for <partclass> element
+ */
+ function xmltag_PartClass($xp, $elem, $attribs)
+ {
+ $this->xmltag_PartGroup($xp, $elem, $attribs);
+ }
+
+ // }}}
+ // {{{ xmltag_Keywords
+
+ /**
+ * start handler for <keywords> element
+ */
+ function xmltag_Keywords($xp, $elem, $attribs)
+ {
+ $this->_aliasAttributes($attribs);
+ if (!isset($attribs['name']) || $attribs['name'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'keyword group name');
+ }
+ if (!isset($attribs['innerGroup']) || $attribs['innerGroup'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'innerGroup');
+ }
+ if (!isset($attribs['inherits']) || $attribs['inherits'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'inherits');
+ }
+ $this->_element = array('name'=>@$attribs['name']);
+ $this->_element['line'] = xml_get_current_line_number($this->parser);
+ $this->_element['innerGroup'] = @$attribs['innerGroup'];
+ if (isset($attribs['case'])) {
+ $this->_element['case'] = $attribs['case'] == 'yes';
+ } else {
+ $this->_element['case'] = $this->_case;
+ }
+ $this->_element['inherits'] = @$attribs['inherits'];
+ if (isset($attribs['otherwise'])) {
+ $this->_element['otherwise'] = $attribs['otherwise'];
+ }
+ if (isset($attribs['ifdef'])) {
+ $this->_element['ifdef'] = $attribs['ifdef'];
+ }
+ if (isset($attribs['ifndef'])) {
+ $this->_element['ifndef'] = $attribs['ifndef'];
+ }
+ }
+
+ // }}}
+ // {{{ xmltag_Keyword
+
+ /**
+ * start handler for <keyword> element
+ */
+ function xmltag_Keyword($xp, $elem, $attribs)
+ {
+ if (!isset($attribs['match']) || $attribs['match'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'match');
+ }
+ $keyword = @$attribs['match'];
+ if (!$this->_element['case']) {
+ $keyword = strtolower($keyword);
+ }
+ $this->_element['match'][$keyword] = true;
+ }
+
+ // }}}
+ // {{{ xmltag_Contains
+
+ /**
+ * start handler for <contains> element
+ */
+ function xmltag_Contains($xp, $elem, $attribs)
+ {
+ $this->_element['contains-all'] = @$attribs['all'] == 'yes';
+ if (isset($attribs['region'])) {
+ $this->_element['contains']['region'][$attribs['region']] =
+ xml_get_current_line_number($this->parser);
+ }
+ if (isset($attribs['block'])) {
+ $this->_element['contains']['block'][$attribs['block']] =
+ xml_get_current_line_number($this->parser);
+ }
+ }
+
+ // }}}
+ // {{{ xmltag_But
+
+ /**
+ * start handler for <but> element
+ */
+ function xmltag_But($xp, $elem, $attribs)
+ {
+ if (isset($attribs['region'])) {
+ $this->_element['not-contains']['region'][$attribs['region']] = true;
+ }
+ if (isset($attribs['block'])) {
+ $this->_element['not-contains']['block'][$attribs['block']] = true;
+ }
+ }
+
+ // }}}
+ // {{{ xmltag_Onlyin
+
+ /**
+ * start handler for <onlyin> element
+ */
+ function xmltag_Onlyin($xp, $elem, $attribs)
+ {
+ if (!isset($attribs['region']) || $attribs['region'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'region');
+ }
+ $this->_element['onlyin'][$attribs['region']] = xml_get_current_line_number($this->parser);
+ }
+
+ // }}}
+ // {{{ xmltag_Author
+
+ /**
+ * start handler for <author> element
+ */
+ function xmltag_Author($xp, $elem, $attribs)
+ {
+ if (!isset($attribs['name']) || $attribs['name'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'author name');
+ }
+ $this->_authors[] = array(
+ 'name' => @$attribs['name'],
+ 'email' => (string)@$attribs['email']
+ );
+ }
+
+ // }}}
+ // {{{ xmltag_Highlight
+
+ /**
+ * start handler for <highlight> element
+ */
+ function xmltag_Highlight($xp, $elem, $attribs)
+ {
+ if (!isset($attribs['lang']) || $attribs['lang'] === '') {
+ $this->_error(TEXT_HIGHLIGHTER_EMPTY_OR_MISSING, 'language name');
+ }
+ $this->_code = '';
+ $this->language = strtoupper(@$attribs['lang']);
+ $this->_case = @$attribs['case'] == 'yes';
+ }
+
+ // }}}
+
+ /**#@-*/
+
+ // {{{ _error
+
+ /**
+ * Add an error message
+ *
+ * @param integer $code Error code
+ * @param mixed $message Error message or array with error message parameters
+ * @param integer $lineNo Source code line number
+ * @access private
+ */
+ function _error($code, $params = array(), $lineNo = 0)
+ {
+ if (!$lineNo && !empty($this->parser)) {
+ $lineNo = xml_get_current_line_number($this->parser);
+ }
+ $this->_errors[] = $this->_formatError($code, $params, $this->_syntaxFile, $lineNo);
+ }
+
+ // }}}
+ // {{{ _aliasAttributes
+
+ /**
+ * BC trick
+ *
+ * @param array $attrs attributes
+ */
+ function _aliasAttributes(&$attrs)
+ {
+ if (isset($attrs['innerClass']) && !isset($attrs['innerGroup'])) {
+ $attrs['innerGroup'] = $attrs['innerClass'];
+ }
+ if (isset($attrs['delimClass']) && !isset($attrs['delimGroup'])) {
+ $attrs['delimGroup'] = $attrs['delimClass'];
+ }
+ if (isset($attrs['partClass']) && !isset($attrs['partGroup'])) {
+ $attrs['partGroup'] = $attrs['partClass'];
+ }
+ }
+
+ // }}}
+
+ /**#@+
+ * @access private
+ * @param resource $xp XML parser resource
+ * @param string $elem XML element name
+ */
+
+ // {{{ xmltag_Comment_
+
+ /**
+ * end handler for <comment> element
+ */
+ function xmltag_Comment_($xp, $elem)
+ {
+ $this->_inComment = false;
+ }
+
+ // }}}
+ // {{{ xmltag_Region_
+
+ /**
+ * end handler for <region> element
+ */
+ function xmltag_Region_($xp, $elem)
+ {
+ $this->_element['type'] = 'region';
+ $this->_element['order'] = $this->_blockOrder ++;
+ $this->_regions[$this->_element['name']] = $this->_element;
+ }
+
+ // }}}
+ // {{{ xmltag_Keywords_
+
+ /**
+ * end handler for <keywords> element
+ */
+ function xmltag_Keywords_($xp, $elem)
+ {
+ $this->_keywords[$this->_element['name']] = $this->_element;
+ }
+
+ // }}}
+ // {{{ xmltag_Block_
+
+ /**
+ * end handler for <block> element
+ */
+ function xmltag_Block_($xp, $elem)
+ {
+ $this->_element['type'] = 'block';
+ $this->_element['order'] = $this->_blockOrder ++;
+ $this->_blocks[$this->_element['name']] = $this->_element;
+ }
+
+ // }}}
+ // {{{ xmltag_Highlight_
+
+ /**
+ * end handler for <highlight> element
+ */
+ function xmltag_Highlight_($xp, $elem)
+ {
+ $conditions = array();
+ $toplevel = array();
+ foreach ($this->_blocks as $i => $current) {
+ if (!$current['contained'] && !isset($current['onlyin'])) {
+ $toplevel[] = $i;
+ }
+ foreach ((array)@$current['onlyin'] as $region => $lineNo) {
+ if (!isset($this->_regions[$region])) {
+ $this->_error(TEXT_HIGHLIGHTER_BLOCK_REGION,
+ array(
+ 'block' => $current['name'],
+ 'region' => $region
+ ));
+ }
+ }
+ }
+ foreach ($this->_regions as $i=>$current) {
+ if (!$current['contained'] && !isset($current['onlyin'])) {
+ $toplevel[] = $i;
+ }
+ foreach ((array)@$current['contains']['region'] as $region => $lineNo) {
+ if (!isset($this->_regions[$region])) {
+ $this->_error(TEXT_HIGHLIGHTER_REGION_REGION,
+ array(
+ 'region1' => $current['name'],
+ 'region2' => $region
+ ));
+ }
+ }
+ foreach ((array)@$current['contains']['block'] as $region => $lineNo) {
+ if (!isset($this->_blocks[$region])) {
+ $this->_error(TEXT_HIGHLIGHTER_REGION_BLOCK,
+ array(
+ 'block' => $current['name'],
+ 'region' => $region
+ ));
+ }
+ }
+ foreach ((array)@$current['onlyin'] as $region => $lineNo) {
+ if (!isset($this->_regions[$region])) {
+ $this->_error(TEXT_HIGHLIGHTER_REGION_REGION,
+ array(
+ 'region1' => $current['name'],
+ 'region2' => $region
+ ));
+ }
+ }
+ foreach ($this->_regions as $j => $region) {
+ if (isset($region['onlyin'])) {
+ $suits = isset($region['onlyin'][$current['name']]);
+ } elseif (isset($current['not-contains']['region'][$region['name']])) {
+ $suits = false;
+ } elseif (isset($current['contains']['region'][$region['name']])) {
+ $suits = true;
+ } else {
+ $suits = @$current['contains-all'] && @!$region['never-contained'];
+ }
+ if ($suits) {
+ $this->_regions[$i]['lookfor'][] = $j;
+ }
+ }
+ foreach ($this->_blocks as $j=>$region) {
+ if (isset($region['onlyin'])) {
+ $suits = isset($region['onlyin'][$current['name']]);
+ } elseif (isset($current['not-contains']['block'][$region['name']])) {
+ $suits = false;
+ } elseif (isset($current['contains']['block'][$region['name']])) {
+ $suits = true;
+ } else {
+ $suits = @$current['contains-all'] && @!$region['never-contained'];
+ }
+ if ($suits) {
+ $this->_regions[$i]['lookfor'][] = $j;
+ }
+ }
+ }
+ foreach ($this->_blocks as $i=>$current) {
+ unset ($this->_blocks[$i]['never-contained']);
+ unset ($this->_blocks[$i]['contained']);
+ unset ($this->_blocks[$i]['contains-all']);
+ unset ($this->_blocks[$i]['contains']);
+ unset ($this->_blocks[$i]['onlyin']);
+ unset ($this->_blocks[$i]['line']);
+ }
+
+ foreach ($this->_regions as $i=>$current) {
+ unset ($this->_regions[$i]['never-contained']);
+ unset ($this->_regions[$i]['contained']);
+ unset ($this->_regions[$i]['contains-all']);
+ unset ($this->_regions[$i]['contains']);
+ unset ($this->_regions[$i]['onlyin']);
+ unset ($this->_regions[$i]['line']);
+ }
+
+ foreach ($this->_keywords as $name => $keyword) {
+ if (isset($keyword['ifdef'])) {
+ $conditions[$keyword['ifdef']][] = array($name, true);
+ }
+ if (isset($keyword['ifndef'])) {
+ $conditions[$keyword['ifndef']][] = array($name, false);
+ }
+ unset($this->_keywords[$name]['line']);
+ if (!isset($this->_blocks[$keyword['inherits']])) {
+ $this->_error(TEXT_HIGHLIGHTER_KEYWORD_INHERITS,
+ array(
+ 'keyword' => $keyword['name'],
+ 'block' => $keyword['inherits']
+ ));
+ }
+ if (isset($keyword['otherwise']) && !isset($this->_blocks[$keyword['otherwise']]) ) {
+ $this->_error(TEXT_HIGHLIGHTER_KEYWORD_BLOCK,
+ array(
+ 'keyword' => $keyword['name'],
+ 'block' => $keyword['inherits']
+ ));
+ }
+ }
+
+ $syntax=array(
+ 'keywords' => $this->_keywords,
+ 'blocks' => array_merge($this->_blocks, $this->_regions),
+ 'toplevel' => $toplevel,
+ );
+ uasort($syntax['blocks'], array(&$this, '_sortBlocks'));
+ foreach ($syntax['blocks'] as $name => $block) {
+ if ($block['type'] == 'block') {
+ continue;
+ }
+ if (is_array(@$syntax['blocks'][$name]['lookfor'])) {
+ usort($syntax['blocks'][$name]['lookfor'], array(&$this, '_sortLookFor'));
+ }
+ }
+ usort($syntax['toplevel'], array(&$this, '_sortLookFor'));
+ $syntax['case'] = $this->_case;
+ $this->_code = <<<CODE
+<?php
+/**
+ * Auto-generated class. {$this->language} syntax highlighting
+CODE;
+
+ if ($this->_comment) {
+ $comment = preg_replace('~^~m',' * ',$this->_comment);
+ $this->_code .= "\n * \n" . $comment;
+ }
+
+ $this->_code .= <<<CODE
+
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
+ * @version generated from: $this->_syntaxFile
+
+CODE;
+
+ foreach ($this->_authors as $author) {
+ $this->_code .= ' * @author ' . $author['name'];
+ if ($author['email']) {
+ $this->_code .= ' <' . $author['email'] . '>';
+ }
+ $this->_code .= "\n";
+ }
+
+ $this->_code .= <<<CODE
+ *
+ */
+
+/**
+ * Auto-generated class. {$this->language} syntax highlighting
+ *
+
+CODE;
+ foreach ($this->_authors as $author) {
+ $this->_code .= ' * @author ' . $author['name'];
+ if ($author['email']) {
+ $this->_code .= ' <' . $author['email']. '>';
+ }
+ $this->_code .= "\n";
+ }
+
+
+ $this->_code .= <<<CODE
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_{$this->language} extends Text_Highlighter
+{
+
+CODE;
+ $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n";
+ $array = var_export($syntax, true);
+ $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array));
+ // \$this->_syntax = $array;
+ $this->_code .= <<<CODE
+
+ /**
+ * Constructor
+ *
+ * @param array \$options
+ * @access public
+ */
+ function __construct(\$options=array())
+ {
+
+CODE;
+ $this->_code .= <<<CODE
+
+ \$this->_options = \$options;
+CODE;
+ $states = array();
+ $i = 0;
+ foreach ($syntax['blocks'] as $name => $block) {
+ if ($block['type'] == 'region') {
+ $states[$name] = $i++;
+ }
+ }
+ $regs = array();
+ $counts = array();
+ $delim = array();
+ $inner = array();
+ $end = array();
+ $stat = array();
+ $keywords = array();
+ $parts = array();
+ $kwmap = array();
+ $subst = array();
+ $re = array();
+ $ce = array();
+ $rd = array();
+ $in = array();
+ $st = array();
+ $kw = array();
+ $sb = array();
+ foreach ($syntax['toplevel'] as $name) {
+ $block = $syntax['blocks'][$name];
+ if ($block['type'] == 'block') {
+ $kwm = array();
+ $re[] = '(' . $block['match'] . ')';
+ $ce[] = $this->_countSubpatterns($block['match']);
+ $rd[] = '';
+ $sb[] = false;;
+ $st[] = -1;
+ foreach ($syntax['keywords'] as $kwname => $kwgroup) {
+ if ($kwgroup['inherits'] != $name) {
+ continue;
+ }
+ $gre = implode('|', array_keys($kwgroup['match']));
+ if (!$kwgroup['case']) {
+ $gre = '(?i)' . $gre;
+ }
+ $kwm[$kwname][] = $gre;
+ $kwmap[$kwname] = $kwgroup['innerGroup'];
+ }
+ foreach ($kwm as $g => $ma) {
+ $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/';
+ }
+ $kw[] = $kwm;
+ } else {
+ $kw[] = -1;
+ $re[] = '(' . $block['start'] . ')';
+ $ce[] = $this->_countSubpatterns($block['start']);
+ $rd[] = $block['delimGroup'];
+ $st[] = $states[$name];
+ $sb[] = $block['remember'];
+ }
+ $in[] = $block['innerGroup'];
+ }
+ $re = implode('|', $re);
+ $regs[-1] = '/' . $re . '/';
+ $counts[-1] = $ce;
+ $delim[-1] = $rd;
+ $inner[-1] = $in;
+ $stat[-1] = $st;
+ $keywords[-1] = $kw;
+ $subst[-1] = $sb;
+
+ foreach ($syntax['blocks'] as $ablock) {
+ if ($ablock['type'] != 'region') {
+ continue;
+ }
+ $end[] = '/' . $ablock['end'] . '/';
+ $re = array();
+ $ce = array();
+ $rd = array();
+ $in = array();
+ $st = array();
+ $kw = array();
+ $pc = array();
+ $sb = array();
+ foreach ((array)@$ablock['lookfor'] as $name) {
+ $block = $syntax['blocks'][$name];
+ if (isset($block['partClass'])) {
+ $pc[] = $block['partClass'];
+ } else {
+ $pc[] = null;
+ }
+ if ($block['type'] == 'block') {
+ $kwm = array();;
+ $re[] = '(' . $block['match'] . ')';
+ $ce[] = $this->_countSubpatterns($block['match']);
+ $rd[] = '';
+ $sb[] = false;
+ $st[] = -1;
+ foreach ($syntax['keywords'] as $kwname => $kwgroup) {
+ if ($kwgroup['inherits'] != $name) {
+ continue;
+ }
+ $gre = implode('|', array_keys($kwgroup['match']));
+ if (!$kwgroup['case']) {
+ $gre = '(?i)' . $gre;
+ }
+ $kwm[$kwname][] = $gre;
+ $kwmap[$kwname] = $kwgroup['innerGroup'];
+ }
+ foreach ($kwm as $g => $ma) {
+ $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/';
+ }
+ $kw[] = $kwm;
+ } else {
+ $sb[] = $block['remember'];
+ $kw[] = -1;
+ $re[] = '(' . $block['start'] . ')';
+ $ce[] = $this->_countSubpatterns($block['start']);
+ $rd[] = $block['delimGroup'];
+ $st[] = $states[$name];
+ }
+ $in[] = $block['innerGroup'];
+ }
+ $re = implode('|', $re);
+ $regs[] = '/' . $re . '/';
+ $counts[] = $ce;
+ $delim[] = $rd;
+ $inner[] = $in;
+ $stat[] = $st;
+ $keywords[] = $kw;
+ $parts[] = $pc;
+ $subst[] = $sb;
+ }
+
+
+ $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs);
+ $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts);
+ $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim);
+ $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner);
+ $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end);
+ $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat);
+ $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords);
+ $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts);
+ $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst);
+ $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions);
+ $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap);
+ $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\'';
+ $this->_code .= <<<CODE
+;
+ \$this->_checkDefines();
+ }
+
+}
+CODE;
+}
+
+// }}}
+}
+
+
+/*
+* Local variables:
+* tab-width: 4
+* c-basic-offset: 4
+* c-hanging-comment-ender-p: nil
+* End:
+*/
+
+?>
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/HTML.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/HTML.php
index 163288a7..eaf001e2 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/HTML.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/HTML.php
@@ -1,53 +1,53 @@
-<?php
-/**
- * Auto-generated class. HTML syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. HTML syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : html.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * @ignore
- */
-
-/**
- * Auto-generated class. HTML syntax highlighting
- *
+ *
+ */
+
+/**
+ * @ignore
+ */
+
+/**
+ * Auto-generated class. HTML syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_HTML extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_HTML extends Text_Highlighter
+{
var $_language = 'html';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\\<!--)|((?i)\\<[\\?\\/]?)|((?i)(&)[\\w\\-\\.]+;)/',
@@ -213,8 +213,8 @@ class Text_Highlighter_HTML extends Text_Highlighter
);
$this->_kwmap = array (
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVA.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVA.php
index ef1e8e29..53c02680 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVA.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVA.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. JAVA syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. JAVA syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : java.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. JAVA syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. JAVA syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_JAVA extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_JAVA extends Text_Highlighter
+{
var $_language = 'java';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)0[xX][\\da-f]+)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
@@ -777,8 +777,8 @@ class Text_Highlighter_JAVA extends Text_Highlighter
'reserved' => 'reserved',
'builtin' => 'builtin',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVASCRIPT.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVASCRIPT.php
index d29a4f64..2055c94e 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVASCRIPT.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/JAVASCRIPT.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. JAVASCRIPT syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. JAVASCRIPT syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : javascript.xml,v 1.2 2007/06/05 21:57:21 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. JAVASCRIPT syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. JAVASCRIPT syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_JAVASCRIPT extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_JAVASCRIPT extends Text_Highlighter
+{
var $_language = 'javascript';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)\\d*\\.?\\d+)/',
@@ -606,8 +606,8 @@ class Text_Highlighter_JAVASCRIPT extends Text_Highlighter
'builtin' => 'builtin',
'reserved' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/MYSQL.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/MYSQL.php
index 0fc75eb2..ba240512 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/MYSQL.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/MYSQL.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. MYSQL syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. MYSQL syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : mysql.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. MYSQL syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. MYSQL syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_MYSQL extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_MYSQL extends Text_Highlighter
+{
var $_language = 'mysql';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)`)|((?i)\\/\\*)|((?i)(#|--\\s).*)|((?i)[a-z_]\\w*(?=\\s*\\())|((?i)[a-z_]\\w*)|((?i)")|((?i)\\()|((?i)\')|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)/',
@@ -409,8 +409,8 @@ class Text_Highlighter_MYSQL extends Text_Highlighter
'function' => 'reserved',
'reserved' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/PERL.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/PERL.php
index ace0d37c..9e8bd752 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/PERL.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/PERL.php
@@ -1,56 +1,56 @@
-<?php
-/**
+<?php
+/**
* Auto-generated class. PERL syntax highlighting
*
* This highlighter is EXPERIMENTAL, so that it may work incorrectly.
* Most rules were created by Mariusz Jakubowski, and extended by me.
* My knowledge of Perl is poor, and Perl syntax seems too
- * complicated to me.
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+ * complicated to me.
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : perl.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Mariusz 'kg' Jakubowski <kg@alternatywa.info>
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. PERL syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. PERL syntax highlighting
+ *
* @author Mariusz 'kg' Jakubowski <kg@alternatywa.info>
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_PERL extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_PERL extends Text_Highlighter
+{
var $_language = 'perl';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?m)^(#!)(.*))|((?m)^=\\w+)|(\\{)|(\\()|(\\[)|((use)\\s+([\\w:]*))|([& ](\\w{2,}::)+\\w{2,})|((?Us)\\b(q[wq]\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|((?Us)\\b(q\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|(#.*)|((?x)(s|tr) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2)((\\\\.|[^\\\\])*?)(\\2[ecgimosx]*))|((?x)(m) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2[ecgimosx]*))|( \\/)|(\\$#?[1-9\'`@!])|((?i)(\\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)(&|\\w+)\'[\\w_\']+\\b)|((?i)(\\{)([a-z1-9]+)(\\}))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(`)|(\')|(")|((?i)[a-z_]\\w*)|(\\d*\\.?\\d+)/',
@@ -1327,8 +1327,8 @@ class Text_Highlighter_PERL extends Text_Highlighter
'missingreserved' => 'reserved',
'flowcontrol' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/PHP.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/PHP.php
index ee49951e..be504b65 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/PHP.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/PHP.php
@@ -1,1089 +1,1089 @@
-<?php
-/**
- * Auto-generated class. PHP syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
- * @version generated from: Text/php.xml
- * @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. PHP syntax highlighting
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_PHP extends Text_Highlighter
-{
- var $_language = 'php';
-
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
- $this->_options = $options;
- $this->_regs = array (
- -1 => '/((?i)(\\<\\?(php|=)?)?)/',
- 0 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
- 1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)\\?\\>)|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
- 2 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
- 3 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
- 4 => '/((?i)\\s@\\w+\\s)|((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\bnote:)|((?i)\\$\\w+\\s*:.*\\$)/',
- 5 => '/((?i)\\\\[\\\\"\'`tnr\\$\\{])|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
- 6 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
- 7 => '/((?i)\\\\[\\\\"\'`tnr\\$\\{])|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
- 8 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)/',
- 9 => '/((?i)\\s@\\w+\\s)|((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\bnote:)|((?i)\\$\\w+\\s*:.*\\$)/',
- 10 => '//',
- );
- $this->_counts = array (
- -1 =>
- array (
- 0 => 2,
- ),
- 0 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 1,
- 7 => 0,
- 8 => 1,
- 9 => 0,
- 10 => 1,
- 11 => 0,
- 12 => 0,
- 13 => 0,
- 14 => 0,
- 15 => 2,
- 16 => 5,
- ),
- 1 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 1,
- 7 => 0,
- 8 => 1,
- 9 => 0,
- 10 => 1,
- 11 => 0,
- 12 => 0,
- 13 => 0,
- 14 => 0,
- 15 => 0,
- 16 => 2,
- 17 => 5,
- ),
- 2 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 1,
- 7 => 0,
- 8 => 1,
- 9 => 0,
- 10 => 1,
- 11 => 0,
- 12 => 0,
- 13 => 0,
- 14 => 0,
- 15 => 2,
- 16 => 5,
- ),
- 3 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 1,
- 7 => 0,
- 8 => 1,
- 9 => 0,
- 10 => 1,
- 11 => 0,
- 12 => 0,
- 13 => 0,
- 14 => 0,
- 15 => 2,
- 16 => 5,
- ),
- 4 =>
- array (
- 0 => 0,
- 1 => 3,
- 2 => 1,
- 3 => 0,
- 4 => 0,
- ),
- 5 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- ),
- 6 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- ),
- 7 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- ),
- 8 =>
- array (
- 0 => 0,
- ),
- 9 =>
- array (
- 0 => 0,
- 1 => 3,
- 2 => 1,
- 3 => 0,
- 4 => 0,
- ),
- 10 =>
- array (
- ),
- );
- $this->_delim = array (
- -1 =>
- array (
- 0 => 'inlinetags',
- ),
- 0 =>
- array (
- 0 => 'brackets',
- 1 => 'brackets',
- 2 => 'brackets',
- 3 => 'comment',
- 4 => 'quotes',
- 5 => 'quotes',
- 6 => 'quotes',
- 7 => 'quotes',
- 8 => 'comment',
- 9 => '',
- 10 => '',
- 11 => '',
- 12 => '',
- 13 => '',
- 14 => '',
- 15 => '',
- 16 => '',
- ),
- 1 =>
- array (
- 0 => 'brackets',
- 1 => 'brackets',
- 2 => 'brackets',
- 3 => 'comment',
- 4 => 'quotes',
- 5 => 'quotes',
- 6 => 'quotes',
- 7 => 'quotes',
- 8 => 'comment',
- 9 => '',
- 10 => '',
- 11 => 'inlinetags',
- 12 => '',
- 13 => '',
- 14 => '',
- 15 => '',
- 16 => '',
- 17 => '',
- ),
- 2 =>
- array (
- 0 => 'brackets',
- 1 => 'brackets',
- 2 => 'brackets',
- 3 => 'comment',
- 4 => 'quotes',
- 5 => 'quotes',
- 6 => 'quotes',
- 7 => 'quotes',
- 8 => 'comment',
- 9 => '',
- 10 => '',
- 11 => '',
- 12 => '',
- 13 => '',
- 14 => '',
- 15 => '',
- 16 => '',
- ),
- 3 =>
- array (
- 0 => 'brackets',
- 1 => 'brackets',
- 2 => 'brackets',
- 3 => 'comment',
- 4 => 'quotes',
- 5 => 'quotes',
- 6 => 'quotes',
- 7 => 'quotes',
- 8 => 'comment',
- 9 => '',
- 10 => '',
- 11 => '',
- 12 => '',
- 13 => '',
- 14 => '',
- 15 => '',
- 16 => '',
- ),
- 4 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- 3 => '',
- 4 => '',
- ),
- 5 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- ),
- 6 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- ),
- 7 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- ),
- 8 =>
- array (
- 0 => '',
- ),
- 9 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- 3 => '',
- 4 => '',
- ),
- 10 =>
- array (
- ),
- );
- $this->_inner = array (
- -1 =>
- array (
- 0 => 'code',
- ),
- 0 =>
- array (
- 0 => 'code',
- 1 => 'code',
- 2 => 'code',
- 3 => 'comment',
- 4 => 'string',
- 5 => 'string',
- 6 => 'string',
- 7 => 'string',
- 8 => 'comment',
- 9 => 'identifier',
- 10 => 'reserved',
- 11 => 'number',
- 12 => 'var',
- 13 => 'number',
- 14 => 'number',
- 15 => 'number',
- 16 => 'number',
- ),
- 1 =>
- array (
- 0 => 'code',
- 1 => 'code',
- 2 => 'code',
- 3 => 'comment',
- 4 => 'string',
- 5 => 'string',
- 6 => 'string',
- 7 => 'string',
- 8 => 'comment',
- 9 => 'identifier',
- 10 => 'reserved',
- 11 => 'default',
- 12 => 'number',
- 13 => 'var',
- 14 => 'number',
- 15 => 'number',
- 16 => 'number',
- 17 => 'number',
- ),
- 2 =>
- array (
- 0 => 'code',
- 1 => 'code',
- 2 => 'code',
- 3 => 'comment',
- 4 => 'string',
- 5 => 'string',
- 6 => 'string',
- 7 => 'string',
- 8 => 'comment',
- 9 => 'identifier',
- 10 => 'reserved',
- 11 => 'number',
- 12 => 'var',
- 13 => 'number',
- 14 => 'number',
- 15 => 'number',
- 16 => 'number',
- ),
- 3 =>
- array (
- 0 => 'code',
- 1 => 'code',
- 2 => 'code',
- 3 => 'comment',
- 4 => 'string',
- 5 => 'string',
- 6 => 'string',
- 7 => 'string',
- 8 => 'comment',
- 9 => 'identifier',
- 10 => 'reserved',
- 11 => 'number',
- 12 => 'var',
- 13 => 'number',
- 14 => 'number',
- 15 => 'number',
- 16 => 'number',
- ),
- 4 =>
- array (
- 0 => 'inlinedoc',
- 1 => 'url',
- 2 => 'url',
- 3 => 'inlinedoc',
- 4 => 'inlinedoc',
- ),
- 5 =>
- array (
- 0 => 'special',
- 1 => 'var',
- 2 => 'var',
- ),
- 6 =>
- array (
- 0 => 'special',
- 1 => 'var',
- 2 => 'var',
- ),
- 7 =>
- array (
- 0 => 'special',
- 1 => 'var',
- 2 => 'var',
- ),
- 8 =>
- array (
- 0 => 'special',
- ),
- 9 =>
- array (
- 0 => 'inlinedoc',
- 1 => 'url',
- 2 => 'url',
- 3 => 'inlinedoc',
- 4 => 'inlinedoc',
- ),
- 10 =>
- array (
- ),
- );
- $this->_end = array (
- 0 => '/(?i)\\?\\>/',
- 1 => '/(?i)\\}/',
- 2 => '/(?i)\\)/',
- 3 => '/(?i)\\]/',
- 4 => '/(?i)\\*\\//',
- 5 => '/(?i)"/',
- 6 => '/(?i)`/',
- 7 => '/(?mi)^%1%;?$/',
- 8 => '/(?i)\'/',
- 9 => '/(?mi)$|(?=\\?\\>)/',
- 10 => '/(?i)\\<\\?(php|=)?/',
- );
- $this->_states = array (
- -1 =>
- array (
- 0 => 0,
- ),
- 0 =>
- array (
- 0 => 1,
- 1 => 2,
- 2 => 3,
- 3 => 4,
- 4 => 5,
- 5 => 6,
- 6 => 7,
- 7 => 8,
- 8 => 9,
- 9 => -1,
- 10 => -1,
- 11 => -1,
- 12 => -1,
- 13 => -1,
- 14 => -1,
- 15 => -1,
- 16 => -1,
- ),
- 1 =>
- array (
- 0 => 1,
- 1 => 2,
- 2 => 3,
- 3 => 4,
- 4 => 5,
- 5 => 6,
- 6 => 7,
- 7 => 8,
- 8 => 9,
- 9 => -1,
- 10 => -1,
- 11 => 10,
- 12 => -1,
- 13 => -1,
- 14 => -1,
- 15 => -1,
- 16 => -1,
- 17 => -1,
- ),
- 2 =>
- array (
- 0 => 1,
- 1 => 2,
- 2 => 3,
- 3 => 4,
- 4 => 5,
- 5 => 6,
- 6 => 7,
- 7 => 8,
- 8 => 9,
- 9 => -1,
- 10 => -1,
- 11 => -1,
- 12 => -1,
- 13 => -1,
- 14 => -1,
- 15 => -1,
- 16 => -1,
- ),
- 3 =>
- array (
- 0 => 1,
- 1 => 2,
- 2 => 3,
- 3 => 4,
- 4 => 5,
- 5 => 6,
- 6 => 7,
- 7 => 8,
- 8 => 9,
- 9 => -1,
- 10 => -1,
- 11 => -1,
- 12 => -1,
- 13 => -1,
- 14 => -1,
- 15 => -1,
- 16 => -1,
- ),
- 4 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- ),
- 5 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- ),
- 6 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- ),
- 7 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- ),
- 8 =>
- array (
- 0 => -1,
- ),
- 9 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- ),
- 10 =>
- array (
- ),
- );
- $this->_keywords = array (
- -1 =>
- array (
- 0 => -1,
- ),
- 0 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- 5 => -1,
- 6 => -1,
- 7 => -1,
- 8 => -1,
- 9 =>
- array (
- 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
- 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
- ),
- 10 =>
- array (
- ),
- 11 =>
- array (
- ),
- 12 =>
- array (
- ),
- 13 =>
- array (
- ),
- 14 =>
- array (
- ),
- 15 =>
- array (
- ),
- 16 =>
- array (
- ),
- ),
- 1 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- 5 => -1,
- 6 => -1,
- 7 => -1,
- 8 => -1,
- 9 =>
- array (
- 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
- 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
- ),
- 10 =>
- array (
- ),
- 11 => -1,
- 12 =>
- array (
- ),
- 13 =>
- array (
- ),
- 14 =>
- array (
- ),
- 15 =>
- array (
- ),
- 16 =>
- array (
- ),
- 17 =>
- array (
- ),
- ),
- 2 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- 5 => -1,
- 6 => -1,
- 7 => -1,
- 8 => -1,
- 9 =>
- array (
- 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
- 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
- ),
- 10 =>
- array (
- ),
- 11 =>
- array (
- ),
- 12 =>
- array (
- ),
- 13 =>
- array (
- ),
- 14 =>
- array (
- ),
- 15 =>
- array (
- ),
- 16 =>
- array (
- ),
- ),
- 3 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => -1,
- 4 => -1,
- 5 => -1,
- 6 => -1,
- 7 => -1,
- 8 => -1,
- 9 =>
- array (
- 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
- 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
- ),
- 10 =>
- array (
- ),
- 11 =>
- array (
- ),
- 12 =>
- array (
- ),
- 13 =>
- array (
- ),
- 14 =>
- array (
- ),
- 15 =>
- array (
- ),
- 16 =>
- array (
- ),
- ),
- 4 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- 3 =>
- array (
- ),
- 4 =>
- array (
- ),
- ),
- 5 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- ),
- 6 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- ),
- 7 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- ),
- 8 =>
- array (
- 0 =>
- array (
- ),
- ),
- 9 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- 3 =>
- array (
- ),
- 4 =>
- array (
- ),
- ),
- 10 =>
- array (
- ),
- );
- $this->_parts = array (
- 0 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- 5 => NULL,
- 6 => NULL,
- 7 => NULL,
- 8 => NULL,
- 9 => NULL,
- 10 => NULL,
- 11 => NULL,
- 12 => NULL,
- 13 => NULL,
- 14 => NULL,
- 15 => NULL,
- 16 => NULL,
- ),
- 1 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- 5 => NULL,
- 6 => NULL,
- 7 => NULL,
- 8 => NULL,
- 9 => NULL,
- 10 => NULL,
- 11 => NULL,
- 12 => NULL,
- 13 => NULL,
- 14 => NULL,
- 15 => NULL,
- 16 => NULL,
- 17 => NULL,
- ),
- 2 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- 5 => NULL,
- 6 => NULL,
- 7 => NULL,
- 8 => NULL,
- 9 => NULL,
- 10 => NULL,
- 11 => NULL,
- 12 => NULL,
- 13 => NULL,
- 14 => NULL,
- 15 => NULL,
- 16 => NULL,
- ),
- 3 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- 5 => NULL,
- 6 => NULL,
- 7 => NULL,
- 8 => NULL,
- 9 => NULL,
- 10 => NULL,
- 11 => NULL,
- 12 => NULL,
- 13 => NULL,
- 14 => NULL,
- 15 => NULL,
- 16 => NULL,
- ),
- 4 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- ),
- 5 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- ),
- 6 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- ),
- 7 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- ),
- 8 =>
- array (
- 0 => NULL,
- ),
- 9 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- 4 => NULL,
- ),
- 10 =>
- array (
- ),
- );
- $this->_subst = array (
- -1 =>
- array (
- 0 => false,
- ),
- 0 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- 5 => false,
- 6 => true,
- 7 => false,
- 8 => false,
- 9 => false,
- 10 => false,
- 11 => false,
- 12 => false,
- 13 => false,
- 14 => false,
- 15 => false,
- 16 => false,
- ),
- 1 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- 5 => false,
- 6 => true,
- 7 => false,
- 8 => false,
- 9 => false,
- 10 => false,
- 11 => false,
- 12 => false,
- 13 => false,
- 14 => false,
- 15 => false,
- 16 => false,
- 17 => false,
- ),
- 2 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- 5 => false,
- 6 => true,
- 7 => false,
- 8 => false,
- 9 => false,
- 10 => false,
- 11 => false,
- 12 => false,
- 13 => false,
- 14 => false,
- 15 => false,
- 16 => false,
- ),
- 3 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- 5 => false,
- 6 => true,
- 7 => false,
- 8 => false,
- 9 => false,
- 10 => false,
- 11 => false,
- 12 => false,
- 13 => false,
- 14 => false,
- 15 => false,
- 16 => false,
- ),
- 4 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- ),
- 5 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- ),
- 6 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- ),
- 7 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- ),
- 8 =>
- array (
- 0 => false,
- ),
- 9 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- 4 => false,
- ),
- 10 =>
- array (
- ),
- );
- $this->_conditions = array (
- );
- $this->_kwmap = array (
- 'constants' => 'reserved',
- 'reserved' => 'reserved',
- );
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+<?php
+/**
+ * Auto-generated class. PHP syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
+ * @version generated from: Text/php.xml
+ * @author Andrey Demenev <demenev@gmail.com>
+ *
+ */
+
+/**
+ * Auto-generated class. PHP syntax highlighting
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_PHP extends Text_Highlighter
+{
+ var $_language = 'php';
+
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
+ $this->_options = $options;
+ $this->_regs = array (
+ -1 => '/((?i)(\\<\\?(php|=)?)?)/',
+ 0 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
+ 1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)\\?\\>)|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
+ 2 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
+ 3 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)`)|((?mi)\\<\\<\\<[\\x20\\x09]*(\\w+)$)|((?i)\')|((?i)(#|\\/\\/))|((?i)[a-z_]\\w*)|((?i)\\((array|int|integer|string|bool|boolean|object|float|double)\\))|((?i)0[xX][\\da-f]+)|((?i)\\$[a-z_]\\w*)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))/',
+ 4 => '/((?i)\\s@\\w+\\s)|((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\bnote:)|((?i)\\$\\w+\\s*:.*\\$)/',
+ 5 => '/((?i)\\\\[\\\\"\'`tnr\\$\\{])|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
+ 6 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
+ 7 => '/((?i)\\\\[\\\\"\'`tnr\\$\\{])|((?i)\\{\\$[a-z_].*\\})|((?i)\\$[a-z_]\\w*)/',
+ 8 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)/',
+ 9 => '/((?i)\\s@\\w+\\s)|((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\bnote:)|((?i)\\$\\w+\\s*:.*\\$)/',
+ 10 => '//',
+ );
+ $this->_counts = array (
+ -1 =>
+ array (
+ 0 => 2,
+ ),
+ 0 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 1,
+ 7 => 0,
+ 8 => 1,
+ 9 => 0,
+ 10 => 1,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 2,
+ 16 => 5,
+ ),
+ 1 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 1,
+ 7 => 0,
+ 8 => 1,
+ 9 => 0,
+ 10 => 1,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 0,
+ 16 => 2,
+ 17 => 5,
+ ),
+ 2 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 1,
+ 7 => 0,
+ 8 => 1,
+ 9 => 0,
+ 10 => 1,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 2,
+ 16 => 5,
+ ),
+ 3 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 1,
+ 7 => 0,
+ 8 => 1,
+ 9 => 0,
+ 10 => 1,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 2,
+ 16 => 5,
+ ),
+ 4 =>
+ array (
+ 0 => 0,
+ 1 => 3,
+ 2 => 1,
+ 3 => 0,
+ 4 => 0,
+ ),
+ 5 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ ),
+ 6 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ ),
+ 7 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ ),
+ 8 =>
+ array (
+ 0 => 0,
+ ),
+ 9 =>
+ array (
+ 0 => 0,
+ 1 => 3,
+ 2 => 1,
+ 3 => 0,
+ 4 => 0,
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_delim = array (
+ -1 =>
+ array (
+ 0 => 'inlinetags',
+ ),
+ 0 =>
+ array (
+ 0 => 'brackets',
+ 1 => 'brackets',
+ 2 => 'brackets',
+ 3 => 'comment',
+ 4 => 'quotes',
+ 5 => 'quotes',
+ 6 => 'quotes',
+ 7 => 'quotes',
+ 8 => 'comment',
+ 9 => '',
+ 10 => '',
+ 11 => '',
+ 12 => '',
+ 13 => '',
+ 14 => '',
+ 15 => '',
+ 16 => '',
+ ),
+ 1 =>
+ array (
+ 0 => 'brackets',
+ 1 => 'brackets',
+ 2 => 'brackets',
+ 3 => 'comment',
+ 4 => 'quotes',
+ 5 => 'quotes',
+ 6 => 'quotes',
+ 7 => 'quotes',
+ 8 => 'comment',
+ 9 => '',
+ 10 => '',
+ 11 => 'inlinetags',
+ 12 => '',
+ 13 => '',
+ 14 => '',
+ 15 => '',
+ 16 => '',
+ 17 => '',
+ ),
+ 2 =>
+ array (
+ 0 => 'brackets',
+ 1 => 'brackets',
+ 2 => 'brackets',
+ 3 => 'comment',
+ 4 => 'quotes',
+ 5 => 'quotes',
+ 6 => 'quotes',
+ 7 => 'quotes',
+ 8 => 'comment',
+ 9 => '',
+ 10 => '',
+ 11 => '',
+ 12 => '',
+ 13 => '',
+ 14 => '',
+ 15 => '',
+ 16 => '',
+ ),
+ 3 =>
+ array (
+ 0 => 'brackets',
+ 1 => 'brackets',
+ 2 => 'brackets',
+ 3 => 'comment',
+ 4 => 'quotes',
+ 5 => 'quotes',
+ 6 => 'quotes',
+ 7 => 'quotes',
+ 8 => 'comment',
+ 9 => '',
+ 10 => '',
+ 11 => '',
+ 12 => '',
+ 13 => '',
+ 14 => '',
+ 15 => '',
+ 16 => '',
+ ),
+ 4 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ 3 => '',
+ 4 => '',
+ ),
+ 5 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ ),
+ 6 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ ),
+ 7 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ ),
+ 8 =>
+ array (
+ 0 => '',
+ ),
+ 9 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ 3 => '',
+ 4 => '',
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_inner = array (
+ -1 =>
+ array (
+ 0 => 'code',
+ ),
+ 0 =>
+ array (
+ 0 => 'code',
+ 1 => 'code',
+ 2 => 'code',
+ 3 => 'comment',
+ 4 => 'string',
+ 5 => 'string',
+ 6 => 'string',
+ 7 => 'string',
+ 8 => 'comment',
+ 9 => 'identifier',
+ 10 => 'reserved',
+ 11 => 'number',
+ 12 => 'var',
+ 13 => 'number',
+ 14 => 'number',
+ 15 => 'number',
+ 16 => 'number',
+ ),
+ 1 =>
+ array (
+ 0 => 'code',
+ 1 => 'code',
+ 2 => 'code',
+ 3 => 'comment',
+ 4 => 'string',
+ 5 => 'string',
+ 6 => 'string',
+ 7 => 'string',
+ 8 => 'comment',
+ 9 => 'identifier',
+ 10 => 'reserved',
+ 11 => 'default',
+ 12 => 'number',
+ 13 => 'var',
+ 14 => 'number',
+ 15 => 'number',
+ 16 => 'number',
+ 17 => 'number',
+ ),
+ 2 =>
+ array (
+ 0 => 'code',
+ 1 => 'code',
+ 2 => 'code',
+ 3 => 'comment',
+ 4 => 'string',
+ 5 => 'string',
+ 6 => 'string',
+ 7 => 'string',
+ 8 => 'comment',
+ 9 => 'identifier',
+ 10 => 'reserved',
+ 11 => 'number',
+ 12 => 'var',
+ 13 => 'number',
+ 14 => 'number',
+ 15 => 'number',
+ 16 => 'number',
+ ),
+ 3 =>
+ array (
+ 0 => 'code',
+ 1 => 'code',
+ 2 => 'code',
+ 3 => 'comment',
+ 4 => 'string',
+ 5 => 'string',
+ 6 => 'string',
+ 7 => 'string',
+ 8 => 'comment',
+ 9 => 'identifier',
+ 10 => 'reserved',
+ 11 => 'number',
+ 12 => 'var',
+ 13 => 'number',
+ 14 => 'number',
+ 15 => 'number',
+ 16 => 'number',
+ ),
+ 4 =>
+ array (
+ 0 => 'inlinedoc',
+ 1 => 'url',
+ 2 => 'url',
+ 3 => 'inlinedoc',
+ 4 => 'inlinedoc',
+ ),
+ 5 =>
+ array (
+ 0 => 'special',
+ 1 => 'var',
+ 2 => 'var',
+ ),
+ 6 =>
+ array (
+ 0 => 'special',
+ 1 => 'var',
+ 2 => 'var',
+ ),
+ 7 =>
+ array (
+ 0 => 'special',
+ 1 => 'var',
+ 2 => 'var',
+ ),
+ 8 =>
+ array (
+ 0 => 'special',
+ ),
+ 9 =>
+ array (
+ 0 => 'inlinedoc',
+ 1 => 'url',
+ 2 => 'url',
+ 3 => 'inlinedoc',
+ 4 => 'inlinedoc',
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_end = array (
+ 0 => '/(?i)\\?\\>/',
+ 1 => '/(?i)\\}/',
+ 2 => '/(?i)\\)/',
+ 3 => '/(?i)\\]/',
+ 4 => '/(?i)\\*\\//',
+ 5 => '/(?i)"/',
+ 6 => '/(?i)`/',
+ 7 => '/(?mi)^%1%;?$/',
+ 8 => '/(?i)\'/',
+ 9 => '/(?mi)$|(?=\\?\\>)/',
+ 10 => '/(?i)\\<\\?(php|=)?/',
+ );
+ $this->_states = array (
+ -1 =>
+ array (
+ 0 => 0,
+ ),
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+ 4 => 5,
+ 5 => 6,
+ 6 => 7,
+ 7 => 8,
+ 8 => 9,
+ 9 => -1,
+ 10 => -1,
+ 11 => -1,
+ 12 => -1,
+ 13 => -1,
+ 14 => -1,
+ 15 => -1,
+ 16 => -1,
+ ),
+ 1 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+ 4 => 5,
+ 5 => 6,
+ 6 => 7,
+ 7 => 8,
+ 8 => 9,
+ 9 => -1,
+ 10 => -1,
+ 11 => 10,
+ 12 => -1,
+ 13 => -1,
+ 14 => -1,
+ 15 => -1,
+ 16 => -1,
+ 17 => -1,
+ ),
+ 2 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+ 4 => 5,
+ 5 => 6,
+ 6 => 7,
+ 7 => 8,
+ 8 => 9,
+ 9 => -1,
+ 10 => -1,
+ 11 => -1,
+ 12 => -1,
+ 13 => -1,
+ 14 => -1,
+ 15 => -1,
+ 16 => -1,
+ ),
+ 3 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+ 4 => 5,
+ 5 => 6,
+ 6 => 7,
+ 7 => 8,
+ 8 => 9,
+ 9 => -1,
+ 10 => -1,
+ 11 => -1,
+ 12 => -1,
+ 13 => -1,
+ 14 => -1,
+ 15 => -1,
+ 16 => -1,
+ ),
+ 4 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ ),
+ 5 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ ),
+ 6 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ ),
+ 7 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ ),
+ 8 =>
+ array (
+ 0 => -1,
+ ),
+ 9 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_keywords = array (
+ -1 =>
+ array (
+ 0 => -1,
+ ),
+ 0 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ 5 => -1,
+ 6 => -1,
+ 7 => -1,
+ 8 => -1,
+ 9 =>
+ array (
+ 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
+ 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
+ ),
+ 10 =>
+ array (
+ ),
+ 11 =>
+ array (
+ ),
+ 12 =>
+ array (
+ ),
+ 13 =>
+ array (
+ ),
+ 14 =>
+ array (
+ ),
+ 15 =>
+ array (
+ ),
+ 16 =>
+ array (
+ ),
+ ),
+ 1 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ 5 => -1,
+ 6 => -1,
+ 7 => -1,
+ 8 => -1,
+ 9 =>
+ array (
+ 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
+ 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
+ ),
+ 10 =>
+ array (
+ ),
+ 11 => -1,
+ 12 =>
+ array (
+ ),
+ 13 =>
+ array (
+ ),
+ 14 =>
+ array (
+ ),
+ 15 =>
+ array (
+ ),
+ 16 =>
+ array (
+ ),
+ 17 =>
+ array (
+ ),
+ ),
+ 2 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ 5 => -1,
+ 6 => -1,
+ 7 => -1,
+ 8 => -1,
+ 9 =>
+ array (
+ 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
+ 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
+ ),
+ 10 =>
+ array (
+ ),
+ 11 =>
+ array (
+ ),
+ 12 =>
+ array (
+ ),
+ 13 =>
+ array (
+ ),
+ 14 =>
+ array (
+ ),
+ 15 =>
+ array (
+ ),
+ 16 =>
+ array (
+ ),
+ ),
+ 3 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => -1,
+ 4 => -1,
+ 5 => -1,
+ 6 => -1,
+ 7 => -1,
+ 8 => -1,
+ 9 =>
+ array (
+ 'constants' => '/^(DIRECTORY_SEPARATOR|PATH_SEPARATOR)$/',
+ 'reserved' => '/^((?i)echo|foreach|else|if|elseif|for|as|while|break|continue|class|const|declare|switch|case|endfor|endswitch|endforeach|endif|array|default|do|enddeclare|eval|exit|die|extends|function|global|include|include_once|require|require_once|isset|empty|list|new|static|unset|var|return|try|catch|final|throw|public|private|protected|abstract|interface|implements|define|__file__|__line__|__class__|__method__|__function__|null|true|false|and|or|xor)$/',
+ ),
+ 10 =>
+ array (
+ ),
+ 11 =>
+ array (
+ ),
+ 12 =>
+ array (
+ ),
+ 13 =>
+ array (
+ ),
+ 14 =>
+ array (
+ ),
+ 15 =>
+ array (
+ ),
+ 16 =>
+ array (
+ ),
+ ),
+ 4 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ 3 =>
+ array (
+ ),
+ 4 =>
+ array (
+ ),
+ ),
+ 5 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ ),
+ 6 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ ),
+ 7 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ ),
+ 8 =>
+ array (
+ 0 =>
+ array (
+ ),
+ ),
+ 9 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ 3 =>
+ array (
+ ),
+ 4 =>
+ array (
+ ),
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_parts = array (
+ 0 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ 5 => NULL,
+ 6 => NULL,
+ 7 => NULL,
+ 8 => NULL,
+ 9 => NULL,
+ 10 => NULL,
+ 11 => NULL,
+ 12 => NULL,
+ 13 => NULL,
+ 14 => NULL,
+ 15 => NULL,
+ 16 => NULL,
+ ),
+ 1 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ 5 => NULL,
+ 6 => NULL,
+ 7 => NULL,
+ 8 => NULL,
+ 9 => NULL,
+ 10 => NULL,
+ 11 => NULL,
+ 12 => NULL,
+ 13 => NULL,
+ 14 => NULL,
+ 15 => NULL,
+ 16 => NULL,
+ 17 => NULL,
+ ),
+ 2 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ 5 => NULL,
+ 6 => NULL,
+ 7 => NULL,
+ 8 => NULL,
+ 9 => NULL,
+ 10 => NULL,
+ 11 => NULL,
+ 12 => NULL,
+ 13 => NULL,
+ 14 => NULL,
+ 15 => NULL,
+ 16 => NULL,
+ ),
+ 3 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ 5 => NULL,
+ 6 => NULL,
+ 7 => NULL,
+ 8 => NULL,
+ 9 => NULL,
+ 10 => NULL,
+ 11 => NULL,
+ 12 => NULL,
+ 13 => NULL,
+ 14 => NULL,
+ 15 => NULL,
+ 16 => NULL,
+ ),
+ 4 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ ),
+ 5 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ ),
+ 6 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ ),
+ 7 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ ),
+ 8 =>
+ array (
+ 0 => NULL,
+ ),
+ 9 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ 4 => NULL,
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_subst = array (
+ -1 =>
+ array (
+ 0 => false,
+ ),
+ 0 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ 5 => false,
+ 6 => true,
+ 7 => false,
+ 8 => false,
+ 9 => false,
+ 10 => false,
+ 11 => false,
+ 12 => false,
+ 13 => false,
+ 14 => false,
+ 15 => false,
+ 16 => false,
+ ),
+ 1 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ 5 => false,
+ 6 => true,
+ 7 => false,
+ 8 => false,
+ 9 => false,
+ 10 => false,
+ 11 => false,
+ 12 => false,
+ 13 => false,
+ 14 => false,
+ 15 => false,
+ 16 => false,
+ 17 => false,
+ ),
+ 2 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ 5 => false,
+ 6 => true,
+ 7 => false,
+ 8 => false,
+ 9 => false,
+ 10 => false,
+ 11 => false,
+ 12 => false,
+ 13 => false,
+ 14 => false,
+ 15 => false,
+ 16 => false,
+ ),
+ 3 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ 5 => false,
+ 6 => true,
+ 7 => false,
+ 8 => false,
+ 9 => false,
+ 10 => false,
+ 11 => false,
+ 12 => false,
+ 13 => false,
+ 14 => false,
+ 15 => false,
+ 16 => false,
+ ),
+ 4 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ ),
+ 5 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ ),
+ 6 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ ),
+ 7 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ ),
+ 8 =>
+ array (
+ 0 => false,
+ ),
+ 9 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ 4 => false,
+ ),
+ 10 =>
+ array (
+ ),
+ );
+ $this->_conditions = array (
+ );
+ $this->_kwmap = array (
+ 'constants' => 'reserved',
+ 'reserved' => 'reserved',
+ );
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/PRADO.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/PRADO.php
index 2bd402c2..dab4a4bc 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/PRADO.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/PRADO.php
@@ -1,254 +1,254 @@
-<?php
-/**
- * Auto-generated class. PRADO syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
- * @version generated from: Text/prado.xml
- * @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. PRADO syntax highlighting
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_PRADO extends Text_Highlighter
-{
- var $_language = 'prado';
-
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
- $this->_options = $options;
- $this->_regs = array (
- -1 => '/((?i)\\<\\!\\[CDATA\\[)|((?i)\\<!--)|((?i)\\<[\\?\\/]?)|((?i)(&|%)[\\w\\-\\.]+;)/',
- 0 => '//',
- 1 => '//',
- 2 => '/((?i)(?<=[\\<\\/?])com:\\w+)|((?i)(?<=[\\<\\/?])[\\w\\-\\:]+)|((?i)[\\w\\-\\:]+)|((?i)")/',
- 3 => '/((?i)(&|%)[\\w\\-\\.]+;)/',
- );
- $this->_counts = array (
- -1 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 1,
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => 0,
- 1 => 0,
- 2 => 0,
- 3 => 0,
- ),
- 3 =>
- array (
- 0 => 1,
- ),
- );
- $this->_delim = array (
- -1 =>
- array (
- 0 => 'comment',
- 1 => 'comment',
- 2 => 'brackets',
- 3 => '',
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => '',
- 1 => '',
- 2 => '',
- 3 => 'quotes',
- ),
- 3 =>
- array (
- 0 => '',
- ),
- );
- $this->_inner = array (
- -1 =>
- array (
- 0 => 'comment',
- 1 => 'comment',
- 2 => 'code',
- 3 => 'special',
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => 'special',
- 1 => 'reserved',
- 2 => 'var',
- 3 => 'string',
- ),
- 3 =>
- array (
- 0 => 'special',
- ),
- );
- $this->_end = array (
- 0 => '/(?i)\\]\\]\\>/',
- 1 => '/(?i)--\\>/',
- 2 => '/(?i)[\\/\\?]?\\>/',
- 3 => '/(?i)"/',
- );
- $this->_states = array (
- -1 =>
- array (
- 0 => 0,
- 1 => 1,
- 2 => 2,
- 3 => -1,
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 => 3,
- ),
- 3 =>
- array (
- 0 => -1,
- ),
- );
- $this->_keywords = array (
- -1 =>
- array (
- 0 => -1,
- 1 => -1,
- 2 => -1,
- 3 =>
- array (
- ),
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- ),
- 3 => -1,
- ),
- 3 =>
- array (
- 0 =>
- array (
- ),
- ),
- );
- $this->_parts = array (
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => NULL,
- 1 => NULL,
- 2 => NULL,
- 3 => NULL,
- ),
- 3 =>
- array (
- 0 => NULL,
- ),
- );
- $this->_subst = array (
- -1 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- ),
- 0 =>
- array (
- ),
- 1 =>
- array (
- ),
- 2 =>
- array (
- 0 => false,
- 1 => false,
- 2 => false,
- 3 => false,
- ),
- 3 =>
- array (
- 0 => false,
- ),
- );
- $this->_conditions = array (
- );
- $this->_kwmap = array (
- );
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+<?php
+/**
+ * Auto-generated class. PRADO syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
+ * @version generated from: Text/prado.xml
+ * @author Andrey Demenev <demenev@gmail.com>
+ *
+ */
+
+/**
+ * Auto-generated class. PRADO syntax highlighting
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_PRADO extends Text_Highlighter
+{
+ var $_language = 'prado';
+
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
+ $this->_options = $options;
+ $this->_regs = array (
+ -1 => '/((?i)\\<\\!\\[CDATA\\[)|((?i)\\<!--)|((?i)\\<[\\?\\/]?)|((?i)(&|%)[\\w\\-\\.]+;)/',
+ 0 => '//',
+ 1 => '//',
+ 2 => '/((?i)(?<=[\\<\\/?])com:\\w+)|((?i)(?<=[\\<\\/?])[\\w\\-\\:]+)|((?i)[\\w\\-\\:]+)|((?i)")/',
+ 3 => '/((?i)(&|%)[\\w\\-\\.]+;)/',
+ );
+ $this->_counts = array (
+ -1 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 1,
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => 0,
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ ),
+ 3 =>
+ array (
+ 0 => 1,
+ ),
+ );
+ $this->_delim = array (
+ -1 =>
+ array (
+ 0 => 'comment',
+ 1 => 'comment',
+ 2 => 'brackets',
+ 3 => '',
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => '',
+ 1 => '',
+ 2 => '',
+ 3 => 'quotes',
+ ),
+ 3 =>
+ array (
+ 0 => '',
+ ),
+ );
+ $this->_inner = array (
+ -1 =>
+ array (
+ 0 => 'comment',
+ 1 => 'comment',
+ 2 => 'code',
+ 3 => 'special',
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => 'special',
+ 1 => 'reserved',
+ 2 => 'var',
+ 3 => 'string',
+ ),
+ 3 =>
+ array (
+ 0 => 'special',
+ ),
+ );
+ $this->_end = array (
+ 0 => '/(?i)\\]\\]\\>/',
+ 1 => '/(?i)--\\>/',
+ 2 => '/(?i)[\\/\\?]?\\>/',
+ 3 => '/(?i)"/',
+ );
+ $this->_states = array (
+ -1 =>
+ array (
+ 0 => 0,
+ 1 => 1,
+ 2 => 2,
+ 3 => -1,
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 => 3,
+ ),
+ 3 =>
+ array (
+ 0 => -1,
+ ),
+ );
+ $this->_keywords = array (
+ -1 =>
+ array (
+ 0 => -1,
+ 1 => -1,
+ 2 => -1,
+ 3 =>
+ array (
+ ),
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ ),
+ 3 => -1,
+ ),
+ 3 =>
+ array (
+ 0 =>
+ array (
+ ),
+ ),
+ );
+ $this->_parts = array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => NULL,
+ 1 => NULL,
+ 2 => NULL,
+ 3 => NULL,
+ ),
+ 3 =>
+ array (
+ 0 => NULL,
+ ),
+ );
+ $this->_subst = array (
+ -1 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ ),
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+ 2 =>
+ array (
+ 0 => false,
+ 1 => false,
+ 2 => false,
+ 3 => false,
+ ),
+ 3 =>
+ array (
+ 0 => false,
+ ),
+ );
+ $this->_conditions = array (
+ );
+ $this->_kwmap = array (
+ );
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/PYTHON.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/PYTHON.php
index 8625ee8b..a1f381cb 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/PYTHON.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/PYTHON.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. PYTHON syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. PYTHON syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : python.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. PYTHON syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. PYTHON syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_PYTHON extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_PYTHON extends Text_Highlighter
+{
var $_language = 'python';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\'\'\')|((?i)""")|((?i)")|((?i)\')|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*(?=\\s*\\())|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)((\\d*\\.\\d+)|(\\d+\\.\\d*)|(\\d+))j)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)|((?i)0[0-7]+l?)|((?i)#.+)/',
@@ -622,8 +622,8 @@ class Text_Highlighter_PYTHON extends Text_Highlighter
'builtin' => 'builtin',
'reserved' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/RUBY.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/RUBY.php
index 80f21d03..3deaa376 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/RUBY.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/RUBY.php
@@ -1,5 +1,5 @@
-<?php
-/**
+<?php
+/**
* Auto-generated class. RUBY syntax highlighting
*
*
@@ -9,50 +9,50 @@
* start of RE), making highlighting improper
*
* %q(a (nested) string) does not get highlighted correctly
- *
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+ *
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : ruby.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. RUBY syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. RUBY syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_RUBY extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_RUBY extends Text_Highlighter
+{
var $_language = 'ruby';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?mi)^__END__$)|((?i)")|((?i)%[Qx]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\')|((?i)%[wq]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\\$(\\W|\\w+))|((?ii)@@?[_a-z][\\d_a-z]*)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)0[xX][\\da-f]+l?)|((?i)\\d+l?|\\b0l?\\b)|((?i)0[0-7]+l?)|((?mi)^=begin$)|((?i)#)|((?i)\\s*\\/)/',
@@ -800,8 +800,8 @@ class Text_Highlighter_RUBY extends Text_Highlighter
$this->_kwmap = array (
'reserved' => 'reserved',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php
index 87b89156..9fcafe2e 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php
@@ -1,152 +1,152 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * Abstract base class for Highlighter renderers
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Andrey Demenev <demenev@gmail.com>
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: Renderer.php,v 1.1 2007/06/03 02:36:35 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * Abstract base class for Highlighter renderers
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- * @abstract
- */
-
-class Text_Highlighter_Renderer
-{
- /**
- * Renderer options
- *
- * @var array
- * @access protected
- */
- public $_options = array();
-
- /**
- * Current language
- *
- * @var string
- * @access protected
- */
- public $_language = '';
-
- /**
- * Constructor
- *
- * @access public
- *
- * @param array $options Rendering options. Renderer-specific.
- */
- function __construct($options = array())
- {
- $this->_options = $options;
- }
-
- /**
- * Resets renderer state
- *
- * @access public
- *
- * @param array $options Rendering options. Renderer-specific.
- */
- function reset()
- {
- return;
- }
-
- /**
- * Preprocesses code
- *
- * @access public
- *
- * @param string $str Code to preprocess
- * @return string Preprocessed code
- */
- function preprocess($str)
- {
- return $str;
- }
-
- /**
- * Accepts next token
- *
- * @abstract
- * @access public
- *
- * @param string $class Token class
- * @param string $content Token content
- */
- function acceptToken($class, $content)
- {
- return;
- }
-
- /**
- * Signals that no more tokens are available
- *
- * @access public
- *
- */
- function finalize()
- {
- return;
- }
-
- /**
- * Get generated output
- *
- * @abstract
- * @return mixed Renderer-specific
- * @access public
- *
- */
- function getOutput()
- {
- return;
- }
-
- /**
- * Set current language
- *
- * @abstract
- * @return void
- * @access public
- *
- */
- function setCurrentLanguage($lang)
- {
- $this->_language = $lang;
- }
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Abstract base class for Highlighter renderers
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: Renderer.php,v 1.1 2007/06/03 02:36:35 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * Abstract base class for Highlighter renderers
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @abstract
+ */
+
+class Text_Highlighter_Renderer
+{
+ /**
+ * Renderer options
+ *
+ * @var array
+ * @access protected
+ */
+ public $_options = array();
+
+ /**
+ * Current language
+ *
+ * @var string
+ * @access protected
+ */
+ public $_language = '';
+
+ /**
+ * Constructor
+ *
+ * @access public
+ *
+ * @param array $options Rendering options. Renderer-specific.
+ */
+ function __construct($options = array())
+ {
+ $this->_options = $options;
+ }
+
+ /**
+ * Resets renderer state
+ *
+ * @access public
+ *
+ * @param array $options Rendering options. Renderer-specific.
+ */
+ function reset()
+ {
+ return;
+ }
+
+ /**
+ * Preprocesses code
+ *
+ * @access public
+ *
+ * @param string $str Code to preprocess
+ * @return string Preprocessed code
+ */
+ function preprocess($str)
+ {
+ return $str;
+ }
+
+ /**
+ * Accepts next token
+ *
+ * @abstract
+ * @access public
+ *
+ * @param string $class Token class
+ * @param string $content Token content
+ */
+ function acceptToken($class, $content)
+ {
+ return;
+ }
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @access public
+ *
+ */
+ function finalize()
+ {
+ return;
+ }
+
+ /**
+ * Get generated output
+ *
+ * @abstract
+ * @return mixed Renderer-specific
+ * @access public
+ *
+ */
+ function getOutput()
+ {
+ return;
+ }
+
+ /**
+ * Set current language
+ *
+ * @abstract
+ * @return void
+ * @access public
+ *
+ */
+ function setCurrentLanguage($lang)
+ {
+ $this->_language = $lang;
+ }
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Array.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Array.php
index 5a0c9c09..ef3ffec1 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Array.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Array.php
@@ -1,199 +1,199 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * Array renderer.
- *
- * Produces an array that contains class names and content pairs.
- * The array can be enumerated or associative. Associative means
- * <code>class =&gt; content</code> pairs.
- * Based on the HTML renderer by Andrey Demenev.
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: Array.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-
-/**
- * Array renderer, based on Andrey Demenev's HTML renderer.
- *
- * In addition to the options supported by the HTML renderer,
- * the following options were also introduced:
- * <ul><li>htmlspecialchars - whether or not htmlspecialchars() will
- * be called on the content, default TRUE</li>
- * <li>enumerated - type of array produced, default FALSE,
- * meaning associative array</li>
- * </ul>
- *
- *
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.5.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_Array extends Text_Highlighter_Renderer
-{
-
- /**#@+
- * @access private
- */
-
- /**
- * Tab size
- *
- * @var integer
- */
- var $_tabsize = 4;
-
- /**
- * Should htmlentities() will be called
- *
- * @var boolean
- */
- var $_htmlspecialchars = true;
-
- /**
- * Enumerated or associative array
- *
- * @var integer
- */
- var $_enumerated = false;
-
- /**
- * Array containing highlighting rules
- *
- * @var array
- */
- var $_output = array();
-
- /**#@-*/
-
- /**
- * Preprocesses code
- *
- * @access public
- *
- * @param string $str Code to preprocess
- * @return string Preprocessed code
- */
- function preprocess($str)
- {
- // normalize whitespace and tabs
- $str = str_replace("\r\n","\n", $str);
- // some browsers refuse to display empty lines
- $str = preg_replace('~^$~m'," ", $str);
- $str = str_replace("\t",str_repeat(' ', $this->_tabsize), $str);
- return rtrim($str);
- }
-
-
- /**
- * Resets renderer state
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- *
- * @access protected
- */
- function reset()
- {
- $this->_output = array();
- $this->_lastClass = 'default';
- if (isset($this->_options['tabsize'])) {
- $this->_tabsize = $this->_options['tabsize'];
- }
- if (isset($this->_options['htmlspecialchars'])) {
- $this->_htmlspecialchars = $this->_options['htmlspecialchars'];
- }
- if (isset($this->_options['enumerated'])) {
- $this->_enumerated = $this->_options['enumerated'];
- }
- }
-
-
-
- /**
- * Accepts next token
- *
- * @abstract
- * @access public
- * @param string $class Token class
- * @param string $content Token content
- */
- function acceptToken($class, $content)
- {
-
-
- $theClass = $this->_getFullClassName($class);
- if ($this->_htmlspecialchars) {
- $content = htmlspecialchars($content);
- }
- if ($this->_enumerated) {
- $this->_output[] = array($class, $content);
- } else {
- $this->_output[][$class] = $content;
- }
- $this->_lastClass = $class;
-
- }
-
-
- /**
- * Given a CSS class name, returns the class name
- * with language name prepended, if necessary
- *
- * @access private
- *
- * @param string $class Token class
- */
- function _getFullClassName($class)
- {
- if (!empty($this->_options['use_language'])) {
- $theClass = $this->_language . '-' . $class;
- } else {
- $theClass = $class;
- }
- return $theClass;
- }
-
- /**
- * Get generated output
- *
- * @abstract
- * @return array Highlighted code as an array
- * @access public
- */
- function getOutput()
- {
- return $this->_output;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Array renderer.
+ *
+ * Produces an array that contains class names and content pairs.
+ * The array can be enumerated or associative. Associative means
+ * <code>class =&gt; content</code> pairs.
+ * Based on the HTML renderer by Andrey Demenev.
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: Array.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+
+/**
+ * Array renderer, based on Andrey Demenev's HTML renderer.
+ *
+ * In addition to the options supported by the HTML renderer,
+ * the following options were also introduced:
+ * <ul><li>htmlspecialchars - whether or not htmlspecialchars() will
+ * be called on the content, default TRUE</li>
+ * <li>enumerated - type of array produced, default FALSE,
+ * meaning associative array</li>
+ * </ul>
+ *
+ *
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.5.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_Array extends Text_Highlighter_Renderer
+{
+
+ /**#@+
+ * @access private
+ */
+
+ /**
+ * Tab size
+ *
+ * @var integer
+ */
+ var $_tabsize = 4;
+
+ /**
+ * Should htmlentities() will be called
+ *
+ * @var boolean
+ */
+ var $_htmlspecialchars = true;
+
+ /**
+ * Enumerated or associative array
+ *
+ * @var integer
+ */
+ var $_enumerated = false;
+
+ /**
+ * Array containing highlighting rules
+ *
+ * @var array
+ */
+ var $_output = array();
+
+ /**#@-*/
+
+ /**
+ * Preprocesses code
+ *
+ * @access public
+ *
+ * @param string $str Code to preprocess
+ * @return string Preprocessed code
+ */
+ function preprocess($str)
+ {
+ // normalize whitespace and tabs
+ $str = str_replace("\r\n","\n", $str);
+ // some browsers refuse to display empty lines
+ $str = preg_replace('~^$~m'," ", $str);
+ $str = str_replace("\t",str_repeat(' ', $this->_tabsize), $str);
+ return rtrim($str);
+ }
+
+
+ /**
+ * Resets renderer state
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ *
+ * @access protected
+ */
+ function reset()
+ {
+ $this->_output = array();
+ $this->_lastClass = 'default';
+ if (isset($this->_options['tabsize'])) {
+ $this->_tabsize = $this->_options['tabsize'];
+ }
+ if (isset($this->_options['htmlspecialchars'])) {
+ $this->_htmlspecialchars = $this->_options['htmlspecialchars'];
+ }
+ if (isset($this->_options['enumerated'])) {
+ $this->_enumerated = $this->_options['enumerated'];
+ }
+ }
+
+
+
+ /**
+ * Accepts next token
+ *
+ * @abstract
+ * @access public
+ * @param string $class Token class
+ * @param string $content Token content
+ */
+ function acceptToken($class, $content)
+ {
+
+
+ $theClass = $this->_getFullClassName($class);
+ if ($this->_htmlspecialchars) {
+ $content = htmlspecialchars($content);
+ }
+ if ($this->_enumerated) {
+ $this->_output[] = array($class, $content);
+ } else {
+ $this->_output[][$class] = $content;
+ }
+ $this->_lastClass = $class;
+
+ }
+
+
+ /**
+ * Given a CSS class name, returns the class name
+ * with language name prepended, if necessary
+ *
+ * @access private
+ *
+ * @param string $class Token class
+ */
+ function _getFullClassName($class)
+ {
+ if (!empty($this->_options['use_language'])) {
+ $theClass = $this->_language . '-' . $class;
+ } else {
+ $theClass = $class;
+ }
+ return $theClass;
+ }
+
+ /**
+ * Get generated output
+ *
+ * @abstract
+ * @return array Highlighted code as an array
+ * @access public
+ */
+ function getOutput()
+ {
+ return $this->_output;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/BB.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/BB.php
index 84bc67c0..3536260b 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/BB.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/BB.php
@@ -1,238 +1,238 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * BB code renderer.
- *
- * This BB renderer produces BB code, ready to be pasted in bulletin boards and
- * other applications that accept BB code. Based on the HTML renderer by Andrey Demenev.
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @copyright 2005 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: BB.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-
-/**
- * BB code renderer, based on Andrey Demenev's HTML renderer.
- *
- * Elements of $options argument of constructor (each being optional):
- *
- * - 'numbers' - Line numbering TRUE or FALSE
- * - 'tabsize' - Tab size, default is 4
- * - 'bb_tags' - An array containing three BB tags, see below
- * - 'tag_brackets' - An array that conains opening and closing tags, [ and ]
- * - 'colors' - An array with all the colors to be used for highlighting
- *
- * The default BB tags are:
- * - 'color' => 'color'
- * - 'list' => 'list'
- * - 'list_item' => '*'
- *
- * The default colors for the highlighter are:
- * - 'default' => 'Black',
- * - 'code' => 'Gray',
- * - 'brackets' => 'Olive',
- * - 'comment' => 'Orange',
- * - 'mlcomment' => 'Orange',
- * - 'quotes' => 'Darkred',
- * - 'string' => 'Red',
- * - 'identifier' => 'Blue',
- * - 'builtin' => 'Teal',
- * - 'reserved' => 'Green',
- * - 'inlinedoc' => 'Blue',
- * - 'var' => 'Darkblue',
- * - 'url' => 'Blue',
- * - 'special' => 'Navy',
- * - 'number' => 'Maroon',
- * - 'inlinetags' => 'Blue',
- *
- *
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 20045 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.5.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_BB extends Text_Highlighter_Renderer_Array
-{
-
- /**#@+
- * @access private
- */
-
- /**
- * Line numbering - will use the specified BB tag for listings
- *
- * @var boolean
- */
- var $_numbers = false;
-
- /**
- * BB tags to be used
- *
- * @var array
- */
- var $_bb_tags = array (
- 'color' => 'color',
- 'list' => 'list',
- 'list_item' => '*',
- 'code' => 'code',
- );
-
- /**
- * BB brackets - [ and ]
- *
- * @var array
- */
- var $_tag_brackets = array ('start' => '[', 'end' => ']');
-
- /**
- * Colors map
- *
- * @var boolean
- */
- var $_colors = array(
- 'default' => 'Black',
- 'code' => 'Gray',
- 'brackets' => 'Olive',
- 'comment' => 'Orange',
- 'mlcomment' => 'Orange',
- 'quotes' => 'Darkred',
- 'string' => 'Red',
- 'identifier' => 'Blue',
- 'builtin' => 'Teal',
- 'reserved' => 'Green',
- 'inlinedoc' => 'Blue',
- 'var' => 'Darkblue',
- 'url' => 'Blue',
- 'special' => 'Navy',
- 'number' => 'Maroon',
- 'inlinetags' => 'Blue',
- );
-
- /**#@-*/
-
- /**
- * Resets renderer state
- *
- * @access protected
- *
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- */
- function reset()
- {
- parent::reset();
- if (isset($this->_options['numbers'])) {
- $this->_numbers = $this->_options['numbers'];
- }
- if (isset($this->_options['bb_tags'])) {
- $this->_bb_tags = array_merge($this->_bb_tags, $this->_options['bb_tags']);
- }
- if (isset($this->_options['tag_brackets'])) {
- $this->_tag_brackets = array_merge($this->_tag_brackets, $this->_options['tag_brackets']);
- }
- if (isset($this->_options['colors'])) {
- $this->_colors = array_merge($this->_colors, $this->_options['colors']);
- }
- }
-
-
- /**
- * Signals that no more tokens are available
- *
- * @abstract
- * @access public
- *
- */
- function finalize()
- {
-
- // get parent's output
- parent::finalize();
- $output = parent::getOutput();
-
- $bb_output = '';
-
- $color_start = $this->_tag_brackets['start'] . $this->_bb_tags['color'] . '=%s' . $this->_tag_brackets['end'];
- $color_end = $this->_tag_brackets['start'] . '/' . $this->_bb_tags['color'] . $this->_tag_brackets['end'];
-
- // loop through each class=>content pair
- foreach ($output AS $token) {
-
- if ($this->_enumerated) {
- $class = $token[0];
- $content = $token[1];
- } else {
- $key = key($token);
- $class = $key;
- $content = $token[$key];
- }
-
- $iswhitespace = ctype_space($content);
- if (!$iswhitespace && !empty($this->_colors[$class])) {
- $bb_output .= sprintf($color_start, $this->_colors[$class]);
- $bb_output .= $content;
- $bb_output .= $color_end;
- } else {
- $bb_output .= $content;
- }
- }
-
- if ($this->_numbers) {
-
- $item_tag = $this->_tag_brackets['start'] .
- $this->_bb_tags['list_item'] .
- $this->_tag_brackets['end'];
- $this->_output = $item_tag . str_replace("\n", "\n". $item_tag .' ', $bb_output);
- $this->_output = $this->_tag_brackets['start'] .
- $this->_bb_tags['list'] .
- $this->_tag_brackets['end'] .
- $this->_output .
- $this->_tag_brackets['start'] .
- '/'.
- $this->_bb_tags['list'] .
- $this->_tag_brackets['end']
- ;
- } else {
- $this->_output = $this->_tag_brackets['start'] .
- $this->_bb_tags['code'] .
- $this->_tag_brackets['end'] .
- $bb_output .
- $this->_tag_brackets['start'] .
- '/' .
- $this->_bb_tags['code'] .
- $this->_tag_brackets['end'];
- }
- }
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * BB code renderer.
+ *
+ * This BB renderer produces BB code, ready to be pasted in bulletin boards and
+ * other applications that accept BB code. Based on the HTML renderer by Andrey Demenev.
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @copyright 2005 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: BB.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+
+/**
+ * BB code renderer, based on Andrey Demenev's HTML renderer.
+ *
+ * Elements of $options argument of constructor (each being optional):
+ *
+ * - 'numbers' - Line numbering TRUE or FALSE
+ * - 'tabsize' - Tab size, default is 4
+ * - 'bb_tags' - An array containing three BB tags, see below
+ * - 'tag_brackets' - An array that conains opening and closing tags, [ and ]
+ * - 'colors' - An array with all the colors to be used for highlighting
+ *
+ * The default BB tags are:
+ * - 'color' => 'color'
+ * - 'list' => 'list'
+ * - 'list_item' => '*'
+ *
+ * The default colors for the highlighter are:
+ * - 'default' => 'Black',
+ * - 'code' => 'Gray',
+ * - 'brackets' => 'Olive',
+ * - 'comment' => 'Orange',
+ * - 'mlcomment' => 'Orange',
+ * - 'quotes' => 'Darkred',
+ * - 'string' => 'Red',
+ * - 'identifier' => 'Blue',
+ * - 'builtin' => 'Teal',
+ * - 'reserved' => 'Green',
+ * - 'inlinedoc' => 'Blue',
+ * - 'var' => 'Darkblue',
+ * - 'url' => 'Blue',
+ * - 'special' => 'Navy',
+ * - 'number' => 'Maroon',
+ * - 'inlinetags' => 'Blue',
+ *
+ *
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 20045 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.5.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_BB extends Text_Highlighter_Renderer_Array
+{
+
+ /**#@+
+ * @access private
+ */
+
+ /**
+ * Line numbering - will use the specified BB tag for listings
+ *
+ * @var boolean
+ */
+ var $_numbers = false;
+
+ /**
+ * BB tags to be used
+ *
+ * @var array
+ */
+ var $_bb_tags = array (
+ 'color' => 'color',
+ 'list' => 'list',
+ 'list_item' => '*',
+ 'code' => 'code',
+ );
+
+ /**
+ * BB brackets - [ and ]
+ *
+ * @var array
+ */
+ var $_tag_brackets = array ('start' => '[', 'end' => ']');
+
+ /**
+ * Colors map
+ *
+ * @var boolean
+ */
+ var $_colors = array(
+ 'default' => 'Black',
+ 'code' => 'Gray',
+ 'brackets' => 'Olive',
+ 'comment' => 'Orange',
+ 'mlcomment' => 'Orange',
+ 'quotes' => 'Darkred',
+ 'string' => 'Red',
+ 'identifier' => 'Blue',
+ 'builtin' => 'Teal',
+ 'reserved' => 'Green',
+ 'inlinedoc' => 'Blue',
+ 'var' => 'Darkblue',
+ 'url' => 'Blue',
+ 'special' => 'Navy',
+ 'number' => 'Maroon',
+ 'inlinetags' => 'Blue',
+ );
+
+ /**#@-*/
+
+ /**
+ * Resets renderer state
+ *
+ * @access protected
+ *
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ */
+ function reset()
+ {
+ parent::reset();
+ if (isset($this->_options['numbers'])) {
+ $this->_numbers = $this->_options['numbers'];
+ }
+ if (isset($this->_options['bb_tags'])) {
+ $this->_bb_tags = array_merge($this->_bb_tags, $this->_options['bb_tags']);
+ }
+ if (isset($this->_options['tag_brackets'])) {
+ $this->_tag_brackets = array_merge($this->_tag_brackets, $this->_options['tag_brackets']);
+ }
+ if (isset($this->_options['colors'])) {
+ $this->_colors = array_merge($this->_colors, $this->_options['colors']);
+ }
+ }
+
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @abstract
+ * @access public
+ *
+ */
+ function finalize()
+ {
+
+ // get parent's output
+ parent::finalize();
+ $output = parent::getOutput();
+
+ $bb_output = '';
+
+ $color_start = $this->_tag_brackets['start'] . $this->_bb_tags['color'] . '=%s' . $this->_tag_brackets['end'];
+ $color_end = $this->_tag_brackets['start'] . '/' . $this->_bb_tags['color'] . $this->_tag_brackets['end'];
+
+ // loop through each class=>content pair
+ foreach ($output AS $token) {
+
+ if ($this->_enumerated) {
+ $class = $token[0];
+ $content = $token[1];
+ } else {
+ $key = key($token);
+ $class = $key;
+ $content = $token[$key];
+ }
+
+ $iswhitespace = ctype_space($content);
+ if (!$iswhitespace && !empty($this->_colors[$class])) {
+ $bb_output .= sprintf($color_start, $this->_colors[$class]);
+ $bb_output .= $content;
+ $bb_output .= $color_end;
+ } else {
+ $bb_output .= $content;
+ }
+ }
+
+ if ($this->_numbers) {
+
+ $item_tag = $this->_tag_brackets['start'] .
+ $this->_bb_tags['list_item'] .
+ $this->_tag_brackets['end'];
+ $this->_output = $item_tag . str_replace("\n", "\n". $item_tag .' ', $bb_output);
+ $this->_output = $this->_tag_brackets['start'] .
+ $this->_bb_tags['list'] .
+ $this->_tag_brackets['end'] .
+ $this->_output .
+ $this->_tag_brackets['start'] .
+ '/'.
+ $this->_bb_tags['list'] .
+ $this->_tag_brackets['end']
+ ;
+ } else {
+ $this->_output = $this->_tag_brackets['start'] .
+ $this->_bb_tags['code'] .
+ $this->_tag_brackets['end'] .
+ $bb_output .
+ $this->_tag_brackets['start'] .
+ '/' .
+ $this->_bb_tags['code'] .
+ $this->_tag_brackets['end'];
+ }
+ }
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Console.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Console.php
index 30e4ed69..224cf71d 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Console.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Console.php
@@ -1,208 +1,208 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * Console renderer
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Andrey Demenev <demenev@gmail.com>
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: Console.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-
-define ('HL_CONSOLE_DEFCOLOR', "\033[0m");
-
-/**
- * Console renderer
- *
- * Suitable for displaying text on color-capable terminals, directly
- * or trough less -r
- *
- * Elements of $options argument of constructor (each being optional):
- *
- * - 'numbers' - whether to add line numbers
- * - 'tabsize' - Tab size
- * - 'colors' - additional colors
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_Console extends Text_Highlighter_Renderer
-{
-
- /**#@+
- * @access private
- */
-
- /**
- * class of last outputted text chunk
- *
- * @var string
- */
- var $_lastClass;
-
- /**
- * Line numbering
- *
- * @var boolean
- */
- var $_numbers = false;
-
- /**
- * Tab size
- *
- * @var integer
- */
- var $_tabsize = 4;
-
- /**
- * Highlighted code
- *
- * @var string
- */
- var $_output = '';
-
- /**#@-*/
-
- var $_colors = array();
-
- var $_defColors = array(
- 'default' => "\033[0m",
- 'inlinetags' => "\033[31m",
- 'brackets' => "\033[36m",
- 'quotes' => "\033[34m",
- 'inlinedoc' => "\033[34m",
- 'var' => "\033[1m",
- 'types' => "\033[32m",
- 'number' => "\033[32m",
- 'string' => "\033[31m",
- 'reserved' => "\033[35m",
- 'comment' => "\033[33m",
- 'mlcomment' => "\033[33m",
- );
-
- function preprocess($str)
- {
- // normalize whitespace and tabs
- $str = str_replace("\r\n","\n", $str);
- $str = str_replace("\t",str_repeat(' ', $this->_tabsize), $str);
- return rtrim($str);
- }
-
-
- /**
- * Resets renderer state
- *
- * @access protected
- *
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- */
- function reset()
- {
- $this->_lastClass = '';
- if (isset($this->_options['numbers'])) {
- $this->_numbers = (bool)$this->_options['numbers'];
- } else {
- $this->_numbers = false;
- }
- if (isset($this->_options['tabsize'])) {
- $this->_tabsize = $this->_options['tabsize'];
- } else {
- $this->_tabsize = 4;
- }
- if (isset($this->_options['colors'])) {
- $this->_colors = array_merge($this->_defColors, $this->_options['colors']);
- } else {
- $this->_colors = $this->_defColors;
- }
- $this->_output = '';
- }
-
-
-
- /**
- * Accepts next token
- *
- * @access public
- *
- * @param string $class Token class
- * @param string $content Token content
- */
- function acceptToken($class, $content)
- {
- if (isset($this->_colors[$class])) {
- $color = $this->_colors[$class];
- } else {
- $color = $this->_colors['default'];
- }
- if ($this->_lastClass != $class) {
- $this->_output .= $color;
- }
- $content = str_replace("\n", $this->_colors['default'] . "\n" . $color, $content);
- $content .= $this->_colors['default'];
- $this->_output .= $content;
- }
-
- /**
- * Signals that no more tokens are available
- *
- * @access public
- *
- */
- function finalize()
- {
- if ($this->_numbers) {
- $nlines = substr_count($this->_output, "\n") + 1;
- $len = strlen($nlines);
- $i = 1;
- $this->_output = preg_replace('~^~em', '" " . str_pad($i++, $len, " ", STR_PAD_LEFT) . ": "', $this->_output);
- }
- $this->_output .= HL_CONSOLE_DEFCOLOR . "\n";
- }
-
- /**
- * Get generated output
- *
- * @return string Highlighted code
- * @access public
- *
- */
- function getOutput()
- {
- return $this->_output;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Console renderer
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: Console.php,v 1.1 2007/06/03 02:37:08 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+
+define ('HL_CONSOLE_DEFCOLOR', "\033[0m");
+
+/**
+ * Console renderer
+ *
+ * Suitable for displaying text on color-capable terminals, directly
+ * or trough less -r
+ *
+ * Elements of $options argument of constructor (each being optional):
+ *
+ * - 'numbers' - whether to add line numbers
+ * - 'tabsize' - Tab size
+ * - 'colors' - additional colors
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_Console extends Text_Highlighter_Renderer
+{
+
+ /**#@+
+ * @access private
+ */
+
+ /**
+ * class of last outputted text chunk
+ *
+ * @var string
+ */
+ var $_lastClass;
+
+ /**
+ * Line numbering
+ *
+ * @var boolean
+ */
+ var $_numbers = false;
+
+ /**
+ * Tab size
+ *
+ * @var integer
+ */
+ var $_tabsize = 4;
+
+ /**
+ * Highlighted code
+ *
+ * @var string
+ */
+ var $_output = '';
+
+ /**#@-*/
+
+ var $_colors = array();
+
+ var $_defColors = array(
+ 'default' => "\033[0m",
+ 'inlinetags' => "\033[31m",
+ 'brackets' => "\033[36m",
+ 'quotes' => "\033[34m",
+ 'inlinedoc' => "\033[34m",
+ 'var' => "\033[1m",
+ 'types' => "\033[32m",
+ 'number' => "\033[32m",
+ 'string' => "\033[31m",
+ 'reserved' => "\033[35m",
+ 'comment' => "\033[33m",
+ 'mlcomment' => "\033[33m",
+ );
+
+ function preprocess($str)
+ {
+ // normalize whitespace and tabs
+ $str = str_replace("\r\n","\n", $str);
+ $str = str_replace("\t",str_repeat(' ', $this->_tabsize), $str);
+ return rtrim($str);
+ }
+
+
+ /**
+ * Resets renderer state
+ *
+ * @access protected
+ *
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ */
+ function reset()
+ {
+ $this->_lastClass = '';
+ if (isset($this->_options['numbers'])) {
+ $this->_numbers = (bool)$this->_options['numbers'];
+ } else {
+ $this->_numbers = false;
+ }
+ if (isset($this->_options['tabsize'])) {
+ $this->_tabsize = $this->_options['tabsize'];
+ } else {
+ $this->_tabsize = 4;
+ }
+ if (isset($this->_options['colors'])) {
+ $this->_colors = array_merge($this->_defColors, $this->_options['colors']);
+ } else {
+ $this->_colors = $this->_defColors;
+ }
+ $this->_output = '';
+ }
+
+
+
+ /**
+ * Accepts next token
+ *
+ * @access public
+ *
+ * @param string $class Token class
+ * @param string $content Token content
+ */
+ function acceptToken($class, $content)
+ {
+ if (isset($this->_colors[$class])) {
+ $color = $this->_colors[$class];
+ } else {
+ $color = $this->_colors['default'];
+ }
+ if ($this->_lastClass != $class) {
+ $this->_output .= $color;
+ }
+ $content = str_replace("\n", $this->_colors['default'] . "\n" . $color, $content);
+ $content .= $this->_colors['default'];
+ $this->_output .= $content;
+ }
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @access public
+ *
+ */
+ function finalize()
+ {
+ if ($this->_numbers) {
+ $nlines = substr_count($this->_output, "\n") + 1;
+ $len = strlen($nlines);
+ $i = 1;
+ $this->_output = preg_replace('~^~em', '" " . str_pad($i++, $len, " ", STR_PAD_LEFT) . ": "', $this->_output);
+ }
+ $this->_output .= HL_CONSOLE_DEFCOLOR . "\n";
+ }
+
+ /**
+ * Get generated output
+ *
+ * @return string Highlighted code
+ * @access public
+ *
+ */
+ function getOutput()
+ {
+ return $this->_output;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Html.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Html.php
index 40cb3f59..a0bcfec2 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Html.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/Html.php
@@ -1,446 +1,446 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * HTML renderer
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Andrey Demenev <demenev@gmail.com>
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: Html.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-require_once dirname(__FILE__).'/../Renderer/Array.php';
-
-// BC trick : only define constants if Text/Highlighter.php
-// is not yet included
-if (!defined('HL_NUMBERS_LI')) {
- /**#@+
- * Constant for use with $options['numbers']
- */
- /**
- * use numbered list, deprecated, use HL_NUMBERS_OL instaed
- * @deprecated
- */
- define ('HL_NUMBERS_LI' , 1);
- /**
- * Use 2-column table with line numbers in left column and code in right column.
- */
- define ('HL_NUMBERS_TABLE' , 2);
- /**#@-*/
-}
-
-
-/**#@+
- * Constant for use with $options['numbers']
- */
-/**
- * Use numbered list
- */
-define ('HL_NUMBERS_OL', 1);
-/**
- * Use non-numbered list
- */
-define ('HL_NUMBERS_UL', 3);
-/**#@-*/
-
-
-/**
- * HTML renderer
- *
- * Elements of $options argument of constructor (each being optional):
- *
- * - 'numbers' - Line numbering style 0 or {@link HL_NUMBERS_TABLE}
- * or {@link HL_NUMBERS_UL} or {@link HL_NUMBERS_OL}
- * - 'numbers_start' - starting number for numbered lines
- * - 'tabsize' - Tab size
- * - 'style_map' - Mapping of keywords to formatting rules using inline styles
- * - 'class_map' - Mapping of keywords to formatting rules using class names
- * - 'doclinks' - array that has keys "url", "target" and "elements", used for
- * generating links to online documentation
- * - 'use_language' - class names will be prefixed with language, like "php-reserved" or "css-code"
- *
- * Example of setting documentation links:
- * $options['doclinks'] = array(
- * 'url' => 'http://php.net/%s',
- * 'target' => '_blank',
- * 'elements' => array('reserved', 'identifier')
- * );
- *
- * Example of setting class names map:
- * $options['class_map'] = array(
- * 'main' => 'my-main',
- * 'table' => 'my-table',
- * 'gutter' => 'my-gutter',
- * 'brackets' => 'my-brackets',
- * 'builtin' => 'my-builtin',
- * 'code' => 'my-code',
- * 'comment' => 'my-comment',
- * 'default' => 'my-default',
- * 'identifier' => 'my-identifier',
- * 'inlinedoc' => 'my-inlinedoc',
- * 'inlinetags' => 'my-inlinetags',
- * 'mlcomment' => 'my-mlcomment',
- * 'number' => 'my-number',
- * 'quotes' => 'my-quotes',
- * 'reserved' => 'my-reserved',
- * 'special' => 'my-special',
- * 'string' => 'my-string',
- * 'url' => 'my-url',
- * 'var' => 'my-var',
- * );
- *
- * Example of setting styles mapping:
- * $options['style_map'] = array(
- * 'main' => 'color: black',
- * 'table' => 'border: 1px solid black',
- * 'gutter' => 'background-color: yellow',
- * 'brackets' => 'color: blue',
- * 'builtin' => 'color: red',
- * 'code' => 'color: green',
- * 'comment' => 'color: orange',
- * // ....
- * );
- *
- *
- * @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_Html extends Text_Highlighter_Renderer_Array
-{
-
- /**#@+
- * @access private
- */
-
- /**
- * Line numbering style
- *
- * @var integer
- */
- var $_numbers = 0;
-
- /**
- * For numberered lines - where to start
- *
- * @var integer
- */
- var $_numbers_start = 0;
-
- /**
- * Tab size
- *
- * @var integer
- */
- var $_tabsize = 4;
-
- /**
- * Highlighted code
- *
- * @var string
- */
- var $_output = '';
-
- /**
- * Mapping of keywords to formatting rules using inline styles
- *
- * @var array
- */
- var $_style_map = array();
-
- /**
- * Mapping of keywords to formatting rules using class names
- *
- * @var array
- */
- var $_class_map = array(
- 'main' => 'hl-main',
- 'table' => 'hl-table',
- 'gutter' => 'hl-gutter',
- 'brackets' => 'hl-brackets',
- 'builtin' => 'hl-builtin',
- 'code' => 'hl-code',
- 'comment' => 'hl-comment',
- 'default' => 'hl-default',
- 'identifier' => 'hl-identifier',
- 'inlinedoc' => 'hl-inlinedoc',
- 'inlinetags' => 'hl-inlinetags',
- 'mlcomment' => 'hl-mlcomment',
- 'number' => 'hl-number',
- 'quotes' => 'hl-quotes',
- 'reserved' => 'hl-reserved',
- 'special' => 'hl-special',
- 'string' => 'hl-string',
- 'url' => 'hl-url',
- 'var' => 'hl-var',
- );
-
- /**
- * Setup for links to online documentation
- *
- * This is an array with keys:
- * - url, ex. http://php.net/%s
- * - target, ex. _blank, default - no target
- * - elements, default is <code>array('reserved', 'identifier')</code>
- *
- * @var array
- */
- var $_doclinks = array();
-
- /**#@-*/
-
- /**
- * Resets renderer state
- *
- * @access protected
- *
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- */
- function reset()
- {
- $this->_output = '';
- if (isset($this->_options['numbers'])) {
- $this->_numbers = (int)$this->_options['numbers'];
- if ($this->_numbers != HL_NUMBERS_LI
- && $this->_numbers != HL_NUMBERS_UL
- && $this->_numbers != HL_NUMBERS_OL
- && $this->_numbers != HL_NUMBERS_TABLE
- ) {
- $this->_numbers = 0;
- }
- }
- if (isset($this->_options['tabsize'])) {
- $this->_tabsize = $this->_options['tabsize'];
- }
- if (isset($this->_options['numbers_start'])) {
- $this->_numbers_start = intval($this->_options['numbers_start']);
- }
- if (isset($this->_options['doclinks']) &&
- is_array($this->_options['doclinks']) &&
- !empty($this->_options['doclinks']['url'])
- ) {
-
- $this->_doclinks = $this->_options['doclinks']; // keys: url, target, elements array
-
- if (empty($this->_options['doclinks']['elements'])) {
- $this->_doclinks['elements'] = array('reserved', 'identifier');
- }
- }
- if (isset($this->_options['style_map'])) {
- $this->_style_map = $this->_options['style_map'];
- }
- if (isset($this->_options['class_map'])) {
- $this->_class_map = array_merge($this->_class_map, $this->_options['class_map']);
- }
- $this->_htmlspecialchars = true;
-
- }
-
-
- /**
- * Given a CSS class name, returns the class name
- * with language name prepended, if necessary
- *
- * @access private
- *
- * @param string $class Token class
- */
- function _getFullClassName($class)
- {
- if (!empty($this->_options['use_language'])) {
- $the_class = $this->_language . '-' . $class;
- } else {
- $the_class = $class;
- }
- return $the_class;
- }
-
- /**
- * Signals that no more tokens are available
- *
- * @access public
- */
- function finalize()
- {
-
- // get parent's output
- parent::finalize();
- $output = parent::getOutput();
- if(empty($output))
- return;
-
- $html_output = '';
- // loop through each class=>content pair
- foreach ($output AS $token) {
-
- if ($this->_enumerated) {
- $the_class = $token[0];
- $content = $token[1];
- } else {
- $key = key($token);
- $the_class = $key;
- $content = $token[$key];
- }
-
- $span = $this->_getStyling($the_class);
- $decorated_output = $this->_decorate($content, $key);
- //print "<pre> token = ".var_export($token, true)." -- span = " . htmlentities($span). "-- deco = ".$decorated_output."</pre>\n";
- $html_output .= sprintf($span, $decorated_output);
- }
-
- // format lists
- if (!empty($this->_numbers) &&
- (
- $this->_numbers == HL_NUMBERS_LI ||
- $this->_numbers == HL_NUMBERS_UL ||
- $this->_numbers == HL_NUMBERS_OL
- )
- ) {
- //$html_output = "<pre>".$html_output."</pre>";
- // additional whitespace for browsers that do not display
- // empty list items correctly
- $this->_output = '<li><pre>&nbsp;' . str_replace("\n", "</pre></li>\n<li><pre>&nbsp;", $html_output) . '</pre></li>';
-
-
- $start = '';
- if ($this->_numbers == HL_NUMBERS_OL && intval($this->_numbers_start) > 0) {
- $start = ' start="' . $this->_numbers_start . '"';
- }
-
- $list_tag = 'ol';
- if ($this->_numbers == HL_NUMBERS_UL) {
- $list_tag = 'ul';
- }
-
-
- $this->_output = '<' . $list_tag . $start
- . ' ' . $this->_getStyling('main', false) . '>'
- . $this->_output . '</'. $list_tag .'>';
-
- // render a table
- } else if ($this->_numbers == HL_NUMBERS_TABLE) {
-
-
- $start_number = 0;
- if (intval($this->_numbers_start)) {
- $start_number = $this->_numbers_start - 1;
- }
-
- $numbers = '';
-
- $nlines = substr_count($html_output,"\n")+1;
- for ($i=1; $i <= $nlines; $i++) {
- $numbers .= ($start_number + $i) . "\n";
- }
- $this->_output = '<table ' . $this->_getStyling('table', false) . ' width="100%"><tr>' .
- '<td '. $this->_getStyling('gutter', false) .' align="right" valign="top">' .
- '<pre>' . $numbers . '</pre></td><td '. $this->_getStyling('main', false) .
- ' valign="top"><pre>' .
- $html_output . '</pre></td></tr></table>';
- }
- if (!$this->_numbers) {
- $this->_output = '<pre>' . $html_output . '</pre>';
- }
- $this->_output = '<div ' . $this->_getStyling('main', false) . '>' . $this->_output . '</div>';
- }
-
-
- /**
- * Provides additional formatting to a keyword
- *
- * @param string $content Keyword
- * @return string Keyword with additional formatting
- * @access public
- *
- */
- function _decorate($content, $key)
- {
- // links to online documentation
- if (!empty($this->_doclinks) &&
- !empty($this->_doclinks['url']) &&
- in_array($key, $this->_doclinks['elements'])
- ) {
-
- $link = '<a href="'. sprintf($this->_doclinks['url'], $content) . '"';
- if (!empty($this->_doclinks['target'])) {
- $link.= ' target="' . $this->_doclinks['target'] . '"';
- }
- $link .= '>';
- $link.= $content;
- $link.= '</a>';
-
- $content = $link;
-
- }
-
- return $content;
- }
-
- /**
- * Returns <code>class</code> and/or <code>style</code> attribute,
- * optionally enclosed in a <code>span</code> tag
- *
- * @param string $class Class name
- * @paran boolean $span_tag Whether or not to return styling attributes in a <code>&gt;span&lt;</code> tag
- * @return string <code>span</code> tag or just a <code>class</code> and/or <code>style</code> attributes
- * @access private
- */
- function _getStyling($class, $span_tag = true)
- {
- $attrib = '';
- if (!empty($this->_style_map) &&
- !empty($this->_style_map[$class])
- ) {
- $attrib = 'style="'. $this->_style_map[$class] .'"';
- }
- if (!empty($this->_class_map) &&
- !empty($this->_class_map[$class])
- ) {
- if ($attrib) {
- $attrib .= ' ';
- }
- $attrib .= 'class="'. $this->_getFullClassName($this->_class_map[$class]) .'"';
- }
-
- if ($span_tag) {
- $span = '<span ' . $attrib . '>%s</span>';
- return $span;
- } else {
- return $attrib;
- }
-
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * HTML renderer
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: Html.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+require_once dirname(__FILE__).'/../Renderer/Array.php';
+
+// BC trick : only define constants if Text/Highlighter.php
+// is not yet included
+if (!defined('HL_NUMBERS_LI')) {
+ /**#@+
+ * Constant for use with $options['numbers']
+ */
+ /**
+ * use numbered list, deprecated, use HL_NUMBERS_OL instaed
+ * @deprecated
+ */
+ define ('HL_NUMBERS_LI' , 1);
+ /**
+ * Use 2-column table with line numbers in left column and code in right column.
+ */
+ define ('HL_NUMBERS_TABLE' , 2);
+ /**#@-*/
+}
+
+
+/**#@+
+ * Constant for use with $options['numbers']
+ */
+/**
+ * Use numbered list
+ */
+define ('HL_NUMBERS_OL', 1);
+/**
+ * Use non-numbered list
+ */
+define ('HL_NUMBERS_UL', 3);
+/**#@-*/
+
+
+/**
+ * HTML renderer
+ *
+ * Elements of $options argument of constructor (each being optional):
+ *
+ * - 'numbers' - Line numbering style 0 or {@link HL_NUMBERS_TABLE}
+ * or {@link HL_NUMBERS_UL} or {@link HL_NUMBERS_OL}
+ * - 'numbers_start' - starting number for numbered lines
+ * - 'tabsize' - Tab size
+ * - 'style_map' - Mapping of keywords to formatting rules using inline styles
+ * - 'class_map' - Mapping of keywords to formatting rules using class names
+ * - 'doclinks' - array that has keys "url", "target" and "elements", used for
+ * generating links to online documentation
+ * - 'use_language' - class names will be prefixed with language, like "php-reserved" or "css-code"
+ *
+ * Example of setting documentation links:
+ * $options['doclinks'] = array(
+ * 'url' => 'http://php.net/%s',
+ * 'target' => '_blank',
+ * 'elements' => array('reserved', 'identifier')
+ * );
+ *
+ * Example of setting class names map:
+ * $options['class_map'] = array(
+ * 'main' => 'my-main',
+ * 'table' => 'my-table',
+ * 'gutter' => 'my-gutter',
+ * 'brackets' => 'my-brackets',
+ * 'builtin' => 'my-builtin',
+ * 'code' => 'my-code',
+ * 'comment' => 'my-comment',
+ * 'default' => 'my-default',
+ * 'identifier' => 'my-identifier',
+ * 'inlinedoc' => 'my-inlinedoc',
+ * 'inlinetags' => 'my-inlinetags',
+ * 'mlcomment' => 'my-mlcomment',
+ * 'number' => 'my-number',
+ * 'quotes' => 'my-quotes',
+ * 'reserved' => 'my-reserved',
+ * 'special' => 'my-special',
+ * 'string' => 'my-string',
+ * 'url' => 'my-url',
+ * 'var' => 'my-var',
+ * );
+ *
+ * Example of setting styles mapping:
+ * $options['style_map'] = array(
+ * 'main' => 'color: black',
+ * 'table' => 'border: 1px solid black',
+ * 'gutter' => 'background-color: yellow',
+ * 'brackets' => 'color: blue',
+ * 'builtin' => 'color: red',
+ * 'code' => 'color: green',
+ * 'comment' => 'color: orange',
+ * // ....
+ * );
+ *
+ *
+ * @author Andrey Demenev <demenev@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_Html extends Text_Highlighter_Renderer_Array
+{
+
+ /**#@+
+ * @access private
+ */
+
+ /**
+ * Line numbering style
+ *
+ * @var integer
+ */
+ var $_numbers = 0;
+
+ /**
+ * For numberered lines - where to start
+ *
+ * @var integer
+ */
+ var $_numbers_start = 0;
+
+ /**
+ * Tab size
+ *
+ * @var integer
+ */
+ var $_tabsize = 4;
+
+ /**
+ * Highlighted code
+ *
+ * @var string
+ */
+ var $_output = '';
+
+ /**
+ * Mapping of keywords to formatting rules using inline styles
+ *
+ * @var array
+ */
+ var $_style_map = array();
+
+ /**
+ * Mapping of keywords to formatting rules using class names
+ *
+ * @var array
+ */
+ var $_class_map = array(
+ 'main' => 'hl-main',
+ 'table' => 'hl-table',
+ 'gutter' => 'hl-gutter',
+ 'brackets' => 'hl-brackets',
+ 'builtin' => 'hl-builtin',
+ 'code' => 'hl-code',
+ 'comment' => 'hl-comment',
+ 'default' => 'hl-default',
+ 'identifier' => 'hl-identifier',
+ 'inlinedoc' => 'hl-inlinedoc',
+ 'inlinetags' => 'hl-inlinetags',
+ 'mlcomment' => 'hl-mlcomment',
+ 'number' => 'hl-number',
+ 'quotes' => 'hl-quotes',
+ 'reserved' => 'hl-reserved',
+ 'special' => 'hl-special',
+ 'string' => 'hl-string',
+ 'url' => 'hl-url',
+ 'var' => 'hl-var',
+ );
+
+ /**
+ * Setup for links to online documentation
+ *
+ * This is an array with keys:
+ * - url, ex. http://php.net/%s
+ * - target, ex. _blank, default - no target
+ * - elements, default is <code>array('reserved', 'identifier')</code>
+ *
+ * @var array
+ */
+ var $_doclinks = array();
+
+ /**#@-*/
+
+ /**
+ * Resets renderer state
+ *
+ * @access protected
+ *
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ */
+ function reset()
+ {
+ $this->_output = '';
+ if (isset($this->_options['numbers'])) {
+ $this->_numbers = (int)$this->_options['numbers'];
+ if ($this->_numbers != HL_NUMBERS_LI
+ && $this->_numbers != HL_NUMBERS_UL
+ && $this->_numbers != HL_NUMBERS_OL
+ && $this->_numbers != HL_NUMBERS_TABLE
+ ) {
+ $this->_numbers = 0;
+ }
+ }
+ if (isset($this->_options['tabsize'])) {
+ $this->_tabsize = $this->_options['tabsize'];
+ }
+ if (isset($this->_options['numbers_start'])) {
+ $this->_numbers_start = intval($this->_options['numbers_start']);
+ }
+ if (isset($this->_options['doclinks']) &&
+ is_array($this->_options['doclinks']) &&
+ !empty($this->_options['doclinks']['url'])
+ ) {
+
+ $this->_doclinks = $this->_options['doclinks']; // keys: url, target, elements array
+
+ if (empty($this->_options['doclinks']['elements'])) {
+ $this->_doclinks['elements'] = array('reserved', 'identifier');
+ }
+ }
+ if (isset($this->_options['style_map'])) {
+ $this->_style_map = $this->_options['style_map'];
+ }
+ if (isset($this->_options['class_map'])) {
+ $this->_class_map = array_merge($this->_class_map, $this->_options['class_map']);
+ }
+ $this->_htmlspecialchars = true;
+
+ }
+
+
+ /**
+ * Given a CSS class name, returns the class name
+ * with language name prepended, if necessary
+ *
+ * @access private
+ *
+ * @param string $class Token class
+ */
+ function _getFullClassName($class)
+ {
+ if (!empty($this->_options['use_language'])) {
+ $the_class = $this->_language . '-' . $class;
+ } else {
+ $the_class = $class;
+ }
+ return $the_class;
+ }
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @access public
+ */
+ function finalize()
+ {
+
+ // get parent's output
+ parent::finalize();
+ $output = parent::getOutput();
+ if(empty($output))
+ return;
+
+ $html_output = '';
+ // loop through each class=>content pair
+ foreach ($output AS $token) {
+
+ if ($this->_enumerated) {
+ $the_class = $token[0];
+ $content = $token[1];
+ } else {
+ $key = key($token);
+ $the_class = $key;
+ $content = $token[$key];
+ }
+
+ $span = $this->_getStyling($the_class);
+ $decorated_output = $this->_decorate($content, $key);
+ //print "<pre> token = ".var_export($token, true)." -- span = " . htmlentities($span). "-- deco = ".$decorated_output."</pre>\n";
+ $html_output .= sprintf($span, $decorated_output);
+ }
+
+ // format lists
+ if (!empty($this->_numbers) &&
+ (
+ $this->_numbers == HL_NUMBERS_LI ||
+ $this->_numbers == HL_NUMBERS_UL ||
+ $this->_numbers == HL_NUMBERS_OL
+ )
+ ) {
+ //$html_output = "<pre>".$html_output."</pre>";
+ // additional whitespace for browsers that do not display
+ // empty list items correctly
+ $this->_output = '<li><pre>&nbsp;' . str_replace("\n", "</pre></li>\n<li><pre>&nbsp;", $html_output) . '</pre></li>';
+
+
+ $start = '';
+ if ($this->_numbers == HL_NUMBERS_OL && intval($this->_numbers_start) > 0) {
+ $start = ' start="' . $this->_numbers_start . '"';
+ }
+
+ $list_tag = 'ol';
+ if ($this->_numbers == HL_NUMBERS_UL) {
+ $list_tag = 'ul';
+ }
+
+
+ $this->_output = '<' . $list_tag . $start
+ . ' ' . $this->_getStyling('main', false) . '>'
+ . $this->_output . '</'. $list_tag .'>';
+
+ // render a table
+ } else if ($this->_numbers == HL_NUMBERS_TABLE) {
+
+
+ $start_number = 0;
+ if (intval($this->_numbers_start)) {
+ $start_number = $this->_numbers_start - 1;
+ }
+
+ $numbers = '';
+
+ $nlines = substr_count($html_output,"\n")+1;
+ for ($i=1; $i <= $nlines; $i++) {
+ $numbers .= ($start_number + $i) . "\n";
+ }
+ $this->_output = '<table ' . $this->_getStyling('table', false) . ' width="100%"><tr>' .
+ '<td '. $this->_getStyling('gutter', false) .' align="right" valign="top">' .
+ '<pre>' . $numbers . '</pre></td><td '. $this->_getStyling('main', false) .
+ ' valign="top"><pre>' .
+ $html_output . '</pre></td></tr></table>';
+ }
+ if (!$this->_numbers) {
+ $this->_output = '<pre>' . $html_output . '</pre>';
+ }
+ $this->_output = '<div ' . $this->_getStyling('main', false) . '>' . $this->_output . '</div>';
+ }
+
+
+ /**
+ * Provides additional formatting to a keyword
+ *
+ * @param string $content Keyword
+ * @return string Keyword with additional formatting
+ * @access public
+ *
+ */
+ function _decorate($content, $key)
+ {
+ // links to online documentation
+ if (!empty($this->_doclinks) &&
+ !empty($this->_doclinks['url']) &&
+ in_array($key, $this->_doclinks['elements'])
+ ) {
+
+ $link = '<a href="'. sprintf($this->_doclinks['url'], $content) . '"';
+ if (!empty($this->_doclinks['target'])) {
+ $link.= ' target="' . $this->_doclinks['target'] . '"';
+ }
+ $link .= '>';
+ $link.= $content;
+ $link.= '</a>';
+
+ $content = $link;
+
+ }
+
+ return $content;
+ }
+
+ /**
+ * Returns <code>class</code> and/or <code>style</code> attribute,
+ * optionally enclosed in a <code>span</code> tag
+ *
+ * @param string $class Class name
+ * @paran boolean $span_tag Whether or not to return styling attributes in a <code>&gt;span&lt;</code> tag
+ * @return string <code>span</code> tag or just a <code>class</code> and/or <code>style</code> attributes
+ * @access private
+ */
+ function _getStyling($class, $span_tag = true)
+ {
+ $attrib = '';
+ if (!empty($this->_style_map) &&
+ !empty($this->_style_map[$class])
+ ) {
+ $attrib = 'style="'. $this->_style_map[$class] .'"';
+ }
+ if (!empty($this->_class_map) &&
+ !empty($this->_class_map[$class])
+ ) {
+ if ($attrib) {
+ $attrib .= ' ';
+ }
+ $attrib .= 'class="'. $this->_getFullClassName($this->_class_map[$class]) .'"';
+ }
+
+ if ($span_tag) {
+ $span = '<span ' . $attrib . '>%s</span>';
+ return $span;
+ } else {
+ return $attrib;
+ }
+
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/HtmlTags.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/HtmlTags.php
index a75e659e..b085d535 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/HtmlTags.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/HtmlTags.php
@@ -1,187 +1,187 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * HTML renderer that uses only basic html tags
- *
- * PHP versions 4 and 5. Based on the "normal" HTML renderer by Andrey Demenev.
- * It's designed to work with user agents that support only a limited number of
- * HTML tags. Like the iPod which supports only b, i, u and a.
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @copyright 2005 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: HtmlTags.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-require_once dirname(__FILE__).'/../Renderer/Array.php';
-
-/**
- * HTML basic tags renderer, based on Andrey Demenev's HTML renderer.
- *
- * Elements of $options argument of constructor (each being optional):
- *
- * - 'numbers' - Line numbering TRUE or FALSE. Default is FALSE.
- * - 'tabsize' - Tab size, default is 4.
- * - 'tags' - Array, containing the tags to be used for highlighting
- *
- * Here's the listing of the default tags:
- * - 'default' => '',
- * - 'code' => '',
- * - 'brackets' => 'b',
- * - 'comment' => 'i',
- * - 'mlcomment' => 'i',
- * - 'quotes' => '',
- * - 'string' => 'i',
- * - 'identifier' => 'b',
- * - 'builtin' => 'b',
- * - 'reserved' => 'u',
- * - 'inlinedoc' => 'i',
- * - 'var' => 'b',
- * - 'url' => 'i',
- * - 'special' => '',
- * - 'number' => '',
- * - 'inlinetags' => ''
- *
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2005 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.5.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_HtmlTags extends Text_Highlighter_Renderer_Array
-{
-
- /**#@+
- * @access private
- */
-
- /**
- * Line numbering - will use 'ol' tag
- *
- * @var boolean
- */
- var $_numbers = false;
-
- /**
- * HTML tags map
- *
- * @var array
- */
- var $_hilite_tags = array(
- 'default' => '',
- 'code' => '',
- 'brackets' => 'b',
- 'comment' => 'i',
- 'mlcomment' => 'i',
- 'quotes' => '',
- 'string' => 'i',
- 'identifier' => 'b',
- 'builtin' => 'b',
- 'reserved' => 'u',
- 'inlinedoc' => 'i',
- 'var' => 'b',
- 'url' => 'i',
- 'special' => '',
- 'number' => '',
- 'inlinetags' => '',
- );
-
- /**#@-*/
-
- /**
- * Resets renderer state
- *
- * @access protected
- *
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- */
- function reset()
- {
- parent::reset();
- if (isset($this->_options['numbers'])) {
- $this->_numbers = $this->_options['numbers'];
- }
- if (isset($this->_options['tags'])) {
- $this->_hilite_tags = array_merge($this->_tags, $this->_options['tags']);
- }
- }
-
-
- /**
- * Signals that no more tokens are available
- *
- * @abstract
- * @access public
- *
- */
- function finalize()
- {
-
- // get parent's output
- parent::finalize();
- $output = parent::getOutput();
-
- $html_output = '';
-
- // loop through each class=>content pair
- foreach ($output AS $token) {
-
- if ($this->_enumerated) {
- $class = $token[0];
- $content = $token[1];
- } else {
- $key = key($token);
- $class = $key;
- $content = $token[$key];
- }
-
- $iswhitespace = ctype_space($content);
- if (!$iswhitespace && !empty($this->_hilite_tags[$class])) {
- $html_output .= '<'. $this->_hilite_tags[$class] . '>' . $content . '</'. $this->_hilite_tags[$class] . '>';
- } else {
- $html_output .= $content;
- }
- }
-
-
- if ($this->_numbers) {
- /* additional whitespace for browsers that do not display
- empty list items correctly */
- $html_output = '<li>&nbsp;' . str_replace("\n", "</li>\n<li>&nbsp;", $html_output) . '</li>';
- $this->_output = '<ol>' . str_replace(' ', '&nbsp;', $html_output) . '</ol>';
- } else {
- $this->_output = '<pre>' . $html_output . '</pre>';
- }
- }
-
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * HTML renderer that uses only basic html tags
+ *
+ * PHP versions 4 and 5. Based on the "normal" HTML renderer by Andrey Demenev.
+ * It's designed to work with user agents that support only a limited number of
+ * HTML tags. Like the iPod which supports only b, i, u and a.
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @copyright 2005 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: HtmlTags.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+require_once dirname(__FILE__).'/../Renderer/Array.php';
+
+/**
+ * HTML basic tags renderer, based on Andrey Demenev's HTML renderer.
+ *
+ * Elements of $options argument of constructor (each being optional):
+ *
+ * - 'numbers' - Line numbering TRUE or FALSE. Default is FALSE.
+ * - 'tabsize' - Tab size, default is 4.
+ * - 'tags' - Array, containing the tags to be used for highlighting
+ *
+ * Here's the listing of the default tags:
+ * - 'default' => '',
+ * - 'code' => '',
+ * - 'brackets' => 'b',
+ * - 'comment' => 'i',
+ * - 'mlcomment' => 'i',
+ * - 'quotes' => '',
+ * - 'string' => 'i',
+ * - 'identifier' => 'b',
+ * - 'builtin' => 'b',
+ * - 'reserved' => 'u',
+ * - 'inlinedoc' => 'i',
+ * - 'var' => 'b',
+ * - 'url' => 'i',
+ * - 'special' => '',
+ * - 'number' => '',
+ * - 'inlinetags' => ''
+ *
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2005 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.5.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_HtmlTags extends Text_Highlighter_Renderer_Array
+{
+
+ /**#@+
+ * @access private
+ */
+
+ /**
+ * Line numbering - will use 'ol' tag
+ *
+ * @var boolean
+ */
+ var $_numbers = false;
+
+ /**
+ * HTML tags map
+ *
+ * @var array
+ */
+ var $_hilite_tags = array(
+ 'default' => '',
+ 'code' => '',
+ 'brackets' => 'b',
+ 'comment' => 'i',
+ 'mlcomment' => 'i',
+ 'quotes' => '',
+ 'string' => 'i',
+ 'identifier' => 'b',
+ 'builtin' => 'b',
+ 'reserved' => 'u',
+ 'inlinedoc' => 'i',
+ 'var' => 'b',
+ 'url' => 'i',
+ 'special' => '',
+ 'number' => '',
+ 'inlinetags' => '',
+ );
+
+ /**#@-*/
+
+ /**
+ * Resets renderer state
+ *
+ * @access protected
+ *
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ */
+ function reset()
+ {
+ parent::reset();
+ if (isset($this->_options['numbers'])) {
+ $this->_numbers = $this->_options['numbers'];
+ }
+ if (isset($this->_options['tags'])) {
+ $this->_hilite_tags = array_merge($this->_tags, $this->_options['tags']);
+ }
+ }
+
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @abstract
+ * @access public
+ *
+ */
+ function finalize()
+ {
+
+ // get parent's output
+ parent::finalize();
+ $output = parent::getOutput();
+
+ $html_output = '';
+
+ // loop through each class=>content pair
+ foreach ($output AS $token) {
+
+ if ($this->_enumerated) {
+ $class = $token[0];
+ $content = $token[1];
+ } else {
+ $key = key($token);
+ $class = $key;
+ $content = $token[$key];
+ }
+
+ $iswhitespace = ctype_space($content);
+ if (!$iswhitespace && !empty($this->_hilite_tags[$class])) {
+ $html_output .= '<'. $this->_hilite_tags[$class] . '>' . $content . '</'. $this->_hilite_tags[$class] . '>';
+ } else {
+ $html_output .= $content;
+ }
+ }
+
+
+ if ($this->_numbers) {
+ /* additional whitespace for browsers that do not display
+ empty list items correctly */
+ $html_output = '<li>&nbsp;' . str_replace("\n", "</li>\n<li>&nbsp;", $html_output) . '</li>';
+ $this->_output = '<ol>' . str_replace(' ', '&nbsp;', $html_output) . '</ol>';
+ } else {
+ $this->_output = '<pre>' . $html_output . '</pre>';
+ }
+ }
+
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/JSON.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/JSON.php
index 7f1158fb..6a6ff71e 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/JSON.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/JSON.php
@@ -1,86 +1,86 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * JSON renderer.
- *
- * Based on the HTML renderer by Andrey Demenev.
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: JSON.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-require_once dirname(__FILE__).'/../Renderer/Array.php';
-
-/**
- * JSON renderer, based on Andrey Demenev's HTML renderer.
- *
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.5.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_JSON extends Text_Highlighter_Renderer_Array
-{
-
- /**
- * Signals that no more tokens are available
- *
- * @abstract
- * @access public
- */
- function finalize()
- {
-
- parent::finalize();
- $output = parent::getOutput();
-
- $json_array = array();
-
- foreach ($output AS $token) {
-
- if ($this->_enumerated) {
- $json_array[] = '["' . $token[0] . '","' . $token[1] . '"]';
- } else {
- $key = key($token);
- $json_array[] = '{"class": "' . $key . '","content":"' . $token[$key] . '"}';
- }
-
- }
-
- $this->_output = '['. implode(',', $json_array) .']';
- $this->_output = str_replace("\n", '\n', $this->_output);
-
- }
-
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * JSON renderer.
+ *
+ * Based on the HTML renderer by Andrey Demenev.
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: JSON.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+require_once dirname(__FILE__).'/../Renderer/Array.php';
+
+/**
+ * JSON renderer, based on Andrey Demenev's HTML renderer.
+ *
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.5.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_JSON extends Text_Highlighter_Renderer_Array
+{
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @abstract
+ * @access public
+ */
+ function finalize()
+ {
+
+ parent::finalize();
+ $output = parent::getOutput();
+
+ $json_array = array();
+
+ foreach ($output AS $token) {
+
+ if ($this->_enumerated) {
+ $json_array[] = '["' . $token[0] . '","' . $token[1] . '"]';
+ } else {
+ $key = key($token);
+ $json_array[] = '{"class": "' . $key . '","content":"' . $token[$key] . '"}';
+ }
+
+ }
+
+ $this->_output = '['. implode(',', $json_array) .']';
+ $this->_output = str_replace("\n", '\n', $this->_output);
+
+ }
+
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/XML.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/XML.php
index e86f620a..ab8a4e3e 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/XML.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer/XML.php
@@ -1,103 +1,103 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-/**
- * XML renderer.
- *
- * Based on the HTML renderer by Andrey Demenev.
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Text
- * @package Text_Highlighter
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version CVS: $Id: XML.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-/**
- * @ignore
- */
-
-require_once dirname(__FILE__).'/../Renderer.php';
-require_once dirname(__FILE__).'/../Renderer/Array.php';
-
-/**
- * XML renderer, based on Andrey Demenev's HTML renderer.
- *
- * @author Stoyan Stefanov <ssttoo@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2006 Stoyan Stefanov
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.5.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-
-class Text_Highlighter_Renderer_XML extends Text_Highlighter_Renderer_Array
-{
-
-
- /**
- * Options for XML_Serializer
- *
- * @access private
- * @var array
- */
- var $_serializer_options = array();
-
-
- /**
- * Resets renderer state
- *
- * Descendents of Text_Highlighter call this method from the constructor,
- * passing $options they get as parameter.
- *
- * @access protected
- */
- function reset()
- {
- parent::reset();
- if (isset($this->_options['xml_serializer'])) {
- $this->_serializer_options = $this->_options['xml_serializer'];
- }
- }
-
-
- /**
- * Signals that no more tokens are available
- *
- * @abstract
- * @access public
- */
- function finalize()
- {
-
- // call parent's finalize(), then serialize array into XML
- parent::finalize();
- $output = parent::getOutput();
-
- $serializer = new XML_Serializer($this->_serializer_options);
- $result = $serializer->serialize($output);
- if ($result === true) {
- $this->_output = $serializer->getSerializedData();
- }
- }
-
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * XML renderer.
+ *
+ * Based on the HTML renderer by Andrey Demenev.
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Text
+ * @package Text_Highlighter
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version CVS: $Id: XML.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+/**
+ * @ignore
+ */
+
+require_once dirname(__FILE__).'/../Renderer.php';
+require_once dirname(__FILE__).'/../Renderer/Array.php';
+
+/**
+ * XML renderer, based on Andrey Demenev's HTML renderer.
+ *
+ * @author Stoyan Stefanov <ssttoo@gmail.com>
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2006 Stoyan Stefanov
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.5.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+
+class Text_Highlighter_Renderer_XML extends Text_Highlighter_Renderer_Array
+{
+
+
+ /**
+ * Options for XML_Serializer
+ *
+ * @access private
+ * @var array
+ */
+ var $_serializer_options = array();
+
+
+ /**
+ * Resets renderer state
+ *
+ * Descendents of Text_Highlighter call this method from the constructor,
+ * passing $options they get as parameter.
+ *
+ * @access protected
+ */
+ function reset()
+ {
+ parent::reset();
+ if (isset($this->_options['xml_serializer'])) {
+ $this->_serializer_options = $this->_options['xml_serializer'];
+ }
+ }
+
+
+ /**
+ * Signals that no more tokens are available
+ *
+ * @abstract
+ * @access public
+ */
+ function finalize()
+ {
+
+ // call parent's finalize(), then serialize array into XML
+ parent::finalize();
+ $output = parent::getOutput();
+
+ $serializer = new XML_Serializer($this->_serializer_options);
+ $result = $serializer->serialize($output);
+ if ($result === true) {
+ $this->_output = $serializer->getSerializedData();
+ }
+ }
+
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+
?> \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/SQL.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/SQL.php
index 9679b230..6b0b4b7c 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/SQL.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/SQL.php
@@ -1,51 +1,51 @@
-<?php
-/**
+<?php
+/**
* Auto-generated class. SQL syntax highlighting
*
- * Based on SQL-99
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+ * Based on SQL-99
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : sql.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. SQL syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. SQL syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_SQL extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_SQL extends Text_Highlighter
+{
var $_language = 'sql';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)`)|((?i)\\/\\*)|((?i)(#|--\\s).*)|((?i)[a-z_]\\w*)|((?i)")|((?i)\\()|((?i)\')|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)/',
@@ -394,8 +394,8 @@ class Text_Highlighter_SQL extends Text_Highlighter
'reserved' => 'reserved',
'keyword' => 'var',
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file
diff --git a/framework/3rdParty/TextHighlighter/Text/Highlighter/XML.php b/framework/3rdParty/TextHighlighter/Text/Highlighter/XML.php
index 8dc3b881..3c454c77 100644
--- a/framework/3rdParty/TextHighlighter/Text/Highlighter/XML.php
+++ b/framework/3rdParty/TextHighlighter/Text/Highlighter/XML.php
@@ -1,49 +1,49 @@
-<?php
-/**
- * Auto-generated class. XML syntax highlighting
- *
- * PHP version 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @link http://pear.php.net/package/Text_Highlighter
- * @category Text
- * @package Text_Highlighter
+<?php
+/**
+ * Auto-generated class. XML syntax highlighting
+ *
+ * PHP version 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @link http://pear.php.net/package/Text_Highlighter
+ * @category Text
+ * @package Text_Highlighter
* @version generated from: : xml.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp
* @author Andrey Demenev <demenev@gmail.com>
- *
- */
-
-/**
- * Auto-generated class. XML syntax highlighting
- *
+ *
+ */
+
+/**
+ * Auto-generated class. XML syntax highlighting
+ *
* @author Andrey Demenev <demenev@gmail.com>
- * @category Text
- * @package Text_Highlighter
- * @copyright 2004-2006 Andrey Demenev
- * @license http://www.php.net/license/3_0.txt PHP License
- * @version Release: 0.7.0
- * @link http://pear.php.net/package/Text_Highlighter
- */
-class Text_Highlighter_XML extends Text_Highlighter
-{
+ * @category Text
+ * @package Text_Highlighter
+ * @copyright 2004-2006 Andrey Demenev
+ * @license http://www.php.net/license/3_0.txt PHP License
+ * @version Release: 0.7.0
+ * @link http://pear.php.net/package/Text_Highlighter
+ */
+class Text_Highlighter_XML extends Text_Highlighter
+{
var $_language = 'xml';
- /**
- * Constructor
- *
- * @param array $options
- * @access public
- */
- function __construct($options=array())
- {
-
+ /**
+ * Constructor
+ *
+ * @param array $options
+ * @access public
+ */
+ function __construct($options=array())
+ {
+
$this->_options = $options;
$this->_regs = array (
-1 => '/((?i)\\<\\!\\[CDATA\\[)|((?i)\\<!--)|((?i)\\<[\\?\\/]?)|((?i)(&|%)[\\w\\-\\.]+;)/',
@@ -238,8 +238,8 @@ class Text_Highlighter_XML extends Text_Highlighter
);
$this->_kwmap = array (
);
- $this->_defClass = 'code';
- $this->_checkDefines();
- }
-
+ $this->_defClass = 'code';
+ $this->_checkDefines();
+ }
+
} \ No newline at end of file