diff --git a/gulliver/thirdparty/Haanga/.travis.yml b/gulliver/thirdparty/Haanga/.travis.yml deleted file mode 100644 index 4a4af7265..000000000 --- a/gulliver/thirdparty/Haanga/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: php -script: cd tests/; phpunit TestSuite.php - -php: - - 5.3 - - 5.4 - -before_script: - - curl -s http://getcomposer.org/installer | php - - php composer.phar install - diff --git a/gulliver/thirdparty/Haanga/LICENSE b/gulliver/thirdparty/Haanga/LICENSE deleted file mode 100644 index f70e9f63b..000000000 --- a/gulliver/thirdparty/Haanga/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2011, César D. Rodas and Menéame Comunicacions S.L. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by César D. Rodas. - -4. Neither the name of the Menéame Comunicacions S.L. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY MENÉAME COMUNICACIONS S.L. ''AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE diff --git a/gulliver/thirdparty/Haanga/Makefile b/gulliver/thirdparty/Haanga/Makefile deleted file mode 100644 index 721a31ce3..000000000 --- a/gulliver/thirdparty/Haanga/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -all: build test - -build: - #plex lib/Haanga/Compiler/Lexer.lex - phplemon lib/Haanga/Compiler/Parser.y - - -test: - cd tests; ~/bin/php-5.2/bin/php /usr/bin/phpunit --colors --verbose TestSuite.php - cd tests; php /usr/bin/phpunit --coverage-html coverage/ --colors --verbose TestSuite.php - -test-fast: - cd tests; php /usr/bin/phpunit --stop-on-failure --colors --verbose TestSuite.php - - -edit: - vim lib/Haanga/Compiler/Parser.y lib/Haanga/Compiler/Tokenizer.php -O diff --git a/gulliver/thirdparty/Haanga/README b/gulliver/thirdparty/Haanga/README deleted file mode 100644 index 49fd8572b..000000000 --- a/gulliver/thirdparty/Haanga/README +++ /dev/null @@ -1,3 +0,0 @@ -This project was created* and sponsored by Menéame (http://meneame.net/) - -[*] http://twitter.com/gallir/status/16256084676 diff --git a/gulliver/thirdparty/Haanga/contrib/dummy.php b/gulliver/thirdparty/Haanga/contrib/dummy.php deleted file mode 100644 index 9f50eaf03..000000000 --- a/gulliver/thirdparty/Haanga/contrib/dummy.php +++ /dev/null @@ -1,11 +0,0 @@ -decl($current, $args[0]); - $code->decl($total, hexec('ceil', hexpr($args[2], '/', $args[1])) ); - $code->decl($start, hexec('max', hexpr($current, '-', hexec('intval', hexpr($args[3],'/', 2))), 1)); - $code->decl($end, hexpr($start, '+', $args[3], '-', 1)); - $code->decl($prev, hexpr_cond( hexpr(1, '==', $current), FALSE, hexpr($current, '-', 1)) ); - $code->decl($next, hexpr_cond( hexpr($args[2], '<', 0, '||', $current, '<', $total), hexpr($current, '+', 1), FALSE)); - $code->decl('mnm_pages', hexec('range', $start, hexpr_cond(hexpr($end,'<', $total), $end, $total))); - - $cmp->set_safe($current); - $cmp->set_safe($total); - $cmp->set_safe($prev); - $cmp->set_safe($next); - $cmp->set_safe($pages); - - - return $code; - } - -} diff --git a/gulliver/thirdparty/Haanga/haanga-cli.php b/gulliver/thirdparty/Haanga/haanga-cli.php deleted file mode 100644 index d48534bbf..000000000 --- a/gulliver/thirdparty/Haanga/haanga-cli.php +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/php - | - +---------------------------------------------------------------------------------+ -*/ - -if (!defined('HAANGA_VERSION')) { - /* anyone can override this value to force recompilation */ - define('HAANGA_VERSION', '1.0.4'); -} - - -/** - * Haanga Runtime class - * - * Simple class to call templates efficiently. This class aims - * to reduce the compilation of a template as less a possible. Also - * it will not load in memory the compiler, except when there is not - * cache (compiled template) or it is out-dated. - * - */ -class Haanga -{ - protected static $cache_dir; - protected static $templates_dir='.'; - protected static $debug; - protected static $bootstrap = NULL; - protected static $check_ttl; - protected static $check_get; - protected static $check_set; - protected static $use_autoload = TRUE; - protected static $hash_filename = TRUE; - protected static $compiler = array(); - - public static $has_compiled; - - private function __construct() - { - /* The class can't be instanced */ - } - - public static function getTemplateDir() - { - return self::$templates_dir; - } - - // configure(Array $opts) {{{ - /** - * Configuration to load Haanga - * - * Options: - * - * - (string) cache_dir - * - (string) tempalte_dir - * - (callback) on_compile - * - (boolean) debug - * - (int) check_ttl - * - (callback) check_get - * - (callback) check_set - * - (boolean) autoload - * - (boolean) use_hash_filename - * - * @return void - */ - final public static function configure(Array $opts) - { - foreach ($opts as $option => $value) { - switch (strtolower($option)) { - case 'cache_dir': - self::$cache_dir = $value; - break; - case 'template_dir': - self::$templates_dir = $value; - break; - case 'bootstrap': - if (is_callable($value)) { - self::$bootstrap = $value; - } - break; - case 'debug': - self::enableDebug((bool)$value); - break; - case 'check_ttl': - self::$check_ttl = (int)$value; - break; - case 'check_get': - if (is_callable($value)) { - self::$check_get = $value; - } - break; - case 'check_set': - if (is_callable($value)) { - self::$check_set = $value; - } - break; - case 'autoload': - self::$use_autoload = (bool)$value; - break; - case 'use_hash_filename': - self::$hash_filename = (bool)$value; - break; - case 'compiler': - if (is_array($value)) { - self::$compiler = $value; - } - break; - default: - continue; - } - } - } - // }}} - - // checkCacheDir(string $dir) {{{ - /** - * Check the directory where the compiled templates - * are stored. - * - * @param string $dir - * - * @return void - */ - public static function checkCacheDir() - { - $dir = self::$cache_dir; - if (!is_dir($dir)) { - $old = umask(0); - if (!mkdir($dir, 0777, TRUE)) { - throw new Haanga_Exception("{$dir} is not a valid directory"); - } - umask($old); - } - if (!is_writable($dir)) { - throw new Haanga_Exception("{$dir} can't be written"); - } - } - // }}} - - // enableDebug($bool) {{{ - public static function enableDebug($bool) - { - self::$debug = $bool; - } - // }}} - - // getCompiler($checkdir=TRUE) {{{ - /** - * This function is a singleton for the Haanga_Compiler_Runtime class. - * The instance is already set up properly and resetted. - * - * - * @param bool $checkdir TRUE - * - * @return Haanga_Compiler_Runtime - */ - protected static function getCompiler($checkdir=TRUE) - { - static $compiler; - static $has_checkdir = FALSE; - - if (!$compiler) { - - /* Load needed files (to avoid autoload as much as possible) */ - $dir = dirname(__FILE__); - require_once "{$dir}/Haanga/AST.php"; - require_once "{$dir}/Haanga/Compiler.php"; - require_once "{$dir}/Haanga/Compiler/Runtime.php"; - require_once "{$dir}/Haanga/Compiler/Parser.php"; - require_once "{$dir}/Haanga/Compiler/Tokenizer.php"; - require_once "{$dir}/Haanga/Generator/PHP.php"; - require_once "{$dir}/Haanga/Extension.php"; - require_once "{$dir}/Haanga/Extension/Filter.php"; - require_once "{$dir}/Haanga/Extension/Tag.php"; - - /* load compiler (done just once) */ - if (self::$use_autoload) { - require_once "{$dir}/Haanga/Loader.php"; - } - - $compiler = new Haanga_Compiler_Runtime; - - if (self::$bootstrap) { - /* call bootstrap hook, just the first time */ - call_user_func(self::$bootstrap); - } - - if (count(self::$compiler) != 0) { - foreach (self::$compiler as $opt => $value) { - Haanga_Compiler::setOption($opt, $value); - } - } - - } - - if ($checkdir && !$has_checkdir) { - self::checkCacheDir(); - $has_checkdir = TRUE; - } - - $compiler->reset(); - return $compiler; - } - // }}} - - // callback compile(string $tpl, $context=array()) {{{ - /** - * Compile one template and return a PHP function - * - * @param string $tpl Template body - * @param array $context Context variables useful to generate efficient code (for array, objects and array) - * - * @return callback($vars=array(), $return=TRUE, $block=array()) - */ - public static function compile($tpl, $context=array()) - { - $compiler = self::getCompiler(FALSE); - - foreach ($context as $var => $value) { - $compiler->set_context($var, $value); - } - - $code = $compiler->compile($tpl); - - return create_function('$' . $compiler->getScopeVariable(NULL, TRUE) . '=array(), $return=TRUE, $blocks=array()', $code); - } - // }}} - - // safe_load(string $file, array $vars, bool $return, array $blocks) {{{ - public static function Safe_Load($file, $vars = array(), $return=FALSE, $blocks=array()) - { - try { - - $tpl = self::$templates_dir.'/'.$file; - if (file_exists($tpl)) { - /* call load if the tpl file exists */ - return self::Load($file, $vars, $return, $blocks); - } - } Catch (Exception $e) { - } - /* some error but we don't care at all */ - return ""; - } - // }}} - - // load(string $file, array $vars, bool $return, array $blocks) {{{ - /** - * Load - * - * Load template. If the template is already compiled, just the compiled - * PHP file will be included an used. If the template is new, or it - * had changed, the Haanga compiler is loaded in memory, and the template - * is compiled. - * - * - * @param string $file - * @param array $vars - * @param bool $return - * @param array $blocks - * - * @return string|NULL - */ - public static function Load($file, $vars = array(), $return=FALSE, $blocks=array()) - { - if (empty(self::$cache_dir)) { - throw new Haanga_Exception("Cache dir or template dir is missing"); - } - - self::$has_compiled = FALSE; - - $tpl = self::$templates_dir.'/'.$file; - $fnc = sha1($tpl); - $callback = "haanga_".$fnc; - - if (is_callable($callback)) { - return $callback($vars, $return, $blocks); - } - - $php = self::$hash_filename ? $fnc : $file; - $php = self::$cache_dir.'/'.$php.'.php'; - - $check = TRUE; - - if (self::$check_ttl && self::$check_get && self::$check_set) { - /* */ - if (call_user_func(self::$check_get, $callback)) { - /* disable checking for the next $check_ttl seconds */ - $check = FALSE; - } else { - $result = call_user_func(self::$check_set, $callback, TRUE, self::$check_ttl); - } - } - - if (!is_file($php) || ($check && filemtime($tpl) > filemtime($php))) { - - if (!is_file($tpl)) { - /* There is no template nor compiled file */ - throw new Exception("View {$file} doesn't exists"); - } - - if (!is_dir(dirname($php))) { - $old = umask(0); - mkdir(dirname($php), 0777, TRUE); - umask($old); - } - - $fp = fopen($php, "a+"); - /* try to block PHP file */ - if (!flock($fp, LOCK_EX | LOCK_NB)) { - /* couldn't block, another process is already compiling */ - fclose($fp); - if (is_file($php)) { - /* - ** if there is an old version of the cache - ** load it - */ - require $php; - if (is_callable($callback)) { - return $callback($vars, $return, $blocks); - } - } - /* - ** no luck, probably the template is new - ** the compilation will be done, but we won't - ** save it (we'll use eval instead) - */ - unset($fp); - } - - /* recompile */ - $compiler = self::getCompiler(); - - if (self::$debug) { - $compiler->setDebug($php.".dump"); - } - - try { - $code = $compiler->compile_file($tpl, FALSE, $vars); - } catch (Exception $e) { - if (isset($fp)) { - /* - ** set the $php file as old (to force future - ** recompilation) - */ - touch($php, 300, 300); - chmod($php, 0777); - } - /* re-throw exception */ - throw $e; - } - - if (isset($fp)) { - ftruncate($fp, 0); // truncate file - fwrite($fp, " | - +---------------------------------------------------------------------------------+ -*/ - -/** - * Simple AST (abstract syntax tree) helper class. This - * helps to generate array structure that is then translated by - * the Haanga_Generator class. - * - */ -class Haanga_AST -{ - public $stack = array(); - public $current = array(); - public $doesPrint = FALSE; - - - // getLast() {{{ - /** - * Return a refernce to the last element - * of the AST stack. - * - * @return array - */ - function & getLast() - { - $f = array(); - if (count($this->stack) == 0) { - return $f; - } - return $this->stack[count($this->stack)-1]; - } - // }}} - - - static protected function check_type($obj, $type) - { - if (is_string($obj)) { - return FALSE; - } - if (is_object($obj)) { - $obj = $obj->getArray(); - } - return isset($obj[$type]); - } - - public static function is_str($arr) - { - return self::check_type($arr, 'string'); - } - - public static function is_var($arr) - { - return self::check_type($arr, 'var'); - } - - public static function is_exec($arr) - { - return self::check_type($arr, 'exec'); - } - - public static function is_expr($arr) - { - return self::check_type($arr, 'op_expr'); - } - - - public static function str($string) - { - return array("string" => $string); - } - - public static function num($number) - { - return array("number" => $number); - } - - function stack_size() - { - return count($this->stack); - } - - function append_ast(Haanga_AST $obj) - { - $this->end(); - $obj->end(); - $this->stack = array_merge($this->stack, $obj->stack); - - return $this; - } - - static function constant($str) - { - return array('constant' => $str); - } - - function comment($str) - { - $this->stack[] = array("op" => "comment", 'comment' => $str); - - return $this; - } - - function declare_function($name) - { - $this->stack[] = array('op' => 'function', 'name' => $name); - - return $this; - } - - function do_return($name) - { - $this->getValue($name, $expr); - $this->stack[] = array('op' => 'return', $expr); - - return $this; - } - - function do_if($expr) - { - $this->getValue($expr, $vexpr); - $this->stack[] = array('op' => 'if', 'expr' => $vexpr); - - return $this; - } - - function do_else() - { - $this->stack[] = array('op' => 'else'); - - return $this; - } - - function do_endif() - { - $this->stack[] = array('op' => 'end_if'); - - return $this; - } - - function do_endfunction() - { - $this->stack[] = array('op' => 'end_function'); - - return $this; - } - - function v() - { - $var = array(); - foreach (func_get_args() as $id => $def) { - if ($id == 0) { - $var[$id] = $def; - } else { - $this->getValue($def, $value); - $var[$id] = $value; - } - } - if (count($var) == 1) { - $var = $var[0]; - } - $this->current = array('var' => $var); - - return $this; - } - - final function __get($property) - { - $property = strtolower($property); - if (isset($this->current[$property])) { - return $this->current[$property]; - } - return FALSE; - } - - static function fromArrayGetAST($obj) - { - $class = __CLASS__; - if ($obj InstanceOf $class) { - return $obj; - } - foreach (array('op_expr', 'expr_cond', 'exec', 'var', 'string', 'number', 'constant') as $type) { - if (isset($obj[$type])) { - $nobj = new $class; - $nobj->stack[] = $obj; - return $nobj; - } - } - } - - static function getValue($obj, &$value, $get_all=FALSE) - { - $class = __CLASS__; - - if ($obj InstanceOf $class) { - $value = $obj->getArray($get_all); - } else if (is_string($obj)) { - $value = self::str($obj); - } else if (is_numeric($obj) or $obj === 0) { - $value = self::num($obj); - } else if ($obj === FALSE) { - $value = array('expr' => FALSE); - } else if ($obj === TRUE) { - $value = array('expr' => TRUE); - } else if (is_array($obj)) { - foreach (array('op_expr', 'exec', 'var', 'string', 'number', 'constant') as $type) { - if (isset($obj[$type])) { - $value = $obj; - return; - } - } - $h = hcode()->arr(); - $first = 0; - foreach($obj as $key => $value) { - if ($key === $first) { - $key = NULL; - $first++; - } - $h->element($key, $value); - } - $value = $h->getArray(); - } else if ($obj === NULL) { - $value = array(); - } else { - var_Dump($obj); - throw new Exception("Imposible to get the value of the object"); - } - } - - function getArray($get_all=FALSE) - { - $this->end(); - if ($get_all) { - return $this->stack; - } - return isset($this->stack[0]) ? $this->stack[0] : NULL; - } - - function do_for($index, $min, $max, $step, Haanga_AST $body) - { - $def = array( - 'op' => 'for', - 'index' => $index, - 'min' => $min, - 'max' => $max, - 'step' => $step, - ); - - $this->stack[] = $def; - $this->stack = array_merge($this->stack, $body->getArray(TRUE)); - $this->stack[] = array('op' => 'end_for'); - - return $this; - } - - function do_foreach($array, $value, $key, Haanga_AST $body) - { - foreach (array('array', 'value', 'key') as $var) { - if ($$var === NULL) { - continue; - } - $var1 = & $$var; - if (is_string($var1)) { - $var1 = hvar($var1); - } - if (is_object($var1)) { - $var1 = $var1->getArray(); - } - if (empty($var1['var'])) { - throw new Exception("Can't iterate, apparently $var isn't a variable"); - } - $var1 = $var1['var']; - } - $def = array('op' => 'foreach', 'array' => $array, 'value' => $value); - if ($key) { - $def['key'] = $key; - } - $this->stack[] = $def; - $this->stack = array_merge($this->stack, $body->getArray(TRUE)); - $this->stack[] = array('op' => 'end_foreach'); - - return $this; - } - - function do_echo($stmt) - { - $this->getValue($stmt, $value); - $this->stack[] = array('op' => 'print', $value); - return $this; - } - - function do_global($array) - { - $this->stack[] = array('op' => 'global', 'vars' => $array); - - return $this; - } - - function do_exec() - { - $params = func_get_args(); - $exec = call_user_func_array('hexec', $params); - $this->stack[] = array('op' => 'expr', $exec->getArray()); - - return $this; - } - - function exec($function) - { - $this->current = array('exec' => $function, 'args' => array()); - foreach (func_get_args() as $id => $param) { - if ($id > 0) { - $this->param($param); - } - } - return $this; - } - - function expr($operation, $term1, $term2=NULL) - { - $this->getValue($term1, $value1); - if ($term2 !== NULL) { - $this->getValue($term2, $value2); - } else { - $value2 = NULL; - } - $this->current = array('op_expr' => $operation, $value1, $value2); - - return $this; - } - - function expr_cond($expr, $if_true, $if_false) - { - $this->getValue($expr, $vExpr); - $this->getValue($if_true, $vIfTrue); - $this->getValue($if_false, $vIfFalse); - - $this->current = array('expr_cond' => $vExpr, 'true' => $vIfTrue, 'false' => $vIfFalse); - - return $this; - } - - - function arr() - { - $this->current = array('array' => array()); - - return $this; - } - - function element($key=NULL, $value) - { - $last = & $this->current; - - if (!isset($last['array'])) { - throw new Exception("Invalid call to element()"); - } - - $this->getValue($value, $val); - if ($key !== NULL) { - $this->getValue($key, $kval); - $val = array('key' => array($kval, $val)); - } - $last['array'][] = $val; - } - - function decl_raw($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($name, $name); - $array = array('op' => 'declare', 'name' => $name['var']); - foreach (func_get_args() as $id => $value) { - if ($id != 0) { - $array[] = $value; - } - } - $this->stack[] = $array; - return $this; - } - - function decl($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($name, $name); - $array = array('op' => 'declare', 'name' => $name['var']); - foreach (func_get_args() as $id => $value) { - if ($id != 0) { - $this->getValue($value, $stmt); - $array[] = $stmt; - } - } - $this->stack[] = $array; - return $this; - } - - function append($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($value, $stmt); - $this->getValue($name, $name); - $this->stack[] = array('op' => 'append_var', 'name' => $name['var'], $stmt); - return $this; - } - - function param($param) - { - $last = & $this->current; - - if (!isset($last['exec'])) { - throw new Exception("Invalid call to param()"); - } - - $this->getValue($param, $value); - $last['args'][] = $value; - - return $this; - } - - function end() - { - if (count($this->current) > 0) { - $this->stack[] = $this->current; - $this->current = array(); - } - - return $this; - } -} - -function hcode() -{ - return new Haanga_AST; -} - -function hexpr($term1, $op='expr', $term2=NULL, $op2=NULL) -{ - $code = hcode(); - switch ($op2) { - case '+': - case '-': - case '/': - case '*': - case '%': - case '||': - case '&&': - case '<': - case '>': - case '<=': - case '>=': - case '==': - case '!=': - /* call recursive to resolve term2 */ - $args = func_get_args(); - $term2 = call_user_func_array('hexpr', array_slice($args, 2)); - break; - } - return $code->expr($op, $term1, $term2); -} - -function hexpr_cond($expr, $if_true, $if_false) -{ - $code = hcode(); - $code->expr_cond($expr, $if_true, $if_false); - - return $code; -} - -function hexec() -{ - $code = hcode(); - $args = func_get_args(); - return call_user_func_array(array($code, 'exec'), $args); -} - -function hconst($str) -{ - return Haanga_AST::Constant($str); -} - -// hvar() {{{ -/** - * Create the representation of a variable - * - * @return Haanga_AST - */ -function hvar() -{ - $args = func_get_args(); - return hvar_ex($args); -} - -function hvar_ex($args) -{ - $code = hcode(); - return call_user_func_array(array($code, 'v'), $args); -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler.php b/gulliver/thirdparty/Haanga/lib/Haanga/Compiler.php deleted file mode 100644 index 8b6eba752..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler.php +++ /dev/null @@ -1,1529 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -class Haanga_Compiler -{ - - // properties {{{ - protected static $block_var=NULL; - protected $generator; - protected $forloop = array(); - protected $forid = 0; - protected $sub_template = FALSE; - protected $name; - protected $check_function = FALSE; - protected $blocks=array(); - protected $line=0; - protected $file; - /** - * number of blocks :-) - */ - protected $in_block=0; - /** - * output buffers :-) - */ - protected $ob_start=0; - protected $append; - protected $prepend_op; - /** - * Context at compile time - */ - protected $context; - /** - * Table which contains all variables - * aliases defined in the template - */ - protected $var_alias; - /** - * Flag the current variable as safe. This means - * that escape won't be called if autoescape is - * activated (which is activated by default) - */ - public $var_is_safe=FALSE; - public $safes; - - /* compiler options */ - static protected $autoescape = TRUE; - static protected $if_empty = TRUE; - static protected $dot_as_object = TRUE; - static protected $strip_whitespace = FALSE; - static protected $is_exec_enabled = FALSE; - static protected $global_context = array(); - static protected $echo_concat = '.'; - static protected $enable_load = TRUE; - - /** - * Debug file - */ - protected $debug; - // }}} - - function __construct() - { - $this->generator = new Haanga_Generator_PHP; - if (self::$block_var===NULL) { - self::$block_var = '{{block.'.md5('super').'}}'; - } - } - - public function getScopeVariable($part = NULL, $string = FALSE) - { - static $var = NULL; - - if ($var === NULL) { - $var = 'vars' . uniqid(true); - } - - if ($string) { - return $var; - } - - if ($part !== NULL) { - return hvar($var, $part); - } - return hvar($var); - } - - // getOption($option) {{{ - public static function getOption($option) - { - $value = NULL; - switch (strtolower($option)) { - case 'enable_load': - $value = self::$enable_load; - break; - case 'if_empty': - $value = self::$if_empty; - break; - case 'autoescape': - $value = self::$autoescape; - break; - case 'dot_as_object': - $value = self::$dot_as_object; - break; - case 'echo_concat': - $value = self::$echo_concat; - break; - case 'strip_whitespace': - $value = self::$strip_whitespace; - break; - case 'is_exec_enabled': - case 'allow_exec': - $value = self::$is_exec_enabled; - break; - case 'global': - $value = self::$global_context; - break; - } - return $value; - } - // }}} - - // setOption($option, $value) {{{ - /** - * Set Compiler option. - * - * @return void - */ - public static function setOption($option, $value) - { - switch (strtolower($option)) { - case 'if_empty': - self::$if_empty = (bool)$value; - break; - case 'enable_load': - self::$enable_load = (bool)$value; - case 'echo_concat': - if ($value == '.' || $value == ',') { - self::$echo_concat = $value; - } - break; - - case 'autoescape': - self::$autoescape = (bool)$value; - break; - case 'dot_as_object': - self::$dot_as_object = (bool)$value; - break; - case 'strip_whitespace': - self::$strip_whitespace = (bool)$value; - break; - case 'is_exec_enabled': - case 'allow_exec': - self::$is_exec_enabled = (bool)$value; - break; - case 'global': - if (!is_array($value)) { - $value = array($value); - } - self::$global_context = $value; - break; - } - } - // }}} - - // setDebug($file) {{{ - function setDebug($file) - { - $this->debug = $file; - } - // }}} - - // reset() {{{ - function reset() - { - foreach (array_keys(get_object_vars($this)) as $key) { - if (isset($avoid_cleaning[$key])) { - continue; - } - $this->$key = NULL; - } - $this->generator = new Haanga_Generator_PHP; - $this->blocks = array(); - $this->cycle = array(); - } - // }}} - - // get_template_name() {{{ - final function get_template_name() - { - return $this->name; - } - // }}} - - // Set template name {{{ - function set_template_name($path) - { - $file = basename($path); - $pos = strpos($file,'.'); - return ($this->name = substr($file, 0, $pos)); - } - // }}} - - // get_function_name(string $name) {{{ - function get_function_name($name) - { - return "{$name}_template"; - } - // }}} - - // Compile ($code, $name=NULL) {{{ - final function compile($code, $name=NULL, $file=NULL) - { - $this->name = $name; - - if (count(self::$global_context) > 0) { - /* add global variables (if any) to the current context */ - foreach (self::$global_context as $var) { - $this->set_context($var, $GLOBALS[$var]); - } - } - - $parsed = Haanga_Compiler_Tokenizer::init($code, $this, $file); - $code = ""; - $this->subtemplate = FALSE; - - $body = new Haanga_AST; - $this->prepend_op = hcode(); - - if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') { - /* {% base ... %} found */ - $base = $parsed[0][0]; - $code .= $this->get_base_template($base); - unset($parsed[0]); - } - - if (defined('HAANGA_VERSION')) { - $body->decl('HAANGA_VERSION', HAANGA_VERSION); - } - - if ($name) { - $func_name = $this->get_function_name($name); - if ($this->check_function) { - $body->do_if(hexpr(hexec('function_exists', $func_name), '===', FALSE)); - } - if (!empty($this->file)) { - $body->comment("Generated from ".$this->file); - } - - $body->declare_function($func_name); - } - if (count(self::$global_context) > 0) { - $body->do_global(self::$global_context); - } - - - $body->do_exec('extract', $this->getScopeVariable()); - $body->do_if(hexpr(hvar('return'), '==', TRUE)); - $body->do_exec('ob_start'); - $body->do_endif(); - - - $this->generate_op_code($parsed, $body); - if ($this->subtemplate) { - $expr = $this->expr_call_base_template(); - $this->do_print($body, $expr); - } - - $body->do_if(hexpr(hvar('return'), '==', TRUE)); - $body->do_return(hexec('ob_get_clean')); - $body->do_endif(); - - if ($name) { - $body->do_endfunction(); - if ($this->check_function) { - $body->do_endif(); - } - } - - if ($this->prepend_op->stack_size() > 0) { - $this->prepend_op->append_ast($body); - $body = $this->prepend_op; - } - - $op_code = $body->getArray(TRUE); - - - $code .= $this->generator->getCode($op_code, $this->getScopeVariable(NULL, TRUE)); - if (!empty($this->append)) { - $code .= $this->append; - } - - if (!empty($this->debug)) { - $op_code['php'] = $code; - file_put_contents($this->debug, print_r($op_code, TRUE), LOCK_EX); - } - return $code; - } - // }}} - - // compile_file($file) {{{ - /** - * Compile a file - * - * @param string $file File path - * @param bool $safe Whether or not add check if the function is already defined - * - * @return Generated PHP code - */ - final function compile_file($file, $safe=FALSE, $context=array()) - { - if (!is_readable($file)) { - throw new Haanga_Compiler_Exception("$file is not a file"); - } - - $this->_base_dir = dirname($file); - $this->file = realpath($file); - $this->line = 0; - $this->check_function = $safe; - $this->context = $context; - $name = $this->set_template_name($file); - try { - return $this->compile(file_get_contents($file), $name, $file); - } catch (Exception $e) { - $this->Error((string)$e); - } - } - // }}} - - // getOpCodes($code, $file='') {{{ - /** - * Compile the $code and return the "opcodes" - * (the Abstract syntax tree). - * - * @param string $code Template content - * @param string $file File path (used for erro reporting) - * - * @return Haanga_AST - * - */ - public function getOpCodes($code, $file) - { - $oldfile = $this->file; - $this->file = $file; - $parsed = Haanga_Compiler_Tokenizer::init($code, $this, $file); - $body = new Haanga_AST; - if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') { - throw new Exception("{% base is not supported on inlines %}"); - } - $body = new Haanga_AST; - $this->generate_op_code($parsed, $body); - $this->file = $oldfile; - return $body; - } - // }}} - - // Error($errtxt) {{{ - /** - * Throw an exception and appends information about the template (the path and - * the last processed line). - * - * - */ - public function Error($err) - { - throw new Haanga_Compiler_Exception("{$err} in {$this->file}:$this->line"); - } - // }}} - - // is_expr methods {{{ - function is_var_filter($cmd) - { - return isset($cmd['var_filter']); - } - - // }}} - - // expr_call_base_template() {{{ - /** - * Generate code to call base template - * - */ - function expr_call_base_template() - { - return hexec( - $this->get_function_name($this->subtemplate), - $this->getScopeVariable(), TRUE, - hvar('blocks') - ); - } - // }}} - - // get_base_template($base) {{{ - /** - * Handle {% base "" %} definition. By default only - * static (string) are supported, but this can be overrided - * on subclasses. - * - * This method load the base class, compile it and return - * the generated code. - * - * @param array $base Base structure - * - * @return string Generated source code - */ - function get_base_template($base) - { - if (!Haanga_AST::is_str($base)) { - throw new Exception("Dynamic inheritance is not supported for compilated templates"); - } - $file = $base['string']; - list($this->subtemplate, $new_code) = $this->compile_required_template($file); - return $new_code."\n\n"; - } - // }}} - - // {% base "foo.html" %} {{{ - protected function generate_op_base() - { - throw new Exception("{% base %} can be only as first statement"); - } - // }}} - - // Main Loop {{{ - protected function generate_op_code($parsed, &$body) - { - if (!is_array($parsed)) { - throw new Exception("Invalid \$parsed array"); - } - foreach ($parsed as $op) { - if (!is_array($op)) { - continue; - } - if (!isset($op['operation'])) { - throw new Exception("Malformed array:".print_r($op, TRUE)); - } - if (isset($op['line'])) { - $this->line = $op['line']; - } - - if ($this->subtemplate && $this->in_block == 0 && $op['operation'] != 'block') { - /* ignore most of tokens in subtemplates */ - continue; - } - - $method = "generate_op_".$op['operation']; - if (!is_callable(array($this, $method))) { - throw new Exception("Compiler: Missing method $method"); - } - $this->$method($op, $body); - } - } - // }}} - - // Check the current expr {{{ - protected function check_expr(&$expr) - { - if (Haanga_AST::is_expr($expr)) { - if ($expr['op_expr'] == 'in') { - for ($id=0; $id < 2; $id++) { - if ($this->is_var_filter($expr[$id])) { - $expr[$id] = $this->get_filtered_var($expr[$id]['var_filter'], $var); - } - } - if (Haanga_AST::is_str($expr[1])) { - $expr = hexpr(hexec('strpos', $expr[1], $expr[0]), '!==', FALSE); - } else { - $expr = hexpr( - hexpr_cond( - hexec('is_array', $expr[1]), - hexec('array_search', $expr[0], $expr[1]), - hexec('strpos', $expr[1], $expr[0]) - ) - ,'!==', FALSE - ); - } - } - if (is_object($expr)) { - $expr = $expr->getArray(); - } - $this->check_expr($expr[0]); - $this->check_expr($expr[1]); - } else if (is_array($expr)) { - if ($this->is_var_filter($expr)) { - $expr = $this->get_filtered_var($expr['var_filter'], $var); - } else if (isset($expr['args'])) { - /* check every arguments */ - foreach ($expr['args'] as &$v) { - $this->check_expr($v); - } - unset($v); - } else if (isset($expr['expr_cond'])) { - /* Check expr conditions */ - $this->check_expr($expr['expr_cond']); - $this->check_expr($expr['true']); - $this->check_expr($expr['false']); - } - } - } - // }}} - - // ifequal|ifnot equal ... else ... {{{ - protected function generate_op_ifequal($details, &$body) - { - $if['expr'] = hexpr($details[1], $details['cmp'], $details[2])->getArray(); - $if['body'] = $details['body']; - if (isset($details['else'])) { - $if['else'] = $details['else']; - } - $this->generate_op_if($if, $body); - } - // }}} - - // {% if %} HTML {% else %} TWO {% endif $} {{{ - protected function generate_op_if($details, &$body) - { - if (self::$if_empty && $this->is_var_filter($details['expr']) && count($details['expr']['var_filter']) == 1) { - /* if we are doing if it should check - if it exists without throw any warning */ - $expr = $details['expr']; - $expr['var_filter'][] = 'empty'; - - $variable = $this->get_filtered_var($expr['var_filter'], $var); - - $details['expr'] = hexpr($variable, '===', FALSE)->getArray(); - } - $this->check_expr($details['expr']); - $expr = Haanga_AST::fromArrayGetAST($details['expr']); - $body->do_if($expr); - $this->generate_op_code($details['body'], $body); - if (isset($details['else'])) { - $body->do_else(); - $this->generate_op_code($details['else'], $body); - } - $body->do_endif(); - } - // }}} - - // Override template {{{ - protected function compile_required_template($file) - { - if (!is_file($file)) { - if (isset($this->_base_dir)) { - $file = $this->_base_dir.'/'.$file; - } - } - if (!is_file($file)) { - throw new Exception("can't find {$file} file template"); - } - $class = get_class($this); - $comp = new $class; - $comp->reset(); - $code = $comp->compile_file($file, $this->check_function); - return array($comp->get_template_name(), $code); - } - // }}} - - // include "file.html" | include {{{ - protected function generate_op_include($details, &$body) - { - if (!$details[0]['string']) { - throw new Exception("Dynamic inheritance is not supported for compilated templates"); - } - list($name,$code) = $this->compile_required_template($details[0]['string']); - $this->append .= "\n\n{$code}"; - $this->do_print($body, - hexec($this->get_function_name($name), - $this->getScopeVariable(), TRUE, hvar('blocks')) - ); - } - // }}} - - // Handle HTML code {{{ - protected function generate_op_html($details, &$body) - { - $string = Haanga_AST::str($details['html']); - $this->do_print($body, $string); - } - // }}} - - function isMethod($varname, &$expr) - { - if (is_array($varname)) { - $tmp = $varname; - $method = array_pop($tmp); - $object = $this->get_context($tmp); - if (!empty($method['object']) && is_string($method['object'])) { - $property = $method['object']; - if (is_object($object) && !isset($object->$property) && is_callable(array($object, $property))) { - $expr = hexec($varname); - return TRUE; - } - } - } - return FALSE; - } - - // get_var_filtered {{{ - /** - * This method handles all the filtered variable (piped_list(X)'s - * output in the parser. - * - * - * @param array $variable (Output of piped_list(B) (parser)) - * @param array &$varname Variable name - * @param bool $accept_string TRUE is string output are OK (ie: block.parent) - * - * @return expr - * - */ - function get_filtered_var($variable, &$varname, $accept_string=NULL) - { - $this->var_is_safe = FALSE; - - if ($accept_string === NULL && is_array($variable[0])) { - $accept_string = $variable[0][0] === 'block'; - } - - if (count($variable) > 1) { - $count = count($variable); - $target = $this->generate_variable_name($variable[0]); - - if (!Haanga_AST::is_var($target)) { - /* block.super can't have any filter */ - throw new Exception("This variable can't have any filter"); - } - - if ($this->isMethod($target['var'], $return)) { - $target = $return; - } - - for ($i=1; $i < $count; $i++) { - $func_name = $variable[$i]; - if ($func_name == 'escape') { - /* to avoid double cleaning */ - $this->var_is_safe = TRUE; - } - $args = array(isset($exec) ? $exec : $target); - $exec = $this->do_filtering($func_name, $args); - } - unset($variable); - $varname = $args[0]; - $details = $exec; - } else { - $details = $this->generate_variable_name($variable[0]); - $varname = $variable[0]; - - if ($this->isMethod($varname, $return)) { - return $return; - } - - if (!Haanga_AST::is_var($details) && !$accept_string) { - /* generate_variable_name didn't replied a variable, weird case - currently just used for {{block.super}}. - */ - throw new Exception("Invalid variable name {$variable[0]}"); - } - } - - return $details; - } - // }}} - - // generate_op_print_var {{{ - /** - * Generate code to print a variable with its filters, if there is any. - * - * All variable (except those flagged as |safe) are automatically - * escaped if autoescape is "on". - * - */ - protected function generate_op_print_var($details, &$body) - { - $expr = $details['expr']; - $this->check_expr($expr); - - - if (!$this->is_safe($expr) && self::$autoescape) { - $args = array($expr); - $expr = $this->do_filtering('escape', $args); - } - - $this->do_print($body, $expr); - } - // }}} - - // {# something #} {{{ - protected function generate_op_comment($details, &$body) - { - /* comments are annoying */ - //$body->comment($details['comment']); - } - // }}} - - // {% block 'name' %} ... {% endblock %} {{{ - protected function generate_op_block($details, &$body) - { - if (is_array($details['name'])) { - $name = ""; - foreach ($details['name'] as $part) { - if (is_string($part)) { - $name .= "{$part}"; - } else if (is_array($part)) { - if (Haanga_AST::is_str($part)) { - $name .= "{$part['string']}"; - } elseif (isset($part['object'])) { - $name .= "{$part['object']}"; - } else { - throw new Exception("Invalid blockname"); - } - } - $name .= "."; - } - $details['name'] = substr($name, 0, -1); - } - $this->in_block++; - $this->blocks[] = $details['name']; - $block_name = hvar('blocks', $details['name']); - - $this->ob_start($body); - $buffer_var = 'buffer'.$this->ob_start; - - $content = hcode(); - $this->generate_op_code($details['body'], $content); - - $body->append_ast($content); - $this->ob_start--; - - $buffer = hvar($buffer_var); - - /* {{{ */ - /** - * isset previous block (parent block)? - * TRUE - * has reference to self::$block_var ? - * TRUE - * replace self::$block_var for current block value (buffer) - * FALSE - * print parent block - * FALSE - * print current block - * - */ - $declare = hexpr_cond( - hexec('isset', $block_name), - hexpr_cond( - hexpr(hexec('strpos', $block_name, self::$block_var), '===', FALSE), - $block_name, - hexec('str_replace', self::$block_var, $buffer, $block_name) - ), $buffer); - /* }}} */ - - if (!$this->subtemplate) { - $this->do_print($body, $declare); - } else { - $body->decl($block_name, $declare); - if ($this->in_block > 1) { - $this->do_print($body, $block_name); - } - } - array_pop($this->blocks); - $this->in_block--; - - } - // }}} - - // regroup by as {{{ - protected function generate_op_regroup($details, &$body) - { - $body->comment("Temporary sorting"); - - $array = $this->get_filtered_var($details['array'], $varname); - - if (Haanga_AST::is_exec($array)) { - $varname = hvar($details['as']); - $body->decl($varname, $array); - } - $var = hvar('item', $details['row']); - - $body->decl('temp_group', array()); - - $body->do_foreach($varname, 'item', NULL, - hcode()->decl(hvar('temp_group', $var, NULL), hvar('item')) - ); - - $body->comment("Proper format"); - $body->decl($details['as'], array()); - $body->do_foreach('temp_group', 'item', 'group', - hcode()->decl( - hvar($details['as'], NULL), - array("grouper" => hvar('group'), "list" => hvar('item')) - ) - ); - $body->comment("Sorting done"); - } - // }}} - - // variable context {{{ - /** - * Variables context - * - * These two functions are useful to detect if a variable - * separated by dot (foo.bar) is an array or object. To avoid - * overhead we decide it at compile time, rather than - * ask over and over at rendering time. - * - * foo.bar: - * + If foo exists at compile time, - * and it is an array, it would be foo['bar'] - * otherwise it'd be foo->bar. - * + If foo don't exists at compile time, - * it would be foo->bar if the compiler option - * dot_as_object is TRUE (by default) otherwise - * it'd be foo['bar'] - * - * @author crodas - * @author gallir (ideas) - * - */ - function set_context($varname, $value) - { - $this->context[$varname] = $value; - } - - function get_context($variable) - { - if (!is_array($variable)) { - $variable = array($variable); - } - $varname = $variable[0]; - if (isset($this->context[$varname])) { - if (count($variable) == 1) { - return $this->context[$varname]; - } - $var = & $this->context[$varname]; - foreach ($variable as $id => $part) { - if ($id != 0) { - if (is_array($part) && isset($part['object'])) { - if (is_array($part['object']) && isset($part['object']['var'])) { - /* object $foo->$bar */ - $name = $part['object']['var']; - $name = $this->get_context($name); - if (!isset($var->$name)) { - return NULL; - } - $var = &$var->$name; - } else { - if (!isset($var->$part['object'])) { - return NULL; - } - $var = &$var->$part['object']; - } - } else if (is_object($var)) { - if (!isset($var->$part)) { - return NULL; - } - $var = &$var->$part; - } else { - if (!is_scalar($part) || empty($part) || !isset($var[$part])) { - return NULL; - } - $var = &$var[$part]; - } - } - } - $variable = $var; - unset($var); - return $variable; - } - - return NULL; - } - - function var_is_object(Array $variable, $default=NULL) - { - $varname = $variable[0]; - switch ($varname) { - case 'GLOBALS': - case '_SERVER': - case '_GET': - case '_POST': - case '_FILES': - case '_COOKIE': - case '_SESSION': - case '_REQUEST': - case '_ENV': - case 'forloop': - case 'block': - return FALSE; /* these are arrays */ - } - - $variable = $this->get_context($variable); - if (is_array($variable) || is_object($variable)) { - return $default ? is_object($variable) : is_object($variable) && !$variable InstanceOf Iterator && !$variable Instanceof ArrayAccess; - } - - return $default===NULL ? self::$dot_as_object : $default; - } - // }}} - - // Get variable name {{{ - function generate_variable_name($variable, $special=true) - { - if (is_array($variable)) { - switch ($variable[0]) { - case 'forloop': - if (!$special) { - return array('var' => $variable); - } - if (!$this->forid) { - throw new Exception("Invalid forloop reference outside of a loop"); - } - - switch ($variable[1]['object']) { - case 'counter': - $this->forloop[$this->forid]['counter'] = TRUE; - $variable = 'forcounter1_'.$this->forid; - break; - case 'counter0': - $this->forloop[$this->forid]['counter0'] = TRUE; - $variable = 'forcounter0_'.$this->forid; - break; - case 'last': - $this->forloop[$this->forid]['counter'] = TRUE; - $this->forloop[$this->forid]['last'] = TRUE; - $variable = 'islast_'.$this->forid; - break; - case 'first': - $this->forloop[$this->forid]['first'] = TRUE; - $variable = 'isfirst_'.$this->forid; - break; - case 'revcounter': - $this->forloop[$this->forid]['revcounter'] = TRUE; - $variable = 'revcount_'.$this->forid; - break; - case 'revcounter0': - $this->forloop[$this->forid]['revcounter0'] = TRUE; - $variable = 'revcount0_'.$this->forid; - break; - case 'parentloop': - unset($variable[1]); - $this->forid--; - $variable = $this->generate_variable_name(array_values($variable)); - $variable = $variable['var']; - $this->forid++; - break; - default: - throw new Exception("Unexpected forloop.{$variable[1]}"); - } - /* no need to escape it */ - $this->var_is_safe = TRUE; - break; - case 'block': - if (!$special) { - return array('var' => $variable); - } - if ($this->in_block == 0) { - throw new Exception("Can't use block.super outside a block"); - } - if (!$this->subtemplate) { - throw new Exception("Only subtemplates can call block.super"); - } - /* no need to escape it */ - $this->var_is_safe = TRUE; - return Haanga_AST::str(self::$block_var); - break; - default: - /* choose array or objects */ - - if ($special) { - // this section is resolved on the parser.y - return array('var' => $variable); - } - - for ($i=1; $i < count($variable); $i++) { - $var_part = array_slice($variable, 0, $i); - $def_arr = TRUE; - - if (is_array($variable[$i])) { - if (isset($variable[$i]['class'])) { - // no type guess for static properties - continue; - } - if (isset($variable[$i]['object'])) { - $def_arr = FALSE; - } - if (!Haanga_AST::is_var($variable[$i])) { - $variable[$i] = current($variable[$i]); - } else { - $variable[$i] = $this->generate_variable_name($variable[$i]['var']); - } - } - - $is_obj = $this->var_is_object($var_part, 'unknown'); - - if ( $is_obj === TRUE || ($is_obj == 'unknown' && !$def_arr)) { - $variable[$i] = array('object' => $variable[$i]); - } - } - - break; - } - - } else if (isset($this->var_alias[$variable])) { - $variable = $this->var_alias[$variable]['var']; - } - - return hvar($variable)->getArray(); - } - // }}} - - // Print {{{ - public function do_print(Haanga_AST $code, $stmt) - { - /* Flag this object as a printing one */ - $code->doesPrint = TRUE; - - if (self::$strip_whitespace && Haanga_AST::is_str($stmt)) { - $stmt['string'] = preg_replace('/\s+/', ' ', $stmt['string']); - } - - if ($this->ob_start == 0) { - $code->do_echo($stmt); - return; - } - - $buffer = hvar('buffer'.$this->ob_start); - $code->append($buffer, $stmt); - - } - - // }}} - - // for [,] in {{{ - protected function generate_op_loop($details, &$body) - { - if (isset($details['empty'])) { - $body->do_if(hexpr(hexec('count', hvar($details['array'])), '==', 0)); - $this->generate_op_code($details['empty'], $body); - $body->do_else(); - } - - /* ForID */ - $oldid = $this->forid; - $this->forid = $oldid+1; - $this->forloop[$this->forid] = array(); - - if (isset($details['range'])) { - $this->set_safe($details['variable']); - } else { - /* check variable context */ - - /* Check if the array to iterate is an object */ - $var = &$details['array'][0]; - if (is_string($var) && $this->var_is_object(array($var), FALSE)) { - /* It is an object, call to get_object_vars */ - $body->decl($var.'_arr', hexec('get_object_vars', hvar($var))); - $var .= '_arr'; - } - unset($var); - /* variables */ - $array = $this->get_filtered_var($details['array'], $varname); - - /* Loop body */ - if ($this->is_safe(hvar($varname))) { - $this->set_safe(hvar($details['variable'])); - } - - if ($array Instanceof Haanga_AST) { - // filtered var - $tmp = hvar('tmp'.($oldid+1)); - $body->decl($tmp, $array); - $array = $tmp; - } - $details['array'] = $array; - } - - /* for_body {{{ */ - $for_body = hcode(); - $this->generate_op_code($details['body'], $for_body); - - - $oid = $this->forid; - $size = hvar('psize_'.$oid); - - // counter {{{ - if (isset($this->forloop[$oid]['counter'])) { - $var = hvar('forcounter1_'.$oid); - $body->decl($var, 1); - $for_body->decl($var, hexpr($var, '+', 1)); - } - // }}} - - // counter0 {{{ - if (isset($this->forloop[$oid]['counter0'])) { - $var = hvar('forcounter0_'.$oid); - $body->decl($var, 0); - $for_body->decl($var, hexpr($var, '+', 1)); - } - // }}} - - // last {{{ - if (isset($this->forloop[$oid]['last'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = 'islast_'.$oid; - $body->decl($var, hexpr(hvar('forcounter1_'.$oid), '==', $size)); - $for_body->decl($var, hexpr(hvar('forcounter1_'.$oid), '==', $size)); - } - // }}} - - // first {{{ - if (isset($this->forloop[$oid]['first'])) { - $var = hvar('isfirst_'.$oid); - $body->decl($var, TRUE); - $for_body->decl($var, FALSE); - } - // }}} - - // revcounter {{{ - if (isset($this->forloop[$oid]['revcounter'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = hvar('revcount_'.$oid); - $body->decl($var, $size); - $for_body->decl($var, hexpr($var, '-', 1)); - } - // }}} - - // revcounter0 {{{ - if (isset($this->forloop[$oid]['revcounter0'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = hvar('revcount0_'.$oid); - $body->decl($var, hexpr($size, "-", 1)); - $for_body->decl($var, hexpr($var, '-', 1)); - } - // }}} - - /* }}} */ - - /* Restore old ForID */ - $this->forid = $oldid; - - /* Merge loop body */ - if (!isset($details['range'])) { - $body->do_foreach($array, $details['variable'], $details['index'], $for_body); - - if ($this->is_safe(hvar($varname))) { - $this->set_unsafe($details['variable']); - } - } else { - for ($i=0; $i < 2; $i++) { - if (Haanga_AST::is_var($details['range'][$i])) { - $details['range'][$i] = $this->generate_variable_name($details['range'][$i]['var']); - } - } - - if (Haanga_AST::is_var($details['step'])) { - $details['step'] = $this->generate_variable_name($details['step']['var']); - } - $body->do_for($details['variable'], $details['range'][0], $details['range'][1], $details['step'], $for_body); - $this->set_unsafe(hvar($details['variable'])); - } - - if (isset($details['empty'])) { - $body->do_endif(); - } - } - // }}} - - function generate_op_set($details, &$body) - { - $var = $this->generate_variable_name($details['var']); - $this->check_expr($details['expr']); - $body->decl_raw($var, $details['expr']); - $body->decl($this->getScopeVariable($var['var']), $var); - } - - - // ifchanged [ ob_start($body); - $var2 = hvar('buffer'.$this->ob_start); - - - $this->generate_op_code($details['body'], $body); - $this->ob_start--; - $body->do_if(hexpr(hexec('isset', hvar($var1)), '==', FALSE, '||', hvar($var1), '!=', $var2)); - $this->do_print($body, $var2); - $body->decl($var1, $var2); - } else { - /* beauty :-) */ - foreach ($details['check'] as $id=>$type) { - if (!Haanga_AST::is_var($type)) { - throw new Exception("Unexpected string {$type['string']}, expected a varabile"); - } - - $this_expr = hexpr(hexpr( - hexec('isset', hvar($var1, $id)), '==', FALSE, - '||', hvar($var1, $id), '!=', $type - )); - - if (isset($expr)) { - $this_expr = hexpr($expr, '&&', $this_expr); - } - - $expr = $this_expr; - - } - $body->do_if($expr); - $this->generate_op_code($details['body'], $body); - $body->decl($var1, $details['check']); - } - - if (isset($details['else'])) { - $body->do_else(); - $this->generate_op_code($details['else'], $body); - } - $body->do_endif(); - } - // }}} - - // autoescape ON|OFF {{{ - function generate_op_autoescape($details, &$body) - { - $old_autoescape = self::$autoescape; - self::$autoescape = strtolower($details['value']) == 'on'; - $this->generate_op_code($details['body'], $body); - self::$autoescape = $old_autoescape; - } - // }}} - - // {% spacefull %} Set to OFF strip_whitespace for a block (the compiler option) {{{ - function generate_op_spacefull($details, &$body) - { - $old_strip_whitespace = self::$strip_whitespace; - self::$strip_whitespace = FALSE; - $this->generate_op_code($details['body'], $body); - self::$strip_whitespace = $old_strip_whitespace; - } - // }}} - - // ob_Start(array &$body) {{{ - /** - * Start a new buffering - * - */ - function ob_start(&$body) - { - $this->ob_start++; - $body->decl('buffer'.$this->ob_start, ""); - } - // }}} - - // Custom Tags {{{ - function get_custom_tag($name) - { - $function = $this->get_function_name($this->name).'_tag_'.$name; - $this->append .= "\n\n".Haanga_Extension::getInstance('Tag')->getFunctionBody($name, $function); - return $function; - } - - /** - * Generate needed code for custom tags (tags that aren't - * handled by the compiler). - * - */ - function generate_op_custom_tag($details, &$body) - { - static $tags; - if (!$tags) { - $tags = Haanga_Extension::getInstance('Tag'); - } - - foreach ($details['list'] as $id => $arg) { - if (Haanga_AST::is_var($arg)) { - $details['list'][$id] = $this->generate_variable_name($arg['var']); - } - } - - - $tag_name = $details['name']; - $tagFunction = $tags->getFunctionAlias($tag_name); - - if (!$tagFunction && !$tags->hasGenerator($tag_name)) { - $function = $this->get_custom_tag($tag_name, isset($details['as'])); - } else { - $function = $tagFunction; - } - if (isset($details['body'])) { - /* - if the custom tag has 'body' - then it behave the same way as a filter - */ - $this->ob_start($body); - $this->generate_op_code($details['body'], $body); - $target = hvar('buffer'.$this->ob_start); - if ($tags->hasGenerator($tag_name)) { - $args = array_merge(array($target), $details['list']); - $exec = $tags->generator($tag_name, $this, $args); - if (!$exec InstanceOf Haanga_AST) { - throw new Exception("Invalid output of custom filter {$tag_name}"); - } - if ($exec->stack_size() >= 2 || $exec->doesPrint) { - /* - The generator returned more than one statement, - so we assume the output is already handled - by one of those stmts. - */ - $body->append_ast($exec); - $this->ob_start--; - return; - } - } else { - $exec = hexec($function, $target); - } - $this->ob_start--; - $this->do_print($body, $exec); - return; - } - - $var = isset($details['as']) ? $details['as'] : NULL; - $args = array_merge(array($function), $details['list']); - - if ($tags->hasGenerator($tag_name)) { - $exec = $tags->generator($tag_name, $this, $details['list'], $var); - if ($exec InstanceOf Haanga_AST) { - if ($exec->stack_size() >= 2 || $exec->doesPrint || $var !== NULL) { - /* - The generator returned more than one statement, - so we assume the output is already handled - by one of those stmts. - */ - $body->append_ast($exec); - return; - } - } else { - throw new Exception("Invalid output of the custom tag {$tag_name}"); - } - } else { - $fnc = array_shift($args); - $exec = hexec($fnc); - foreach ($args as $arg) { - $exec->param($arg); - } - } - - if ($var) { - $body->decl($var, $exec); - } else { - $this->do_print($body, $exec); - } - } - // }}} - - // with as {{{ - /** - * - * - */ - function generate_op_alias($details, &$body) - { - $this->var_alias[ $details['as'] ] = $this->generate_variable_name($details['var']); - $this->generate_op_code($details['body'], $body); - unset($this->var_alias[ $details['as'] ] ); - } - // }}} - - // Custom Filters {{{ - function get_custom_filter($name) - { - $function = $this->get_function_name($this->name).'_filter_'.$name; - $this->append .= "\n\n".Haanga_Extension::getInstance('Filter')->getFunctionBody($name, $function); - return $function; - } - - - function do_filtering($name, $args) - { - static $filter; - if (!$filter) { - $filter = Haanga_Extension::getInstance('Filter'); - } - - if (is_array($name)) { - /* - prepare array for ($func_name, $arg1, $arg2 ... ) - where $arg1 = last expression and $arg2.. $argX is - defined in the template - */ - $args = array_merge($args, $name['args']); - $name = $name[0]; - } - - if (!$filter->isValid($name)) { - throw new Exception("{$name} is an invalid filter"); - } - - if ($filter->isSafe($name)) { - /* check if the filter is return HTML-safe data (to avoid double scape) */ - $this->var_is_safe = TRUE; - } - - - if ($filter->hasGenerator($name)) { - return $filter->generator($name, $this, $args); - } - $fnc = $filter->getFunctionAlias($name); - if (!$fnc) { - $fnc = $this->get_custom_filter($name); - } - - $args = array_merge(array($fnc), $args); - $exec = call_user_func_array('hexec', $args); - - return $exec; - } - - function generate_op_filter($details, &$body) - { - $this->ob_start($body); - $this->generate_op_code($details['body'], $body); - $target = hvar('buffer'.$this->ob_start); - foreach ($details['functions'] as $f) { - $param = (isset($exec) ? $exec : $target); - $exec = $this->do_filtering($f, array($param)); - } - $this->ob_start--; - $this->do_print($body, $exec); - } - // }}} - - /* variable safety {{{ */ - function set_safe($name) - { - if (!Haanga_AST::is_Var($name)) { - $name = hvar($name)->getArray(); - } - $this->safes[serialize($name)] = TRUE; - } - - function set_unsafe($name) - { - if (!Haanga_AST::is_Var($name)) { - $name = hvar($name)->getArray(); - } - unset($this->safes[serialize($name)]); - } - - function is_safe($name) - { - if ($this->var_is_safe) { - return TRUE; - } - if (isset($this->safes[serialize($name)])) { - return TRUE; - } - return FALSE; - } - /* }}} */ - - final static function main_cli() - { - $argv = $GLOBALS['argv']; - $haanga = new Haanga_Compiler; - $code = $haanga->compile_file($argv[1], TRUE); - if (!isset($argv[2]) || $argv[2] != '--notags') { - $code = " | - +---------------------------------------------------------------------------------+ -*/ - -// Exception Class {{{ -/** - * Exception class - * - */ -class Haanga_Compiler_Exception extends Exception -{ -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.php b/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.php deleted file mode 100644 index 813aef413..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.php +++ /dev/null @@ -1,2319 +0,0 @@ -string = $s->string; - $this->metadata = $s->metadata; - } else { - $this->string = (string) $s; - if ($m instanceof Haanga_yyToken) { - $this->metadata = $m->metadata; - } elseif (is_array($m)) { - $this->metadata = $m; - } - } - } - - function __toString() - { - return $this->string; - } - - function offsetExists($offset) - { - return isset($this->metadata[$offset]); - } - - function offsetGet($offset) - { - return $this->metadata[$offset]; - } - - function offsetSet($offset, $value) - { - if ($offset === null) { - if (isset($value[0])) { - $x = ($value instanceof Haanga_yyToken) ? - $value->metadata : $value; - $this->metadata = array_merge($this->metadata, $x); - return; - } - $offset = count($this->metadata); - } - if ($value === null) { - return; - } - if ($value instanceof Haanga_yyToken) { - if ($value->metadata) { - $this->metadata[$offset] = $value->metadata; - } - } elseif ($value) { - $this->metadata[$offset] = $value; - } - } - - function offsetUnset($offset) - { - unset($this->metadata[$offset]); - } -} - -/** The following structure represents a single element of the - * parser's stack. Information stored includes: - * - * + The state number for the parser at this level of the stack. - * - * + The value of the token stored at this level of the stack. - * (In other words, the "major" token.) - * - * + The semantic value stored at this level of the stack. This is - * the information used by the action routines in the grammar. - * It is sometimes called the "minor" token. - */ -class Haanga_yyStackEntry -{ - public $stateno; /* The state-number */ - public $major; /* The major token value. This is the code - ** number for the token at this stack level */ - public $minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; - -// code external to the class is included here -#line 2 "Parser.y" - -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas | - +---------------------------------------------------------------------------------+ -*/ -#line 136 "Parser.php" - -// declare_class is output here -#line 39 "Parser.y" - class Haanga_Compiler_Parser #line 141 "Parser.php" -{ -/* First off, code is included which follows the "include_class" declaration -** in the input file. */ -#line 40 "Parser.y" - - protected $lex; - protected $file; - - function __construct($lex, $file='') - { - $this->lex = $lex; - $this->file = $file; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text.' in '.$this->file.':'.$this->lex->getLine()); - } - -#line 162 "Parser.php" - -/* Next is all token values, as class constants -*/ -/* -** These constants (all generated automatically by the parser generator) -** specify the various kinds of tokens (terminals) that the parser -** understands. -** -** Each symbol here is a terminal symbol in the grammar. -*/ - const T_TAG_OPEN = 1; - const T_NOT = 2; - const T_AND = 3; - const T_OR = 4; - const T_EQ = 5; - const T_NE = 6; - const T_GT = 7; - const T_GE = 8; - const T_LT = 9; - const T_LE = 10; - const T_IN = 11; - const T_PLUS = 12; - const T_MINUS = 13; - const T_CONCAT = 14; - const T_TIMES = 15; - const T_DIV = 16; - const T_MOD = 17; - const T_PIPE = 18; - const T_BITWISE = 19; - const T_HTML = 20; - const T_COMMENT = 21; - const T_PRINT_OPEN = 22; - const T_PRINT_CLOSE = 23; - const T_EXTENDS = 24; - const T_TAG_CLOSE = 25; - const T_INCLUDE = 26; - const T_AUTOESCAPE = 27; - const T_CUSTOM_END = 28; - const T_CUSTOM_TAG = 29; - const T_AS = 30; - const T_CUSTOM_BLOCK = 31; - const T_SPACEFULL = 32; - const T_WITH = 33; - const T_SET = 34; - const T_ASSIGN = 35; - const T_LOAD = 36; - const T_FOR = 37; - const T_COMMA = 38; - const T_STEP = 39; - const T_EMPTY = 40; - const T_IF = 41; - const T_ELSE = 42; - const T_IFCHANGED = 43; - const T_IFEQUAL = 44; - const T_IFNOTEQUAL = 45; - const T_BLOCK = 46; - const T_FILTER = 47; - const T_REGROUP = 48; - const T_BY = 49; - const T_COLON = 50; - const T_TRUE = 51; - const T_FALSE = 52; - const T_STRING = 53; - const T_INTL = 54; - const T_RPARENT = 55; - const T_LPARENT = 56; - const T_OBJ = 57; - const T_DOT = 58; - const T_CLASS = 59; - const T_BRACKETS_OPEN = 60; - const T_BRACKETS_CLOSE = 61; - const T_ALPHA = 62; - const T_DOTDOT = 63; - const T_NUMERIC = 64; - const YY_NO_ACTION = 356; - const YY_ACCEPT_ACTION = 355; - const YY_ERROR_ACTION = 354; - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < self::YYNSTATE Shift N. That is, -** push the lookahead -** token onto the stack -** and goto state N. -** -** self::YYNSTATE <= N < self::YYNSTATE+self::YYNRULE Reduce by rule N-YYNSTATE. -** -** N == self::YYNSTATE+self::YYNRULE A syntax error has occurred. -** -** N == self::YYNSTATE+self::YYNRULE+1 The parser accepts its -** input. (and concludes parsing) -** -** N == self::YYNSTATE+self::YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large static array $yy_action. -** Given state S and lookahead X, the action is computed as -** -** self::$yy_action[self::$yy_shift_ofst[S] + X ] -** -** If the index value self::$yy_shift_ofst[S]+X is out of range or if the value -** self::$yy_lookahead[self::$yy_shift_ofst[S]+X] is not equal to X or if -** self::$yy_shift_ofst[S] is equal to self::YY_SHIFT_USE_DFLT, it means that -** the action is not in the table and that self::$yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the static $yy_reduce_ofst array is used in place of -** the static $yy_shift_ofst array and self::YY_REDUCE_USE_DFLT is used in place of -** self::YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** self::$yy_action A single table containing all actions. -** self::$yy_lookahead A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** self::$yy_shift_ofst For each state, the offset into self::$yy_action for -** shifting terminals. -** self::$yy_reduce_ofst For each state, the offset into self::$yy_action for -** shifting non-terminals after a reduce. -** self::$yy_default Default action for each state. -*/ - const YY_SZ_ACTTAB = 1352; -static public $yy_action = array( - /* 0 */ 47, 46, 50, 68, 167, 40, 114, 42, 185, 66, - /* 10 */ 67, 96, 95, 60, 351, 228, 160, 27, 176, 41, - /* 20 */ 36, 35, 56, 55, 53, 47, 64, 50, 68, 153, - /* 30 */ 40, 212, 42, 185, 66, 67, 102, 95, 60, 33, - /* 40 */ 33, 248, 27, 148, 41, 36, 35, 56, 55, 53, - /* 50 */ 47, 225, 50, 68, 170, 40, 253, 42, 185, 66, - /* 60 */ 67, 57, 95, 60, 39, 243, 172, 27, 189, 41, - /* 70 */ 36, 35, 56, 55, 53, 47, 65, 50, 68, 177, - /* 80 */ 40, 201, 42, 185, 66, 67, 242, 95, 60, 355, - /* 90 */ 72, 61, 27, 161, 41, 36, 35, 56, 55, 53, - /* 100 */ 47, 229, 50, 68, 178, 40, 105, 42, 185, 66, - /* 110 */ 67, 113, 95, 60, 215, 116, 235, 27, 179, 41, - /* 120 */ 36, 35, 56, 55, 53, 47, 232, 50, 68, 136, - /* 130 */ 40, 251, 42, 185, 66, 67, 190, 95, 60, 236, - /* 140 */ 237, 108, 27, 137, 41, 36, 35, 56, 55, 53, - /* 150 */ 47, 155, 50, 68, 169, 40, 202, 42, 185, 66, - /* 160 */ 67, 57, 95, 60, 204, 100, 103, 27, 239, 41, - /* 170 */ 36, 35, 56, 55, 53, 47, 57, 50, 68, 183, - /* 180 */ 40, 210, 42, 185, 66, 67, 57, 95, 60, 191, - /* 190 */ 112, 252, 27, 97, 41, 36, 35, 56, 55, 53, - /* 200 */ 47, 52, 50, 68, 186, 40, 264, 42, 185, 66, - /* 210 */ 67, 224, 95, 60, 31, 188, 106, 27, 247, 41, - /* 220 */ 36, 35, 56, 55, 53, 47, 233, 50, 68, 143, - /* 230 */ 40, 230, 42, 185, 66, 67, 115, 95, 60, 46, - /* 240 */ 104, 198, 27, 98, 41, 36, 35, 56, 55, 53, - /* 250 */ 47, 54, 50, 68, 140, 40, 214, 42, 185, 66, - /* 260 */ 67, 192, 95, 60, 209, 73, 246, 27, 244, 41, - /* 270 */ 36, 35, 56, 55, 53, 47, 88, 50, 68, 174, - /* 280 */ 40, 238, 42, 185, 66, 67, 84, 95, 60, 77, - /* 290 */ 89, 83, 27, 173, 41, 36, 35, 56, 55, 53, - /* 300 */ 47, 78, 50, 68, 146, 40, 91, 42, 185, 66, - /* 310 */ 67, 81, 95, 60, 76, 87, 90, 27, 185, 41, - /* 320 */ 36, 35, 56, 55, 53, 47, 92, 50, 68, 182, - /* 330 */ 40, 82, 42, 185, 66, 67, 86, 95, 60, 74, - /* 340 */ 85, 241, 27, 185, 41, 36, 35, 56, 55, 53, - /* 350 */ 47, 71, 50, 68, 58, 40, 75, 42, 185, 66, - /* 360 */ 67, 80, 95, 60, 79, 93, 185, 27, 185, 41, - /* 370 */ 36, 35, 56, 55, 53, 47, 185, 50, 68, 187, - /* 380 */ 40, 185, 42, 185, 66, 67, 185, 95, 60, 185, - /* 390 */ 185, 185, 27, 185, 41, 36, 35, 56, 55, 53, - /* 400 */ 47, 185, 50, 68, 94, 40, 185, 42, 185, 66, - /* 410 */ 67, 185, 95, 60, 185, 185, 185, 27, 185, 41, - /* 420 */ 36, 35, 56, 55, 53, 47, 185, 50, 68, 158, - /* 430 */ 40, 185, 42, 185, 66, 67, 185, 95, 60, 185, - /* 440 */ 185, 185, 27, 57, 41, 36, 35, 56, 55, 53, - /* 450 */ 34, 26, 28, 28, 28, 28, 28, 28, 28, 24, - /* 460 */ 24, 24, 29, 29, 29, 33, 33, 29, 29, 29, - /* 470 */ 33, 33, 110, 47, 62, 50, 68, 141, 40, 185, - /* 480 */ 42, 185, 66, 67, 185, 95, 60, 185, 185, 185, - /* 490 */ 27, 185, 41, 36, 35, 56, 55, 53, 34, 26, - /* 500 */ 28, 28, 28, 28, 28, 28, 28, 24, 24, 24, - /* 510 */ 29, 29, 29, 33, 33, 47, 185, 50, 68, 156, - /* 520 */ 40, 154, 42, 185, 66, 67, 22, 95, 60, 185, - /* 530 */ 254, 185, 27, 195, 41, 36, 35, 56, 55, 53, - /* 540 */ 223, 45, 185, 227, 185, 193, 194, 32, 185, 221, - /* 550 */ 250, 127, 220, 185, 34, 26, 28, 28, 28, 28, - /* 560 */ 28, 28, 28, 24, 24, 24, 29, 29, 29, 33, - /* 570 */ 33, 107, 219, 185, 196, 69, 69, 70, 48, 47, - /* 580 */ 185, 50, 68, 165, 40, 51, 42, 185, 66, 67, - /* 590 */ 185, 95, 60, 185, 185, 185, 27, 185, 41, 36, - /* 600 */ 35, 56, 55, 53, 47, 185, 50, 68, 152, 40, - /* 610 */ 185, 42, 185, 66, 67, 185, 95, 60, 185, 185, - /* 620 */ 185, 27, 185, 41, 36, 35, 56, 55, 53, 47, - /* 630 */ 185, 50, 68, 163, 40, 185, 42, 185, 66, 67, - /* 640 */ 185, 95, 60, 257, 127, 220, 27, 185, 41, 36, - /* 650 */ 35, 56, 55, 53, 34, 26, 28, 28, 28, 28, - /* 660 */ 28, 28, 28, 24, 24, 24, 29, 29, 29, 33, - /* 670 */ 33, 26, 28, 28, 28, 28, 28, 28, 28, 24, - /* 680 */ 24, 24, 29, 29, 29, 33, 33, 28, 28, 28, - /* 690 */ 28, 28, 28, 28, 24, 24, 24, 29, 29, 29, - /* 700 */ 33, 33, 154, 15, 185, 25, 185, 185, 185, 185, - /* 710 */ 185, 185, 185, 185, 234, 185, 154, 231, 231, 63, - /* 720 */ 231, 185, 193, 194, 32, 185, 254, 49, 185, 185, - /* 730 */ 185, 231, 231, 185, 231, 231, 223, 44, 185, 227, - /* 740 */ 222, 222, 228, 160, 185, 221, 154, 127, 220, 231, - /* 750 */ 4, 231, 185, 219, 261, 261, 228, 160, 213, 30, - /* 760 */ 185, 231, 231, 59, 231, 231, 199, 219, 185, 193, - /* 770 */ 194, 32, 185, 203, 185, 200, 154, 127, 220, 231, - /* 780 */ 185, 185, 185, 185, 222, 222, 228, 160, 99, 254, - /* 790 */ 185, 231, 231, 185, 231, 231, 185, 219, 185, 223, - /* 800 */ 43, 49, 227, 185, 185, 185, 154, 185, 221, 231, - /* 810 */ 127, 220, 185, 185, 222, 222, 228, 160, 111, 185, - /* 820 */ 154, 231, 231, 185, 231, 231, 185, 219, 185, 185, - /* 830 */ 255, 49, 117, 185, 185, 231, 231, 185, 231, 231, - /* 840 */ 223, 185, 185, 227, 222, 222, 228, 160, 185, 221, - /* 850 */ 154, 127, 220, 231, 185, 231, 122, 219, 222, 222, - /* 860 */ 228, 160, 109, 185, 185, 231, 231, 163, 231, 231, - /* 870 */ 259, 219, 162, 185, 258, 249, 262, 263, 127, 220, - /* 880 */ 185, 185, 154, 231, 223, 185, 185, 227, 222, 222, - /* 890 */ 228, 160, 142, 221, 185, 127, 220, 231, 231, 231, - /* 900 */ 231, 219, 226, 127, 220, 157, 208, 207, 205, 206, - /* 910 */ 211, 217, 218, 216, 154, 231, 240, 185, 101, 185, - /* 920 */ 222, 222, 228, 160, 138, 185, 185, 185, 185, 231, - /* 930 */ 231, 231, 231, 219, 223, 185, 245, 227, 180, 231, - /* 940 */ 231, 185, 231, 221, 185, 127, 220, 231, 119, 127, - /* 950 */ 220, 185, 261, 261, 228, 160, 185, 231, 185, 163, - /* 960 */ 185, 121, 259, 231, 162, 219, 185, 249, 262, 263, - /* 970 */ 127, 220, 163, 231, 133, 259, 260, 162, 185, 185, - /* 980 */ 249, 262, 263, 127, 220, 127, 220, 163, 185, 135, - /* 990 */ 259, 185, 162, 185, 185, 249, 262, 263, 127, 220, - /* 1000 */ 163, 185, 125, 259, 185, 162, 185, 12, 249, 262, - /* 1010 */ 263, 127, 220, 163, 185, 185, 259, 185, 162, 126, - /* 1020 */ 185, 249, 262, 263, 127, 220, 193, 194, 32, 185, - /* 1030 */ 163, 185, 124, 259, 185, 162, 185, 185, 249, 262, - /* 1040 */ 263, 127, 220, 163, 185, 166, 259, 118, 162, 185, - /* 1050 */ 185, 249, 262, 263, 127, 220, 127, 220, 163, 185, - /* 1060 */ 123, 259, 185, 162, 185, 185, 249, 262, 263, 127, - /* 1070 */ 220, 163, 185, 120, 259, 185, 162, 185, 185, 249, - /* 1080 */ 262, 263, 127, 220, 163, 185, 185, 259, 185, 162, - /* 1090 */ 185, 185, 249, 262, 263, 127, 220, 185, 163, 185, - /* 1100 */ 185, 259, 185, 162, 185, 185, 37, 262, 263, 127, - /* 1110 */ 220, 185, 129, 231, 231, 185, 231, 134, 128, 149, - /* 1120 */ 185, 200, 263, 127, 220, 163, 154, 197, 259, 185, - /* 1130 */ 162, 231, 185, 144, 262, 263, 127, 220, 127, 220, - /* 1140 */ 163, 231, 231, 259, 231, 162, 185, 231, 147, 262, - /* 1150 */ 263, 127, 220, 163, 185, 185, 259, 185, 162, 231, - /* 1160 */ 185, 38, 262, 263, 127, 220, 168, 185, 185, 185, - /* 1170 */ 150, 185, 185, 185, 185, 231, 223, 219, 6, 227, - /* 1180 */ 223, 185, 185, 227, 185, 221, 185, 127, 220, 221, - /* 1190 */ 256, 127, 220, 185, 185, 185, 163, 193, 194, 32, - /* 1200 */ 223, 131, 185, 227, 185, 163, 263, 127, 220, 221, - /* 1210 */ 132, 127, 220, 199, 5, 263, 127, 220, 163, 3, - /* 1220 */ 139, 185, 200, 130, 127, 220, 7, 185, 263, 127, - /* 1230 */ 220, 1, 175, 193, 194, 32, 21, 185, 193, 194, - /* 1240 */ 32, 18, 185, 127, 220, 193, 194, 32, 8, 185, - /* 1250 */ 193, 194, 32, 10, 185, 193, 194, 32, 9, 185, - /* 1260 */ 193, 194, 32, 13, 185, 185, 185, 193, 194, 32, - /* 1270 */ 11, 185, 193, 194, 32, 17, 185, 193, 194, 32, - /* 1280 */ 2, 185, 193, 194, 32, 20, 185, 185, 185, 193, - /* 1290 */ 194, 32, 19, 185, 193, 194, 32, 23, 151, 193, - /* 1300 */ 194, 32, 16, 185, 193, 194, 32, 14, 185, 127, - /* 1310 */ 220, 193, 194, 32, 185, 185, 193, 194, 32, 185, - /* 1320 */ 159, 193, 194, 32, 185, 184, 193, 194, 32, 171, - /* 1330 */ 145, 127, 220, 185, 164, 185, 127, 220, 185, 181, - /* 1340 */ 185, 127, 220, 185, 185, 127, 220, 185, 185, 185, - /* 1350 */ 127, 220, - ); - static public $yy_lookahead = array( - /* 0 */ 24, 50, 26, 27, 28, 29, 25, 31, 32, 33, - /* 10 */ 34, 25, 36, 37, 63, 53, 54, 41, 42, 43, - /* 20 */ 44, 45, 46, 47, 48, 24, 30, 26, 27, 28, - /* 30 */ 29, 25, 31, 32, 33, 34, 25, 36, 37, 18, - /* 40 */ 19, 25, 41, 42, 43, 44, 45, 46, 47, 48, - /* 50 */ 24, 68, 26, 27, 28, 29, 25, 31, 32, 33, - /* 60 */ 34, 18, 36, 37, 11, 25, 40, 41, 25, 43, - /* 70 */ 44, 45, 46, 47, 48, 24, 30, 26, 27, 28, - /* 80 */ 29, 25, 31, 32, 33, 34, 25, 36, 37, 66, - /* 90 */ 67, 38, 41, 42, 43, 44, 45, 46, 47, 48, - /* 100 */ 24, 93, 26, 27, 28, 29, 25, 31, 32, 33, - /* 110 */ 34, 25, 36, 37, 25, 25, 25, 41, 42, 43, - /* 120 */ 44, 45, 46, 47, 48, 24, 93, 26, 27, 28, - /* 130 */ 29, 25, 31, 32, 33, 34, 25, 36, 37, 25, - /* 140 */ 25, 25, 41, 42, 43, 44, 45, 46, 47, 48, - /* 150 */ 24, 53, 26, 27, 28, 29, 25, 31, 32, 33, - /* 160 */ 34, 18, 36, 37, 25, 25, 25, 41, 25, 43, - /* 170 */ 44, 45, 46, 47, 48, 24, 18, 26, 27, 28, - /* 180 */ 29, 25, 31, 32, 33, 34, 18, 36, 37, 25, - /* 190 */ 25, 25, 41, 25, 43, 44, 45, 46, 47, 48, - /* 200 */ 24, 63, 26, 27, 28, 29, 25, 31, 32, 33, - /* 210 */ 34, 25, 36, 37, 35, 25, 25, 41, 25, 43, - /* 220 */ 44, 45, 46, 47, 48, 24, 55, 26, 27, 28, - /* 230 */ 29, 61, 31, 32, 33, 34, 25, 36, 37, 50, - /* 240 */ 25, 25, 41, 25, 43, 44, 45, 46, 47, 48, - /* 250 */ 24, 11, 26, 27, 28, 29, 25, 31, 32, 33, - /* 260 */ 34, 25, 36, 37, 64, 67, 25, 41, 25, 43, - /* 270 */ 44, 45, 46, 47, 48, 24, 67, 26, 27, 28, - /* 280 */ 29, 25, 31, 32, 33, 34, 67, 36, 37, 67, - /* 290 */ 67, 67, 41, 90, 43, 44, 45, 46, 47, 48, - /* 300 */ 24, 67, 26, 27, 28, 29, 67, 31, 32, 33, - /* 310 */ 34, 67, 36, 37, 67, 67, 67, 41, 94, 43, - /* 320 */ 44, 45, 46, 47, 48, 24, 67, 26, 27, 28, - /* 330 */ 29, 67, 31, 32, 33, 34, 67, 36, 37, 67, - /* 340 */ 67, 84, 41, 94, 43, 44, 45, 46, 47, 48, - /* 350 */ 24, 67, 26, 27, 28, 29, 67, 31, 32, 33, - /* 360 */ 34, 67, 36, 37, 67, 67, 94, 41, 94, 43, - /* 370 */ 44, 45, 46, 47, 48, 24, 94, 26, 27, 28, - /* 380 */ 29, 94, 31, 32, 33, 34, 94, 36, 37, 94, - /* 390 */ 94, 94, 41, 94, 43, 44, 45, 46, 47, 48, - /* 400 */ 24, 94, 26, 27, 28, 29, 94, 31, 32, 33, - /* 410 */ 34, 94, 36, 37, 94, 94, 94, 41, 94, 43, - /* 420 */ 44, 45, 46, 47, 48, 24, 94, 26, 27, 28, - /* 430 */ 29, 94, 31, 32, 33, 34, 94, 36, 37, 94, - /* 440 */ 94, 94, 41, 18, 43, 44, 45, 46, 47, 48, - /* 450 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 460 */ 13, 14, 15, 16, 17, 18, 19, 15, 16, 17, - /* 470 */ 18, 19, 25, 24, 49, 26, 27, 28, 29, 94, - /* 480 */ 31, 32, 33, 34, 94, 36, 37, 94, 94, 94, - /* 490 */ 41, 94, 43, 44, 45, 46, 47, 48, 3, 4, - /* 500 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 510 */ 15, 16, 17, 18, 19, 24, 94, 26, 27, 28, - /* 520 */ 29, 13, 31, 32, 33, 34, 1, 36, 37, 94, - /* 530 */ 71, 94, 41, 25, 43, 44, 45, 46, 47, 48, - /* 540 */ 81, 82, 94, 84, 94, 20, 21, 22, 94, 90, - /* 550 */ 55, 92, 93, 94, 3, 4, 5, 6, 7, 8, - /* 560 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 570 */ 19, 25, 64, 94, 23, 57, 58, 59, 60, 24, - /* 580 */ 94, 26, 27, 28, 29, 39, 31, 32, 33, 34, - /* 590 */ 94, 36, 37, 94, 94, 94, 41, 94, 43, 44, - /* 600 */ 45, 46, 47, 48, 24, 94, 26, 27, 28, 29, - /* 610 */ 94, 31, 32, 33, 34, 94, 36, 37, 94, 94, - /* 620 */ 94, 41, 94, 43, 44, 45, 46, 47, 48, 24, - /* 630 */ 94, 26, 27, 81, 29, 94, 31, 32, 33, 34, - /* 640 */ 94, 36, 37, 91, 92, 93, 41, 94, 43, 44, - /* 650 */ 45, 46, 47, 48, 3, 4, 5, 6, 7, 8, - /* 660 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 670 */ 19, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 680 */ 13, 14, 15, 16, 17, 18, 19, 5, 6, 7, - /* 690 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 700 */ 18, 19, 13, 1, 94, 2, 94, 94, 94, 94, - /* 710 */ 94, 94, 94, 94, 25, 94, 13, 28, 29, 30, - /* 720 */ 31, 94, 20, 21, 22, 94, 71, 38, 94, 94, - /* 730 */ 94, 28, 29, 94, 31, 46, 81, 82, 94, 84, - /* 740 */ 51, 52, 53, 54, 94, 90, 13, 92, 93, 46, - /* 750 */ 1, 62, 94, 64, 51, 52, 53, 54, 25, 56, - /* 760 */ 94, 28, 29, 30, 31, 62, 81, 64, 94, 20, - /* 770 */ 21, 22, 94, 88, 94, 90, 13, 92, 93, 46, - /* 780 */ 94, 94, 94, 94, 51, 52, 53, 54, 25, 71, - /* 790 */ 94, 28, 29, 94, 31, 62, 94, 64, 94, 81, - /* 800 */ 82, 38, 84, 94, 94, 94, 13, 94, 90, 46, - /* 810 */ 92, 93, 94, 94, 51, 52, 53, 54, 25, 94, - /* 820 */ 13, 28, 29, 94, 31, 62, 94, 64, 94, 94, - /* 830 */ 71, 38, 25, 94, 94, 28, 29, 94, 31, 46, - /* 840 */ 81, 94, 94, 84, 51, 52, 53, 54, 94, 90, - /* 850 */ 13, 92, 93, 46, 94, 62, 70, 64, 51, 52, - /* 860 */ 53, 54, 25, 94, 94, 28, 29, 81, 31, 62, - /* 870 */ 84, 64, 86, 94, 71, 89, 90, 91, 92, 93, - /* 880 */ 94, 94, 13, 46, 81, 94, 94, 84, 51, 52, - /* 890 */ 53, 54, 81, 90, 94, 92, 93, 28, 29, 62, - /* 900 */ 31, 64, 69, 92, 93, 72, 73, 74, 75, 76, - /* 910 */ 77, 78, 79, 80, 13, 46, 83, 94, 85, 94, - /* 920 */ 51, 52, 53, 54, 71, 94, 94, 94, 94, 28, - /* 930 */ 29, 62, 31, 64, 81, 94, 25, 84, 81, 28, - /* 940 */ 29, 94, 31, 90, 94, 92, 93, 46, 70, 92, - /* 950 */ 93, 94, 51, 52, 53, 54, 94, 46, 94, 81, - /* 960 */ 94, 70, 84, 62, 86, 64, 94, 89, 90, 91, - /* 970 */ 92, 93, 81, 62, 81, 84, 70, 86, 94, 94, - /* 980 */ 89, 90, 91, 92, 93, 92, 93, 81, 94, 70, - /* 990 */ 84, 94, 86, 94, 94, 89, 90, 91, 92, 93, - /* 1000 */ 81, 94, 70, 84, 94, 86, 94, 1, 89, 90, - /* 1010 */ 91, 92, 93, 81, 94, 94, 84, 94, 86, 70, - /* 1020 */ 94, 89, 90, 91, 92, 93, 20, 21, 22, 94, - /* 1030 */ 81, 94, 70, 84, 94, 86, 94, 94, 89, 90, - /* 1040 */ 91, 92, 93, 81, 94, 81, 84, 70, 86, 94, - /* 1050 */ 94, 89, 90, 91, 92, 93, 92, 93, 81, 94, - /* 1060 */ 70, 84, 94, 86, 94, 94, 89, 90, 91, 92, - /* 1070 */ 93, 81, 94, 70, 84, 94, 86, 94, 94, 89, - /* 1080 */ 90, 91, 92, 93, 81, 94, 94, 84, 94, 86, - /* 1090 */ 94, 94, 89, 90, 91, 92, 93, 94, 81, 94, - /* 1100 */ 94, 84, 94, 86, 94, 94, 89, 90, 91, 92, - /* 1110 */ 93, 94, 81, 28, 29, 94, 31, 86, 87, 88, - /* 1120 */ 94, 90, 91, 92, 93, 81, 13, 81, 84, 94, - /* 1130 */ 86, 46, 94, 89, 90, 91, 92, 93, 92, 93, - /* 1140 */ 81, 28, 29, 84, 31, 86, 94, 62, 89, 90, - /* 1150 */ 91, 92, 93, 81, 94, 94, 84, 94, 86, 46, - /* 1160 */ 94, 89, 90, 91, 92, 93, 71, 94, 94, 94, - /* 1170 */ 71, 94, 94, 94, 94, 62, 81, 64, 1, 84, - /* 1180 */ 81, 94, 94, 84, 94, 90, 94, 92, 93, 90, - /* 1190 */ 71, 92, 93, 94, 94, 94, 81, 20, 21, 22, - /* 1200 */ 81, 86, 94, 84, 94, 81, 91, 92, 93, 90, - /* 1210 */ 86, 92, 93, 81, 1, 91, 92, 93, 81, 1, - /* 1220 */ 88, 94, 90, 86, 92, 93, 1, 94, 91, 92, - /* 1230 */ 93, 1, 81, 20, 21, 22, 1, 94, 20, 21, - /* 1240 */ 22, 1, 94, 92, 93, 20, 21, 22, 1, 94, - /* 1250 */ 20, 21, 22, 1, 94, 20, 21, 22, 1, 94, - /* 1260 */ 20, 21, 22, 1, 94, 94, 94, 20, 21, 22, - /* 1270 */ 1, 94, 20, 21, 22, 1, 94, 20, 21, 22, - /* 1280 */ 1, 94, 20, 21, 22, 1, 94, 94, 94, 20, - /* 1290 */ 21, 22, 1, 94, 20, 21, 22, 1, 81, 20, - /* 1300 */ 21, 22, 1, 94, 20, 21, 22, 1, 94, 92, - /* 1310 */ 93, 20, 21, 22, 94, 94, 20, 21, 22, 94, - /* 1320 */ 81, 20, 21, 22, 94, 81, 20, 21, 22, 90, - /* 1330 */ 81, 92, 93, 94, 81, 94, 92, 93, 94, 81, - /* 1340 */ 94, 92, 93, 94, 94, 92, 93, 94, 94, 94, - /* 1350 */ 92, 93, -); - const YY_SHIFT_USE_DFLT = -50; - const YY_SHIFT_MAX = 187; - static public $yy_shift_ofst = array( - /* 0 */ -50, 101, 51, -24, 76, 1, 26, 491, 580, 301, - /* 10 */ 201, 151, 251, 326, 351, 226, 555, 126, 449, 376, - /* 20 */ 276, 176, 401, 605, 703, 703, 703, 703, 703, 703, - /* 30 */ 703, 703, 703, 703, 703, 901, 901, 901, 901, 1113, - /* 40 */ 733, 807, 837, 689, 793, 763, 869, 869, 869, 869, - /* 50 */ 869, 1113, 1113, 1085, 1085, 1085, 1113, 1085, 911, 1085, - /* 60 */ 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, - /* 70 */ 1085, 1284, 1296, 1291, 1306, 1301, 1218, 1177, 1006, 749, - /* 80 */ 702, 525, 1213, 1252, 1225, 1230, 1240, 1257, 1247, 1262, - /* 90 */ 1269, 1279, 1274, 1235, 508, -38, -50, -50, -50, -50, - /* 100 */ -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - /* 110 */ -50, -50, -50, -50, -50, -50, -50, -50, 447, 495, - /* 120 */ 551, 651, 651, 667, 682, 682, 452, 518, 546, -49, - /* 130 */ 425, 43, 168, 53, 143, 21, 16, 11, 6, -14, - /* 140 */ 40, 56, -4, 89, 86, 81, 131, 218, 215, 138, - /* 150 */ 170, 240, 243, 241, 200, 171, 193, 156, 164, 140, - /* 160 */ 98, 165, 158, 189, 179, 166, 181, 114, 186, 190, - /* 170 */ 139, 141, 191, 236, 256, 231, 211, 216, 61, 90, - /* 180 */ 91, -19, 31, 106, 46, 116, 115, 111, -); - const YY_REDUCE_USE_DFLT = -18; - const YY_REDUCE_MAX = 117; - static public $yy_reduce_ofst = array( - /* 0 */ 23, 833, 833, 833, 833, 833, 833, 833, 833, 833, - /* 10 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, - /* 20 */ 833, 833, 833, 833, 949, 786, 962, 977, 932, 919, - /* 30 */ 878, 891, 1003, 906, 990, 1017, 1072, 1059, 1044, 1031, - /* 40 */ 718, 655, 459, 759, 759, 759, 803, 1095, 1099, 1119, - /* 50 */ 853, 1132, 685, 1137, 1115, 1124, 1239, 552, 964, 1151, - /* 60 */ 893, 1217, 811, 857, 1046, 1258, 1244, 1253, 1249, 33, - /* 70 */ 8, -17, -17, -17, -17, -17, -17, -17, -17, -17, - /* 80 */ -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - /* 90 */ -17, -17, -17, -17, 203, 257, 269, 272, 264, 259, - /* 100 */ 223, 222, 219, 198, 209, 224, 234, 284, 249, 248, - /* 110 */ 247, 239, 244, 273, 289, 298, 294, 297, -); - static public $yyExpectedTokens = array( - /* 0 */ array(), - /* 1 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 42, 43, 44, 45, 46, 47, 48, ), - /* 2 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 42, 43, 44, 45, 46, 47, 48, ), - /* 3 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 42, 43, 44, 45, 46, 47, 48, ), - /* 4 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 42, 43, 44, 45, 46, 47, 48, ), - /* 5 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 42, 43, 44, 45, 46, 47, 48, ), - /* 6 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 40, 41, 43, 44, 45, 46, 47, 48, ), - /* 7 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 8 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 9 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 10 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 11 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 12 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 13 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 14 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 15 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 16 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 17 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 18 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 19 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 20 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 21 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 22 */ array(24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 23 */ array(24, 26, 27, 29, 31, 32, 33, 34, 36, 37, 41, 43, 44, 45, 46, 47, 48, ), - /* 24 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 25 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 26 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 27 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 28 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 29 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 30 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 31 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 32 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 33 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 34 */ array(2, 13, 28, 29, 31, 46, 51, 52, 53, 54, 56, 62, 64, ), - /* 35 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 36 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 37 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 38 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 39 */ array(13, 28, 29, 31, 46, 62, 64, ), - /* 40 */ array(13, 25, 28, 29, 30, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 41 */ array(13, 25, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 42 */ array(13, 25, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 43 */ array(13, 25, 28, 29, 30, 31, 38, 46, 51, 52, 53, 54, 62, 64, ), - /* 44 */ array(13, 25, 28, 29, 31, 38, 46, 51, 52, 53, 54, 62, 64, ), - /* 45 */ array(13, 25, 28, 29, 31, 38, 46, 51, 52, 53, 54, 62, 64, ), - /* 46 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 47 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 48 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 49 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 50 */ array(13, 28, 29, 31, 46, 51, 52, 53, 54, 62, 64, ), - /* 51 */ array(13, 28, 29, 31, 46, 62, 64, ), - /* 52 */ array(13, 28, 29, 31, 46, 62, 64, ), - /* 53 */ array(28, 29, 31, 46, 62, ), - /* 54 */ array(28, 29, 31, 46, 62, ), - /* 55 */ array(28, 29, 31, 46, 62, ), - /* 56 */ array(13, 28, 29, 31, 46, 62, 64, ), - /* 57 */ array(28, 29, 31, 46, 62, ), - /* 58 */ array(25, 28, 29, 31, 46, 62, ), - /* 59 */ array(28, 29, 31, 46, 62, ), - /* 60 */ array(28, 29, 31, 46, 62, ), - /* 61 */ array(28, 29, 31, 46, 62, ), - /* 62 */ array(28, 29, 31, 46, 62, ), - /* 63 */ array(28, 29, 31, 46, 62, ), - /* 64 */ array(28, 29, 31, 46, 62, ), - /* 65 */ array(28, 29, 31, 46, 62, ), - /* 66 */ array(28, 29, 31, 46, 62, ), - /* 67 */ array(28, 29, 31, 46, 62, ), - /* 68 */ array(28, 29, 31, 46, 62, ), - /* 69 */ array(28, 29, 31, 46, 62, ), - /* 70 */ array(28, 29, 31, 46, 62, ), - /* 71 */ array(1, 20, 21, 22, ), - /* 72 */ array(1, 20, 21, 22, ), - /* 73 */ array(1, 20, 21, 22, ), - /* 74 */ array(1, 20, 21, 22, ), - /* 75 */ array(1, 20, 21, 22, ), - /* 76 */ array(1, 20, 21, 22, ), - /* 77 */ array(1, 20, 21, 22, ), - /* 78 */ array(1, 20, 21, 22, ), - /* 79 */ array(1, 20, 21, 22, ), - /* 80 */ array(1, 20, 21, 22, ), - /* 81 */ array(1, 20, 21, 22, ), - /* 82 */ array(1, 20, 21, 22, ), - /* 83 */ array(1, 20, 21, 22, ), - /* 84 */ array(1, 20, 21, 22, ), - /* 85 */ array(1, 20, 21, 22, ), - /* 86 */ array(1, 20, 21, 22, ), - /* 87 */ array(1, 20, 21, 22, ), - /* 88 */ array(1, 20, 21, 22, ), - /* 89 */ array(1, 20, 21, 22, ), - /* 90 */ array(1, 20, 21, 22, ), - /* 91 */ array(1, 20, 21, 22, ), - /* 92 */ array(1, 20, 21, 22, ), - /* 93 */ array(1, 20, 21, 22, ), - /* 94 */ array(13, 25, 64, ), - /* 95 */ array(53, 54, ), - /* 96 */ array(), - /* 97 */ array(), - /* 98 */ array(), - /* 99 */ array(), - /* 100 */ array(), - /* 101 */ array(), - /* 102 */ array(), - /* 103 */ array(), - /* 104 */ array(), - /* 105 */ array(), - /* 106 */ array(), - /* 107 */ array(), - /* 108 */ array(), - /* 109 */ array(), - /* 110 */ array(), - /* 111 */ array(), - /* 112 */ array(), - /* 113 */ array(), - /* 114 */ array(), - /* 115 */ array(), - /* 116 */ array(), - /* 117 */ array(), - /* 118 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 25, ), - /* 119 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 55, ), - /* 120 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 23, ), - /* 121 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ), - /* 122 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ), - /* 123 */ array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ), - /* 124 */ array(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ), - /* 125 */ array(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ), - /* 126 */ array(15, 16, 17, 18, 19, ), - /* 127 */ array(57, 58, 59, 60, ), - /* 128 */ array(25, 39, ), - /* 129 */ array(50, 63, ), - /* 130 */ array(18, 49, ), - /* 131 */ array(18, 25, ), - /* 132 */ array(18, 25, ), - /* 133 */ array(11, 38, ), - /* 134 */ array(18, 25, ), - /* 135 */ array(18, 19, ), - /* 136 */ array(25, ), - /* 137 */ array(25, ), - /* 138 */ array(25, ), - /* 139 */ array(25, ), - /* 140 */ array(25, ), - /* 141 */ array(25, ), - /* 142 */ array(30, ), - /* 143 */ array(25, ), - /* 144 */ array(25, ), - /* 145 */ array(25, ), - /* 146 */ array(25, ), - /* 147 */ array(25, ), - /* 148 */ array(25, ), - /* 149 */ array(63, ), - /* 150 */ array(61, ), - /* 151 */ array(11, ), - /* 152 */ array(25, ), - /* 153 */ array(25, ), - /* 154 */ array(64, ), - /* 155 */ array(55, ), - /* 156 */ array(25, ), - /* 157 */ array(25, ), - /* 158 */ array(25, ), - /* 159 */ array(25, ), - /* 160 */ array(53, ), - /* 161 */ array(25, ), - /* 162 */ array(18, ), - /* 163 */ array(50, ), - /* 164 */ array(35, ), - /* 165 */ array(25, ), - /* 166 */ array(25, ), - /* 167 */ array(25, ), - /* 168 */ array(25, ), - /* 169 */ array(25, ), - /* 170 */ array(25, ), - /* 171 */ array(25, ), - /* 172 */ array(25, ), - /* 173 */ array(25, ), - /* 174 */ array(25, ), - /* 175 */ array(25, ), - /* 176 */ array(25, ), - /* 177 */ array(25, ), - /* 178 */ array(25, ), - /* 179 */ array(25, ), - /* 180 */ array(25, ), - /* 181 */ array(25, ), - /* 182 */ array(25, ), - /* 183 */ array(25, ), - /* 184 */ array(30, ), - /* 185 */ array(25, ), - /* 186 */ array(25, ), - /* 187 */ array(25, ), - /* 188 */ array(), - /* 189 */ array(), - /* 190 */ array(), - /* 191 */ array(), - /* 192 */ array(), - /* 193 */ array(), - /* 194 */ array(), - /* 195 */ array(), - /* 196 */ array(), - /* 197 */ array(), - /* 198 */ array(), - /* 199 */ array(), - /* 200 */ array(), - /* 201 */ array(), - /* 202 */ array(), - /* 203 */ array(), - /* 204 */ array(), - /* 205 */ array(), - /* 206 */ array(), - /* 207 */ array(), - /* 208 */ array(), - /* 209 */ array(), - /* 210 */ array(), - /* 211 */ array(), - /* 212 */ array(), - /* 213 */ array(), - /* 214 */ array(), - /* 215 */ array(), - /* 216 */ array(), - /* 217 */ array(), - /* 218 */ array(), - /* 219 */ array(), - /* 220 */ array(), - /* 221 */ array(), - /* 222 */ array(), - /* 223 */ array(), - /* 224 */ array(), - /* 225 */ array(), - /* 226 */ array(), - /* 227 */ array(), - /* 228 */ array(), - /* 229 */ array(), - /* 230 */ array(), - /* 231 */ array(), - /* 232 */ array(), - /* 233 */ array(), - /* 234 */ array(), - /* 235 */ array(), - /* 236 */ array(), - /* 237 */ array(), - /* 238 */ array(), - /* 239 */ array(), - /* 240 */ array(), - /* 241 */ array(), - /* 242 */ array(), - /* 243 */ array(), - /* 244 */ array(), - /* 245 */ array(), - /* 246 */ array(), - /* 247 */ array(), - /* 248 */ array(), - /* 249 */ array(), - /* 250 */ array(), - /* 251 */ array(), - /* 252 */ array(), - /* 253 */ array(), - /* 254 */ array(), - /* 255 */ array(), - /* 256 */ array(), - /* 257 */ array(), - /* 258 */ array(), - /* 259 */ array(), - /* 260 */ array(), - /* 261 */ array(), - /* 262 */ array(), - /* 263 */ array(), - /* 264 */ array(), -); - static public $yy_default = array( - /* 0 */ 267, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 10 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 20 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 30 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 40 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 50 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 60 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 70 */ 354, 354, 265, 354, 354, 354, 354, 354, 354, 354, - /* 80 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 90 */ 354, 354, 354, 354, 354, 354, 267, 267, 267, 267, - /* 100 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 110 */ 267, 267, 267, 267, 267, 267, 267, 267, 354, 354, - /* 120 */ 354, 292, 334, 335, 336, 338, 337, 343, 354, 320, - /* 130 */ 354, 354, 354, 354, 354, 339, 354, 354, 354, 354, - /* 140 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 150 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 160 */ 354, 354, 328, 320, 354, 354, 354, 354, 354, 354, - /* 170 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - /* 180 */ 354, 354, 354, 354, 354, 354, 354, 354, 289, 296, - /* 190 */ 315, 306, 314, 269, 270, 313, 271, 316, 304, 351, - /* 200 */ 350, 299, 298, 349, 297, 276, 277, 275, 274, 353, - /* 210 */ 273, 278, 279, 284, 285, 283, 282, 280, 281, 352, - /* 220 */ 347, 325, 326, 324, 272, 266, 268, 327, 332, 345, - /* 230 */ 346, 348, 344, 333, 286, 287, 301, 302, 300, 295, - /* 240 */ 293, 294, 303, 305, 310, 311, 309, 308, 307, 342, - /* 250 */ 341, 290, 291, 288, 323, 321, 322, 317, 319, 331, - /* 260 */ 340, 330, 329, 318, 312, -); -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** self::YYNOCODE is a number which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** self::YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** self::YYSTACKDEPTH is the maximum depth of the parser's stack. -** self::YYNSTATE the combined number of states. -** self::YYNRULE the number of rules in the grammar -** self::YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ - const YYNOCODE = 95; - const YYSTACKDEPTH = 100; - const YYNSTATE = 265; - const YYNRULE = 89; - const YYERRORSYMBOL = 65; - const YYERRSYMDT = 'yy0'; - const YYFALLBACK = 0; - /** The next table maps tokens into fallback tokens. If a construct - * like the following: - * - * %fallback ID X Y Z. - * - * appears in the grammer, then ID becomes a fallback token for X, Y, - * and Z. Whenever one of the tokens X, Y, or Z is input to the parser - * but it does not parse, the type of the token is changed to ID and - * the parse is retried before an error is thrown. - */ - static public $yyFallback = array( - ); - /** - * Turn parser tracing on by giving a stream to which to write the trace - * and a prompt to preface each trace message. Tracing is turned off - * by making either argument NULL - * - * Inputs: - * - * - A stream resource to which trace output should be written. - * If NULL, then tracing is turned off. - * - A prefix string written at the beginning of every - * line of trace output. If NULL, then tracing is - * turned off. - * - * Outputs: - * - * - None. - * @param resource - * @param string - */ - static function Trace($TraceFILE, $zTracePrompt) - { - if (!$TraceFILE) { - $zTracePrompt = 0; - } elseif (!$zTracePrompt) { - $TraceFILE = 0; - } - self::$yyTraceFILE = $TraceFILE; - self::$yyTracePrompt = $zTracePrompt; - } - - /** - * Output debug information to output (php://output stream) - */ - static function PrintTrace() - { - self::$yyTraceFILE = fopen('php://output', 'w'); - self::$yyTracePrompt = ''; - } - - /** - * @var resource|0 - */ - static public $yyTraceFILE; - /** - * String to prepend to debug output - * @var string|0 - */ - static public $yyTracePrompt; - /** - * @var int - */ - public $yyidx = -1; /* Index of top element in stack */ - /** - * @var int - */ - public $yyerrcnt; /* Shifts left before out of the error */ - /** - * @var array - */ - public $yystack = array(); /* The parser's stack */ - - /** - * For tracing shifts, the names of all terminals and nonterminals - * are required. The following table supplies these names - * @var array - */ - static public $yyTokenName = array( - '$', 'T_TAG_OPEN', 'T_NOT', 'T_AND', - 'T_OR', 'T_EQ', 'T_NE', 'T_GT', - 'T_GE', 'T_LT', 'T_LE', 'T_IN', - 'T_PLUS', 'T_MINUS', 'T_CONCAT', 'T_TIMES', - 'T_DIV', 'T_MOD', 'T_PIPE', 'T_BITWISE', - 'T_HTML', 'T_COMMENT', 'T_PRINT_OPEN', 'T_PRINT_CLOSE', - 'T_EXTENDS', 'T_TAG_CLOSE', 'T_INCLUDE', 'T_AUTOESCAPE', - 'T_CUSTOM_END', 'T_CUSTOM_TAG', 'T_AS', 'T_CUSTOM_BLOCK', - 'T_SPACEFULL', 'T_WITH', 'T_SET', 'T_ASSIGN', - 'T_LOAD', 'T_FOR', 'T_COMMA', 'T_STEP', - 'T_EMPTY', 'T_IF', 'T_ELSE', 'T_IFCHANGED', - 'T_IFEQUAL', 'T_IFNOTEQUAL', 'T_BLOCK', 'T_FILTER', - 'T_REGROUP', 'T_BY', 'T_COLON', 'T_TRUE', - 'T_FALSE', 'T_STRING', 'T_INTL', 'T_RPARENT', - 'T_LPARENT', 'T_OBJ', 'T_DOT', 'T_CLASS', - 'T_BRACKETS_OPEN', 'T_BRACKETS_CLOSE', 'T_ALPHA', 'T_DOTDOT', - 'T_NUMERIC', 'error', 'start', 'body', - 'code', 'stmts', 'expr', 'var_or_string', - 'stmt', 'for_stmt', 'ifchanged_stmt', 'block_stmt', - 'filter_stmt', 'if_stmt', 'custom_tag', 'alias', - 'ifequal', 'varname', 'params', 'regroup', - 'string', 'for_def', 'filtered_var', 'range', - 'numvar', 'fvar_or_string', 'number', 'varname_args', - 'varpart', 'varpart_single', - ); - - /** - * For tracing reduce actions, the names of all rules are required. - * @var array - */ - static public $yyRuleName = array( - /* 0 */ "start ::= body", - /* 1 */ "body ::= body code", - /* 2 */ "body ::=", - /* 3 */ "code ::= T_TAG_OPEN stmts", - /* 4 */ "code ::= T_HTML", - /* 5 */ "code ::= T_COMMENT", - /* 6 */ "code ::= T_PRINT_OPEN expr T_PRINT_CLOSE", - /* 7 */ "stmts ::= T_EXTENDS var_or_string T_TAG_CLOSE", - /* 8 */ "stmts ::= stmt T_TAG_CLOSE", - /* 9 */ "stmts ::= for_stmt", - /* 10 */ "stmts ::= ifchanged_stmt", - /* 11 */ "stmts ::= block_stmt", - /* 12 */ "stmts ::= filter_stmt", - /* 13 */ "stmts ::= if_stmt", - /* 14 */ "stmts ::= T_INCLUDE var_or_string T_TAG_CLOSE", - /* 15 */ "stmts ::= custom_tag", - /* 16 */ "stmts ::= alias", - /* 17 */ "stmts ::= ifequal", - /* 18 */ "stmts ::= T_AUTOESCAPE varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 19 */ "custom_tag ::= T_CUSTOM_TAG T_TAG_CLOSE", - /* 20 */ "custom_tag ::= T_CUSTOM_TAG T_AS varname T_TAG_CLOSE", - /* 21 */ "custom_tag ::= T_CUSTOM_TAG params T_TAG_CLOSE", - /* 22 */ "custom_tag ::= T_CUSTOM_TAG params T_AS varname T_TAG_CLOSE", - /* 23 */ "custom_tag ::= T_CUSTOM_BLOCK T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 24 */ "custom_tag ::= T_CUSTOM_BLOCK params T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 25 */ "custom_tag ::= T_SPACEFULL T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 26 */ "alias ::= T_WITH varname T_AS varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 27 */ "stmt ::= T_SET varname T_ASSIGN expr", - /* 28 */ "stmt ::= regroup", - /* 29 */ "stmt ::= T_LOAD string", - /* 30 */ "for_def ::= T_FOR varname T_IN filtered_var T_TAG_CLOSE", - /* 31 */ "for_def ::= T_FOR varname T_COMMA varname T_IN filtered_var T_TAG_CLOSE", - /* 32 */ "for_stmt ::= for_def body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 33 */ "for_stmt ::= T_FOR varname T_IN range T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 34 */ "for_stmt ::= T_FOR varname T_IN range T_STEP numvar T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 35 */ "for_stmt ::= for_def body T_TAG_OPEN T_EMPTY T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 36 */ "if_stmt ::= T_IF expr T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 37 */ "if_stmt ::= T_IF expr T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 38 */ "ifchanged_stmt ::= T_IFCHANGED T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 39 */ "ifchanged_stmt ::= T_IFCHANGED params T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 40 */ "ifchanged_stmt ::= T_IFCHANGED T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 41 */ "ifchanged_stmt ::= T_IFCHANGED params T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 42 */ "ifequal ::= T_IFEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 43 */ "ifequal ::= T_IFEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 44 */ "ifequal ::= T_IFNOTEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 45 */ "ifequal ::= T_IFNOTEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 46 */ "block_stmt ::= T_BLOCK varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 47 */ "block_stmt ::= T_BLOCK varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END varname T_TAG_CLOSE", - /* 48 */ "block_stmt ::= T_BLOCK number T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 49 */ "block_stmt ::= T_BLOCK number T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END number T_TAG_CLOSE", - /* 50 */ "filter_stmt ::= T_FILTER filtered_var T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 51 */ "regroup ::= T_REGROUP filtered_var T_BY varname T_AS varname", - /* 52 */ "filtered_var ::= filtered_var T_PIPE varname_args", - /* 53 */ "filtered_var ::= varname_args", - /* 54 */ "varname_args ::= varname T_COLON var_or_string", - /* 55 */ "varname_args ::= varname", - /* 56 */ "params ::= params var_or_string", - /* 57 */ "params ::= params T_COMMA var_or_string", - /* 58 */ "params ::= var_or_string", - /* 59 */ "var_or_string ::= varname", - /* 60 */ "var_or_string ::= number", - /* 61 */ "var_or_string ::= T_TRUE|T_FALSE", - /* 62 */ "var_or_string ::= string", - /* 63 */ "fvar_or_string ::= filtered_var", - /* 64 */ "fvar_or_string ::= number", - /* 65 */ "fvar_or_string ::= T_TRUE|T_FALSE", - /* 66 */ "fvar_or_string ::= string", - /* 67 */ "string ::= T_STRING", - /* 68 */ "string ::= T_INTL T_STRING T_RPARENT", - /* 69 */ "expr ::= T_NOT expr", - /* 70 */ "expr ::= expr T_AND expr", - /* 71 */ "expr ::= expr T_OR expr", - /* 72 */ "expr ::= expr T_PLUS|T_MINUS|T_CONCAT expr", - /* 73 */ "expr ::= expr T_EQ|T_NE|T_GT|T_GE|T_LT|T_LE|T_IN expr", - /* 74 */ "expr ::= expr T_TIMES|T_DIV|T_MOD expr", - /* 75 */ "expr ::= expr T_BITWISE|T_PIPE expr", - /* 76 */ "expr ::= T_LPARENT expr T_RPARENT", - /* 77 */ "expr ::= fvar_or_string", - /* 78 */ "varname ::= varpart", - /* 79 */ "varpart ::= varpart T_OBJ|T_DOT varpart_single", - /* 80 */ "varpart ::= varpart T_CLASS varpart_single", - /* 81 */ "varpart ::= varpart T_BRACKETS_OPEN var_or_string T_BRACKETS_CLOSE", - /* 82 */ "varpart ::= varpart_single", - /* 83 */ "varpart_single ::= T_ALPHA|T_BLOCK|T_CUSTOM_TAG|T_CUSTOM_END|T_CUSTOM_BLOCK", - /* 84 */ "range ::= numvar T_DOTDOT numvar", - /* 85 */ "numvar ::= number", - /* 86 */ "numvar ::= varname", - /* 87 */ "number ::= T_NUMERIC", - /* 88 */ "number ::= T_MINUS T_NUMERIC", - ); - - /** - * This function returns the symbolic name associated with a token - * value. - * @param int - * @return string - */ - function tokenName($tokenType) - { - if ($tokenType === 0) { - return 'End of Input'; - } - if ($tokenType > 0 && $tokenType < count(self::$yyTokenName)) { - return self::$yyTokenName[$tokenType]; - } else { - return "Unknown"; - } - } - - /** - * The following function deletes the value associated with a - * symbol. The symbol can be either a terminal or nonterminal. - * @param int the symbol code - * @param mixed the symbol's value - */ - static function yy_destructor($yymajor, $yypminor) - { - switch ($yymajor) { - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - default: break; /* If no destructor action specified: do nothing */ - } - } - - /** - * Pop the parser's stack once. - * - * If there is a destructor routine associated with the token which - * is popped from the stack, then call it. - * - * Return the major token number for the symbol popped. - * @param Haanga_yyParser - * @return int - */ - function yy_pop_parser_stack() - { - if (!count($this->yystack)) { - return; - } - $yytos = array_pop($this->yystack); - if (self::$yyTraceFILE && $this->yyidx >= 0) { - fwrite(self::$yyTraceFILE, - self::$yyTracePrompt . 'Popping ' . self::$yyTokenName[$yytos->major] . - "\n"); - } - $yymajor = $yytos->major; - self::yy_destructor($yymajor, $yytos->minor); - $this->yyidx--; - return $yymajor; - } - - /** - * Deallocate and destroy a parser. Destructors are all called for - * all stack elements before shutting the parser down. - */ - function __destruct() - { - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - if (is_resource(self::$yyTraceFILE)) { - fclose(self::$yyTraceFILE); - } - } - - /** - * Based on the current state and parser stack, get a list of all - * possible lookahead tokens - * @param int - * @return array - */ - function yy_get_expected_tokens($token) - { - $state = $this->yystack[$this->yyidx]->stateno; - $expected = self::$yyExpectedTokens[$state]; - if (in_array($token, self::$yyExpectedTokens[$state], true)) { - return $expected; - } - $stack = $this->yystack; - $yyidx = $this->yyidx; - do { - $yyact = $this->yy_find_shift_action($token); - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { - // reduce action - $done = 0; - do { - if ($done++ == 100) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // too much recursion prevents proper detection - // so give up - return array_unique($expected); - } - $yyruleno = $yyact - self::YYNSTATE; - $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs']; - $nextstate = $this->yy_find_reduce_action( - $this->yystack[$this->yyidx]->stateno, - self::$yyRuleInfo[$yyruleno]['lhs']); - if (isset(self::$yyExpectedTokens[$nextstate])) { - $expected += self::$yyExpectedTokens[$nextstate]; - if (in_array($token, - self::$yyExpectedTokens[$nextstate], true)) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - return array_unique($expected); - } - } - if ($nextstate < self::YYNSTATE) { - // we need to shift a non-terminal - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $nextstate; - $x->major = self::$yyRuleInfo[$yyruleno]['lhs']; - $this->yystack[$this->yyidx] = $x; - continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // the last token was just ignored, we can't accept - // by ignoring input, this is in essence ignoring a - // syntax error! - return array_unique($expected); - } elseif ($nextstate === self::YY_NO_ACTION) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // input accepted, but not shifted (I guess) - return $expected; - } else { - $yyact = $nextstate; - } - } while (true); - } - break; - } while (true); - return array_unique($expected); - } - - /** - * Based on the parser state and current parser stack, determine whether - * the lookahead token is possible. - * - * The parser will convert the token value to an error token if not. This - * catches some unusual edge cases where the parser would fail. - * @param int - * @return bool - */ - function yy_is_expected_token($token) - { - if ($token === 0) { - return true; // 0 is not part of this - } - $state = $this->yystack[$this->yyidx]->stateno; - if (in_array($token, self::$yyExpectedTokens[$state], true)) { - return true; - } - $stack = $this->yystack; - $yyidx = $this->yyidx; - do { - $yyact = $this->yy_find_shift_action($token); - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { - // reduce action - $done = 0; - do { - if ($done++ == 100) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // too much recursion prevents proper detection - // so give up - return true; - } - $yyruleno = $yyact - self::YYNSTATE; - $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs']; - $nextstate = $this->yy_find_reduce_action( - $this->yystack[$this->yyidx]->stateno, - self::$yyRuleInfo[$yyruleno]['lhs']); - if (isset(self::$yyExpectedTokens[$nextstate]) && - in_array($token, self::$yyExpectedTokens[$nextstate], true)) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - return true; - } - if ($nextstate < self::YYNSTATE) { - // we need to shift a non-terminal - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $nextstate; - $x->major = self::$yyRuleInfo[$yyruleno]['lhs']; - $this->yystack[$this->yyidx] = $x; - continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - if (!$token) { - // end of input: this is valid - return true; - } - // the last token was just ignored, we can't accept - // by ignoring input, this is in essence ignoring a - // syntax error! - return false; - } elseif ($nextstate === self::YY_NO_ACTION) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // input accepted, but not shifted (I guess) - return true; - } else { - $yyact = $nextstate; - } - } while (true); - } - break; - } while (true); - $this->yyidx = $yyidx; - $this->yystack = $stack; - return true; - } - - /** - * Find the appropriate action for a parser given the terminal - * look-ahead token iLookAhead. - * - * If the look-ahead token is YYNOCODE, then check to see if the action is - * independent of the look-ahead. If it is, return the action, otherwise - * return YY_NO_ACTION. - * @param int The look-ahead token - */ - function yy_find_shift_action($iLookAhead) - { - $stateno = $this->yystack[$this->yyidx]->stateno; - - /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ - if (!isset(self::$yy_shift_ofst[$stateno])) { - // no shift actions - return self::$yy_default[$stateno]; - } - $i = self::$yy_shift_ofst[$stateno]; - if ($i === self::YY_SHIFT_USE_DFLT) { - return self::$yy_default[$stateno]; - } - if ($iLookAhead == self::YYNOCODE) { - return self::YY_NO_ACTION; - } - $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[$i] != $iLookAhead) { - if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) - && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) { - if (self::$yyTraceFILE) { - fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " . - self::$yyTokenName[$iLookAhead] . " => " . - self::$yyTokenName[$iFallback] . "\n"); - } - return $this->yy_find_shift_action($iFallback); - } - return self::$yy_default[$stateno]; - } else { - return self::$yy_action[$i]; - } - } - - /** - * Find the appropriate action for a parser given the non-terminal - * look-ahead token $iLookAhead. - * - * If the look-ahead token is self::YYNOCODE, then check to see if the action is - * independent of the look-ahead. If it is, return the action, otherwise - * return self::YY_NO_ACTION. - * @param int Current state number - * @param int The look-ahead token - */ - function yy_find_reduce_action($stateno, $iLookAhead) - { - /* $stateno = $this->yystack[$this->yyidx]->stateno; */ - - if (!isset(self::$yy_reduce_ofst[$stateno])) { - return self::$yy_default[$stateno]; - } - $i = self::$yy_reduce_ofst[$stateno]; - if ($i == self::YY_REDUCE_USE_DFLT) { - return self::$yy_default[$stateno]; - } - if ($iLookAhead == self::YYNOCODE) { - return self::YY_NO_ACTION; - } - $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[$i] != $iLookAhead) { - return self::$yy_default[$stateno]; - } else { - return self::$yy_action[$i]; - } - } - - /** - * Perform a shift action. - * @param int The new state to shift in - * @param int The major token to shift in - * @param mixed the minor token to shift in - */ - function yy_shift($yyNewState, $yyMajor, $yypMinor) - { - $this->yyidx++; - if ($this->yyidx >= self::YYSTACKDEPTH) { - $this->yyidx--; - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will execute if the parser - ** stack ever overflows */ - return; - } - $yytos = new Haanga_yyStackEntry; - $yytos->stateno = $yyNewState; - $yytos->major = $yyMajor; - $yytos->minor = $yypMinor; - array_push($this->yystack, $yytos); - if (self::$yyTraceFILE && $this->yyidx > 0) { - fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt, - $yyNewState); - fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt); - for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf(self::$yyTraceFILE, " %s", - self::$yyTokenName[$this->yystack[$i]->major]); - } - fwrite(self::$yyTraceFILE,"\n"); - } - } - - /** - * The following table contains information about every rule that - * is used during the reduce. - * - *
-     * array(
-     *  array(
-     *   int $lhs;         Symbol on the left-hand side of the rule
-     *   int $nrhs;     Number of right-hand side symbols in the rule
-     *  ),...
-     * );
-     * 
- */ - static public $yyRuleInfo = array( - array( 'lhs' => 66, 'rhs' => 1 ), - array( 'lhs' => 67, 'rhs' => 2 ), - array( 'lhs' => 67, 'rhs' => 0 ), - array( 'lhs' => 68, 'rhs' => 2 ), - array( 'lhs' => 68, 'rhs' => 1 ), - array( 'lhs' => 68, 'rhs' => 1 ), - array( 'lhs' => 68, 'rhs' => 3 ), - array( 'lhs' => 69, 'rhs' => 3 ), - array( 'lhs' => 69, 'rhs' => 2 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 3 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 7 ), - array( 'lhs' => 78, 'rhs' => 2 ), - array( 'lhs' => 78, 'rhs' => 4 ), - array( 'lhs' => 78, 'rhs' => 3 ), - array( 'lhs' => 78, 'rhs' => 5 ), - array( 'lhs' => 78, 'rhs' => 6 ), - array( 'lhs' => 78, 'rhs' => 7 ), - array( 'lhs' => 78, 'rhs' => 6 ), - array( 'lhs' => 79, 'rhs' => 9 ), - array( 'lhs' => 72, 'rhs' => 4 ), - array( 'lhs' => 72, 'rhs' => 1 ), - array( 'lhs' => 72, 'rhs' => 2 ), - array( 'lhs' => 85, 'rhs' => 5 ), - array( 'lhs' => 85, 'rhs' => 7 ), - array( 'lhs' => 73, 'rhs' => 5 ), - array( 'lhs' => 73, 'rhs' => 9 ), - array( 'lhs' => 73, 'rhs' => 11 ), - array( 'lhs' => 73, 'rhs' => 9 ), - array( 'lhs' => 77, 'rhs' => 7 ), - array( 'lhs' => 77, 'rhs' => 11 ), - array( 'lhs' => 74, 'rhs' => 6 ), - array( 'lhs' => 74, 'rhs' => 7 ), - array( 'lhs' => 74, 'rhs' => 10 ), - array( 'lhs' => 74, 'rhs' => 11 ), - array( 'lhs' => 80, 'rhs' => 8 ), - array( 'lhs' => 80, 'rhs' => 12 ), - array( 'lhs' => 80, 'rhs' => 8 ), - array( 'lhs' => 80, 'rhs' => 12 ), - array( 'lhs' => 75, 'rhs' => 7 ), - array( 'lhs' => 75, 'rhs' => 8 ), - array( 'lhs' => 75, 'rhs' => 7 ), - array( 'lhs' => 75, 'rhs' => 8 ), - array( 'lhs' => 76, 'rhs' => 7 ), - array( 'lhs' => 83, 'rhs' => 6 ), - array( 'lhs' => 86, 'rhs' => 3 ), - array( 'lhs' => 86, 'rhs' => 1 ), - array( 'lhs' => 91, 'rhs' => 3 ), - array( 'lhs' => 91, 'rhs' => 1 ), - array( 'lhs' => 82, 'rhs' => 2 ), - array( 'lhs' => 82, 'rhs' => 3 ), - array( 'lhs' => 82, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 89, 'rhs' => 1 ), - array( 'lhs' => 89, 'rhs' => 1 ), - array( 'lhs' => 89, 'rhs' => 1 ), - array( 'lhs' => 89, 'rhs' => 1 ), - array( 'lhs' => 84, 'rhs' => 1 ), - array( 'lhs' => 84, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 2 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 70, 'rhs' => 1 ), - array( 'lhs' => 81, 'rhs' => 1 ), - array( 'lhs' => 92, 'rhs' => 3 ), - array( 'lhs' => 92, 'rhs' => 3 ), - array( 'lhs' => 92, 'rhs' => 4 ), - array( 'lhs' => 92, 'rhs' => 1 ), - array( 'lhs' => 93, 'rhs' => 1 ), - array( 'lhs' => 87, 'rhs' => 3 ), - array( 'lhs' => 88, 'rhs' => 1 ), - array( 'lhs' => 88, 'rhs' => 1 ), - array( 'lhs' => 90, 'rhs' => 1 ), - array( 'lhs' => 90, 'rhs' => 2 ), - ); - - /** - * The following table contains a mapping of reduce action to method name - * that handles the reduction. - * - * If a rule is not set, it has no handler. - */ - static public $yyReduceMap = array( - 0 => 0, - 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - 6 => 6, - 7 => 7, - 8 => 8, - 68 => 8, - 9 => 9, - 10 => 9, - 11 => 9, - 12 => 9, - 13 => 9, - 15 => 9, - 16 => 9, - 17 => 9, - 28 => 9, - 55 => 9, - 67 => 9, - 77 => 9, - 82 => 9, - 83 => 9, - 85 => 9, - 87 => 9, - 14 => 14, - 18 => 18, - 19 => 19, - 20 => 20, - 21 => 21, - 22 => 22, - 23 => 23, - 24 => 24, - 25 => 25, - 26 => 26, - 27 => 27, - 29 => 29, - 30 => 30, - 31 => 31, - 32 => 32, - 33 => 33, - 34 => 34, - 35 => 35, - 36 => 36, - 37 => 37, - 38 => 38, - 39 => 39, - 40 => 40, - 41 => 41, - 42 => 42, - 43 => 43, - 44 => 44, - 45 => 45, - 46 => 46, - 47 => 47, - 49 => 47, - 48 => 48, - 50 => 50, - 51 => 51, - 52 => 52, - 57 => 52, - 53 => 53, - 58 => 53, - 54 => 54, - 56 => 56, - 59 => 59, - 86 => 59, - 60 => 60, - 64 => 60, - 61 => 61, - 65 => 61, - 62 => 62, - 66 => 62, - 63 => 63, - 69 => 69, - 70 => 70, - 71 => 70, - 72 => 70, - 74 => 70, - 73 => 73, - 75 => 75, - 76 => 76, - 78 => 78, - 79 => 79, - 80 => 80, - 81 => 81, - 84 => 84, - 88 => 88, - ); - /* Beginning here are the reduction cases. A typical example - ** follows: - ** #line - ** function yy_r0($yymsp){ ... } // User supplied code - ** #line - */ -#line 80 "Parser.y" - function yy_r0(){ $this->body = $this->yystack[$this->yyidx + 0]->minor; } -#line 1686 "Parser.php" -#line 82 "Parser.y" - function yy_r1(){ $this->_retvalue=$this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 1689 "Parser.php" -#line 83 "Parser.y" - function yy_r2(){ $this->_retvalue = array(); } -#line 1692 "Parser.php" -#line 86 "Parser.y" - function yy_r3(){ if (count($this->yystack[$this->yyidx + 0]->minor)) $this->yystack[$this->yyidx + 0]->minor['line'] = $this->lex->getLine(); $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } -#line 1695 "Parser.php" -#line 88 "Parser.y" - function yy_r4(){ - $this->_retvalue = array('operation' => 'html', 'html' => $this->yystack[$this->yyidx + 0]->minor, 'line' => $this->lex->getLine() ); - } -#line 1700 "Parser.php" -#line 92 "Parser.y" - function yy_r5(){ - $this->yystack[$this->yyidx + 0]->minor=rtrim($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = array('operation' => 'comment', 'comment' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 1705 "Parser.php" -#line 96 "Parser.y" - function yy_r6(){ - $this->_retvalue = array('operation' => 'print_var', 'expr' => $this->yystack[$this->yyidx + -1]->minor, 'line' => $this->lex->getLine() ); - } -#line 1710 "Parser.php" -#line 100 "Parser.y" - function yy_r7(){ $this->_retvalue = array('operation' => 'base', $this->yystack[$this->yyidx + -1]->minor); } -#line 1713 "Parser.php" -#line 101 "Parser.y" - function yy_r8(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } -#line 1716 "Parser.php" -#line 102 "Parser.y" - function yy_r9(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } -#line 1719 "Parser.php" -#line 107 "Parser.y" - function yy_r14(){ $this->_retvalue = array('operation' => 'include', $this->yystack[$this->yyidx + -1]->minor); } -#line 1722 "Parser.php" -#line 111 "Parser.y" - function yy_r18(){ - $this->yystack[$this->yyidx + -5]->minor = strtolower($this->yystack[$this->yyidx + -5]->minor); - if ($this->yystack[$this->yyidx + -5]->minor != 'on' && $this->yystack[$this->yyidx + -5]->minor != 'off') { - $this->Error("Invalid autoescape param (".$this->yystack[$this->yyidx + -5]->minor."), it must be on or off"); - } - if ($this->yystack[$this->yyidx + -1]->minor != "endautoescape") { - $this->Error("Invalid close tag ".$this->yystack[$this->yyidx + -1]->minor.", it must be endautoescape"); - } - $this->_retvalue = array('operation' => 'autoescape', 'value' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1734 "Parser.php" -#line 125 "Parser.y" - function yy_r19(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); - } -#line 1739 "Parser.php" -#line 128 "Parser.y" - function yy_r20(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -3]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); - } -#line 1744 "Parser.php" -#line 131 "Parser.y" - function yy_r21(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -2]->minor, 'list' => $this->yystack[$this->yyidx + -1]->minor); - } -#line 1749 "Parser.php" -#line 134 "Parser.y" - function yy_r22(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -4]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1754 "Parser.php" -#line 139 "Parser.y" - function yy_r23(){ - if ('end'.$this->yystack[$this->yyidx + -5]->minor != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'list' => array()); - } -#line 1762 "Parser.php" -#line 145 "Parser.y" - function yy_r24(){ - if ('end'.$this->yystack[$this->yyidx + -6]->minor != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -6]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'list' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1770 "Parser.php" -#line 153 "Parser.y" - function yy_r25(){ - if ('endspacefull' != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'spacefull', 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1778 "Parser.php" -#line 161 "Parser.y" - function yy_r26(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endwith") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endwith"); - } - $this->_retvalue = array('operation' => 'alias', 'var' => $this->yystack[$this->yyidx + -7]->minor, 'as' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1786 "Parser.php" -#line 169 "Parser.y" - function yy_r27(){ $this->_retvalue = array('operation' => 'set', 'var' => $this->yystack[$this->yyidx + -2]->minor,'expr' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1789 "Parser.php" -#line 171 "Parser.y" - function yy_r29(){ - if (!is_file($this->yystack[$this->yyidx + 0]->minor) || !Haanga_Compiler::getOption('enable_load')) { - $this->error($this->yystack[$this->yyidx + 0]->minor." is not a valid file"); - } - require_once $this->yystack[$this->yyidx + 0]->minor; - } -#line 1797 "Parser.php" -#line 180 "Parser.y" - function yy_r30(){ - $var = $this->compiler->get_context($this->yystack[$this->yyidx + -1]->minor[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context($this->yystack[$this->yyidx + -3]->minor, current($var)); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -3]->minor, 'index' => NULL, 'array' => $this->yystack[$this->yyidx + -1]->minor); - } -#line 1807 "Parser.php" -#line 188 "Parser.y" - function yy_r31(){ - $var = $this->compiler->get_context($this->yystack[$this->yyidx + -1]->minor[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context($this->yystack[$this->yyidx + -3]->minor, current($var)); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -3]->minor, 'index' => $this->yystack[$this->yyidx + -5]->minor, 'array' => $this->yystack[$this->yyidx + -1]->minor); - - } -#line 1818 "Parser.php" -#line 198 "Parser.y" - function yy_r32(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = $this->yystack[$this->yyidx + -4]->minor; - $this->_retvalue['body'] = $this->yystack[$this->yyidx + -3]->minor; - } -#line 1827 "Parser.php" -#line 206 "Parser.y" - function yy_r33(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'range' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'step' => 1); - } -#line 1835 "Parser.php" -#line 213 "Parser.y" - function yy_r34(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -9]->minor, 'range' => $this->yystack[$this->yyidx + -7]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'variable' => $this->yystack[$this->yyidx + -9]->minor, 'step' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1843 "Parser.php" -#line 220 "Parser.y" - function yy_r35(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = $this->yystack[$this->yyidx + -8]->minor; - $this->_retvalue['body'] = $this->yystack[$this->yyidx + -7]->minor; - $this->_retvalue['empty'] = $this->yystack[$this->yyidx + -3]->minor; - } -#line 1853 "Parser.php" -#line 229 "Parser.y" - function yy_r36(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endif") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endif"); - } - $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1861 "Parser.php" -#line 235 "Parser.y" - function yy_r37(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endif") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endif"); - } - $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1869 "Parser.php" -#line 243 "Parser.y" - function yy_r38(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1877 "Parser.php" -#line 250 "Parser.y" - function yy_r39(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor, 'check' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1885 "Parser.php" -#line 256 "Parser.y" - function yy_r40(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1893 "Parser.php" -#line 263 "Parser.y" - function yy_r41(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'check' => $this->yystack[$this->yyidx + -9]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1901 "Parser.php" -#line 271 "Parser.y" - function yy_r42(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '==', 1 => $this->yystack[$this->yyidx + -6]->minor, 2 => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1909 "Parser.php" -#line 277 "Parser.y" - function yy_r43(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '==', 1 => $this->yystack[$this->yyidx + -10]->minor, 2 => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1917 "Parser.php" -#line 283 "Parser.y" - function yy_r44(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifnotequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifnotequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '!=', 1 => $this->yystack[$this->yyidx + -6]->minor, 2 => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1925 "Parser.php" -#line 289 "Parser.y" - function yy_r45(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifnotequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifnotequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '!=', 1 => $this->yystack[$this->yyidx + -10]->minor, 2 => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1933 "Parser.php" -#line 297 "Parser.y" - function yy_r46(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1941 "Parser.php" -#line 304 "Parser.y" - function yy_r47(){ - if ($this->yystack[$this->yyidx + -2]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -2]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -6]->minor, 'body' => $this->yystack[$this->yyidx + -4]->minor); - } -#line 1949 "Parser.php" -#line 311 "Parser.y" - function yy_r48(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1957 "Parser.php" -#line 326 "Parser.y" - function yy_r50(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfilter") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfilter"); - } - $this->_retvalue = array('operation' => 'filter', 'functions' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1965 "Parser.php" -#line 334 "Parser.y" - function yy_r51(){ $this->_retvalue=array('operation' => 'regroup', 'array' => $this->yystack[$this->yyidx + -4]->minor, 'row' => $this->yystack[$this->yyidx + -2]->minor, 'as' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1968 "Parser.php" -#line 337 "Parser.y" - function yy_r52(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 1971 "Parser.php" -#line 338 "Parser.y" - function yy_r53(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); } -#line 1974 "Parser.php" -#line 340 "Parser.y" - function yy_r54(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, 'args'=>array($this->yystack[$this->yyidx + 0]->minor)); } -#line 1977 "Parser.php" -#line 344 "Parser.y" - function yy_r56(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 1980 "Parser.php" -#line 350 "Parser.y" - function yy_r59(){ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1983 "Parser.php" -#line 351 "Parser.y" - function yy_r60(){ $this->_retvalue = array('number' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1986 "Parser.php" -#line 352 "Parser.y" - function yy_r61(){ $this->_retvalue = trim(@$this->yystack[$this->yyidx + 0]->minor); } -#line 1989 "Parser.php" -#line 353 "Parser.y" - function yy_r62(){ $this->_retvalue = array('string' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1992 "Parser.php" -#line 356 "Parser.y" - function yy_r63(){ $this->_retvalue = array('var_filter' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1995 "Parser.php" -#line 366 "Parser.y" - function yy_r69(){ $this->_retvalue = array('op_expr' => 'not', $this->yystack[$this->yyidx + 0]->minor); } -#line 1998 "Parser.php" -#line 367 "Parser.y" - function yy_r70(){ $this->_retvalue = array('op_expr' => @$this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2001 "Parser.php" -#line 370 "Parser.y" - function yy_r73(){ $this->_retvalue = array('op_expr' => trim(@$this->yystack[$this->yyidx + -1]->minor), $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2004 "Parser.php" -#line 372 "Parser.y" - function yy_r75(){ $this->_retvalue = array('op_expr' => 'expr', array('op_expr' => @$this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor)); } -#line 2007 "Parser.php" -#line 373 "Parser.y" - function yy_r76(){ $this->_retvalue = array('op_expr' => 'expr', $this->yystack[$this->yyidx + -1]->minor); } -#line 2010 "Parser.php" -#line 378 "Parser.y" - function yy_r78(){ $this->_retvalue = current($this->compiler->generate_variable_name($this->yystack[$this->yyidx + 0]->minor, false)); } -#line 2013 "Parser.php" -#line 380 "Parser.y" - function yy_r79(){ - if (!is_array($this->yystack[$this->yyidx + -2]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } $this->_retvalue[]=array('object' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 2019 "Parser.php" -#line 385 "Parser.y" - function yy_r80(){ - if (!is_array($this->yystack[$this->yyidx + -2]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } $this->_retvalue[]=array('class' => '$'.$this->yystack[$this->yyidx + 0]->minor); - } -#line 2025 "Parser.php" -#line 390 "Parser.y" - function yy_r81(){ - if (!is_array($this->yystack[$this->yyidx + -3]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -3]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor; } $this->_retvalue[]=$this->yystack[$this->yyidx + -1]->minor; - } -#line 2031 "Parser.php" -#line 399 "Parser.y" - function yy_r84(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2034 "Parser.php" -#line 405 "Parser.y" - function yy_r88(){ $this->_retvalue = -1 * ($this->yystack[$this->yyidx + 0]->minor); } -#line 2037 "Parser.php" - - /** - * placeholder for the left hand side in a reduce operation. - * - * For a parser with a rule like this: - *
-     * rule(A) ::= B. { A = 1; }
-     * 
- * - * The parser will translate to something like: - * - * - * function yy_r0(){$this->_retvalue = 1;} - * - */ - private $_retvalue; - - /** - * Perform a reduce action and the shift that must immediately - * follow the reduce. - * - * For a rule such as: - * - *
-     * A ::= B blah C. { dosomething(); }
-     * 
- * - * This function will first call the action, if any, ("dosomething();" in our - * example), and then it will pop three states from the stack, - * one for each entry on the right-hand side of the expression - * (B, blah, and C in our example rule), and then push the result of the action - * back on to the stack with the resulting state reduced to (as described in the .out - * file) - * @param int Number of the rule by which to reduce - */ - function yy_reduce($yyruleno) - { - //int $yygoto; /* The next state */ - //int $yyact; /* The next action */ - //mixed $yygotominor; /* The LHS of the rule reduced */ - //Haanga_yyStackEntry $yymsp; /* The top of the parser's stack */ - //int $yysize; /* Amount to pop the stack */ - $yymsp = $this->yystack[$this->yyidx]; - if (self::$yyTraceFILE && $yyruleno >= 0 - && $yyruleno < count(self::$yyRuleName)) { - fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n", - self::$yyTracePrompt, $yyruleno, - self::$yyRuleName[$yyruleno]); - } - - $this->_retvalue = $yy_lefthand_side = null; - if (array_key_exists($yyruleno, self::$yyReduceMap)) { - // call the action - $this->_retvalue = null; - $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}(); - $yy_lefthand_side = $this->_retvalue; - } - $yygoto = self::$yyRuleInfo[$yyruleno]['lhs']; - $yysize = self::$yyRuleInfo[$yyruleno]['rhs']; - $this->yyidx -= $yysize; - for ($i = $yysize; $i; $i--) { - // pop all of the right-hand side parameters - array_pop($this->yystack); - } - $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto); - if ($yyact < self::YYNSTATE) { - /* If we are not debugging and the reduce action popped at least - ** one element off the stack, then we can push the new element back - ** onto the stack here, and skip the stack overflow test in yy_shift(). - ** That gives a significant speed improvement. */ - if (!self::$yyTraceFILE && $yysize) { - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $yyact; - $x->major = $yygoto; - $x->minor = $yy_lefthand_side; - $this->yystack[$this->yyidx] = $x; - } else { - $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); - } - } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { - $this->yy_accept(); - } - } - - /** - * The following code executes when the parse fails - * - * Code from %parse_fail is inserted here - */ - function yy_parse_failed() - { - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will be executed whenever the - ** parser fails */ - } - - /** - * The following code executes when a syntax error first occurs. - * - * %syntax_error code is inserted here - * @param int The major type of the error token - * @param mixed The minor type of the error token - */ - function yy_syntax_error($yymajor, $TOKEN) - { -#line 71 "Parser.y" - - $expect = array(); - foreach ($this->yy_get_expected_tokens($yymajor) as $token) { - $expect[] = self::$yyTokenName[$token]; - } - $this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. ')'); -#line 2157 "Parser.php" - } - - /** - * The following is executed when the parser accepts - * - * %parse_accept code is inserted here - */ - function yy_accept() - { - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $stack = $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -#line 57 "Parser.y" - -#line 2178 "Parser.php" - } - - /** - * The main parser program. - * - * The first argument is the major token number. The second is - * the token value string as scanned from the input. - * - * @param int $yymajor the token number - * @param mixed $yytokenvalue the token value - * @param mixed ... any extra arguments that should be passed to handlers - * - * @return void - */ - function doParse($yymajor, $yytokenvalue) - { -// $yyact; /* The parser action. */ -// $yyendofinput; /* True if we are at the end of input */ - $yyerrorhit = 0; /* True if yymajor has invoked an error */ - - /* (re)initialize the parser, if necessary */ - if ($this->yyidx === null || $this->yyidx < 0) { - /* if ($yymajor == 0) return; // not sure why this was here... */ - $this->yyidx = 0; - $this->yyerrcnt = -1; - $x = new Haanga_yyStackEntry; - $x->stateno = 0; - $x->major = 0; - $this->yystack = array(); - array_push($this->yystack, $x); - } - $yyendofinput = ($yymajor==0); - - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sInput %s\n", - self::$yyTracePrompt, - self::$yyTokenName[$yymajor] - ); - } - - do { - $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL - && !$this->yy_is_expected_token($yymajor) - ) { - // force a syntax error - $yyact = self::YY_ERROR_ACTION; - } - if ($yyact < self::YYNSTATE) { - $this->yy_shift($yyact, $yymajor, $yytokenvalue); - $this->yyerrcnt--; - if ($yyendofinput && $this->yyidx >= 0) { - $yymajor = 0; - } else { - $yymajor = self::YYNOCODE; - } - } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { - $this->yy_reduce($yyact - self::YYNSTATE); - } elseif ($yyact == self::YY_ERROR_ACTION) { - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sSyntax Error!\n", - self::$yyTracePrompt - ); - } - if (self::YYERRORSYMBOL) { - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if ($this->yyerrcnt < 0) { - $this->yy_syntax_error($yymajor, $yytokenvalue); - } - $yymx = $this->yystack[$this->yyidx]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ) { - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sDiscard input token %s\n", - self::$yyTracePrompt, - self::$yyTokenName[$yymajor] - ); - } - $this->yy_destructor($yymajor, $yytokenvalue); - $yymajor = self::YYNOCODE; - } else { - while ($this->yyidx >= 0 - && $yymx != self::YYERRORSYMBOL - && ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE - ) { - $this->yy_pop_parser_stack(); - } - if ($this->yyidx < 0 || $yymajor==0) { - $this->yy_destructor($yymajor, $yytokenvalue); - $this->yy_parse_failed(); - $yymajor = self::YYNOCODE; - } elseif ($yymx != self::YYERRORSYMBOL) { - $u2 = 0; - $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); - } - } - $this->yyerrcnt = 3; - $yyerrorhit = 1; - } else { - /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if ($this->yyerrcnt <= 0) { - $this->yy_syntax_error($yymajor, $yytokenvalue); - } - $this->yyerrcnt = 3; - $this->yy_destructor($yymajor, $yytokenvalue); - if ($yyendofinput) { - $this->yy_parse_failed(); - } - $yymajor = self::YYNOCODE; - } - } else { - $this->yy_accept(); - $yymajor = self::YYNOCODE; - } - } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.y b/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.y deleted file mode 100644 index 456a8f7bb..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Parser.y +++ /dev/null @@ -1,408 +0,0 @@ -%name Haanga_ -%include { -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas | - +---------------------------------------------------------------------------------+ -*/ -} - -%declare_class { class Haanga_Compiler_Parser } -%include_class { - protected $lex; - protected $file; - - function __construct($lex, $file='') - { - $this->lex = $lex; - $this->file = $file; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text.' in '.$this->file.':'.$this->lex->getLine()); - } - -} - -%parse_accept { -} - -%right T_TAG_OPEN. -%right T_NOT. -%left T_AND. -%left T_OR. -%nonassoc T_EQ T_NE. -%nonassoc T_GT T_GE T_LT T_LE. -%nonassoc T_IN. -%left T_PLUS T_MINUS T_CONCAT. -%left T_TIMES T_DIV T_MOD. -%left T_PIPE T_BITWISE. - -%syntax_error { - $expect = array(); - foreach ($this->yy_get_expected_tokens($yymajor) as $token) { - $expect[] = self::$yyTokenName[$token]; - } - $this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. ')'); -} - - -start ::= body(B). { $this->body = B; } - -body(A) ::= body(B) code(C). { A=B; A[] = C; } -body(A) ::= . { A = array(); } - -/* List of statements */ -code(A) ::= T_TAG_OPEN stmts(B). { if (count(B)) B['line'] = $this->lex->getLine(); A = B; } - -code(A) ::= T_HTML(B). { - A = array('operation' => 'html', 'html' => B, 'line' => $this->lex->getLine() ); -} - -code(A) ::= T_COMMENT(B). { - B=rtrim(B); A = array('operation' => 'comment', 'comment' => B); -} - -code(A) ::= T_PRINT_OPEN expr(B) T_PRINT_CLOSE. { - A = array('operation' => 'print_var', 'expr' => B, 'line' => $this->lex->getLine() ); -} - -stmts(A) ::= T_EXTENDS var_or_string(B) T_TAG_CLOSE. { A = array('operation' => 'base', B); } -stmts(A) ::= stmt(B) T_TAG_CLOSE. { A = B; } -stmts(A) ::= for_stmt(B). { A = B; } -stmts(A) ::= ifchanged_stmt(B). { A = B; } -stmts(A) ::= block_stmt(B). { A = B; } -stmts(A) ::= filter_stmt(B). { A = B; } -stmts(A) ::= if_stmt(B). { A = B; } -stmts(A) ::= T_INCLUDE var_or_string(B) T_TAG_CLOSE. { A = array('operation' => 'include', B); } -stmts(A) ::= custom_tag(B). { A = B; } -stmts(A) ::= alias(B). { A = B; } -stmts(A) ::= ifequal(B). { A = B; } -stmts(A) ::= T_AUTOESCAPE varname(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(E) T_TAG_CLOSE. { - B = strtolower(B); - if (B != 'on' && B != 'off') { - $this->Error("Invalid autoescape param (".B."), it must be on or off"); - } - if (E != "endautoescape") { - $this->Error("Invalid close tag ".E.", it must be endautoescape"); - } - A = array('operation' => 'autoescape', 'value' => B, 'body' => X); -} - -/* Statement */ - -/* CUSTOM TAGS */ -custom_tag(A) ::= T_CUSTOM_TAG(B) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'list'=>array()); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) T_AS varname(C) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'as' => C, 'list'=>array()); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) params(X) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'list' => X); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) params(X) T_AS varname(C) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'as' => C, 'list' => X); -} - -/* tags as blocks */ -custom_tag(A) ::= T_CUSTOM_BLOCK(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('end'.B != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'custom_tag', 'name' => B, 'body' => X, 'list' => array()); -} -custom_tag(A) ::= T_CUSTOM_BLOCK(B) params(L) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('end'.B != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'custom_tag', 'name' => B, 'body' => X, 'list' => L); -} - -/* Spacefull is very special, and it is handled in the compiler class */ -custom_tag(A) ::= T_SPACEFULL T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('endspacefull' != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'spacefull', 'body' => X); -} - -/* variable alias (easier to handle in the compiler class) */ -alias(A) ::= T_WITH varname(B) T_AS varname(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endwith") { - $this->Error("Unexpected ".Z.", expecting endwith"); - } - A = array('operation' => 'alias', 'var' => B, 'as' => C, 'body' => X); -} - -/* Simple statements (don't require a end_tag or a body ) */ -stmt(A) ::= T_SET varname(C) T_ASSIGN expr(X). { A = array('operation' => 'set', 'var' => C,'expr' => X); } -stmt(A) ::= regroup(B). { A = B; } -stmt ::= T_LOAD string(B). { - if (!is_file(B) || !Haanga_Compiler::getOption('enable_load')) { - $this->error(B." is not a valid file"); - } - require_once B; -} - -/* FOR loop */ - -for_def(A) ::= T_FOR varname(B) T_IN filtered_var(C) T_TAG_CLOSE . { - $var = $this->compiler->get_context(C[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context(B, current($var)); - } - A = array('operation' => 'loop', 'variable' => B, 'index' => NULL, 'array' => C); -} - -for_def(A) ::= T_FOR varname(I) T_COMMA varname(B) T_IN filtered_var(C) T_TAG_CLOSE . { - $var = $this->compiler->get_context(C[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context(B, current($var)); - } - A = array('operation' => 'loop', 'variable' => B, 'index' => I, 'array' => C); - -} - - -for_stmt(A) ::= for_def(B) body(D) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = B; - A['body'] = D; -} - -for_stmt(A) ::= T_FOR varname(B) T_IN range(X) T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = array('operation' => 'loop', 'variable' => B, 'range' => X, 'body' => E, 'variable' => B, 'step' => 1); -} - -for_stmt(A) ::= T_FOR varname(B) T_IN range(X) T_STEP numvar(S) T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = array('operation' => 'loop', 'variable' => B, 'range' => X, 'body' => E, 'variable' => B, 'step' => S); -} - -for_stmt(A) ::= for_def(B) body(D) T_TAG_OPEN T_EMPTY T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = B; - A['body'] = D; - A['empty'] = E; -} -/* IF */ -if_stmt(A) ::= T_IF expr(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endif") { - $this->Error("Unexpected ".Z.", expecting endif"); - } - A = array('operation' => 'if', 'expr' => B, 'body' => X); -} -if_stmt(A) ::= T_IF expr(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endif") { - $this->Error("Unexpected ".Z.", expecting endif"); - } - A = array('operation' => 'if', 'expr' => B, 'body' => X, 'else' => Y); -} - -/* ifchanged */ -ifchanged_stmt(A) ::= T_IFCHANGED T_TAG_CLOSE body(B) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B); -} - -ifchanged_stmt(A) ::= T_IFCHANGED params(X) T_TAG_CLOSE body(B) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'check' => X); -} -ifchanged_stmt(A) ::= T_IFCHANGED T_TAG_CLOSE body(B) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'else' => C); -} - -ifchanged_stmt(A) ::= T_IFCHANGED params(X) T_TAG_CLOSE body(B) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'check' => X, 'else' => C); -} - -/* ifequal */ -ifequal(A) ::= T_IFEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifequal") { - $this->Error("Unexpected ".Z.", expecting endifequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '==', 1 => B, 2 => C, 'body' => X); -} -ifequal(A) ::= T_IFEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifequal") { - $this->Error("Unexpected ".Z.", expecting endifequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '==', 1 => B, 2 => C, 'body' => X, 'else' => Y); -} -ifequal(A) ::= T_IFNOTEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifnotequal") { - $this->Error("Unexpected ".Z.", expecting endifnotequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '!=', 1 => B, 2 => C, 'body' => X); -} -ifequal(A) ::= T_IFNOTEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifnotequal") { - $this->Error("Unexpected ".Z.", expecting endifnotequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '!=', 1 => B, 2 => C, 'body' => X, 'else' => Y); -} - -/* block stmt */ -block_stmt(A) ::= T_BLOCK varname(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK varname(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) varname T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK number(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK number(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) number T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -/* filter stmt */ -filter_stmt(A) ::= T_FILTER filtered_var(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfilter") { - $this->Error("Unexpected ".Z.", expecting endfilter"); - } - A = array('operation' => 'filter', 'functions' => B, 'body' => X); -} - -/* regroup stmt */ -regroup(A) ::= T_REGROUP filtered_var(B) T_BY varname(C) T_AS varname(X). { A=array('operation' => 'regroup', 'array' => B, 'row' => C, 'as' => X); } - -/* variables with filters */ -filtered_var(A) ::= filtered_var(B) T_PIPE varname_args(C). { A = B; A[] = C; } -filtered_var(A) ::= varname_args(B). { A = array(B); } - -varname_args(A) ::= varname(B) T_COLON var_or_string(X) . { A = array(B, 'args'=>array(X)); } -varname_args(A) ::= varname(B). { A = B; } - -/* List of variables */ -params(A) ::= params(B) var_or_string(C). { A = B; A[] = C; } -params(A) ::= params(B) T_COMMA var_or_string(C). { A = B; A[] = C; } -params(A) ::= var_or_string(B). { A = array(B); } - - -/* variable or string (used on params) */ -var_or_string(A) ::= varname(B). { A = array('var' => B); } -var_or_string(A) ::= number(B). { A = array('number' => B); } -var_or_string(A) ::= T_TRUE|T_FALSE(B). { A = trim(@B); } -var_or_string(A) ::= string(B). { A = array('string' => B); } - -/* filtered variables */ -fvar_or_string(A) ::= filtered_var(B). { A = array('var_filter' => B); } -fvar_or_string(A) ::= number(B). { A = array('number' => B); } -fvar_or_string(A) ::= T_TRUE|T_FALSE(B). { A = trim(@B); } -fvar_or_string(A) ::= string(B). { A = array('string' => B); } - -/* */ -string(A) ::= T_STRING(B). { A = B; } -string(A) ::= T_INTL T_STRING(B) T_RPARENT. { A = B; } - -/* expr */ -expr(A) ::= T_NOT expr(B). { A = array('op_expr' => 'not', B); } -expr(A) ::= expr(B) T_AND(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_OR(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_PLUS|T_MINUS|T_CONCAT(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_EQ|T_NE|T_GT|T_GE|T_LT|T_LE|T_IN(X) expr(C). { A = array('op_expr' => trim(@X), B, C); } -expr(A) ::= expr(B) T_TIMES|T_DIV|T_MOD(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_BITWISE|T_PIPE(X) expr(C). { A = array('op_expr' => 'expr', array('op_expr' => @X, B, C)); } -expr(A) ::= T_LPARENT expr(B) T_RPARENT. { A = array('op_expr' => 'expr', B); } -expr(A) ::= fvar_or_string(B). { A = B; } - -/* Variable name */ - -varname(A) ::= varpart(B). { A = current($this->compiler->generate_variable_name(B, false)); } - -varpart(A) ::= varpart(B) T_OBJ|T_DOT varpart_single(C). { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=array('object' => C); -} - -varpart(A) ::= varpart(B) T_CLASS varpart_single(C). { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=array('class' => '$'.C); -} - -varpart(A) ::= varpart(B) T_BRACKETS_OPEN var_or_string(C) T_BRACKETS_CLOSE. { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=C; -} -varpart(A) ::= varpart_single(B). { A = B; } - -/* T_BLOCK|T_CUSTOM|T_CUSTOM_BLOCK are also T_ALPHA */ -varpart_single(A) ::= T_ALPHA|T_BLOCK|T_CUSTOM_TAG|T_CUSTOM_END|T_CUSTOM_BLOCK(B). { A = B; } - -range(A) ::= numvar(B) T_DOTDOT numvar(C). { A = array(B, C); } - -numvar(A) ::= number(B). { A = B; } -numvar(A) ::= varname(B). { A = array('var' => B); } - -number(A) ::= T_NUMERIC(B). { A = B; } -number(A) ::= T_MINUS T_NUMERIC(B). { A = -1 * (B); } diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Runtime.php b/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Runtime.php deleted file mode 100644 index ce3736b85..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Runtime.php +++ /dev/null @@ -1,136 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -/** - * Runtime compiler - * - */ -final class Haanga_Compiler_Runtime extends Haanga_Compiler -{ - - // get_function_name($name=NULL) {{{ - /** - * - * - */ - function get_function_name($name) - { - return "haanga_".sha1($name); - } - // }}} - - // set_template_name($path) {{{ - function set_template_name($path) - { - return $path; - } - // }}} - - // Override {% include %} {{{ - protected function generate_op_include($details, &$body) - { - $this->do_print($body, - hexec('Haanga::Load', $details[0], $this->getScopeVariable(), - TRUE, - hvar('blocks')) - ); - } - // }}} - - // {% base "" %} {{{ - function expr_call_base_template() - { - return hexec('Haanga::Load', $this->subtemplate, - $this->getScopeVariable(), TRUE, hvar('blocks')); - } - // }}} - - // get_base_template($base) {{{ - function get_base_template($base) - { - $this->subtemplate = $base; - } - // }}} - - // Override get_Custom_tag {{{ - /** - * - * - */ - function get_custom_tag($name) - { - static $tag = NULL; - if (!$tag) $tag = Haanga_Extension::getInstance('Tag'); - $loaded = &$this->tags; - - if (!isset($loaded[$name])) { - $this->prepend_op->comment("Load tag {$name} definition"); - $this->prepend_op->do_exec('require_once', $tag->getFilePath($name, FALSE)); - $loaded[$name] = TRUE; - } - - return $tag->getClassName($name)."::main"; - } - // }}} - - // Override get_custom_filter {{{ - function get_custom_filter($name) - { - static $filter = NULL; - if (!$filter) $filter=Haanga_Extension::getInstance('Filter'); - $loaded = &$this->filters; - - if (!isset($loaded[$name])) { - $this->prepend_op->comment("Load filter {$name} definition"); - $this->prepend_op->do_exec('require_once', $filter->getFilePath($name, FALSE)); - $loaded[$name] = TRUE; - } - - return $filter->getClassName($name)."::main"; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Tokenizer.php b/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Tokenizer.php deleted file mode 100644 index e618b7a02..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Compiler/Tokenizer.php +++ /dev/null @@ -1,572 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -class HG_Parser Extends Haanga_Compiler_Parser -{ - /* subclass to made easier references to constants */ -} - - -/** - * Hand-written Tokenizer class inspired by SQLite's tokenize.c - * - */ -class Haanga_Compiler_Tokenizer -{ - /* they are case sensitive and sorted! */ - static $keywords = array( - 'AND' => HG_Parser::T_AND, - 'FALSE' => HG_Parser::T_FALSE, - 'NOT' => HG_Parser::T_NOT, - 'OR' => HG_Parser::T_OR, - 'TRUE' => HG_Parser::T_TRUE, - '_(' => HG_Parser::T_INTL, - 'as' => HG_Parser::T_AS, - 'autoescape' => HG_Parser::T_AUTOESCAPE, - 'block' => HG_Parser::T_BLOCK, - 'by' => HG_Parser::T_BY, - 'else' => HG_Parser::T_ELSE, - 'empty' => HG_Parser::T_EMPTY, - 'extends' => HG_Parser::T_EXTENDS, - 'filter' => HG_Parser::T_FILTER, - 'for' => HG_Parser::T_FOR, - 'if' => HG_Parser::T_IF, - 'ifchanged' => HG_Parser::T_IFCHANGED, - 'ifequal' => HG_Parser::T_IFEQUAL, - 'ifnotequal' => HG_Parser::T_IFNOTEQUAL, - 'in' => HG_Parser::T_IN, - 'include' => HG_Parser::T_INCLUDE, - 'load' => HG_Parser::T_LOAD, - 'not' => HG_Parser::T_NOT, - 'regroup' => HG_Parser::T_REGROUP, - 'set' => HG_Parser::T_SET, - 'spacefull' => HG_Parser::T_SPACEFULL, - 'step' => HG_Parser::T_STEP, - 'with' => HG_Parser::T_WITH, - ); - - /* common operations */ - static $operators_single = array( - '!' => HG_Parser::T_NOT, - '%' => HG_Parser::T_MOD, - '&' => HG_Parser::T_BITWISE, - '(' => HG_Parser::T_LPARENT, - ')' => HG_Parser::T_RPARENT, - '*' => HG_Parser::T_TIMES, - '+' => HG_Parser::T_PLUS, - ',' => HG_Parser::T_COMMA, - '-' => HG_Parser::T_MINUS, - '.' => HG_Parser::T_DOT, - '/' => HG_Parser::T_DIV, - ':' => HG_Parser::T_COLON, - '<' => HG_Parser::T_LT, - '=' => HG_Parser::T_ASSIGN, - '>' => HG_Parser::T_GT, - '[' => HG_Parser::T_BRACKETS_OPEN, - ']' => HG_Parser::T_BRACKETS_CLOSE, - '|' => HG_Parser::T_PIPE, - ); - static $operators = array( - '!==' => HG_Parser::T_NE, - '!=' => HG_Parser::T_NE, - '&&' => HG_Parser::T_AND, - '->' => HG_Parser::T_OBJ, - '..' => HG_Parser::T_DOTDOT, - '::' => HG_Parser::T_CLASS, - '<<' => HG_Parser::T_BITWISE, - '<=' => HG_Parser::T_LE, - '===' => HG_Parser::T_EQ, - '==' => HG_Parser::T_EQ, - '>=' => HG_Parser::T_GE, - '>>' => HG_Parser::T_BITWISE, - '||' => HG_Parser::T_OR, - ); - - static $close_tags = array(); - - static $open_tag = "{%"; - static $end_tag = "%}"; - static $open_comment = "{#"; - static $end_comment = "#}"; - static $open_print = "{{"; - static $end_print = "}}"; - - public $open_tags; - public $value; - public $token; - public $status = self::IN_NONE; - - const IN_NONE = 0; - const IN_HTML = 1; - const IN_TAG = 2; - const IN_ECHO = 3; - - function __construct($data, $compiler, $file) - { - $this->data = $data; - $this->compiler = $compiler; - $this->line = 1; - $this->N = 0; - $this->file = $file; - $this->length = strlen($data); - - - /*$tmp1 = self::$operators; - $tmp2 = $tmp1; - ksort($tmp2); - var_dump($tmp2, $tmp1 === $tmp2);die();/**/ - - self::$close_tags =array( - self::$end_tag => HG_Parser::T_TAG_CLOSE, - self::$end_print => HG_Parser::T_PRINT_CLOSE, - ); - - - $this->open_tags = array( - self::$open_tag => HG_Parser::T_TAG_OPEN, - self::$open_print => HG_Parser::T_PRINT_OPEN, - self::$open_comment => HG_Parser::T_COMMENT, - ); - } - - function yylex() - { - $this->token = NULL; - - if ($this->length == $this->N) { - if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) { - $this->Error("Unexpected end"); - } - return FALSE; - } - - if ($this->status == self::IN_NONE) { - $i = &$this->N; - $data = substr($this->data, $i, 12); - - static $lencache = array(); - foreach ($this->open_tags as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - if (strncmp($data, $value, $len) == 0) { - $this->value = $value; - $this->token = $token; - $i += $len; - switch ($this->token) { - case HG_Parser::T_TAG_OPEN: - $this->status = self::IN_TAG; - break; - case HG_Parser::T_COMMENT: - $zdata = & $this->data; - - if (($pos=strpos($zdata, self::$end_comment, $i)) === FALSE) { - $this->error("unexpected end"); - } - - $this->value = substr($zdata, $i, $pos-2); - $this->status = self::IN_NONE; - $i = $pos + 2; - break; - case HG_Parser::T_PRINT_OPEN: - $this->status = self::IN_ECHO; - break; - } - return TRUE; - } - } - - $this->status = self::IN_HTML; - } - - switch ($this->status) - { - case self::IN_TAG: - case self::IN_ECHO: - $this->yylex_main(); - break; - default: - $this->yylex_html(); - } - - - if (empty($this->token)) { - if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) { - $this->Error("Unexpected end"); - } - return FALSE; - } - - return TRUE; - - } - - function yylex_html() - { - $data = &$this->data; - $i = &$this->N; - - foreach ($this->open_tags as $value => $status) { - $pos = strpos($data, $value, $i); - if ($pos === FALSE) { - continue; - } - if (!isset($lowest_pos) || $lowest_pos > $pos) { - $lowest_pos = $pos; - } - } - - if (isset($lowest_pos)) { - $this->value = substr($data, $i, $lowest_pos-$i); - $this->token = HG_Parser::T_HTML; - $this->status = self::IN_NONE; - $i += $lowest_pos - $i; - } else { - $this->value = substr($data, $i); - $this->token = HG_Parser::T_HTML; - $i = $this->length; - } - - $this->line += substr_count($this->value, "\n"); - - } - - - function yylex_main() - { - $data = &$this->data; - - for ($i=&$this->N; is_null($this->token) && $i < $this->length; ++$i) { - switch ($data[$i]) { - - /* strings {{{ */ - case '"': - case "'": - $end = $data[$i]; - $value = ""; - while ($data[++$i] != $end) { - switch ($data[$i]) { - case "\\": - switch ($data[++$i]) { - case "n": - $value .= "\n"; - break; - case "t": - $value .= "\t"; - break; - default: - $value .= $data[$i]; - } - break; - case $end: - --$i; - break 2; - default: - if ($data[$i] == "\n") { - $this->line++; - } - $value .= $data[$i]; - } - if (!isset($data[$i+1])) { - $this->Error("unclosed string"); - } - } - $this->value = $value; - $this->token = HG_Parser::T_STRING; - break; - /* }}} */ - - /* number {{{ */ - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - $value = ""; - $dot = FALSE; - for ($e=0; $i < $this->length; ++$e, ++$i) { - switch ($data[$i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - $value .= $data[$i]; - break; - case '.': - if (!$dot) { - $value .= "."; - $dot = TRUE; - } else { - $this->error("Invalid number"); - } - break; - default: - break 2; /* break the main loop */ - } - } - if (!$this->is_token_end($data[$i]) && - !isset(self::$operators_single[$data[$i]]) || $value[$e-1] == '.') { - $this->error("Unexpected '{$data[$i]}'"); - } - $this->value = $value; - $this->token = HG_Parser::T_NUMERIC; - break 2; - /* }}} */ - - case "\n": case " ": case "\t": case "\r": case "\f": - for (; is_null($this->token) && $i < $this->length; ++$i) { - switch ($data[$i]) { - case "\n": - $this->line++; - case " ": case "\t": case "\r": case "\f": - break; - case '.': - if ($data[$i+1] != '.') { - $this->token = HG_Parser::T_CONCAT; - $this->value = '.'; - $i++; - return; - } - default: - /* break main loop */ - /* and decrease because last processed byte */ - /* wasn't a dot (T_CONCAT) */ - --$i; - break 2; - } - } - break; /* whitespaces are ignored */ - default: - if (!$this->getTag() && !$this->getOperator()) { - $alpha = $this->getAlpha(); - if ($alpha === FALSE) { - $this->error("error: unexpected ".substr($data, $i)); - } - static $tag=NULL; - if (!$tag) { - $tag = Haanga_Extension::getInstance('Tag'); - } - $value = $tag->isValid($alpha); - $this->token = $value ? $value : HG_Parser::T_ALPHA; - $this->value = $alpha; - - } - break 2; - } - } - - if ($this->token == HG_Parser::T_TAG_CLOSE || - $this->token == HG_Parser::T_PRINT_CLOSE) { - $this->status = self::IN_NONE; - } - - } - - function getTag() - { - static $lencache = array(); - - $i = &$this->N; - $data = substr($this->data, $i, 12); - foreach (self::$close_tags as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - if (strncmp($data, $value, $len) == 0) { - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - foreach (self::$keywords as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - switch (strncmp($data, $value, $len)) { - case -1: - break 2; - case 0: // match - if (isset($data[$len]) && !$this->is_token_end($data[$len])) { - /* probably a variable name TRUEfoo (and not TRUE) */ - continue; - } - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - /* /end([a-zA-Z][a-zA-Z0-9]*)/ */ - if (strncmp($data, "end", 3) == 0) { - $this->value = $this->getAlpha(); - $this->token = HG_Parser::T_CUSTOM_END; - return TRUE; - } - - return FALSE; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text." in ".$this->file.":".$this->line); - } - - function getOperator() - { - static $lencache = array(); - - $i = &$this->N; - $data = substr($this->data, $i, 12); - - foreach (self::$operators as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - switch (strncmp($data, $value, $len)) { - case -1: - if (strlen($data) == $len) { - break 2; - } - break; - case 0: - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - $data = $this->data[$i]; - foreach (self::$operators_single as $value => $token) { - if ($value == $data) { - $this->token = $token; - $this->value = $value; - $i += 1; - return TRUE; - } else if ($value > $data) { - break; - } - } - - - return FALSE; - } - - - /** - * Return TRUE if $letter is a valid "token_end". We use token_end - * to avoid confuse T_ALPHA TRUEfoo with TRUE and foo (T_ALPHA) - * - * @param string $letter - * - * @return bool - */ - protected function is_token_end($letter) - { - /* [^a-zA-Z0-9_] */ - return !( - ('a' <= $letter && 'z' >= $letter) || - ('A' <= $letter && 'Z' >= $letter) || - ('0' <= $letter && '9' >= $letter) || - $letter == "_" - ); - } - - function getAlpha() - { - /* [a-zA-Z_][a-zA-Z0-9_]* */ - $i = &$this->N; - $data = &$this->data; - - if ( !('a' <= $data[$i] && 'z' >= $data[$i]) && - !('A' <= $data[$i] && 'Z' >= $data[$i]) && $data[$i] != '_') { - return FALSE; - } - - $value = ""; - for (; $i < $this->length; ++$i) { - if ( - ('a' <= $data[$i] && 'z' >= $data[$i]) || - ('A' <= $data[$i] && 'Z' >= $data[$i]) || - ('0' <= $data[$i] && '9' >= $data[$i]) || - $data[$i] == "_" - ) { - $value .= $data[$i]; - } else { - break; - } - } - - return $value; - } - - function getLine() - { - return $this->line; - } - - - static function init($template, $compiler, $file='') - { - $lexer = new Haanga_Compiler_Tokenizer($template, $compiler, $file); - $parser = new Haanga_Compiler_Parser($lexer, $file); - - $parser->compiler = $compiler; - - try { - for($i=0; ; $i++) { - if (!$lexer->yylex()) { - break; - } - $parser->doParse($lexer->token, $lexer->value); - } - } catch (Exception $e) { - /* destroy the parser */ - try { - $parser->doParse(0,0); - } catch (Exception $y) {} - throw $e; /* re-throw exception */ - } - - $parser->doParse(0, 0); - - return (array)$parser->body; - - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Exception.php b/gulliver/thirdparty/Haanga/lib/Haanga/Exception.php deleted file mode 100644 index 04594018c..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Exception.php +++ /dev/null @@ -1,57 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -// Haanga_Exception {{{ -/** - * General exception class. It is thrown - * when something is not configured properly - * - */ -class Haanga_Exception extends Exception -{ -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ - diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension.php deleted file mode 100644 index 1720b4ffd..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension.php +++ /dev/null @@ -1,183 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -Abstract Class Haanga_Extension -{ - private static $_instances; - - final private function __construct() - { - } - - final static function getInstance($name) - { - $name = 'Haanga_Extension_'.$name; - if (!class_exists($name)) { - throw new Haanga_Compiler_Exception("{$name} is not a class"); - } - if (!is_subclass_of($name, __CLASS__)) { - throw new Haanga_Compiler_Exception("{$name} is not a sub-class of ".__CLASS__); - } - - if (!isset(self::$_instances[$name])) { - self::$_instances[$name] = new $name; - } - return self::$_instances[$name]; - } - - abstract function isValid($name); - abstract function getClassName($name); - - final function getFilePath($name, $rel=TRUE, $pref=NULL) - { - try { - $reflection = new ReflectionClass($this->getClassName($name)); - $file = $reflection->getFileName(); - } catch (Exception $e) { - $file = ""; - } - return $file; - } - - final public function getFunctionAlias($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - $properties = get_class_vars($zclass); - if (isset($properties['php_alias'])) { - return $properties['php_alias']; - } - return NULL; - } - - final public function isSafe($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - $properties = get_class_vars($zclass); - return isset($properties['is_safe']) ? $properties['is_safe'] : FALSE; - } - - // generator(string $name, Haanga_Compiler $compiler, Array $args) {{{ - /** - * Executer the generator method of the extension. If - * the extension doesn't has any generator method, an empty - * will be returned. - * - * @param string $name extension name - * @param Haanga_Compiler Compiler object - * @param array Arrays - * @param mixed Extra param - * - * @return array - */ - function generator($name, Haanga_Compiler $compiler, $args, $extra=NULL) - { - if (!$this->hasGenerator($name)) { - return array(); - } - $zclass = $this->getClassName($name); - return call_user_func(array($zclass, 'generator'), $compiler, $args, $extra); - } - // }}} - - // hasGenerator(string $name) {{{ - /** - * Return TRUE if the extension has a - * generator method - * - * @param string $name Extension name - * - * @return bool - */ - function hasGenerator($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - return is_callable(array($zclass, 'generator')); - } - // }}} - - // getFunctionBody(string $name, string $name) {{{ - /** - * Return the body function of the custom extension main method. - * - * @param string $name - * @param string $name - * - * @return string - */ - function getFunctionBody($tag_name, $name) - { - if (!$this->isValid($tag_name)) { - return NULL; - } - $zclass = $this->getClassName($tag_name); - if (!is_callable(array($zclass, 'main'))) { - throw new Haanga_Compiler_Exception("{$name}: missing main method in {$zclass} class"); - } - - $reflection = new ReflectionMethod($zclass, 'main'); - $content = file($this->getFilePath($tag_name)); - - $start = $reflection->getStartLine()-1; - $end = $reflection->getEndLine(); - $content = array_slice($content, $start, $end-$start); - - $content[0] = str_replace("main", $name, $content[0]); - - - return "if (!function_exists('{$name}')) {\n".implode("", $content)."}"; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter.php deleted file mode 100644 index 2a2fa16c0..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter.php +++ /dev/null @@ -1,79 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -class Haanga_Extension_Filter extends Haanga_Extension -{ - /** - * isValid - * - * - */ - final function isValid($filter) - { - static $cache = array(); - $filter = strtolower($filter); - - if (!isset($cache[$filter])) { - $class_name = $this->getClassName($filter); - if (class_exists($class_name)) { - $cache[$filter] = TRUE; - } else { - $cache[$filter] = FALSE; - } - } - - return $cache[$filter]; - } - - final function getClassName($filter) - { - $filter = str_replace("_", "", ucfirst($filter)); - return "Haanga_Extension_Filter_{$filter}"; - } - - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ - diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Capfirst.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Capfirst.php deleted file mode 100644 index 109408f21..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Capfirst.php +++ /dev/null @@ -1,6 +0,0 @@ - $item) { - $field[$key] = $item[$sort_by]; - } - array_multisort($field, SORT_REGULAR, $array); - return $array; - - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Empty.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Empty.php deleted file mode 100644 index 65fbb9b40..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Empty.php +++ /dev/null @@ -1,6 +0,0 @@ -get_context($args[0]['var']); - if (is_array($value)) { - return $count; - } else if (is_string($value)) { - return $strlen; - } else { - return $guess; - } - } - - if (Haanga_AST::is_str($args[0])) { - return $strlen; - } - - return $guess; - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Lower.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Lower.php deleted file mode 100644 index d9e8341cf..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Lower.php +++ /dev/null @@ -1,6 +0,0 @@ - 1) { - if (!Haanga_AST::is_str($args[1])) { - $compiler->Error("pluralize: First parameter must be an string"); - } - $parts = explode(",", $args[1]['string']); - $singular = ""; - if (count($parts) == 1) { - $plural = $parts[0]; - } else { - $singular = $parts[0]; - $plural = $parts[1]; - } - } else { - $singular = ""; - $plural = "s"; - } - - return hexpr_cond(hexpr($args[0], '<=', 1), $singular, $plural); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Reverse.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Reverse.php deleted file mode 100644 index 836dd0f80..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Reverse.php +++ /dev/null @@ -1,13 +0,0 @@ -Error("Reverse only needs one parameter"); - } - - return hexec('array_reverse', $args[0], TRUE); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Safe.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Safe.php deleted file mode 100644 index eef6ca166..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Safe.php +++ /dev/null @@ -1,10 +0,0 @@ -var_is_safe = TRUE; - return current($args); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Slugify.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Slugify.php deleted file mode 100644 index 8e4418ed4..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Slugify.php +++ /dev/null @@ -1,16 +0,0 @@ -Error("slugify filter only needs one parameter"); - } - - $arg = hexec('strtolower', $args[0]); - $arg = hexec('str_replace'," ","-",$arg); - $arg = hexec('preg_replace',"/[^\d\w-_]/",'',$arg); - return $arg; - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Stringformat.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Stringformat.php deleted file mode 100644 index 271bb2dac..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Stringformat.php +++ /dev/null @@ -1,9 +0,0 @@ -Error("substr parameter must have one param"); - } - if (!isset($args[1]['string'])) { - $cmp->Error("substr parameter must be a string"); - } - list($start, $end) = explode(",", $args[1]['string']); - return hexec('substr', $args[0], (int)$start, (int)$end); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Title.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Title.php deleted file mode 100644 index a68251b69..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Title.php +++ /dev/null @@ -1,13 +0,0 @@ -Error("title filter only needs one parameter"); - } - - return hexec('ucwords', hexec('strtolower', $args[0])); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Trans.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Trans.php deleted file mode 100644 index b077e0d2e..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Filter/Trans.php +++ /dev/null @@ -1,6 +0,0 @@ -var_is_safe = TRUE; - return hexec('urlencode', $args[0]); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag.php deleted file mode 100644 index 4b344fb7b..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag.php +++ /dev/null @@ -1,93 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - - -class Haanga_Extension_Tag extends Haanga_Extension -{ - /** - * isValid - * - * Check if the current $tag (string) is registered as a custom - * tag, if so, it check wether it is just a custom tag or a custom block. - * - * This method is called from the lexer for each alpha (within {% %}), - * to avoid parsing conflicts. - * - * @param string $tag Tag to check - * - * @return int|bool HG_Parser::T_CUSTOM_TAG, HG_Parser::T_CUSTOM_TAG or FALSE - */ - final function isValid($tag) - { - static $cache = array(); - $tag = strtolower($tag); - - if (!isset($cache[$tag])) { - $class_name = $this->getClassName($tag); - if (class_exists($class_name)) { - $properties = get_class_vars($class_name); - $is_block = FALSE; - if (isset($properties['is_block'])) { - $is_block = (bool)$properties['is_block']; - } - $cache[$tag] = $is_block ? HG_Parser::T_CUSTOM_BLOCK : HG_Parser::T_CUSTOM_TAG; - } - if (!isset($cache[$tag])) { - $cache[$tag] = FALSE; - } - } - - return $cache[$tag]; - } - - final function getClassName($tag) - { - $tag = str_replace("_", "", ucfirst($tag)); - return "Haanga_Extension_Tag_{$tag}"; - } - - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Buffer.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Buffer.php deleted file mode 100644 index e89817cc2..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Buffer.php +++ /dev/null @@ -1,25 +0,0 @@ -Error("buffer filter must have one parameter"); - } - - /* get new code object */ - $code = hcode(); - /* redirect buffer to $args[1] */ - $code->decl($args[1], $args[0]); - /* telling to Haanga that we're handling the output */ - $code->doesPrint = TRUE; - - /* $args[1] is already safe (it might have HTML) */ - $cmp->set_safe($args[1]['var']); - - return $code; - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Currenttime.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Currenttime.php deleted file mode 100644 index c1233c02d..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Currenttime.php +++ /dev/null @@ -1,8 +0,0 @@ -cycle)) { - $cmp->cycle = array(); - } - - $code = hcode(); - - $index = 'index_'.$cycle; - $def = 'def_cycle_'.$cycle; - - if (count($args) == 1 && Haanga_AST::is_var($args[0]) && isset($cmp->cycle[$args[0]['var']])) { - $id = $cmp->cycle[$args[0]['var']]; - $index = 'index_'.$id; - $def = 'def_cycle_'.$id; - } else { - if (!$declared) { - $code->do_if(hexpr(hexec('isset', hvar($def)), '==', FALSE)); - } - $code->decl($def, $args); - if (!$declared) { - $code->do_endif(); - } - } - - /* isset($var) == FALSE */ - $expr = hexpr(hexec('isset', hvar($index)), '==', FALSE); - $inc = hexpr(hexpr(hexpr(hvar($index), '+', 1)), '%', hexec('count', hvar($def))); - - - if (!$declared) { - if (isset($id)) { - $code->decl($index, $inc); - } else { - $code->decl($index, hexpr_cond($expr, 0, $inc)); - } - $code->end(); - $var = hvar($def, hvar($index)); - $cmp->do_print($code, $var); - } else { - $code->decl($index, -1); - $cmp->cycle[$declared] = $cycle; - } - - $cycle++; - - return $code; - - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Dictsort.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Dictsort.php deleted file mode 100644 index c558cc472..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Dictsort.php +++ /dev/null @@ -1,43 +0,0 @@ -Error("dictsort must be redirected to a variable using AS "); - } - if (count($args) != 2) { - $cmp->Error("Dictsort must have two params"); - } - - if (!Haanga_AST::is_var($args[0])) { - $cmp->Error("Dictsort: First parameter must be an array"); - } - - $var = $cmp->get_context($args[0]['var']); - $cmp->set_context($redirected, $var); - - $redirected = hvar($redirected); - $field = hvar('field'); - $key = hvar('key'); - - $code = hcode(); - $body = hcode(); - - $body->decl(hvar('field', $key), hvar('item', $args[1])); - - $code->decl($redirected, $args[0]); - $code->decl($field, array()); - $code->do_foreach($redirected, 'item', $key, $body); - $code->do_exec('array_multisort', $field, hconst('SORT_REGULAR'), $redirected); - - return $code; - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Exec.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Exec.php deleted file mode 100644 index 6fe85a2e1..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Exec.php +++ /dev/null @@ -1,49 +0,0 @@ -getOption('allow_exec')) { - $cmp->Error("Tag exec is disabled for security reasons"); - } - - - $code = hcode(); - if (Haanga_AST::is_var($args[0])) { - $args[0] = $args[0]['var']; - } else if (Haanga_AST::is_str($args[0])) { - $args[0] = $args[0]['string']; - } else { - $cmp->Error("invalid param"); - } - - // fix for static calls {{{ - if (is_array($args[0])) { - $end = end($args[0]); - if (isset($end['class'])) { - $args[0][ key($args[0]) ]['class'] = substr($end['class'], 1); - } - } - // }}} - - $exec = hexec($args[0]); - for ($i=1; $i < count($args); $i++) { - $exec->param($args[$i]); - } - $exec->end(); - if ($assign) { - $code->decl($assign, $exec); - - // make it global - $code->decl($cmp->getScopeVariable($assign), hvar($assign)); - } else { - $cmp->do_print($code, $exec); - } - return $code; - } -} - diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Firstof.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Firstof.php deleted file mode 100644 index a47e37cd9..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Firstof.php +++ /dev/null @@ -1,22 +0,0 @@ -Error("inline needs one argument"); - } - - if ($redirected) { - $cmp->Error("inline can't be redirected to one variable"); - } - - if (!Haanga_AST::is_str($args[0])) { - $cmp->Error("The argument to inline must be an string"); - } - $file = $args[0]['string']; - - if (class_exists('Haanga')) { - $file = Haanga::GetTemplateDir().'/'.$file; - } - - if (!is_file($file)) { - $cmp->Error("{$file} is not a template"); - } - - return $cmp->getOpCodes(file_get_contents($file), $file); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Lower.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Lower.php deleted file mode 100644 index 823ae9a71..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Lower.php +++ /dev/null @@ -1,8 +0,0 @@ -set_safe($arg['var']); - } - } - - return hcode(); - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Spaceless.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Spaceless.php deleted file mode 100644 index 21a9f1886..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Spaceless.php +++ /dev/null @@ -1,51 +0,0 @@ -[ \t\r\n]+[ \t\r\n]+$/sU', - ); - $replaces = array('><', '<', '>'); - $html = preg_replace($regex, $replaces, $html); - return $html; - } }}} */ - - /** - * spaceless now uses generated code instead of - * calling Spaceless_Tag::main() at everytime. - * - */ - static function generator($compiler, $args) - { - $regex = array('/>[ \t\r\n]+[ \t\r\n]+$/sU'); - $repl = array('><', '<', '>'); - - return hexec('preg_replace', $regex, $repl, $args[0]); - } - - -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Templatetag.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Templatetag.php deleted file mode 100644 index cd0ebbcbc..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Templatetag.php +++ /dev/null @@ -1,56 +0,0 @@ -Error("templatetag only needs one parameter"); - } - - if (Haanga_AST::is_var($args[0])) { - $type = $args[0]['var']; - if (!is_string($type)) { - $compiler->Error("Invalid parameter"); - } - } else if (Haanga_AST::is_str($args[0])) { - $type = $args[0]['string']; - } - - switch ($type) - { - case 'openblock': - $str = '{%'; - break; - case 'closeblock': - $str = '%}'; - break; - case 'openbrace': - $str = '{'; - break; - case 'closebrace': - $str = '}'; - break; - case 'openvariable': - $str = '{{'; - break; - case 'closevariable': - $str = '}}'; - break; - case 'opencomment': - $str = '{#'; - break; - case 'closecomment': - $str = '#}'; - break; - default: - $compiler->Error("Invalid parameter"); - break; - } - - $code = hcode(); - $compiler->do_print($code, Haanga_AST::str($str)); - - return $code; - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Trans.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Trans.php deleted file mode 100644 index 8c8497f15..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Trans.php +++ /dev/null @@ -1,32 +0,0 @@ - 1) { - $exec = hexec('sprintf', $exec); - foreach ($args as $id => $arg) { - if ($id !== 0) { - $exec->param($arg); - } - } - } - - - if ($redirect) { - $code->decl($redirect, $exec); - } else { - $cmp->do_print($code, $exec); - } - - return $code; - } - -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php deleted file mode 100644 index c7d18057d..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php +++ /dev/null @@ -1,19 +0,0 @@ -Error("try_include can't be redirected to a variable"); - } - - $code = hcode(); - $exec = hexec('Haanga::Safe_Load', $args[0], $cmp->getScopeVariable(), TRUE, array()); - - $cmp->do_print($code, $exec); - - return $code; - - } -} diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Upper.php b/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Upper.php deleted file mode 100644 index 1fd0eb2fe..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Extension/Tag/Upper.php +++ /dev/null @@ -1,8 +0,0 @@ - | - +---------------------------------------------------------------------------------+ -*/ - -// addslashes_ex($string) {{{ -/** - * addslashes like function for single quote string ('foo') - * - * @return string - */ -function addslashes_ex($string) -{ - return str_replace(array("\\", "'"), array("\\\\", "\\'"), $string); -} -// }}} - -/** - * Haanga_Generator_PHP class - * - * This class takes the generated AST structure (arrays), - * and generated the PHP represantion. - * - * - */ -class Haanga_Generator_PHP -{ - protected $ident; - protected $tab = " "; - protected $scopeVariableName; - - // getCode (AST $op_code) {{{ - /** - * Transform the AST generated by the Haanga_Compiler class - * and return the equivalent PHP code. - * - * @param array $op_code - * - * @return string - */ - final function getCode($op_code, $scope) - { - $this->scopeVariableName = $scope; - $this->ident = 0; - $code = ""; - $size = count($op_code); - for ($i=0; $i < $size; $i++) { - $op = $op_code[$i]; - if (!isset($op['op'])) { - throw new Haanga_Compiler_Exception("Invalid \$op_code ".print_r($op, TRUE)); - } - - /* echo optimization {{{ */ - if ($op['op'] == 'print') { - do { - $next_op = $op_code[$i+1]; - if (!isset($next_op) || $next_op['op'] != 'print') { - break; - } - for ($e=0; $e < count($next_op); $e++) { - if (!isset($next_op[$e])) { - break; - } - $op[] = $next_op[$e]; - } - $i++; - } while(TRUE); - } - /* }}} */ - - /* declare optimization {{{ */ - if ($op['op'] == 'declare' || $op['op'] == 'append_var') { - /* Code optimization - ** - ** If a variable declaration, or append variable is followed - ** by several append_var, then merge everything into a - ** single STMT. - ** - */ - do { - $next_op = $op_code[$i+1]; - if (!isset($next_op) || $next_op['op'] != 'append_var' || $next_op['name'] != $op['name']) { - break; - } - for ($e=0; $e < count($next_op); $e++) { - if (!isset($next_op[$e])) { - break; - } - $op[] = $next_op[$e]; - } - $i++; - } while(TRUE); - } - /* }}} */ - - $method = "php_{$op['op']}"; - if (!is_callable(array($this, $method))) { - throw new Exception("CodeGenerator: Missing method $method"); - } - switch ($op['op']) { - case 'end_for': - case 'end_foreach': - case 'end_if': - case 'end_function': - case 'else': - break; - default: - $code .= $this->ident(); - } - $code .= $this->$method($op); - } - return $code; - } - // }}} - - // ident() {{{ - /** - * Get the string for the current tabulation - * - * @return string - */ - protected function ident() - { - $code = PHP_EOL; - $code .= str_repeat($this->tab, $this->ident); - - return $code; - } - // }}} - - // php_else() {{{ - /** - * Return code for "else" - * - * @return string - */ - protected function php_else() - { - $this->ident--; - $code = $this->ident()."} else {"; - $this->ident++; - return $code; - } - // }}} - - // php_comment() {{{ - /** - * Return code for "comments" - * - * @return string - */ - function php_comment($op) - { - return "/* {$op['comment']} */"; - } - // }}} - - // php_function(array $op) {{{ - /** - * Return the function declaration of the class, for now - * it has fixed params, this should change soon to generate - * any sort of functions - * - * @return string - */ - function php_function($op) - { - $code = "function {$op['name']}(\${$this->scopeVariableName}, \$return=FALSE, \$blocks=array())".$this->ident()."{"; - $this->ident++; - return $code; - } - // }}} - - // php_if(array $op) {{{ - /** - * Return the "if" declaration and increase $this->ident - * - * @return string - */ - protected function php_if($op) - { - $code = "if (".$this->php_generate_expr($op['expr']).") {"; - $this->ident++; - return $code; - } - // }}} - - // php_expr($op) {{{ - /** - * Return a stand-alone statement - * - * @return string - */ - protected function php_expr($op) - { - return $this->php_generate_expr($op[0]).";"; - } - // }}} - - // php_end_block() {{{ - /** - * Finish the current block (if, for, function, etc), - * return the final "}", and decrease $this->ident - * - * @return string - */ - protected function php_end_block() - { - $this->ident--; - return $this->ident()."}"; - } - // }}} - - // php_end_function() {{{ - /** - * Return code to end a function - * - * @return string - */ - protected function php_end_function() - { - return $this->php_end_block(); - } - // }}} - - // php_end_if() {{{ - /** - * Return code to end a if - * - * @return string - */ - protected function php_end_if() - { - return $this->php_end_block(); - } - // }}} - - // php_end_for() {{{ - /** - * Return code to end a for - * - * @return string - */ - protected function php_end_for() - { - return $this->php_end_block(); - } - // }}} - - // php_end_foreach() {{{ - /** - * Return code to end a foreach - * - * @return string - */ - protected function php_end_foreach() - { - return $this->php_end_block(); - } - // }}} - - // php_for() {{{ - /** - * - */ - protected function php_for($op) - { - $index = $this->php_get_varname($op['index']); - foreach (array('min', 'max', 'step') as $type) { - if (is_array($op[$type])) { - $$type = $this->php_get_varname($op[$type]['var']); - } else { - $$type = $op[$type]; - } - } - $cmp = "<="; - if (is_numeric($step) && $step < 0) { - $cmp = ">="; - } - if (is_numeric($min) && is_numeric($max) && $max < $min) { - if (is_numeric($step) && $step > 0) { - $step *= -1; - } - $cmp = ">="; - } - - $code = "for ({$index} = {$min}; {$index} {$cmp} {$max}; {$index} += {$step}) {"; - $this->ident++; - - return $code; - } - // }}} - - // php_foreach(array $op) {{{ - /** - * Return the declaration of a "foreach" statement. - * - * @return string - */ - protected function php_foreach($op) - { - $op['array'] = $this->php_get_varname($op['array']); - $op['value'] = $this->php_get_varname($op['value']); - $code = "foreach ((array) {$op['array']} as "; - if (!isset($op['key'])) { - $code .= " {$op['value']}"; - } else { - $op['key'] = $this->php_get_varname($op['key']); - $code .= " {$op['key']} => {$op['value']}"; - } - - $code .= ") {"; - $this->ident++; - return $code; - } - // }}} - - // php_append_var(array $op) {{{ - /** - * Return code to append something to a variable - * - * @return string - */ - protected function php_append_var($op) - { - return $this->php_declare($op, '.='); - } - // }}} - - // php_exec($op) {{{ - /** - * Return code for a function calling. - * - * @return string - */ - protected function php_exec($op) - { - $code = ""; - if (is_string($op['name'])) { - $code .= $op['name']; - } else { - $function = $this->php_get_varname($op['name']); - $code .= $function; - } - $code .= '('; - if (isset($op['args'])) { - $code .= $this->php_generate_list($op['args']); - } - $code .= ')'; - return $code; - } - // }}} - - // php_global($op) {{{ - function php_global($op) - { - return "global \$".implode(", \$", $op['vars']).";"; - } - // }}} - - // php_generate_expr($op) {{{ - /** - * Return an expression - * - * @return string - */ - protected function php_generate_expr($expr) - { - $code = ''; - if (is_object($expr)) { - $expr = $expr->getArray(); - } - if (is_array($expr) && isset($expr['op_expr'])) { - if ($expr['op_expr'] == 'expr') { - $code .= "("; - $code .= $this->php_generate_expr($expr[0]); - $code .= ")"; - } else if ($expr['op_expr'] == 'not') { - $code .= "!".$this->php_generate_expr($expr[0]); - } else { - $code .= $this->php_generate_expr($expr[0]); - if (is_object($expr['op_expr'])) { - var_dump($expr);die('unexpected error'); - } - $code .= " {$expr['op_expr']} "; - $code .= $this->php_generate_expr($expr[1]); - } - } else { - if (is_array($expr)) { - $code .= $this->php_generate_stmt(array($expr)); - } else { - if ($expr === FALSE) { - $expr = 'FALSE'; - } else if ($expr === TRUE) { - $expr = 'TRUE'; - } - $code .= $expr; - } - } - return $code; - } - // }}} - - // php_generate_list(array ($array) {{{ - /** - * Return a list of expressions for parameters - * of a function - * - * @return string - */ - protected function php_generate_list($array) - { - $code = ""; - foreach ($array as $value) { - $code .= $this->php_generate_stmt(array($value)); - $code .= ", "; - } - return substr($code, 0, -2); - } - // }}} - - // php_generate_stmt(Array $op) {{{ - /** - * Return the representation of a statement - * - * @return string - */ - protected function php_generate_stmt($op, $concat='.') - { - $code = ""; - - for ($i=0; $i < count($op); $i++) { - if (!isset($op[$i])) { - continue; - } - if (!is_Array($op[$i])) { - throw new Haanga_Compiler_Exception("Malformed declaration ".print_r($op, TRUE)); - } - $key = key($op[$i]); - $value = current($op[$i]); - switch ($key) { - case 'array': - $code .= "Array("; - $code .= $this->php_generate_list($value); - $code .= ")"; - break; - case 'function': - case 'exec': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - - $value = array('name' => $value, 'args' => $op[$i]['args']); - $code .= $this->php_exec($value, FALSE); - $code .= $concat; - break; - case 'key': - $code .= $this->php_generate_stmt(array($value[0]))." => ".$this->php_generate_stmt(array($value[1])); - break; - case 'string': - if ($code != "" && $code[strlen($code)-1] == "'") { - $code = substr($code, 0, -1); - } else { - $code .= "'"; - } - $html = addslashes_ex($value); - $code .= $html."'"; - break; - case 'var': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= $this->php_get_varname($value). $concat; - break; - case 'number': - if (!is_numeric($value)) { - throw new Exception("$value is not a valid number"); - } - $code .= $value; - break; - case 'op_expr': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= '(' . $this->php_generate_expr($op[$i]) . ')'; - $code .= $concat; - break; - case 'expr': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= $this->php_generate_expr($value); - $code .= $concat; - break; - case 'expr_cond': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= "("; - $code .= $this->php_generate_expr($value); - $code .= " ? "; - $code .= $this->php_generate_stmt(array($op[$i]['true'])); - $code .= " : "; - $code .= $this->php_generate_stmt(array($op[$i]['false'])); - $code .= "){$concat}"; - break; - case 'constant': - $code = $value; - break; - default: - throw new Exception("Don't know how to declare {$key} = {$value} (".print_r($op, TRUE)); - } - } - - if ($code != "" && $code[strlen($code)-1] == $concat) { - $code = substr($code, 0, -1); - } - - return $code; - } - // }}} - - // php_print(array $op) {{{ - /** - * Return an echo of an stmt - * - * @return string - */ - protected function php_print($op) - { - $output = $this->php_generate_stmt($op, Haanga_Compiler::getOption('echo_concat')); - if ($output == "' '" && Haanga_Compiler::getOption('strip_whitespace')) { - return; /* ignore this */ - } - return 'echo '.$output.';'; - } - // }}} - - // php_inc(array $op) {{{ - /** - * Return increment a variable ($var++) - * - * @return string - */ - protected function php_inc($op) - { - return "++".$this->php_get_varname($op['name']); - } - // }}} - - // php_declare(array $op, $assign='=') {{{ - /** - * Return a variable declaration - * - * @return string - */ - protected function php_declare($op, $assign=' =') - { - $op['name'] = $this->php_get_varname($op['name']); - $code = "{$op['name']} {$assign} ".$this->php_generate_stmt($op).";"; - return $code; - } - // }}} - - // php_get_varname(mixed $var) {{{ - /** - * Return a variable - * - * @param mixed $var - * - * @return string - */ - protected function php_get_varname($var) - { - if (is_array($var)) { - if (!is_string($var[0])) { - if (count($var) == 1) { - return $this->php_get_varname($var[0]); - } else { - throw new Exception("Invalid variable definition ".print_r($var, TRUE)); - } - } - $var_str = $this->php_get_varname($var[0]); - for ($i=1; $i < count($var); $i++) { - if (is_string($var[$i])) { - $var_str .= "['".addslashes_ex($var[$i])."']"; - } else if (is_array($var[$i])) { - if (isset($var[$i]['var'])) { - /* index is a variable */ - $var_str .= '['.$this->php_get_varname($var[$i]['var']).']'; - } else if (isset($var[$i]['string'])) { - /* index is a string */ - $var_str .= "['".addslashes_ex($var[$i]['string'])."']"; - } else if (isset($var[$i]['number'])) { - /* index is a number */ - $var_str .= '['.$var[$i]['number'].']'; - } else if (isset($var[$i]['object'])) { - /* Accessing a object's property */ - if (is_array($var[$i]['object'])) { - $var_str .= '->{'.$this->php_get_varname($var[$i]['object']['var']).'}'; - } else { - $var_str .= '->'.$var[$i]['object']; - } - } else if (isset($var[$i]['class'])) { - /* Accessing a class' property */ - $var_str = substr($var_str, 1); - if (is_array($var[$i]['class'])) { - $var_str .= '::{'.$this->php_get_varname($var[$i]['class']['var']).'}'; - } else { - $var_str .= '::'.$var[$i]['class']; - } - } else if ($var[$i] === array()) { - /* index is a NULL (do append) */ - $var_str .= '[]'; - } else { - throw new Haanga_Compiler_Exception('Unknown variable definition '.print_r($var, TRUE)); - } - } - } - return $var_str; - } else { - return "\$".$var; - } - } - // }}} - - // php_return($op) {{{ - /** - * Return "return" - * - * @return string - */ - protected function php_return($op) - { - $code = "return ".$this->php_generate_stmt($op).";"; - return $code; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/gulliver/thirdparty/Haanga/lib/Haanga/Loader.php b/gulliver/thirdparty/Haanga/lib/Haanga/Loader.php deleted file mode 100644 index e1b980d4d..000000000 --- a/gulliver/thirdparty/Haanga/lib/Haanga/Loader.php +++ /dev/null @@ -1,118 +0,0 @@ - file) - */ - - // classes {{{ - static $classes = array ( - 'haanga' => '/../Haanga.php', - 'haanga_ast' => '/AST.php', - 'haanga_extension_filter' => '/Extension/Filter.php', - 'haanga_extension' => '/Extension.php', - 'haanga_extension_tag_spaceless' => '/Extension/Tag/Spaceless.php', - 'haanga_extension_tag_exec' => '/Extension/Tag/Exec.php', - 'haanga_extension_tag_inline' => '/Extension/Tag/Inline.php', - 'haanga_extension_tag_upper' => '/Extension/Tag/Upper.php', - 'haanga_extension_tag_trans' => '/Extension/Tag/Trans.php', - 'haanga_extension_tag_templatetag' => '/Extension/Tag/Templatetag.php', - 'haanga_extension_tag_tryinclude' => '/Extension/Tag/Tryinclude.php', - 'haanga_extension_tag_setsafe' => '/Extension/Tag/Setsafe.php', - 'haanga_extension_tag_dictsort' => '/Extension/Tag/Dictsort.php', - 'haanga_extension_tag_min' => '/Extension/Tag/Min.php', - 'haanga_extension_tag_lower' => '/Extension/Tag/Lower.php', - 'haanga_extension_tag_currenttime' => '/Extension/Tag/Currenttime.php', - 'haanga_extension_tag_firstof' => '/Extension/Tag/Firstof.php', - 'haanga_extension_tag_buffer' => '/Extension/Tag/Buffer.php', - 'haanga_extension_tag_cycle' => '/Extension/Tag/Cycle.php', - 'haanga_extension_filter_urlencode' => '/Extension/Filter/Urlencode.php', - 'haanga_extension_filter_default' => '/Extension/Filter/Default.php', - 'haanga_extension_filter_length' => '/Extension/Filter/Length.php', - 'haanga_extension_filter_truncatechars' => '/Extension/Filter/Truncatechars.php', - 'haanga_extension_filter_intval' => '/Extension/Filter/Intval.php', - 'haanga_extension_filter_translation' => '/Extension/Filter/Translation.php', - 'haanga_extension_filter_trans' => '/Extension/Filter/Trans.php', - 'haanga_extension_filter_stringformat' => '/Extension/Filter/Stringformat.php', - 'haanga_extension_filter_capfirst' => '/Extension/Filter/Capfirst.php', - 'haanga_extension_filter_reverse' => '/Extension/Filter/Reverse.php', - 'haanga_extension_filter_substr' => '/Extension/Filter/Substr.php', - 'haanga_extension_filter_upper' => '/Extension/Filter/Upper.php', - 'haanga_extension_filter_isarray' => '/Extension/Filter/Isarray.php', - 'haanga_extension_filter_empty' => '/Extension/Filter/Empty.php', - 'haanga_extension_filter_trim' => '/Extension/Filter/Trim.php', - 'haanga_extension_filter_hostname' => '/Extension/Filter/Hostname.php', - 'haanga_extension_filter_count' => '/Extension/Filter/Count.php', - 'haanga_extension_filter_truncatewords' => '/Extension/Filter/Truncatewords.php', - 'haanga_extension_filter_dictsort' => '/Extension/Filter/Dictsort.php', - 'haanga_extension_filter_exists' => '/Extension/Filter/Exists.php', - 'haanga_extension_filter_title' => '/Extension/Filter/Title.php', - 'haanga_extension_filter_cut' => '/Extension/Filter/Cut.php', - 'haanga_extension_filter_date' => '/Extension/Filter/Date.php', - 'haanga_extension_filter_lower' => '/Extension/Filter/Lower.php', - 'haanga_extension_filter_slugify' => '/Extension/Filter/Slugify.php', - 'haanga_extension_filter_join' => '/Extension/Filter/Join.php', - 'haanga_extension_filter_escape' => '/Extension/Filter/Escape.php', - 'haanga_extension_filter_pluralize' => '/Extension/Filter/Pluralize.php', - 'haanga_extension_filter_safe' => '/Extension/Filter/Safe.php', - 'haanga_extension_filter_null' => '/Extension/Filter/Null.php', - 'haanga_extension_tag' => '/Extension/Tag.php', - 'hg_parser' => '/Compiler/Tokenizer.php', - 'haanga_compiler_parser' => '/Compiler/Parser.php', - 'haanga_compiler_tokenizer' => '/Compiler/Tokenizer.php', - 'haanga_yytoken' => '/Compiler/Parser.php', - 'haanga_yystackentry' => '/Compiler/Parser.php', - 'haanga_compiler_exception' => '/Compiler/Exception.php', - 'haanga_compiler_runtime' => '/Compiler/Runtime.php', - 'haanga_compiler' => '/Compiler.php', - 'haanga_exception' => '/Exception.php', - 'haanga_generator_php' => '/Generator/PHP.php', -); - // }}} - - // deps {{{ - static $deps = array ( - 'haanga_extension_filter' => - array ( - 0 => 'haanga_extension', - ), - 'haanga_extension_filter_translation' => - array ( - 0 => 'haanga_extension_filter_trans', - ), - 'haanga_extension_tag' => - array ( - 0 => 'haanga_extension', - ), - 'hg_parser' => - array ( - 0 => 'haanga_compiler_parser', - ), - 'haanga_compiler_runtime' => - array ( - 0 => 'haanga_compiler', - ), -); - // }}} - - $class = strtolower($class); - if (isset($classes[$class])) { - if (!empty($deps[$class])) { - foreach ($deps[$class] as $zclass) { - if (!class_exists($zclass, false) && !interface_exists($zclass, false)) { - require __DIR__ . $classes[$zclass]; - } - } - } - - if (!class_exists($class, false) && !interface_exists($class, false)) { - require __DIR__ . $classes[$class]; - } - return true; - } - - return false; -} -spl_autoload_register( "hanga_anonymous" ); - - diff --git a/gulliver/thirdparty/krumo/INSTALL b/gulliver/thirdparty/krumo/INSTALL deleted file mode 100755 index e6117c854..000000000 --- a/gulliver/thirdparty/krumo/INSTALL +++ /dev/null @@ -1,32 +0,0 @@ ------------------------------------------------------------------------------- - - SETUP: How to install Krumo ? - ------------------------------------------------------------------------------- - -In order to use Krumo you have to put it on your (development) server, and -include it in your script. You can put it somewhere in the INCLUDE_PATH, or -specify the full path to the "class.krumo.php" file. - -You have to modify the "krumo.ini" file too. It is the configuration file for -Krumo. The first option is choosing a skin: - - [skin] - selected = "orange" - -The value for this setting has to be the name of one of the sub-folders from the -"Krumo/skins/" folder. If the value provided for the skin results in not finding -the skin, the `default` skin will be used instead. - -The second option is used to set the correct web path to the folder where Krumo -is installed. This is used in order to make the images from Krumo's CSS skins -web-accessible. - - [css] - url = "http://www.example.com/Krumo/" - -So far those two are the only configuration options. - -All the CSS files ("skin.css") from the "Krumo/skins/" sub-folders must have the -proper permissions in order to be readable from Krumo. Same applies for -"krumo.ini" and "krumo.js" files. \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/LICENSE b/gulliver/thirdparty/krumo/LICENSE deleted file mode 100755 index 03851a338..000000000 --- a/gulliver/thirdparty/krumo/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/gulliver/thirdparty/krumo/README b/gulliver/thirdparty/krumo/README deleted file mode 100755 index 93914098b..000000000 --- a/gulliver/thirdparty/krumo/README +++ /dev/null @@ -1,103 +0,0 @@ -============================================================================= - - Krumo - version 0.2.1a - -============================================================================= - -You probably got this package from... -http://www.sourceforge.net/projects/krumo/ - -If there is no licence agreement with this package please download -a version from the location above. You must read and accept that -licence to use this software. The file is titled simply LICENSE. - -OVERVIEW ------------------------------------------------------------------------------- -To put it simply, Krumo is a replacement for print_r() and var_dump(). By -definition Krumo is a debugging tool (for PHP5), which displays structured -information about any PHP variable. - -A lot of developers use print_r() and var_dump() in the means of debugging -tools. Although they were intended to present human readble information about a -variable, we can all agree that in general they are not. Krumo is an -alternative: it does the same job, but it presents the information beautified -using CSS and DHTML. - -EXAMPLES ------------------------------------------------------------------------------- -Here's a basic example, which will return a report on the array variable passed -as argument to it: - - krumo(array('a1'=> 'A1', 3, 'red')); - -You can dump simultaneously more then one variable - here's another example: - - krumo($_SERVER, $_REQUEST); - -You probably saw from the examples above that some of the nodes are expandable, -so if you want to inspect the nested information, click on them and they will -expand; if you do not need that information shown simply click again on it to -collapse it. Here's an example to test this: - - $x1->x2->x3->x4->x5->x6->x7->x8->x9 = 'X10'; - krumo($x1); - -The krumo() is the only standalone function from the package, and this is -because basic dumps about variables (like print_r() or var_dump()) are the most -common tasks such functionality is used for. The rest of the functionality can -be called using static calls to the Krumo class. Here are several more examples: - - // print a debug backgrace - krumo::backtrace(); - - // print all the included(or required) files - krumo::includes(); - - // print all the included functions - krumo::functions(); - - // print all the declared classes - krumo::classes(); - - // print all the defined constants - krumo::defines(); - - ... and so on, etc. - -A full PHPDocumenter API documentation exists both in this package and at the -project's website. - -INSTALL ------------------------------------------------------------------------------- -Read the INSTALL file. - -DOCUMENTATION ------------------------------------------------------------------------------- -As I said, a full PHPDocumenter API documentation can be found both in this -package and at the project's website. - -SKINS ------------------------------------------------------------------------------- -There are several skins pre-installed with this package, but if you wish you can -create skins of your own. The skins are simply CSS files that are prepended to -the result that Krumo prints. If you want to use images in your CSS (for -background, list-style, etc), you have to put "%URL%" in front of the image URL -in order hook it up to the skin folder and make the image web-accessible. - -Here's an example: - - ul.krumo-first {background: url(%url%bg.gif);} - -TODO ------------------------------------------------------------------------------- -You can find the list of stuff that is going to be added to this project in the -TODO file from this very package. - -CONTRIBUTION ------------------------------------------------------------------------------ -If you download and use and possibly even extend this tool, please let us know. -Any feedback, even bad, is always welcome and your suggestions are going to be -considered for our next release. Please use our SourceForge page for that: - - http://www.sourceforge.net/projects/krumo/ diff --git a/gulliver/thirdparty/krumo/TODO b/gulliver/thirdparty/krumo/TODO deleted file mode 100755 index d1de49fab..000000000 --- a/gulliver/thirdparty/krumo/TODO +++ /dev/null @@ -1,24 +0,0 @@ -****************************************************************************** - - Krumo: TODO - -****************************************************************************** - -BUGS ----------------- - - watch the SourceForge.net Bug Tracker - -Features: PHP ----------------- - - Try to detect anonymous (lambda) functions - - Try to detect whether an array is indexed or associated - - Add var_export support for arrays and objects - - Add JSON support for arrays and objects - -Features: GUI ----------------- - - Nicer and friendlier skin(s) - - Add top-level links for collapsing and expanding the whole tree - - Add object & array -level links for collapsing and expanding all the - nested nodes - - Print all parent classes for the rendered objects \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/VERSION b/gulliver/thirdparty/krumo/VERSION deleted file mode 100755 index 8d940129e..000000000 --- a/gulliver/thirdparty/krumo/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.1a \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/class.krumo.php b/gulliver/thirdparty/krumo/class.krumo.php deleted file mode 100755 index 1d9ec62c7..000000000 --- a/gulliver/thirdparty/krumo/class.krumo.php +++ /dev/null @@ -1,1302 +0,0 @@ - -* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License Version 2.1 -* -* @package Krumo -* @version $Id: class.krumo.php 22 2007-12-02 07:38:18Z Mrasnika $ -*/ - -////////////////////////////////////////////////////////////////////////////// - -/** -* backward compatibility: the DIR_SEP constant isn't used anymore -*/ -if(!defined('DIR_SEP')) { - define('DIR_SEP', DIRECTORY_SEPARATOR); - } -/** -* backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2 -*/ -if (!defined('PATH_SEPARATOR')) { - define('PATH_SEPARATOR', OS_WINDOWS ? ';' : ':'); - } - -// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -/** -* Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is -* not defined, include_path will be used. Set KRUMO_DIR only if any other module -* or application has not already set it up. -*/ -if (!defined('KRUMO_DIR')) { - define('KRUMO_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); - } - -/** -* This constant sets the maximum strings of strings that will be shown -* as they are. Longer strings will be truncated with this length, and -* their `full form` will be shown in a child node. -*/ -if (!defined('KRUMO_TRUNCATE_LENGTH')) { - define('KRUMO_TRUNCATE_LENGTH', 50); - } - -////////////////////////////////////////////////////////////////////////////// - -/** -* Krumo API -* -* This class stores the Krumo API for rendering and -* displaying the structured information it is reporting -* -* @package Krumo -*/ -Class krumo { - - public static $show_details; - - /** - * Return Krumo version - * - * @return string - * @access public - * @static - */ - Public Static Function version() { - return '0.2.1a'; - } - - // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - /** - * Prints a debug backtrace - * - * @access public - * @static - */ - Public Static Function backtrace() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - return krumo::dump(debug_backtrace()); - } - - /** - * Prints a list of all currently declared classes. - * - * @access public - * @static - */ - Public Static Function classes() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all currently declared classes. -
- -
-This is a list of all currently declared interfaces. -
- -
-This is a list of all currently included (or required) files. -
- -
-This is a list of all currently declared functions. -
- -
-This is a list of all currently declared constants (defines). -
- -
-This is a list of all currently loaded PHP extensions. -
- -
-This is a list of all HTTP request headers. -
- php.ini - * - * @access public - * @static - */ - Public Static Function phpini() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - if (!readable(get_cfg_var('cfg_file_path'))) { - return false; - } - - // render it - // - ?> -
-This is a list of the configuration settings read from . -
- -
-This is a list of all your configuration settings. -
- include_path option. - * - * @access public - * @static - */ - Public Static Function path() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of the specified directories under your include_path option. -
- $_REQUEST array. - * - * @access public - * @static - */ - Public Static Function request() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_REQUEST array. -
- $_GET array. - * - * @access public - * @static - */ - Public Static Function get() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_GET array. -
- $_POST array. - * - * @access public - * @static - */ - Public Static Function post() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_POST array. -
- $_SERVER array. - * - * @access public - * @static - */ - Public Static Function server() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_SERVER array. -
- $_COOKIE array. - * - * @access public - * @static - */ - Public Static Function cookie() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_COOKIE array. -
- $_ENV array. - * - * @access public - * @static - */ - Public Static Function env() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_ENV array. -
- $_SESSION array. - * - * @access public - * @static - */ - Public Static Function session() { - - // disabled ? - // - if (!krumo::_debug()) { - return false; - } - - // render it - // - ?> -
-This is a list of all the values from the $_SESSION array. -
- -
-This is a list of all the values from the INI file. -
- 1) { - $_ = func_get_args(); - foreach($_ as $d) { - krumo::dump($d); - } - return; - } - - // the css ? - // - krumo::_css(); - - // find caller - // - $_ = debug_backtrace(); - while($d = array_pop($_)) { - if ((strToLower($d['function']) == 'krumo') || (strToLower(@$d['class']) == 'krumo')) { - break; - } - } - - // the content - // - ?> -
- -
-$bee){ - if (is_object($bee)) { - unset($hive[$i]->$_recursion_marker); - } else { - unset($hive[$i][$_recursion_marker]); - } - } - } - - // PHP 4.x.x array reference bug... - // - if (is_array($data) && version_compare(PHP_VERSION, "5", "<")) { - unset($GLOBALS[krumo::_marker()]); - } - } - - // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - /** - * Returns values from Krumo's configuration - * - * @param string $group - * @param string $name - * @param mixed $fallback - * @return mixed - * - * @access private - * @static - */ - Private Static Function _config($group, $name, $fallback=null) { - - static $_config = array(); - - // not loaded ? - // - if (empty($_config)) { - $_config = (array) @parse_ini_file( - KRUMO_DIR . 'krumo.ini', - true); - } - - // exists ? - // - return (isset($_config[$group][$name])) - ? $_config[$group][$name] - : $fallback; - } - - // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - /** - * Print the skin (CSS) - * - * @return boolean - * @access private - * @static - */ - Private Static Function _css() { - - static $_css = false; - - // already set ? - // - if ($_css) { - return true; - } - - $css = ''; - $skin = krumo::_config('skin', 'selected', 'default'); - - // custom selected skin ? - // - $_ = KRUMO_DIR . "skins/{$skin}/skin.css"; - if ($fp = @fopen($_, 'r', 1)) { - $css = fread($fp, filesize($_)); - fclose($fp); - } - - // defautl skin ? - // - if (!$css && ($skin != 'default')) { - $skin = 'default'; - $_ = KRUMO_DIR . "skins/default/skin.css"; - $css = join('', @file($_)); - } - - // print ? - // - if ($_css = $css != '') { - - // fix the urls - // - $css_url = krumo::_config('css', 'url') . "skins/{$skin}/"; - $css = preg_replace('~%url%~Uis', $css_url, $css); - - // the CSS - // - ?> - - - -
  • -
    - - - (NULL) -
    -
  • -$_recursion_marker++) - : @($bee[$_recursion_marker]++); - - $_[0][] =& $bee; - } - - // return all bees - // - return $_[0]; - } - - // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - /** - * Render a dump for the properties of an array or objeect - * - * @param mixed &$data - * @access private - * @static - */ - Private Static Function _vars(&$data) { - - $_is_object = is_object($data); - - // test for references in order to - // prevent endless recursion loops - // - $_recursion_marker = krumo::_marker(); - $_r = ($_is_object) - ? @$data->$_recursion_marker - : @$data[$_recursion_marker] ; - $_r = (integer) $_r; - - // recursion detected - // - if ($_r > 0) { - return krumo::_recursion(); - } - - // stain it - // - krumo::_hive($data); - - // render it - // - ?> - - - - -
  • - -
    0) {?> onClick="krumo.toggle(this);" - onMouseOver="krumo.over(this);" - onMouseOut="krumo.out(this);"> - - - (Array, ) - - - - | - (Callback) - ::(); - - -
    - - -
  • - -
  • - -
    0) {?> onClick="krumo.toggle(this);" - onMouseOver="krumo.over(this);" - onMouseOut="krumo.out(this);"> - - - (Object) - -
    - - -
  • - -
  • - -
    - - - (Resource) - -
    - -
  • - -
  • - -
    - - - (Boolean) - -
    - -
  • - -
  • - -
    - - - (Integer) - -
    - -
  • - -
  • - -
    - - - (Float) - -
    - -
  • - KRUMO_TRUNCATE_LENGTH) { - $_ = substr($data, 0, KRUMO_TRUNCATE_LENGTH - 3) . '...'; - $_extra = true; - } -?> -
  • - -
    onClick="krumo.toggle(this);" - onMouseOver="krumo.over(this);" - onMouseOut="krumo.out(this);"> - - - (String, - characters ) - - - - | - (Callback) - (); - - -
    - - - - -
  • - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/Krumo/_class.krumo.php.html b/gulliver/thirdparty/krumo/docs/Krumo/_class.krumo.php.html deleted file mode 100755 index 05ac34528..000000000 --- a/gulliver/thirdparty/krumo/docs/Krumo/_class.krumo.php.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - Docs for page class.krumo.php - - - - - -
    -

    File/class.krumo.php

    - - -
    -
    Description
    - -
    - -

    Krumo: Structured information display solution

    -

    Krumo is a debugging tool (PHP5 only), which displays structured information about any PHP variable. It is a nice replacement for print_r() or var_dump() which are used by a lot of PHP developers.

    - - -
    -
    - - -
    -
    Classes
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - krumo - - Krumo API -
    -
    -
    - - - -
    -
    Constants
    - -
    - -
    - -
    - - - DIR_SEP = DIRECTORY_SEPARATOR - (line 22) - -
    - - -

    backward compatibility: the DIR_SEP constant isn't used anymore

    - - -
    - -
    - -
    - - - KRUMO_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR - (line 39) - -
    - - -

    Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is not defined, include_path will be used. Set KRUMO_DIR only if any other module or application has not already set it up.

    - - -
    - -
    - -
    - - - KRUMO_TRUNCATE_LENGTH = 50 - (line 48) - -
    - - -

    This constant sets the maximum strings of strings that will be shown as they are. Longer strings will be truncated with this length, and their `full form` will be shown in a child node.

    - - -
    - -
    - -
    - - - PATH_SEPARATOR = OS_WINDOWS?';':':' - (line 28) - -
    - - -

    backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2

    - - -
    -
    -
    - - - -
    -
    Functions
    - -
    - -
    - -
    - - krumo (line 1295) -
    - - -

    Alias of krumo::dump()

    - -
    - void - - krumo - - ([mixed $data,... = ]) -
    - -
      -
    • - mixed - $data,...
    • -
    - - -
    -
    -
    - -

    - Documentation generated on Sun, 02 Dec 2007 09:43:24 +0200 by phpDocumentor 1.4.0a2 -

    -
    - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/Krumo/_class_krumo_php.html b/gulliver/thirdparty/krumo/docs/Krumo/_class_krumo_php.html deleted file mode 100755 index ffbee47e0..000000000 --- a/gulliver/thirdparty/krumo/docs/Krumo/_class_krumo_php.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - Docs for page class.krumo.php - - - - - -
    -

    File/class.krumo.php

    - - -
    -
    Description
    - -
    - -

    Krumo: Structured information display solution

    -

    Krumo is a debugging tool (PHP4/PHP5), which displays structured information about any PHP variable. It is a nice replacement for print_r() or var_dump() which are used by a lot of PHP developers.

    - - -
    -
    - - -
    -
    Classes
    - -
    - - - - - - - - - -
    ClassDescription
    -  class - krumo - - Krumo API -
    -
    -
    - - - -
    -
    Constants
    - -
    - -
    - -
    - - - DIR_SEP = DIRECTORY_SEPARATOR - (line 22) - -
    - - -

    backward compatibility: the DIR_SEP constant isn't used anymore

    - - -
    - -
    - -
    - - - KRUMO_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR - (line 39) - -
    - - -

    Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is not defined, include_path will be used. Set KRUMO_DIR only if any other module or application has not already set it up.

    - - -
    - -
    - -
    - - - KRUMO_TRUNCATE_LENGTH = 50 - (line 48) - -
    - - -

    This constant sets the maximum strings of strings that will be shown as they are. Longer strings will be truncated with this length, and their `full form` will be shown in a child node.

    - - -
    - -
    - -
    - - - PATH_SEPARATOR = OS_WINDOWS?';':':' - (line 28) - -
    - - -

    backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2

    - - -
    -
    -
    - - - -
    -
    Functions
    - -
    - -
    - -
    - - krumo (line 1296) -
    - - -

    Alias of krumo::dump()

    - -
    - void - - krumo - - ([mixed $data,... - = ]) -
    - -
      -
    • - mixed - $data,... -
    • -
    - - -
    -
    -
    - -

    - Documentation generated on Sat, 16 Jun 2007 09:50:08 +0300 by phpDocumentor 1.3.0RC4 -

    -
    - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/Krumo/krumo.html b/gulliver/thirdparty/krumo/docs/Krumo/krumo.html deleted file mode 100755 index ce4d33b89..000000000 --- a/gulliver/thirdparty/krumo/docs/Krumo/krumo.html +++ /dev/null @@ -1,900 +0,0 @@ - - - - - - Docs For Class krumo - - - - - -
    -

     Class krumo

    - - -
    -
    Description
    - -
    - -

    Krumo API

    -

    This class stores the Krumo API for rendering and displaying the structured information it is reporting

    -

    - Located in /class.krumo.php (line 61) -

    - - -
    
    -	
    -			
    -
    - - - - - -
    -
    Method Summary
    - -
    -
    - -
    -  - static void - backtrace - () -
    - -
    -  - static void - classes - () -
    - -
    -  - static void - conf - () -
    - -
    -  - static void - cookie - () -
    - -
    -  - static void - defines - () -
    - -
    -  - static boolean - disable - () -
    - -
    -  - static void - dump - ( $data, mixed $data,...) -
    - -
    -  - static boolean - enable - () -
    - -
    -  - static void - env - () -
    - -
    -  - static void - extensions - () -
    - -
    -  - static void - functions - () -
    - -
    -  - static void - get - () -
    - -
    -  - static void - headers - () -
    - -
    -  - static void - includes - () -
    - -
    -  - static void - ini - (string $ini_file) -
    - -
    -  - static void - interfaces - () -
    - -
    -  - static void - path - () -
    - -
    -  - static void - phpini - () -
    - -
    -  - static void - post - () -
    - -
    -  - static void - request - () -
    - -
    -  - static void - server - () -
    - -
    -  - static void - session - () -
    - -
    -  - static string - version - () -
    -
    -
    -
    - - - -
    -
    Methods
    - -
    - - -
    - -
    - - static backtrace (line 82) -
    - - -

    Prints a debug backtrace

    -
      -
    • access: public
    • -
    - -
    - static void - - backtrace - - () -
    - - - -
    - -
    - -
    - - static classes (line 101) -
    - - -

    Prints a list of all currently declared classes.

    -
      -
    • access: public
    • -
    - -
    - static void - - classes - - () -
    - - - -
    - -
    - -
    - - static conf (line 297) -
    - - -

    Prints a list of all your configuration settings.

    -
      -
    • access: public
    • -
    - -
    - static void - - conf - - () -
    - - - -
    - -
    - -
    - - static cookie (line 441) -
    - - -

    Prints a list of all the values from the $_COOKIE array.

    -
      -
    • access: public
    • -
    - -
    - static void - - cookie - - () -
    - - - -
    - -
    - -
    - - static defines (line 197) -
    - - -

    Prints a list of all currently declared constants.

    -
      -
    • access: public
    • -
    - -
    - static void - - defines - - () -
    - - - -
    - -
    - -
    - - static disable (line 747) -
    - - -

    Disable Krumo

    -
      -
    • access: public
    • -
    - -
    - static boolean - - disable - - () -
    - - - -
    - -
    - -
    - - static dump (line 548) -
    - - -

    Dump information about a variable

    -
      -
    • access: public
    • -
    - -
    - static void - - dump - - ( $data, mixed $data,...) -
    - -
      -
    • - mixed - $data,...
    • -
    • - - $data
    • -
    - - -
    - -
    - -
    - - static enable (line 736) -
    - - -

    Enable Krumo

    -
      -
    • access: public
    • -
    - -
    - static boolean - - enable - - () -
    - - - -
    - -
    - -
    - - static env (line 465) -
    - - -

    Prints a list of all the values from the $_ENV array.

    -
      -
    • access: public
    • -
    - -
    - static void - - env - - () -
    - - - -
    - -
    - -
    - - static extensions (line 221) -
    - - -

    Prints a list of all currently loaded PHP extensions.

    -
      -
    • access: public
    • -
    - -
    - static void - - extensions - - () -
    - - - -
    - -
    - -
    - - static functions (line 173) -
    - - -

    Prints a list of all currently declared functions.

    -
      -
    • access: public
    • -
    - -
    - static void - - functions - - () -
    - - - -
    - -
    - -
    - - static get (line 369) -
    - - -

    Prints a list of all the values from the $_GET array.

    -
      -
    • access: public
    • -
    - -
    - static void - - get - - () -
    - - - -
    - -
    - -
    - - static headers (line 245) -
    - - -

    Prints a list of all HTTP request headers.

    -
      -
    • access: public
    • -
    - -
    - static void - - headers - - () -
    - - - -
    - -
    - -
    - - static includes (line 149) -
    - - -

    Prints a list of all currently included (or required) files.

    -
      -
    • access: public
    • -
    - -
    - static void - - includes - - () -
    - - - -
    - -
    - -
    - - static ini (line 515) -
    - - -

    Prints a list of all the values from an INI file.

    -
      -
    • access: public
    • -
    - -
    - static void - - ini - - (string $ini_file) -
    - -
      -
    • - string - $ini_file
    • -
    - - -
    - -
    - -
    - - static interfaces (line 125) -
    - - -

    Prints a list of all currently declared interfaces (PHP5 only).

    -
      -
    • access: public
    • -
    - -
    - static void - - interfaces - - () -
    - - - -
    - -
    - -
    - - static path (line 321) -
    - - -

    Prints a list of the specified directories under your include_path option.

    -
      -
    • access: public
    • -
    - -
    - static void - - path - - () -
    - - - -
    - -
    - -
    - - static phpini (line 269) -
    - - -

    Prints a list of the configuration settings read from php.ini

    -
      -
    • access: public
    • -
    - -
    - static void - - phpini - - () -
    - - - -
    - -
    - -
    - - static post (line 393) -
    - - -

    Prints a list of all the values from the $_POST array.

    -
      -
    • access: public
    • -
    - -
    - static void - - post - - () -
    - - - -
    - -
    - -
    - - static request (line 345) -
    - - -

    Prints a list of all the values from the $_REQUEST array.

    -
      -
    • access: public
    • -
    - -
    - static void - - request - - () -
    - - - -
    - -
    - -
    - - static server (line 417) -
    - - -

    Prints a list of all the values from the $_SERVER array.

    -
      -
    • access: public
    • -
    - -
    - static void - - server - - () -
    - - - -
    - -
    - -
    - - static session (line 489) -
    - - -

    Prints a list of all the values from the $_SESSION array.

    -
      -
    • access: public
    • -
    - -
    - static void - - session - - () -
    - - - -
    - -
    - -
    - - static version (line 70) -
    - - -

    Return Krumo version

    -
      -
    • access: public
    • -
    - -
    - static string - - version - - () -
    - - - -
    - -
    -
    - - -

    - Documentation generated on Sun, 02 Dec 2007 09:43:24 +0200 by phpDocumentor 1.4.0a2 -

    -
    - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/blank.html b/gulliver/thirdparty/krumo/docs/blank.html deleted file mode 100755 index 98c96360e..000000000 --- a/gulliver/thirdparty/krumo/docs/blank.html +++ /dev/null @@ -1,13 +0,0 @@ - - - Krumo - - - - -

    Krumo

    -Welcome to Krumo!
    -
    -This documentation was generated by phpDocumentor v1.4.0a2
    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/classtrees_Krumo.html b/gulliver/thirdparty/krumo/docs/classtrees_Krumo.html deleted file mode 100755 index 8123084b9..000000000 --- a/gulliver/thirdparty/krumo/docs/classtrees_Krumo.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - -

    - -

    -

    Root class krumo

    - - -

    - Documentation generated on Sun, 02 Dec 2007 09:43:24 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/elementindex.html b/gulliver/thirdparty/krumo/docs/elementindex.html deleted file mode 100755 index dd757db70..000000000 --- a/gulliver/thirdparty/krumo/docs/elementindex.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - - - -

    Full index

    -

    Package indexes

    - -
    -
    - b - c - d - e - f - g - h - i - k - p - r - s - v -
    - - -
    -
    b
    - -
    -
    -
    -
    - Method - backtrace -
    -
    -
    krumo::backtrace() in class.krumo.php
    -
    Prints a debug backtrace
    -
    -
    - -
    -
    c
    - -
    -
    -
    -
    - Method - classes -
    -
    -
    krumo::classes() in class.krumo.php
    -
    Prints a list of all currently declared classes.
    -
    -
    - Page - class.krumo.php -
    -
    -
    class.krumo.php in class.krumo.php
    -
    -
    - Method - conf -
    -
    -
    krumo::conf() in class.krumo.php
    -
    Prints a list of all your configuration settings.
    -
    -
    - Method - cookie -
    -
    -
    krumo::cookie() in class.krumo.php
    -
    Prints a list of all the values from the $_COOKIE array.
    -
    -
    - -
    -
    d
    - -
    -
    -
    -
    - Method - defines -
    -
    -
    krumo::defines() in class.krumo.php
    -
    Prints a list of all currently declared constants.
    -
    -
    - Constant - DIR_SEP -
    -
    -
    DIR_SEP in class.krumo.php
    -
    backward compatibility: the DIR_SEP constant isn't used anymore
    -
    -
    - Method - disable -
    -
    -
    krumo::disable() in class.krumo.php
    -
    Disable Krumo
    -
    -
    - Method - dump -
    -
    -
    krumo::dump() in class.krumo.php
    -
    Dump information about a variable
    -
    -
    - -
    -
    e
    - -
    -
    -
    -
    - Method - enable -
    -
    -
    krumo::enable() in class.krumo.php
    -
    Enable Krumo
    -
    -
    - Method - env -
    -
    -
    krumo::env() in class.krumo.php
    -
    Prints a list of all the values from the $_ENV array.
    -
    -
    - Method - extensions -
    -
    -
    krumo::extensions() in class.krumo.php
    -
    Prints a list of all currently loaded PHP extensions.
    -
    -
    - -
    -
    f
    - -
    -
    -
    -
    - Method - functions -
    -
    -
    krumo::functions() in class.krumo.php
    -
    Prints a list of all currently declared functions.
    -
    -
    - -
    -
    g
    - -
    -
    -
    -
    - Method - get -
    -
    -
    krumo::get() in class.krumo.php
    -
    Prints a list of all the values from the $_GET array.
    -
    -
    - -
    -
    h
    - -
    -
    -
    -
    - Method - headers -
    -
    -
    krumo::headers() in class.krumo.php
    -
    Prints a list of all HTTP request headers.
    -
    -
    - -
    -
    i
    - -
    -
    -
    -
    - Method - includes -
    -
    -
    krumo::includes() in class.krumo.php
    -
    Prints a list of all currently included (or required) files.
    -
    -
    - Method - ini -
    -
    -
    krumo::ini() in class.krumo.php
    -
    Prints a list of all the values from an INI file.
    -
    -
    - Method - interfaces -
    -
    -
    krumo::interfaces() in class.krumo.php
    -
    Prints a list of all currently declared interfaces (PHP5 only).
    -
    -
    - -
    -
    k
    - -
    -
    -
    -
    - Function - krumo -
    -
    -
    krumo() in class.krumo.php
    -
    Alias of krumo::dump()
    -
    -
    - Class - krumo -
    -
    -
    krumo in class.krumo.php
    -
    Krumo API
    -
    -
    - Constant - KRUMO_DIR -
    -
    -
    KRUMO_DIR in class.krumo.php
    -
    Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is not defined, include_path will be used. Set KRUMO_DIR only if any other module or application has not already set it up.
    -
    -
    - Constant - KRUMO_TRUNCATE_LENGTH -
    -
    -
    KRUMO_TRUNCATE_LENGTH in class.krumo.php
    -
    This constant sets the maximum strings of strings that will be shown as they are. Longer strings will be truncated with this length, and their `full form` will be shown in a child node.
    -
    -
    - -
    -
    p
    - -
    -
    -
    -
    - Method - path -
    -
    -
    krumo::path() in class.krumo.php
    -
    Prints a list of the specified directories under your include_path option.
    -
    -
    - Constant - PATH_SEPARATOR -
    -
    -
    PATH_SEPARATOR in class.krumo.php
    -
    backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2
    -
    -
    - Method - phpini -
    -
    -
    krumo::phpini() in class.krumo.php
    -
    Prints a list of the configuration settings read from php.ini
    -
    -
    - Method - post -
    -
    -
    krumo::post() in class.krumo.php
    -
    Prints a list of all the values from the $_POST array.
    -
    -
    - -
    -
    r
    - -
    -
    -
    -
    - Method - request -
    -
    -
    krumo::request() in class.krumo.php
    -
    Prints a list of all the values from the $_REQUEST array.
    -
    -
    - -
    -
    s
    - -
    -
    -
    -
    - Method - server -
    -
    -
    krumo::server() in class.krumo.php
    -
    Prints a list of all the values from the $_SERVER array.
    -
    -
    - Method - session -
    -
    -
    krumo::session() in class.krumo.php
    -
    Prints a list of all the values from the $_SESSION array.
    -
    -
    - -
    -
    v
    - -
    -
    -
    -
    - Method - version -
    -
    -
    krumo::version() in class.krumo.php
    -
    Return Krumo version
    -
    -
    - -
    - b - c - d - e - f - g - h - i - k - p - r - s - v -
    - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/elementindex_Krumo.html b/gulliver/thirdparty/krumo/docs/elementindex_Krumo.html deleted file mode 100755 index 529c1801a..000000000 --- a/gulliver/thirdparty/krumo/docs/elementindex_Krumo.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - - - - - -

    [Krumo] element index

    -All elements -
    -
    - b - c - d - e - f - g - h - i - k - p - r - s - v -
    - - -
    -
    b
    - -
    -
    -
    -
    - Method - backtrace -
    -
    -
    krumo::backtrace() in class.krumo.php
    -
    Prints a debug backtrace
    -
    -
    - -
    -
    c
    - -
    -
    -
    -
    - Method - classes -
    -
    -
    krumo::classes() in class.krumo.php
    -
    Prints a list of all currently declared classes.
    -
    -
    - Page - class.krumo.php -
    -
    -
    class.krumo.php in class.krumo.php
    -
    -
    - Method - conf -
    -
    -
    krumo::conf() in class.krumo.php
    -
    Prints a list of all your configuration settings.
    -
    -
    - Method - cookie -
    -
    -
    krumo::cookie() in class.krumo.php
    -
    Prints a list of all the values from the $_COOKIE array.
    -
    -
    - -
    -
    d
    - -
    -
    -
    -
    - Method - defines -
    -
    -
    krumo::defines() in class.krumo.php
    -
    Prints a list of all currently declared constants.
    -
    -
    - Constant - DIR_SEP -
    -
    -
    DIR_SEP in class.krumo.php
    -
    backward compatibility: the DIR_SEP constant isn't used anymore
    -
    -
    - Method - disable -
    -
    -
    krumo::disable() in class.krumo.php
    -
    Disable Krumo
    -
    -
    - Method - dump -
    -
    -
    krumo::dump() in class.krumo.php
    -
    Dump information about a variable
    -
    -
    - -
    -
    e
    - -
    -
    -
    -
    - Method - enable -
    -
    -
    krumo::enable() in class.krumo.php
    -
    Enable Krumo
    -
    -
    - Method - env -
    -
    -
    krumo::env() in class.krumo.php
    -
    Prints a list of all the values from the $_ENV array.
    -
    -
    - Method - extensions -
    -
    -
    krumo::extensions() in class.krumo.php
    -
    Prints a list of all currently loaded PHP extensions.
    -
    -
    - -
    -
    f
    - -
    -
    -
    -
    - Method - functions -
    -
    -
    krumo::functions() in class.krumo.php
    -
    Prints a list of all currently declared functions.
    -
    -
    - -
    -
    g
    - -
    -
    -
    -
    - Method - get -
    -
    -
    krumo::get() in class.krumo.php
    -
    Prints a list of all the values from the $_GET array.
    -
    -
    - -
    -
    h
    - -
    -
    -
    -
    - Method - headers -
    -
    -
    krumo::headers() in class.krumo.php
    -
    Prints a list of all HTTP request headers.
    -
    -
    - -
    -
    i
    - -
    -
    -
    -
    - Method - includes -
    -
    -
    krumo::includes() in class.krumo.php
    -
    Prints a list of all currently included (or required) files.
    -
    -
    - Method - ini -
    -
    -
    krumo::ini() in class.krumo.php
    -
    Prints a list of all the values from an INI file.
    -
    -
    - Method - interfaces -
    -
    -
    krumo::interfaces() in class.krumo.php
    -
    Prints a list of all currently declared interfaces (PHP5 only).
    -
    -
    - -
    -
    k
    - -
    -
    -
    -
    - Function - krumo -
    -
    -
    krumo() in class.krumo.php
    -
    Alias of krumo::dump()
    -
    -
    - Class - krumo -
    -
    -
    krumo in class.krumo.php
    -
    Krumo API
    -
    -
    - Constant - KRUMO_DIR -
    -
    -
    KRUMO_DIR in class.krumo.php
    -
    Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is not defined, include_path will be used. Set KRUMO_DIR only if any other module or application has not already set it up.
    -
    -
    - Constant - KRUMO_TRUNCATE_LENGTH -
    -
    -
    KRUMO_TRUNCATE_LENGTH in class.krumo.php
    -
    This constant sets the maximum strings of strings that will be shown as they are. Longer strings will be truncated with this length, and their `full form` will be shown in a child node.
    -
    -
    - -
    -
    p
    - -
    -
    -
    -
    - Method - path -
    -
    -
    krumo::path() in class.krumo.php
    -
    Prints a list of the specified directories under your include_path option.
    -
    -
    - Constant - PATH_SEPARATOR -
    -
    -
    PATH_SEPARATOR in class.krumo.php
    -
    backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2
    -
    -
    - Method - phpini -
    -
    -
    krumo::phpini() in class.krumo.php
    -
    Prints a list of the configuration settings read from php.ini
    -
    -
    - Method - post -
    -
    -
    krumo::post() in class.krumo.php
    -
    Prints a list of all the values from the $_POST array.
    -
    -
    - -
    -
    r
    - -
    -
    -
    -
    - Method - request -
    -
    -
    krumo::request() in class.krumo.php
    -
    Prints a list of all the values from the $_REQUEST array.
    -
    -
    - -
    -
    s
    - -
    -
    -
    -
    - Method - server -
    -
    -
    krumo::server() in class.krumo.php
    -
    Prints a list of all the values from the $_SERVER array.
    -
    -
    - Method - session -
    -
    -
    krumo::session() in class.krumo.php
    -
    Prints a list of all the values from the $_SESSION array.
    -
    -
    - -
    -
    v
    - -
    -
    -
    -
    - Method - version -
    -
    -
    krumo::version() in class.krumo.php
    -
    Return Krumo version
    -
    -
    - -
    - b - c - d - e - f - g - h - i - k - p - r - s - v -
    - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/errors.html b/gulliver/thirdparty/krumo/docs/errors.html deleted file mode 100755 index cf21fd427..000000000 --- a/gulliver/thirdparty/krumo/docs/errors.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - phpDocumentor Parser Errors and Warnings - - - - Post-parsing
    -

    - Documentation generated on Sun, 02 Dec 2007 09:43:25 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/index.html b/gulliver/thirdparty/krumo/docs/index.html deleted file mode 100755 index 6787e62f0..000000000 --- a/gulliver/thirdparty/krumo/docs/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Krumo - - - - - - - - - - - <H2>Frame Alert</H2> - <P>This document is designed to be viewed using the frames feature. - If you see this message, you are using a non-frame-capable web client.</P> - - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/li_Krumo.html b/gulliver/thirdparty/krumo/docs/li_Krumo.html deleted file mode 100755 index f353e8db6..000000000 --- a/gulliver/thirdparty/krumo/docs/li_Krumo.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - -

    Krumo

    -
    - -
    -

    - Generated by - phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/media/banner.css b/gulliver/thirdparty/krumo/docs/media/banner.css deleted file mode 100755 index 1b7fa8a24..000000000 --- a/gulliver/thirdparty/krumo/docs/media/banner.css +++ /dev/null @@ -1,32 +0,0 @@ -body -{ - background-color: #EEEEEE; - margin: 0px; - padding: 0px; -} - -/* Banner (top bar) classes */ - -.banner { } - -.banner-menu -{ - clear: both; - padding: .5em; - border-top: 2px solid #AAAAAA; -} - -.banner-title -{ - text-align: right; - font-size: 20pt; - font-weight: bold; - margin: .2em; -} - -.package-selector -{ - background-color: #DDDDDD; - border: 1px solid #AAAAAA; - color: #000090; -} diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractClass.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractClass.png deleted file mode 100755 index afa9d1d92..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractClass.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractClass_logo.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractClass_logo.png deleted file mode 100755 index 8f65c390e..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractClass_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractMethod.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractMethod.png deleted file mode 100755 index 605ccbe58..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractMethod.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass.png deleted file mode 100755 index 53d76c636..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass_logo.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass_logo.png deleted file mode 100755 index 4e68f570d..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateClass_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateMethod.png b/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateMethod.png deleted file mode 100755 index 41cc9f021..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/AbstractPrivateMethod.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Class.png b/gulliver/thirdparty/krumo/docs/media/images/Class.png deleted file mode 100755 index cf548d274..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Class.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Class_logo.png b/gulliver/thirdparty/krumo/docs/media/images/Class_logo.png deleted file mode 100755 index 6f223c479..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Class_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Constant.png b/gulliver/thirdparty/krumo/docs/media/images/Constant.png deleted file mode 100755 index a9c6f28b3..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Constant.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Constructor.png b/gulliver/thirdparty/krumo/docs/media/images/Constructor.png deleted file mode 100755 index 3f16222b4..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Constructor.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Destructor.png b/gulliver/thirdparty/krumo/docs/media/images/Destructor.png deleted file mode 100755 index f28528f08..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Destructor.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Function.png b/gulliver/thirdparty/krumo/docs/media/images/Function.png deleted file mode 100755 index 902fe2580..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Function.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Global.png b/gulliver/thirdparty/krumo/docs/media/images/Global.png deleted file mode 100755 index 7281bd2aa..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Global.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/I.png b/gulliver/thirdparty/krumo/docs/media/images/I.png deleted file mode 100755 index e8512fb91..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/I.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Index.png b/gulliver/thirdparty/krumo/docs/media/images/Index.png deleted file mode 100755 index 6558ec393..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Index.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Interface.PNG b/gulliver/thirdparty/krumo/docs/media/images/Interface.PNG deleted file mode 100755 index e6cd51edf..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Interface.PNG and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Interface_logo.png b/gulliver/thirdparty/krumo/docs/media/images/Interface_logo.png deleted file mode 100755 index 6f223c479..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Interface_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/L.png b/gulliver/thirdparty/krumo/docs/media/images/L.png deleted file mode 100755 index eb334edae..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/L.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Lminus.png b/gulliver/thirdparty/krumo/docs/media/images/Lminus.png deleted file mode 100755 index f7c43c0aa..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Lminus.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Lplus.png b/gulliver/thirdparty/krumo/docs/media/images/Lplus.png deleted file mode 100755 index 848ec2fc3..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Lplus.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Method.png b/gulliver/thirdparty/krumo/docs/media/images/Method.png deleted file mode 100755 index 9b2157845..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Method.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Page.png b/gulliver/thirdparty/krumo/docs/media/images/Page.png deleted file mode 100755 index ffe7986ee..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Page.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Page_logo.png b/gulliver/thirdparty/krumo/docs/media/images/Page_logo.png deleted file mode 100755 index 44ce0b3c6..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Page_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/PrivateClass.png b/gulliver/thirdparty/krumo/docs/media/images/PrivateClass.png deleted file mode 100755 index 470e6d568..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/PrivateClass.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/PrivateClass_logo.png b/gulliver/thirdparty/krumo/docs/media/images/PrivateClass_logo.png deleted file mode 100755 index 590e00640..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/PrivateClass_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/PrivateMethod.png b/gulliver/thirdparty/krumo/docs/media/images/PrivateMethod.png deleted file mode 100755 index d01f2b314..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/PrivateMethod.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/PrivateVariable.png b/gulliver/thirdparty/krumo/docs/media/images/PrivateVariable.png deleted file mode 100755 index d76b21d4e..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/PrivateVariable.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/StaticMethod.png b/gulliver/thirdparty/krumo/docs/media/images/StaticMethod.png deleted file mode 100755 index 9b2157845..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/StaticMethod.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/StaticVariable.png b/gulliver/thirdparty/krumo/docs/media/images/StaticVariable.png deleted file mode 100755 index 8e820193c..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/StaticVariable.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/T.png b/gulliver/thirdparty/krumo/docs/media/images/T.png deleted file mode 100755 index 301732540..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/T.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Tminus.png b/gulliver/thirdparty/krumo/docs/media/images/Tminus.png deleted file mode 100755 index 2260e4248..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Tminus.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Tplus.png b/gulliver/thirdparty/krumo/docs/media/images/Tplus.png deleted file mode 100755 index 2c8d8f4fd..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Tplus.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/Variable.png b/gulliver/thirdparty/krumo/docs/media/images/Variable.png deleted file mode 100755 index 8e820193c..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/Variable.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/blank.png b/gulliver/thirdparty/krumo/docs/media/images/blank.png deleted file mode 100755 index cee9cd37a..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/blank.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/class_folder.png b/gulliver/thirdparty/krumo/docs/media/images/class_folder.png deleted file mode 100755 index 84e9587af..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/class_folder.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/empty.png b/gulliver/thirdparty/krumo/docs/media/images/empty.png deleted file mode 100755 index d56838651..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/empty.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/file.png b/gulliver/thirdparty/krumo/docs/media/images/file.png deleted file mode 100755 index 0bb2427f8..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/file.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/folder.png b/gulliver/thirdparty/krumo/docs/media/images/folder.png deleted file mode 100755 index a2d79f8de..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/folder.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/function_folder.png b/gulliver/thirdparty/krumo/docs/media/images/function_folder.png deleted file mode 100755 index 8b3d6e3b1..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/function_folder.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/minus.gif b/gulliver/thirdparty/krumo/docs/media/images/minus.gif deleted file mode 100755 index f502662bc..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/minus.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/next_button.png b/gulliver/thirdparty/krumo/docs/media/images/next_button.png deleted file mode 100755 index cdbc615d9..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/next_button.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/next_button_disabled.png b/gulliver/thirdparty/krumo/docs/media/images/next_button_disabled.png deleted file mode 100755 index 4a11780fc..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/next_button_disabled.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/package.png b/gulliver/thirdparty/krumo/docs/media/images/package.png deleted file mode 100755 index b04cf566d..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/package.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/package_folder.png b/gulliver/thirdparty/krumo/docs/media/images/package_folder.png deleted file mode 100755 index 6162bafd9..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/package_folder.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/plus.gif b/gulliver/thirdparty/krumo/docs/media/images/plus.gif deleted file mode 100755 index eeca02ce0..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/plus.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/previous_button.png b/gulliver/thirdparty/krumo/docs/media/images/previous_button.png deleted file mode 100755 index 327fdbc23..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/previous_button.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/previous_button_disabled.png b/gulliver/thirdparty/krumo/docs/media/images/previous_button_disabled.png deleted file mode 100755 index c02ff64bf..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/previous_button_disabled.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/private_class_logo.png b/gulliver/thirdparty/krumo/docs/media/images/private_class_logo.png deleted file mode 100755 index 590e00640..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/private_class_logo.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/tutorial.png b/gulliver/thirdparty/krumo/docs/media/images/tutorial.png deleted file mode 100755 index bc1973752..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/tutorial.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/tutorial_folder.png b/gulliver/thirdparty/krumo/docs/media/images/tutorial_folder.png deleted file mode 100755 index 2a468b2a0..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/tutorial_folder.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/images/up_button.png b/gulliver/thirdparty/krumo/docs/media/images/up_button.png deleted file mode 100755 index ff36c5935..000000000 Binary files a/gulliver/thirdparty/krumo/docs/media/images/up_button.png and /dev/null differ diff --git a/gulliver/thirdparty/krumo/docs/media/lib/classTree.js b/gulliver/thirdparty/krumo/docs/media/lib/classTree.js deleted file mode 100755 index 5989426f0..000000000 --- a/gulliver/thirdparty/krumo/docs/media/lib/classTree.js +++ /dev/null @@ -1,454 +0,0 @@ -/*----------------------------------------\ -| Cross Browser Tree Widget 1.1 | -|-----------------------------------------| -| Created by Emil A. Eklund (eae@eae.net) | -| For WebFX (http://webfx.eae.net/) | -|-----------------------------------------| -| This script is provided as is without | -| any warranty whatsoever. It may be used | -| free of charge for non commerical sites | -| For commerical use contact the author | -| of this script for further details. | -|-----------------------------------------| -| Created 2000-12-11 | Updated 2001-09-06 | -\----------------------------------------*/ - -var webFXTreeConfig = { - rootIcon : 'media/images/empty.png', - openRootIcon : 'media/images/empty.png', - folderIcon : 'media/images/empty.png', - openFolderIcon : 'media/images/empty.png', - fileIcon : 'media/images/empty.png', - iIcon : 'media/images/I.png', - lIcon : 'media/images/L.png', - lMinusIcon : 'media/images/Lminus.png', - lPlusIcon : 'media/images/Lplus.png', - tIcon : 'media/images/T.png', - tMinusIcon : 'media/images/Tminus.png', - tPlusIcon : 'media/images/Tplus.png', - blankIcon : 'media/images/blank.png', - defaultText : 'Tree Item', - defaultAction : 'javascript:void(0);', - defaultTarget : 'right', - defaultBehavior : 'classic' -}; - -var webFXTreeHandler = { - idCounter : 0, - idPrefix : "webfx-tree-object-", - all : {}, - behavior : null, - selected : null, - getId : function() { return this.idPrefix + this.idCounter++; }, - toggle : function (oItem) { this.all[oItem.id.replace('-plus','')].toggle(); }, - select : function (oItem) { this.all[oItem.id.replace('-icon','')].select(); }, - focus : function (oItem) { this.all[oItem.id.replace('-anchor','')].focus(); }, - blur : function (oItem) { this.all[oItem.id.replace('-anchor','')].blur(); }, - keydown : function (oItem) { return this.all[oItem.id].keydown(window.event.keyCode); }, - cookies : new WebFXCookie() -}; - -/* - * WebFXCookie class - */ - -function WebFXCookie() { - if (document.cookie.length) { this.cookies = ' ' + document.cookie; } -} - -WebFXCookie.prototype.setCookie = function (key, value) { - document.cookie = key + "=" + escape(value); -} - -WebFXCookie.prototype.getCookie = function (key) { - if (this.cookies) { - var start = this.cookies.indexOf(' ' + key + '='); - if (start == -1) { return null; } - var end = this.cookies.indexOf(";", start); - if (end == -1) { end = this.cookies.length; } - end -= start; - var cookie = this.cookies.substr(start,end); - return unescape(cookie.substr(cookie.indexOf('=') + 1, cookie.length - cookie.indexOf('=') + 1)); - } - else { return null; } -} - -/* - * WebFXTreeAbstractNode class - */ - -function WebFXTreeAbstractNode(sText, sAction, sTarget) { - this.childNodes = []; - this.id = webFXTreeHandler.getId(); - this.text = sText || webFXTreeConfig.defaultText; - this.action = sAction || webFXTreeConfig.defaultAction; - this.targetWindow = sTarget || webFXTreeConfig.defaultTarget; - this._last = false; - webFXTreeHandler.all[this.id] = this; -} - -WebFXTreeAbstractNode.prototype.add = function (node) { - node.parentNode = this; - this.childNodes[this.childNodes.length] = node; - var root = this; - if (this.childNodes.length >=2) { - this.childNodes[this.childNodes.length -2]._last = false; - } - while (root.parentNode) { root = root.parentNode; } - if (root.rendered) { - if (this.childNodes.length >= 2) { - document.getElementById(this.childNodes[this.childNodes.length -2].id + '-plus').src = ((this.childNodes[this.childNodes.length -2].folder)?webFXTreeConfig.tMinusIcon:webFXTreeConfig.tIcon); - if (this.childNodes[this.childNodes.length -2].folder) { - this.childNodes[this.childNodes.length -2].plusIcon = webFXTreeConfig.tPlusIcon; - this.childNodes[this.childNodes.length -2].minusIcon = webFXTreeConfig.tMinusIcon; - } - this.childNodes[this.childNodes.length -2]._last = false; - } - this._last = true; - var foo = this; - while (foo.parentNode) { - for (var i = 0; i < foo.parentNode.childNodes.length; i++) { - if (foo.id == foo.parentNode.childNodes[i].id) { break; } - } - if (++i == foo.parentNode.childNodes.length) { foo.parentNode._last = true; } - else { foo.parentNode._last = false; } - foo = foo.parentNode; - } - document.getElementById(this.id + '-cont').insertAdjacentHTML("beforeEnd", node.toString()); - if ((!this.folder) && (!this.openIcon)) { - this.icon = webFXTreeConfig.folderIcon; - this.openIcon = webFXTreeConfig.openFolderIcon; - } - this.folder = true; - this.indent(); - this.expand(); - } - return node; -} - -WebFXTreeAbstractNode.prototype.toggle = function() { - if (this.folder) { - if (this.open) { this.collapse(); } - else { this.expand(); } - } -} - -WebFXTreeAbstractNode.prototype.select = function() { - document.getElementById(this.id + '-anchor').focus(); -} - -WebFXTreeAbstractNode.prototype.focus = function() { - webFXTreeHandler.selected = this; - if ((this.openIcon) && (webFXTreeHandler.behavior != 'classic')) { document.getElementById(this.id + '-icon').src = this.openIcon; } - document.getElementById(this.id + '-anchor').style.backgroundColor = 'highlight'; - document.getElementById(this.id + '-anchor').style.color = 'highlighttext'; - document.getElementById(this.id + '-anchor').focus(); -} - -WebFXTreeAbstractNode.prototype.blur = function() { - if ((this.openIcon) && (webFXTreeHandler.behavior != 'classic')) { document.getElementById(this.id + '-icon').src = this.icon; } - document.getElementById(this.id + '-anchor').style.backgroundColor = 'transparent'; - document.getElementById(this.id + '-anchor').style.color = 'menutext'; -} - -WebFXTreeAbstractNode.prototype.doExpand = function() { - if (webFXTreeHandler.behavior == 'classic') { document.getElementById(this.id + '-icon').src = this.openIcon; } - if (this.childNodes.length) { document.getElementById(this.id + '-cont').style.display = 'block'; } - this.open = true; - webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '1'); -} - -WebFXTreeAbstractNode.prototype.doCollapse = function() { - if (webFXTreeHandler.behavior == 'classic') { document.getElementById(this.id + '-icon').src = this.icon; } - if (this.childNodes.length) { document.getElementById(this.id + '-cont').style.display = 'none'; } - this.open = false; - webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '0'); -} - -WebFXTreeAbstractNode.prototype.expandAll = function() { - this.expandChildren(); - if ((this.folder) && (!this.open)) { this.expand(); } -} - -WebFXTreeAbstractNode.prototype.expandChildren = function() { - for (var i = 0; i < this.childNodes.length; i++) { - this.childNodes[i].expandAll(); -} } - -WebFXTreeAbstractNode.prototype.collapseAll = function() { - if ((this.folder) && (this.open)) { this.collapse(); } - this.collapseChildren(); -} - -WebFXTreeAbstractNode.prototype.collapseChildren = function() { - for (var i = 0; i < this.childNodes.length; i++) { - this.childNodes[i].collapseAll(); -} } - -WebFXTreeAbstractNode.prototype.indent = function(lvl, del, last, level) { - /* - * Since we only want to modify items one level below ourself, - * and since the rightmost indentation position is occupied by - * the plus icon we set this to -2 - */ - if (lvl == null) { lvl = -2; } - var state = 0; - for (var i = this.childNodes.length - 1; i >= 0 ; i--) { - state = this.childNodes[i].indent(lvl + 1, del, last, level); - if (state) { return; } - } - if (del) { - if (level >= this._level) { - if (this.folder) { - document.getElementById(this.id + '-plus').src = (this.open)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.lPlusIcon; - this.plusIcon = webFXTreeConfig.lPlusIcon; - this.minusIcon = webFXTreeConfig.lMinusIcon; - } - else { document.getElementById(this.id + '-plus').src = webFXTreeConfig.lIcon; } - return 1; - } - } - var foo = document.getElementById(this.id + '-indent-' + lvl); - if (foo) { - if ((del) && (last)) { foo._last = true; } - if (foo._last) { foo.src = webFXTreeConfig.blankIcon; } - else { foo.src = webFXTreeConfig.iIcon; } - } - return 0; -} - -/* - * WebFXTree class - */ - -function WebFXTree(sText, sAction, sBehavior, sIcon, sOpenIcon) { - this.base = WebFXTreeAbstractNode; - this.base(sText, sAction); - this.icon = sIcon || webFXTreeConfig.rootIcon; - this.openIcon = sOpenIcon || webFXTreeConfig.openRootIcon; - /* Defaults to open */ - this.open = (webFXTreeHandler.cookies.getCookie(this.id.substr(18,this.id.length - 18)) == '0')?false:true; - this.folder = true; - this.rendered = false; - if (!webFXTreeHandler.behavior) { webFXTreeHandler.behavior = sBehavior || webFXTreeConfig.defaultBehavior; } - this.targetWindow = 'right'; -} - -WebFXTree.prototype = new WebFXTreeAbstractNode; - -WebFXTree.prototype.setBehavior = function (sBehavior) { - webFXTreeHandler.behavior = sBehavior; -}; - -WebFXTree.prototype.getBehavior = function (sBehavior) { - return webFXTreeHandler.behavior; -}; - -WebFXTree.prototype.getSelected = function() { - if (webFXTreeHandler.selected) { return webFXTreeHandler.selected; } - else { return null; } -} - -WebFXTree.prototype.remove = function() { } - -WebFXTree.prototype.expand = function() { - this.doExpand(); -} - -WebFXTree.prototype.collapse = function() { - this.focus(); - this.doCollapse(); -} - -WebFXTree.prototype.getFirst = function() { - return null; -} - -WebFXTree.prototype.getLast = function() { - return null; -} - -WebFXTree.prototype.getNextSibling = function() { - return null; -} - -WebFXTree.prototype.getPreviousSibling = function() { - return null; -} - -WebFXTree.prototype.keydown = function(key) { - if (key == 39) { this.expand(); return false; } - if (key == 37) { this.collapse(); return false; } - if ((key == 40) && (this.open)) { this.childNodes[0].select(); return false; } - return true; -} - -WebFXTree.prototype.toString = function() { - var str = "
    "; - str += "" + this.text + "
    "; - str += "
    "; - for (var i = 0; i < this.childNodes.length; i++) { - str += this.childNodes[i].toString(i, this.childNodes.length); - } - str += "
    "; - this.rendered = true; - return str; -}; - -/* - * WebFXTreeItem class - */ - -function WebFXTreeItem(sText, sAction, eParent, sIcon, sOpenIcon) { - this.base = WebFXTreeAbstractNode; - this.base(sText, sAction); - /* Defaults to close */ - this.open = (webFXTreeHandler.cookies.getCookie(this.id.substr(18,this.id.length - 18)) == '1')?true:false; - if (eParent) { eParent.add(this); } - if (sIcon) { this.icon = sIcon; } - if (sOpenIcon) { this.openIcon = sOpenIcon; } -} - -WebFXTreeItem.prototype = new WebFXTreeAbstractNode; - -WebFXTreeItem.prototype.remove = function() { - var parentNode = this.parentNode; - var prevSibling = this.getPreviousSibling(true); - var nextSibling = this.getNextSibling(true); - var folder = this.parentNode.folder; - var last = ((nextSibling) && (nextSibling.parentNode) && (nextSibling.parentNode.id == parentNode.id))?false:true; - this.getPreviousSibling().focus(); - this._remove(); - if (parentNode.childNodes.length == 0) { - parentNode.folder = false; - parentNode.open = false; - } - if (last) { - if (parentNode.id == prevSibling.id) { - document.getElementById(parentNode.id + '-icon').src = webFXTreeConfig.fileIcon; - } - else { } - } - if ((!prevSibling.parentNode) || (prevSibling.parentNode != parentNode)) { - parentNode.indent(null, true, last, this._level); - } - if (document.getElementById(prevSibling.id + '-plus')) { - if (nextSibling) { - if ((parentNode == prevSibling) && (parentNode.getNextSibling)) { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.tIcon; } - else if (nextSibling.parentNode != prevSibling) { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.lIcon; } - } - else { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.lIcon; } - } -} - -WebFXTreeItem.prototype._remove = function() { - for (var i = this.childNodes.length - 1; i >= 0; i--) { - this.childNodes[i]._remove(); - } - for (var i = 0; i < this.parentNode.childNodes.length; i++) { - if (this.id == this.parentNode.childNodes[i].id) { - for (var j = i; j < this.parentNode.childNodes.length; j++) { - this.parentNode.childNodes[i] = this.parentNode.childNodes[i+1] - } - this.parentNode.childNodes.length = this.parentNode.childNodes.length - 1; - if (i + 1 == this.parentNode.childNodes.length) { this.parentNode._last = true; } - } - } - webFXTreeHandler.all[this.id] = null; - if (document.getElementById(this.id)) { - document.getElementById(this.id).innerHTML = ""; - document.getElementById(this.id).removeNode(); - } -} - -WebFXTreeItem.prototype.expand = function() { - this.doExpand(); - document.getElementById(this.id + '-plus').src = this.minusIcon; -} - -WebFXTreeItem.prototype.collapse = function() { - this.focus(); - this.doCollapse(); - document.getElementById(this.id + '-plus').src = this.plusIcon; -} - -WebFXTreeItem.prototype.getFirst = function() { - return this.childNodes[0]; -} - -WebFXTreeItem.prototype.getLast = function() { - if (this.childNodes[this.childNodes.length - 1].open) { return this.childNodes[this.childNodes.length - 1].getLast(); } - else { return this.childNodes[this.childNodes.length - 1]; } -} - -WebFXTreeItem.prototype.getNextSibling = function() { - for (var i = 0; i < this.parentNode.childNodes.length; i++) { - if (this == this.parentNode.childNodes[i]) { break; } - } - if (++i == this.parentNode.childNodes.length) { return this.parentNode.getNextSibling(); } - else { return this.parentNode.childNodes[i]; } -} - -WebFXTreeItem.prototype.getPreviousSibling = function(b) { - for (var i = 0; i < this.parentNode.childNodes.length; i++) { - if (this == this.parentNode.childNodes[i]) { break; } - } - if (i == 0) { return this.parentNode; } - else { - if ((this.parentNode.childNodes[--i].open) || (b && this.parentNode.childNodes[i].folder)) { return this.parentNode.childNodes[i].getLast(); } - else { return this.parentNode.childNodes[i]; } -} } - -WebFXTreeItem.prototype.keydown = function(key) { - if ((key == 39) && (this.folder)) { - if (!this.open) { this.expand(); return false; } - else { this.getFirst().select(); return false; } - } - else if (key == 37) { - if (this.open) { this.collapse(); return false; } - else { this.parentNode.select(); return false; } - } - else if (key == 40) { - if (this.open) { this.getFirst().select(); return false; } - else { - var sib = this.getNextSibling(); - if (sib) { sib.select(); return false; } - } } - else if (key == 38) { this.getPreviousSibling().select(); return false; } - return true; -} - -WebFXTreeItem.prototype.toString = function (nItem, nItemCount) { - var foo = this.parentNode; - var indent = ''; - if (nItem + 1 == nItemCount) { this.parentNode._last = true; } - var i = 0; - while (foo.parentNode) { - foo = foo.parentNode; - indent = "" + indent; - i++; - } - this._level = i; - if (this.childNodes.length) { this.folder = 1; } - else { this.open = false; } - if ((this.folder) || (webFXTreeHandler.behavior != 'classic')) { - if (!this.icon) { this.icon = webFXTreeConfig.folderIcon; } - if (!this.openIcon) { this.openIcon = webFXTreeConfig.openFolderIcon; } - } - else if (!this.icon) { this.icon = webFXTreeConfig.fileIcon; } - var label = this.text; - label = label.replace('<', '<'); - label = label.replace('>', '>'); - var str = "
    "; - str += indent; - str += "" - str += "" + label + "
    "; - str += "
    "; - for (var i = 0; i < this.childNodes.length; i++) { - str += this.childNodes[i].toString(i,this.childNodes.length); - } - str += "
    "; - this.plusIcon = ((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon); - this.minusIcon = ((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon); - return str; -} \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/media/stylesheet.css b/gulliver/thirdparty/krumo/docs/media/stylesheet.css deleted file mode 100755 index 498826ae1..000000000 --- a/gulliver/thirdparty/krumo/docs/media/stylesheet.css +++ /dev/null @@ -1,181 +0,0 @@ -a { color: #000090; text-decoration: none; } -a:hover, a:active, a:focus { color: highlighttext; background-color: highlight; text-decoration: none; } - -body { background : #FFFFFF; } -body, table { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; } - -a img { border: 0px; } - -/* Page layout/boxes */ - -.info-box { } -.info-box-title { margin: 1em 0em 0em 0em; font-weight: normal; font-size: 14pt; color: #999999; border-bottom: 2px solid #999999; } -.info-box-body { border: 1px solid #999999; padding: .5em; } -.nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; } - -.oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em} -.evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em} - -.page-body { max-width: 800px; margin: auto; } -.tree { } - -/* Index formatting classes */ - -.index-item-body { margin-top: .5em; margin-bottom: .5em} -.index-item-description { margin-top: .25em } -.index-item-details { font-weight: normal; font-style: italic; font-size: 8pt } -.index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em} -.index-letter-title { font-size: 12pt; font-weight: bold } -.index-letter-menu { text-align: center; margin: 1em } -.index-letter { font-size: 12pt } - -/* Docbook classes */ - -.description {} -.short-description { font-weight: bold; color: #666666; } -.tags { padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; } -.parameters { padding-left: 0em; margin-left: 3em; color: #014fbe; list-style-type: square; } -.redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; } -.package { font-weight: bold; } -.package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black } -.sub-package { font-weight: bold; } -.tutorial { border-width: thin; border-color: #0066ff; } -.tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; } - -/* Generic formatting */ - -.field { font-weight: bold; } -.detail { font-size: 8pt; } -.notes { font-style: italic; font-size: 8pt; } -.separator { background-color: #999999; height: 2px; } -.warning { color: #FF6600; } -.disabled { font-style: italic; color: #999999; } - -/* Code elements */ - -.line-number { } - -.class-table { width: 100%; } -.class-table-header { border-bottom: 1px dotted #666666; text-align: left} -.class-name { color: #0000AA; font-weight: bold; } - -.method-summary { color: #009000; padding-left: 1em; font-size: 8pt; } -.method-header { } -.method-definition { margin-bottom: .2em } -.method-title { color: #009000; font-weight: bold; } -.method-name { font-weight: bold; } -.method-signature { font-size: 85%; color: #666666; margin: .5em 0em } -.method-result { font-style: italic; } - -.var-summary { padding-left: 1em; font-size: 8pt; } -.var-header { } -.var-title { color: #014fbe; margin-bottom: .3em } -.var-type { font-style: italic; } -.var-name { font-weight: bold; } -.var-default {} -.var-description { font-weight: normal; color: #000000; } - -.include-title { color: #014fbe;} -.include-type { font-style: italic; } -.include-name { font-weight: bold; } - -.const-title { color: #FF6600; } -.const-name { font-weight: bold; } - -/* Syntax highlighting */ - -.src-code { font-family: 'Courier New', Courier, monospace; font-weight: normal; } -.src-line { font-family: 'Courier New', Courier, monospace; font-weight: normal; } - -.src-code a:link { padding: 1px; text-decoration: underline; color: #0000DD; } -.src-code a:visited { text-decoration: underline; color: #0000DD; } -.src-code a:active { background-color: #FFFF66; color: #008000; } -.src-code a:hover { background-color: #FFFF66; text-decoration: overline underline; color: #008000; } - -.src-comm { color: #666666; } -.src-id { color: #FF6600; font-style: italic; } -.src-inc { color: #0000AA; font-weight: bold; } -.src-key { color: #0000AA; font-weight: bold; } -.src-num { color: #CC0000; } -.src-str { color: #CC0000; } -.src-sym { } -.src-var { } - -.src-php { font-weight: bold; } - -.src-doc { color: #666666; } -.src-doc-close-template { color: #666666 } -.src-doc-coretag { color: #008000; } -.src-doc-inlinetag {} -.src-doc-internal {} -.src-doc-tag { color: #0080CC; } -.src-doc-template { color: #666666 } -.src-doc-type { font-style: italic; color: #444444 } -.src-doc-var { color: #444444 } - -.tute-tag { color: #009999 } -.tute-attribute-name { color: #0000FF } -.tute-attribute-value { color: #0099FF } -.tute-entity { font-weight: bold; } -.tute-comment { font-style: italic } -.tute-inline-tag { color: #636311; font-weight: bold } - -/* tutorial */ - -.authors { } -.author { font-style: italic; font-weight: bold } -.author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal } -.example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; } -.listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap; } -.release-info { font-size: 85%; font-style: italic; margin: 1em 0em } -.ref-title-box { } -.ref-title { } -.ref-purpose { font-style: italic; color: #666666 } -.ref-synopsis { } -.title { font-weight: bold; border-bottom: 1px solid #999999; color: #999999; } -.cmd-synopsis { margin: 1em 0em } -.cmd-title { font-weight: bold } -.toc { margin-left: 2em; padding-left: 0em } - -/*------------------------------------------------------------------------------ - webfx-tree -------------------------------------------------------------------------------*/ - -.webfx-tree-container { - margin: 0px; - padding: 0px; - white-space: nowrap; - font: icon; -} - -.webfx-tree-item { - padding: 0px; - margin: 0px; - color: black; - white-space: nowrap; - font: icon; -} - -.webfx-tree-item a { - margin-left: 3px; - padding: 1px 2px 1px 2px; - color: black; - text-decoration: none; -} - -.webfx-tree-item a:hover, .webfx-tree-item a:active { - color: highlighttext; - background: highlight; - text-decoration: none -} - -.webfx-tree-item img { - vertical-align: middle; - border: 0px; -} - -.webfx-tree-icon { - width: 16px; - height: 16px; -} - diff --git a/gulliver/thirdparty/krumo/docs/packages.html b/gulliver/thirdparty/krumo/docs/packages.html deleted file mode 100755 index a4852e3d0..000000000 --- a/gulliver/thirdparty/krumo/docs/packages.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/ric_INSTALL.html b/gulliver/thirdparty/krumo/docs/ric_INSTALL.html deleted file mode 100755 index 8851703f1..000000000 --- a/gulliver/thirdparty/krumo/docs/ric_INSTALL.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - -

    INSTALL

    -
    -------------------------------------------------------------------------------
    -
    -                     SETUP: How to install Krumo ?
    -
    -------------------------------------------------------------------------------
    -
    -In order to use Krumo you have to put it on your (development) server, and 
    -include it in your script. You can put it somewhere in the INCLUDE_PATH, or 
    -specify the full path to the "class.krumo.php" file.
    -
    -You have to modify the "krumo.ini" file too. It is the configuration file for 
    -Krumo. The first option is choosing a skin:
    -
    - [skin]
    - selected = "orange"
    -
    -The value for this setting has to be the name of one of the sub-folders from the 
    -"Krumo/skins/" folder. If the value provided for the skin results in not finding 
    -the skin, the `default` skin will be used instead.
    -
    -The second option is used to set the correct web path to the folder where Krumo 
    -is installed. This is used in order to make the images from Krumo's CSS skins 
    -web-accessible.
    -
    - [css]
    - url = "http://www.example.com/Krumo/"
    -
    -So far those two are the only configuration options.
    -
    -All the CSS files ("skin.css") from the "Krumo/skins/" sub-folders must have the 
    -proper permissions in order to be readable from Krumo. Same applies for 
    -"krumo.ini" and "krumo.js" files.
    -
    -

    - Documentation generated on Sun, 02 Dec 2007 09:43:22 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/ric_LICENSE.html b/gulliver/thirdparty/krumo/docs/ric_LICENSE.html deleted file mode 100755 index aa2cad1e9..000000000 --- a/gulliver/thirdparty/krumo/docs/ric_LICENSE.html +++ /dev/null @@ -1,522 +0,0 @@ - - - - - - - - - -

    LICENSE

    -
    -		  GNU LESSER GENERAL PUBLIC LICENSE
    -		       Version 2.1, February 1999
    -
    - Copyright (C) 1991, 1999 Free Software Foundation, Inc.
    -     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    - Everyone is permitted to copy and distribute verbatim copies
    - of this license document, but changing it is not allowed.
    -
    -[This is the first released version of the Lesser GPL.  It also counts
    - as the successor of the GNU Library Public License, version 2, hence
    - the version number 2.1.]
    -
    -			    Preamble
    -
    -  The licenses for most software are designed to take away your
    -freedom to share and change it.  By contrast, the GNU General Public
    -Licenses are intended to guarantee your freedom to share and change
    -free software--to make sure the software is free for all its users.
    -
    -  This license, the Lesser General Public License, applies to some
    -specially designated software packages--typically libraries--of the
    -Free Software Foundation and other authors who decide to use it.  You
    -can use it too, but we suggest you first think carefully about whether
    -this license or the ordinary General Public License is the better
    -strategy to use in any particular case, based on the explanations below.
    -
    -  When we speak of free software, we are referring to freedom of use,
    -not price.  Our General Public Licenses are designed to make sure that
    -you have the freedom to distribute copies of free software (and charge
    -for this service if you wish); that you receive source code or can get
    -it if you want it; that you can change the software and use pieces of
    -it in new free programs; and that you are informed that you can do
    -these things.
    -
    -  To protect your rights, we need to make restrictions that forbid
    -distributors to deny you these rights or to ask you to surrender these
    -rights.  These restrictions translate to certain responsibilities for
    -you if you distribute copies of the library or if you modify it.
    -
    -  For example, if you distribute copies of the library, whether gratis
    -or for a fee, you must give the recipients all the rights that we gave
    -you.  You must make sure that they, too, receive or can get the source
    -code.  If you link other code with the library, you must provide
    -complete object files to the recipients, so that they can relink them
    -with the library after making changes to the library and recompiling
    -it.  And you must show them these terms so they know their rights.
    -
    -  We protect your rights with a two-step method: (1) we copyright the
    -library, and (2) we offer you this license, which gives you legal
    -permission to copy, distribute and/or modify the library.
    -
    -  To protect each distributor, we want to make it very clear that
    -there is no warranty for the free library.  Also, if the library is
    -modified by someone else and passed on, the recipients should know
    -that what they have is not the original version, so that the original
    -author's reputation will not be affected by problems that might be
    -introduced by others.
    -
    -  Finally, software patents pose a constant threat to the existence of
    -any free program.  We wish to make sure that a company cannot
    -effectively restrict the users of a free program by obtaining a
    -restrictive license from a patent holder.  Therefore, we insist that
    -any patent license obtained for a version of the library must be
    -consistent with the full freedom of use specified in this license.
    -
    -  Most GNU software, including some libraries, is covered by the
    -ordinary GNU General Public License.  This license, the GNU Lesser
    -General Public License, applies to certain designated libraries, and
    -is quite different from the ordinary General Public License.  We use
    -this license for certain libraries in order to permit linking those
    -libraries into non-free programs.
    -
    -  When a program is linked with a library, whether statically or using
    -a shared library, the combination of the two is legally speaking a
    -combined work, a derivative of the original library.  The ordinary
    -General Public License therefore permits such linking only if the
    -entire combination fits its criteria of freedom.  The Lesser General
    -Public License permits more lax criteria for linking other code with
    -the library.
    -
    -  We call this license the "Lesser" General Public License because it
    -does Less to protect the user's freedom than the ordinary General
    -Public License.  It also provides other free software developers Less
    -of an advantage over competing non-free programs.  These disadvantages
    -are the reason we use the ordinary General Public License for many
    -libraries.  However, the Lesser license provides advantages in certain
    -special circumstances.
    -
    -  For example, on rare occasions, there may be a special need to
    -encourage the widest possible use of a certain library, so that it becomes
    -a de-facto standard.  To achieve this, non-free programs must be
    -allowed to use the library.  A more frequent case is that a free
    -library does the same job as widely used non-free libraries.  In this
    -case, there is little to gain by limiting the free library to free
    -software only, so we use the Lesser General Public License.
    -
    -  In other cases, permission to use a particular library in non-free
    -programs enables a greater number of people to use a large body of
    -free software.  For example, permission to use the GNU C Library in
    -non-free programs enables many more people to use the whole GNU
    -operating system, as well as its variant, the GNU/Linux operating
    -system.
    -
    -  Although the Lesser General Public License is Less protective of the
    -users' freedom, it does ensure that the user of a program that is
    -linked with the Library has the freedom and the wherewithal to run
    -that program using a modified version of the Library.
    -
    -  The precise terms and conditions for copying, distribution and
    -modification follow.  Pay close attention to the difference between a
    -"work based on the library" and a "work that uses the library".  The
    -former contains code derived from the library, whereas the latter must
    -be combined with the library in order to run.
    -
    -		  GNU LESSER GENERAL PUBLIC LICENSE
    -   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    -
    -  0. This License Agreement applies to any software library or other
    -program which contains a notice placed by the copyright holder or
    -other authorized party saying it may be distributed under the terms of
    -this Lesser General Public License (also called "this License").
    -Each licensee is addressed as "you".
    -
    -  A "library" means a collection of software functions and/or data
    -prepared so as to be conveniently linked with application programs
    -(which use some of those functions and data) to form executables.
    -
    -  The "Library", below, refers to any such software library or work
    -which has been distributed under these terms.  A "work based on the
    -Library" means either the Library or any derivative work under
    -copyright law: that is to say, a work containing the Library or a
    -portion of it, either verbatim or with modifications and/or translated
    -straightforwardly into another language.  (Hereinafter, translation is
    -included without limitation in the term "modification".)
    -
    -  "Source code" for a work means the preferred form of the work for
    -making modifications to it.  For a library, complete source code means
    -all the source code for all modules it contains, plus any associated
    -interface definition files, plus the scripts used to control compilation
    -and installation of the library.
    -
    -  Activities other than copying, distribution and modification are not
    -covered by this License; they are outside its scope.  The act of
    -running a program using the Library is not restricted, and output from
    -such a program is covered only if its contents constitute a work based
    -on the Library (independent of the use of the Library in a tool for
    -writing it).  Whether that is true depends on what the Library does
    -and what the program that uses the Library does.
    -  
    -  1. You may copy and distribute verbatim copies of the Library's
    -complete source code as you receive it, in any medium, provided that
    -you conspicuously and appropriately publish on each copy an
    -appropriate copyright notice and disclaimer of warranty; keep intact
    -all the notices that refer to this License and to the absence of any
    -warranty; and distribute a copy of this License along with the
    -Library.
    -
    -  You may charge a fee for the physical act of transferring a copy,
    -and you may at your option offer warranty protection in exchange for a
    -fee.
    -
    -  2. You may modify your copy or copies of the Library or any portion
    -of it, thus forming a work based on the Library, and copy and
    -distribute such modifications or work under the terms of Section 1
    -above, provided that you also meet all of these conditions:
    -
    -    a) The modified work must itself be a software library.
    -
    -    b) You must cause the files modified to carry prominent notices
    -    stating that you changed the files and the date of any change.
    -
    -    c) You must cause the whole of the work to be licensed at no
    -    charge to all third parties under the terms of this License.
    -
    -    d) If a facility in the modified Library refers to a function or a
    -    table of data to be supplied by an application program that uses
    -    the facility, other than as an argument passed when the facility
    -    is invoked, then you must make a good faith effort to ensure that,
    -    in the event an application does not supply such function or
    -    table, the facility still operates, and performs whatever part of
    -    its purpose remains meaningful.
    -
    -    (For example, a function in a library to compute square roots has
    -    a purpose that is entirely well-defined independent of the
    -    application.  Therefore, Subsection 2d requires that any
    -    application-supplied function or table used by this function must
    -    be optional: if the application does not supply it, the square
    -    root function must still compute square roots.)
    -
    -These requirements apply to the modified work as a whole.  If
    -identifiable sections of that work are not derived from the Library,
    -and can be reasonably considered independent and separate works in
    -themselves, then this License, and its terms, do not apply to those
    -sections when you distribute them as separate works.  But when you
    -distribute the same sections as part of a whole which is a work based
    -on the Library, the distribution of the whole must be on the terms of
    -this License, whose permissions for other licensees extend to the
    -entire whole, and thus to each and every part regardless of who wrote
    -it.
    -
    -Thus, it is not the intent of this section to claim rights or contest
    -your rights to work written entirely by you; rather, the intent is to
    -exercise the right to control the distribution of derivative or
    -collective works based on the Library.
    -
    -In addition, mere aggregation of another work not based on the Library
    -with the Library (or with a work based on the Library) on a volume of
    -a storage or distribution medium does not bring the other work under
    -the scope of this License.
    -
    -  3. You may opt to apply the terms of the ordinary GNU General Public
    -License instead of this License to a given copy of the Library.  To do
    -this, you must alter all the notices that refer to this License, so
    -that they refer to the ordinary GNU General Public License, version 2,
    -instead of to this License.  (If a newer version than version 2 of the
    -ordinary GNU General Public License has appeared, then you can specify
    -that version instead if you wish.)  Do not make any other change in
    -these notices.
    -
    -  Once this change is made in a given copy, it is irreversible for
    -that copy, so the ordinary GNU General Public License applies to all
    -subsequent copies and derivative works made from that copy.
    -
    -  This option is useful when you wish to copy part of the code of
    -the Library into a program that is not a library.
    -
    -  4. You may copy and distribute the Library (or a portion or
    -derivative of it, under Section 2) in object code or executable form
    -under the terms of Sections 1 and 2 above provided that you accompany
    -it with the complete corresponding machine-readable source code, which
    -must be distributed under the terms of Sections 1 and 2 above on a
    -medium customarily used for software interchange.
    -
    -  If distribution of object code is made by offering access to copy
    -from a designated place, then offering equivalent access to copy the
    -source code from the same place satisfies the requirement to
    -distribute the source code, even though third parties are not
    -compelled to copy the source along with the object code.
    -
    -  5. A program that contains no derivative of any portion of the
    -Library, but is designed to work with the Library by being compiled or
    -linked with it, is called a "work that uses the Library".  Such a
    -work, in isolation, is not a derivative work of the Library, and
    -therefore falls outside the scope of this License.
    -
    -  However, linking a "work that uses the Library" with the Library
    -creates an executable that is a derivative of the Library (because it
    -contains portions of the Library), rather than a "work that uses the
    -library".  The executable is therefore covered by this License.
    -Section 6 states terms for distribution of such executables.
    -
    -  When a "work that uses the Library" uses material from a header file
    -that is part of the Library, the object code for the work may be a
    -derivative work of the Library even though the source code is not.
    -Whether this is true is especially significant if the work can be
    -linked without the Library, or if the work is itself a library.  The
    -threshold for this to be true is not precisely defined by law.
    -
    -  If such an object file uses only numerical parameters, data
    -structure layouts and accessors, and small macros and small inline
    -functions (ten lines or less in length), then the use of the object
    -file is unrestricted, regardless of whether it is legally a derivative
    -work.  (Executables containing this object code plus portions of the
    -Library will still fall under Section 6.)
    -
    -  Otherwise, if the work is a derivative of the Library, you may
    -distribute the object code for the work under the terms of Section 6.
    -Any executables containing that work also fall under Section 6,
    -whether or not they are linked directly with the Library itself.
    -
    -  6. As an exception to the Sections above, you may also combine or
    -link a "work that uses the Library" with the Library to produce a
    -work containing portions of the Library, and distribute that work
    -under terms of your choice, provided that the terms permit
    -modification of the work for the customer's own use and reverse
    -engineering for debugging such modifications.
    -
    -  You must give prominent notice with each copy of the work that the
    -Library is used in it and that the Library and its use are covered by
    -this License.  You must supply a copy of this License.  If the work
    -during execution displays copyright notices, you must include the
    -copyright notice for the Library among them, as well as a reference
    -directing the user to the copy of this License.  Also, you must do one
    -of these things:
    -
    -    a) Accompany the work with the complete corresponding
    -    machine-readable source code for the Library including whatever
    -    changes were used in the work (which must be distributed under
    -    Sections 1 and 2 above); and, if the work is an executable linked
    -    with the Library, with the complete machine-readable "work that
    -    uses the Library", as object code and/or source code, so that the
    -    user can modify the Library and then relink to produce a modified
    -    executable containing the modified Library.  (It is understood
    -    that the user who changes the contents of definitions files in the
    -    Library will not necessarily be able to recompile the application
    -    to use the modified definitions.)
    -
    -    b) Use a suitable shared library mechanism for linking with the
    -    Library.  A suitable mechanism is one that (1) uses at run time a
    -    copy of the library already present on the user's computer system,
    -    rather than copying library functions into the executable, and (2)
    -    will operate properly with a modified version of the library, if
    -    the user installs one, as long as the modified version is
    -    interface-compatible with the version that the work was made with.
    -
    -    c) Accompany the work with a written offer, valid for at
    -    least three years, to give the same user the materials
    -    specified in Subsection 6a, above, for a charge no more
    -    than the cost of performing this distribution.
    -
    -    d) If distribution of the work is made by offering access to copy
    -    from a designated place, offer equivalent access to copy the above
    -    specified materials from the same place.
    -
    -    e) Verify that the user has already received a copy of these
    -    materials or that you have already sent this user a copy.
    -
    -  For an executable, the required form of the "work that uses the
    -Library" must include any data and utility programs needed for
    -reproducing the executable from it.  However, as a special exception,
    -the materials to be distributed need not include anything that is
    -normally distributed (in either source or binary form) with the major
    -components (compiler, kernel, and so on) of the operating system on
    -which the executable runs, unless that component itself accompanies
    -the executable.
    -
    -  It may happen that this requirement contradicts the license
    -restrictions of other proprietary libraries that do not normally
    -accompany the operating system.  Such a contradiction means you cannot
    -use both them and the Library together in an executable that you
    -distribute.
    -
    -  7. You may place library facilities that are a work based on the
    -Library side-by-side in a single library together with other library
    -facilities not covered by this License, and distribute such a combined
    -library, provided that the separate distribution of the work based on
    -the Library and of the other library facilities is otherwise
    -permitted, and provided that you do these two things:
    -
    -    a) Accompany the combined library with a copy of the same work
    -    based on the Library, uncombined with any other library
    -    facilities.  This must be distributed under the terms of the
    -    Sections above.
    -
    -    b) Give prominent notice with the combined library of the fact
    -    that part of it is a work based on the Library, and explaining
    -    where to find the accompanying uncombined form of the same work.
    -
    -  8. You may not copy, modify, sublicense, link with, or distribute
    -the Library except as expressly provided under this License.  Any
    -attempt otherwise to copy, modify, sublicense, link with, or
    -distribute the Library is void, and will automatically terminate your
    -rights under this License.  However, parties who have received copies,
    -or rights, from you under this License will not have their licenses
    -terminated so long as such parties remain in full compliance.
    -
    -  9. You are not required to accept this License, since you have not
    -signed it.  However, nothing else grants you permission to modify or
    -distribute the Library or its derivative works.  These actions are
    -prohibited by law if you do not accept this License.  Therefore, by
    -modifying or distributing the Library (or any work based on the
    -Library), you indicate your acceptance of this License to do so, and
    -all its terms and conditions for copying, distributing or modifying
    -the Library or works based on it.
    -
    -  10. Each time you redistribute the Library (or any work based on the
    -Library), the recipient automatically receives a license from the
    -original licensor to copy, distribute, link with or modify the Library
    -subject to these terms and conditions.  You may not impose any further
    -restrictions on the recipients' exercise of the rights granted herein.
    -You are not responsible for enforcing compliance by third parties with
    -this License.
    -
    -  11. If, as a consequence of a court judgment or allegation of patent
    -infringement or for any other reason (not limited to patent issues),
    -conditions are imposed on you (whether by court order, agreement or
    -otherwise) that contradict the conditions of this License, they do not
    -excuse you from the conditions of this License.  If you cannot
    -distribute so as to satisfy simultaneously your obligations under this
    -License and any other pertinent obligations, then as a consequence you
    -may not distribute the Library at all.  For example, if a patent
    -license would not permit royalty-free redistribution of the Library by
    -all those who receive copies directly or indirectly through you, then
    -the only way you could satisfy both it and this License would be to
    -refrain entirely from distribution of the Library.
    -
    -If any portion of this section is held invalid or unenforceable under any
    -particular circumstance, the balance of the section is intended to apply,
    -and the section as a whole is intended to apply in other circumstances.
    -
    -It is not the purpose of this section to induce you to infringe any
    -patents or other property right claims or to contest validity of any
    -such claims; this section has the sole purpose of protecting the
    -integrity of the free software distribution system which is
    -implemented by public license practices.  Many people have made
    -generous contributions to the wide range of software distributed
    -through that system in reliance on consistent application of that
    -system; it is up to the author/donor to decide if he or she is willing
    -to distribute software through any other system and a licensee cannot
    -impose that choice.
    -
    -This section is intended to make thoroughly clear what is believed to
    -be a consequence of the rest of this License.
    -
    -  12. If the distribution and/or use of the Library is restricted in
    -certain countries either by patents or by copyrighted interfaces, the
    -original copyright holder who places the Library under this License may add
    -an explicit geographical distribution limitation excluding those countries,
    -so that distribution is permitted only in or among countries not thus
    -excluded.  In such case, this License incorporates the limitation as if
    -written in the body of this License.
    -
    -  13. The Free Software Foundation may publish revised and/or new
    -versions of the Lesser General Public License from time to time.
    -Such new versions will be similar in spirit to the present version,
    -but may differ in detail to address new problems or concerns.
    -
    -Each version is given a distinguishing version number.  If the Library
    -specifies a version number of this License which applies to it and
    -"any later version", you have the option of following the terms and
    -conditions either of that version or of any later version published by
    -the Free Software Foundation.  If the Library does not specify a
    -license version number, you may choose any version ever published by
    -the Free Software Foundation.
    -
    -  14. If you wish to incorporate parts of the Library into other free
    -programs whose distribution conditions are incompatible with these,
    -write to the author to ask for permission.  For software which is
    -copyrighted by the Free Software Foundation, write to the Free
    -Software Foundation; we sometimes make exceptions for this.  Our
    -decision will be guided by the two goals of preserving the free status
    -of all derivatives of our free software and of promoting the sharing
    -and reuse of software generally.
    -
    -			    NO WARRANTY
    -
    -  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
    -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
    -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
    -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
    -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
    -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    -PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
    -LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
    -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
    -
    -  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
    -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
    -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
    -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
    -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    -DAMAGES.
    -
    -		     END OF TERMS AND CONDITIONS
    -
    -           How to Apply These Terms to Your New Libraries
    -
    -  If you develop a new library, and you want it to be of the greatest
    -possible use to the public, we recommend making it free software that
    -everyone can redistribute and change.  You can do so by permitting
    -redistribution under these terms (or, alternatively, under the terms of the
    -ordinary General Public License).
    -
    -  To apply these terms, attach the following notices to the library.  It is
    -safest to attach them to the start of each source file to most effectively
    -convey the exclusion of warranty; and each file should have at least the
    -"copyright" line and a pointer to where the full notice is found.
    -
    -    <one line to give the library's name and a brief idea of what it does.>
    -    Copyright (C) <year>  <name of author>
    -
    -    This library is free software; you can redistribute it and/or
    -    modify it under the terms of the GNU Lesser General Public
    -    License as published by the Free Software Foundation; either
    -    version 2.1 of the License, or (at your option) any later version.
    -
    -    This library is distributed in the hope that it will be useful,
    -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -    Lesser General Public License for more details.
    -
    -    You should have received a copy of the GNU Lesser General Public
    -    License along with this library; if not, write to the Free Software
    -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    -
    -Also add information on how to contact you by electronic and paper mail.
    -
    -You should also get your employer (if you work as a programmer) or your
    -school, if any, to sign a "copyright disclaimer" for the library, if
    -necessary.  Here is a sample; alter the names:
    -
    -  Yoyodyne, Inc., hereby disclaims all copyright interest in the
    -  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
    -
    -  <signature of Ty Coon>, 1 April 1990
    -  Ty Coon, President of Vice
    -
    -That's all there is to it!
    -
    -
    -
    -
    -

    - Documentation generated on Sun, 02 Dec 2007 09:43:23 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/ric_README.html b/gulliver/thirdparty/krumo/docs/ric_README.html deleted file mode 100755 index 559d3c24c..000000000 --- a/gulliver/thirdparty/krumo/docs/ric_README.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - -

    README

    -
    -=============================================================================
    -
    -                               Krumo
    -                            version 0.1a
    -
    -=============================================================================
    -
    -You probably got this package from...
    -http://www.sourceforge.net/projects/krumo/
    -
    -If there is no licence agreement with this package please download
    -a version from the location above. You must read and accept that
    -licence to use this software. The file is titled simply LICENSE.
    -
    -OVERVIEW
    -------------------------------------------------------------------------------
    -To put it simply, Krumo is a replacement for print_r() and var_dump(). By 
    -definition Krumo is a debugging tool (PHP4/PHP5), which displays structured 
    -information about any PHP variable.
    -
    -A lot of developers use print_r() and var_dump() in the means of debugging 
    -tools. Although they were intended to present human readble information about a 
    -variable, we can all agree that in general they are not. Krumo is an 
    -alternative: it does the same job, but it presents the information beautified 
    -using CSS and DHTML. 
    -
    -EXAMPLES
    -------------------------------------------------------------------------------
    -Here's a basic example, which will return a report on the array variable passed 
    -as argument to it:
    -
    - krumo(array('a1'=> 'A1', 3, 'red'));
    -
    -You can dump simultaneously more then one variable - here's another example:
    -
    - krumo($_SERVER, $_REQUEST);
    -
    -You probably saw from the examples above that some of the nodes are expandable, 
    -so if you want to inspect the nested information, click on them and they will 
    -expand; if you do not need that information shown simply click again on it to 
    -collapse it. Here's an example to test this:
    -
    - $x1->x2->x3->x4->x5->x6->x7->x8->x9 = 'X10';
    - krumo($x1);
    -
    -The krumo() is the only standalone function from the package, and this is 
    -because basic dumps about variables (like print_r() or var_dump()) are the most 
    -common tasks such functionality is used for. The rest of the functionality can 
    -be called using static calls to the Krumo class. Here are several more examples:
    -
    - // print a debug backgrace
    - krumo::backtrace();
    -
    - // print all the included(or required) files
    - krumo::includes();
    - 
    - // print all the included functions
    - krumo::functions();
    - 
    - // print all the declared classes
    - krumo::classes();
    - 
    - // print all the defined constants
    - krumo::defines();
    -
    - ... and so on, etc.
    -
    -A full PHPDocumenter API documentation exists both in this package and at the 
    -project's website.
    -
    -INSTALL
    -------------------------------------------------------------------------------
    -Read the INSTALL file.
    -
    -DOCUMENTATION
    -------------------------------------------------------------------------------
    -As I said, a full PHPDocumenter API documentation can be found both in this
    -package and at the project's website.
    -
    -SKINS
    -------------------------------------------------------------------------------
    -There are several skins pre-installed with this package, but if you wish you can 
    -create skins of your own. The skins are simply CSS files that are prepended to 
    -the result that Krumo prints. If you want to use images in your CSS (for 
    -background, list-style, etc), you have to put "%URL%" in front of the image URL 
    -in order hook it up to the skin folder and make the image web-accessible.
    -
    -Here's an example:
    -
    - ul.krumo-first {background: url(%url%bg.gif);}
    -
    -TODO
    -------------------------------------------------------------------------------
    -You can find the list of stuff that is going to be added to this project in the 
    -TODO file from this very package.
    -
    -CONTRIBUTION
    ------------------------------------------------------------------------------
    -If you download and use and possibly even extend this tool, please let us know. 
    -Any feedback, even bad, is always welcome and your suggestions are going to be 
    -considered for our next release. Please use our SourceForge page for that:
    - 
    - http://www.sourceforge.net/projects/krumo/
    -
    -
    -

    - Documentation generated on Sat, 16 Jun 2007 09:50:08 +0300 by phpDocumentor 1.3.0RC4 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/ric_TODO.html b/gulliver/thirdparty/krumo/docs/ric_TODO.html deleted file mode 100755 index 82b751e8b..000000000 --- a/gulliver/thirdparty/krumo/docs/ric_TODO.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - -

    TODO

    -
    -******************************************************************************
    -
    -                                 Krumo: TODO
    -
    -******************************************************************************
    -
    -BUGS
    -----------------
    - - watch the SourceForge.net Bug Tracker
    -
    -Features: PHP
    -----------------
    - - Try to detect anonymous (lambda) functions
    - - Try to detect whether an array is indexed or associated
    - - Add var_export support for arrays and objects
    - - Add JSON support for arrays and objects
    - 
    -Features: GUI
    -----------------
    - - Nicer and friendlier skin(s)
    - - Add top-level links for collapsing and expanding the whole tree
    - - Add object & array -level links for collapsing and expanding all the
    - 	nested nodes
    - - Print all parent classes for the rendered objects
    -
    -

    - Documentation generated on Sun, 02 Dec 2007 09:43:23 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/docs/ric_VERSION.html b/gulliver/thirdparty/krumo/docs/ric_VERSION.html deleted file mode 100755 index 45904040e..000000000 --- a/gulliver/thirdparty/krumo/docs/ric_VERSION.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -

    VERSION

    -
    -0.2.1a
    -
    -

    - Documentation generated on Sun, 02 Dec 2007 09:43:23 +0200 by phpDocumentor 1.4.0a2 -

    - - \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/krumo.ini b/gulliver/thirdparty/krumo/krumo.ini deleted file mode 100755 index 2ccfc128c..000000000 --- a/gulliver/thirdparty/krumo/krumo.ini +++ /dev/null @@ -1,20 +0,0 @@ -; -; KRUMO CONFIGURATION FILE -; - -[skin] -selected = "schablon.com" -; -; Change the above value to set the CSS skin used to render -; Krumo layout. If the skin is not found, then the "default" one -; is going to be used. -; - -[css] -url = "/Krumo/" -; -; This value is used to set the URL path to -; where the Krumo folder is. This is required in -; order to have web access to Krumo's CSS and -; image files. -; \ No newline at end of file diff --git a/gulliver/thirdparty/krumo/krumo.js b/gulliver/thirdparty/krumo/krumo.js deleted file mode 100755 index 035fe44c0..000000000 --- a/gulliver/thirdparty/krumo/krumo.js +++ /dev/null @@ -1,37 +0,0 @@ -/** JavaScript routines for Krumo -* @version $Id: krumo.js 22 2007-12-02 07:38:18Z Mrasnika $ -* @link http://sourceforge.net/projects/krumo -*/ - -function krumo() {} -krumo.reclass = function(el, className) { - if (el.className.indexOf(className) < 0) { - el.className += (' ' + className); - } -} -krumo.unclass = function(el, className) { - if (el.className.indexOf(className) > -1) { - el.className = el.className.replace(className, ''); - } -} -krumo.toggle = function(el) { - var ul = el.parentNode.getElementsByTagName('ul'); - for (var i=0; i -*/ - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -ul.krumo-node { - margin: 0px; - padding: 0px; - } -ul.krumo-node ul { - margin-left: 20px; - } -* html ul.krumo-node ul { - margin-left: 24px; - } -div.krumo-root { - border: solid 1px black; - margin: 1em 0em; - } -ul.krumo-first { - font: normal 12px arial; - border: solid 2px white; - border-top-width:1px; - background: url(%url%bg.gif); - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-child { - display:block; - list-style: none; - padding: 0px; - margin: 0px; - overflow:hidden; - } -div.krumo-element { - cursor:default; - - line-height: 24px; - display:block; - - clear:both; - white-space:nowrap; - - border-top: solid 1px white; - background: #BFDFFF; - padding-left: 10px; - } -* html div.krumo-element { - padding-bottom: 3px; - } -a.krumo-name { - color:navy; - font: bold 13px Arial; - } -a.krumo-name big { - font: bold 20pt Georgia; - line-height: 14px; - position:relative; - top:2px; - left:-2px; - } -* html a.krumo-name big { - font: bold 19pt Georgia; - top: 5px; - left: 0px; - line-height: 9px; - height: 12px; - padding: 0px; - margin: 0px; - } -div.krumo-expand { - background: #AAD5FF; - cursor:pointer; - } -div.krumo-hover { - background: #FFBE7D; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-preview { - font: normal 13px courier new; - padding: 5px 5px 14px 5px; - background: white; - border-top: 0px; - overflow:auto; - } -* html div.krumo-preview { - padding-top: 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-footnote { - background:white; - padding: 2px 5px; - list-style:none; - border-top: solid 1px #bebebe; - margin-top:2px; - cursor:default; - } -* html li.krumo-footnote { - line-height: 13px; - } -div.krumo-version { - float:right; - } -li.krumo-footnote h6 { - font: bold 11px verdana; - margin: 0px; - padding: 0px; - color:navy; - display:inline; - } -* html li.krumo-footnote h6 { - margin-right: 3px; - } -li.krumo-footnote a { - font: bold 10px arial; - color: #434343; - text-decoration:none; - } -li.krumo-footnote a:hover { - color:black; - } - -li.krumo-footnote span.krumo-call { - font:normal 11px verdana; - position: relative; - top: 1px; - } -li.krumo-footnote span.krumo-call code { - font-weight:bold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-title { - font: normal 11px verdana ; - position:relative; - top:9px; - cursor:default; - line-height:2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -strong.krumo-array-length, -strong.krumo-string-length { - font-weight: normal; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ diff --git a/gulliver/thirdparty/krumo/skins/default/bg.gif b/gulliver/thirdparty/krumo/skins/default/bg.gif deleted file mode 100755 index fee4763e7..000000000 Binary files a/gulliver/thirdparty/krumo/skins/default/bg.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/default/skin.css b/gulliver/thirdparty/krumo/skins/default/skin.css deleted file mode 100755 index 4c14dbd51..000000000 --- a/gulliver/thirdparty/krumo/skins/default/skin.css +++ /dev/null @@ -1,158 +0,0 @@ -/** -* Krumo Default Skin -* -* @version $Id: skin.css 6 2007-06-16 06:37:27Z mrasnika $ -* @author Kaloyan K. Tsvetkov -*/ - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -ul.krumo-node { - margin: 0px; - padding: 0px; - } -ul.krumo-node ul { - margin-left: 20px; - } -* html ul.krumo-node ul { - margin-left: 24px; - } -div.krumo-root { - border: solid 1px black; - margin: 1em 0em; - } -ul.krumo-first { - font: normal 12px arial; - border: solid 2px white; - border-top-width:1px; - background: url(%url%bg.gif); - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-child { - display:block; - list-style: none; - padding: 0px; - margin: 0px; - overflow:hidden; - } -div.krumo-element { - cursor:default; - - line-height: 24px; - display:block; - - clear:both; - white-space:nowrap; - - border-top: solid 1px white; - background: #E8E8E8; - padding-left: 10px; - } -* html div.krumo-element { - padding-bottom: 3px; - } -a.krumo-name { - color:#2C5858; - font: bold 13px Arial; - } -a.krumo-name big { - font: bold 20pt Georgia; - line-height: 14px; - position:relative; - top:2px; - left:-2px; - } -* html a.krumo-name big { - font: bold 19pt Georgia; - top: 5px; - left: 0px; - line-height: 9px; - height: 12px; - padding: 0px; - margin: 0px; - } -div.krumo-expand { - background: #CCCCCC; - cursor:pointer; - } -div.krumo-hover { - background: #B7DBDB; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-preview { - font: normal 13px courier new; - padding: 5px 5px 14px 5px; - background: white; - border-top: 0px; - overflow:auto; - } -* html div.krumo-preview { - padding-top: 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-footnote { - background:white; - padding: 2px 5px; - list-style:none; - border-top: solid 1px #bebebe; - margin-top:2px; - cursor:default; - } -* html li.krumo-footnote { - line-height: 13px; - } -div.krumo-version { - float:right; - } -li.krumo-footnote h6 { - font: bold 11px verdana; - margin: 0px; - padding: 0px; - color:#366D6D; - display:inline; - } -* html li.krumo-footnote h6 { - margin-right: 3px; - } -li.krumo-footnote a { - font: bold 10px arial; - color: #434343; - text-decoration:none; - } -li.krumo-footnote a:hover { - color:black; - } - -li.krumo-footnote span.krumo-call { - font:normal 11px verdana; - position: relative; - top: 1px; - } -li.krumo-footnote span.krumo-call code { - font-weight:bold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-title { - font: normal 11px verdana ; - position:relative; - top:9px; - cursor:default; - line-height:2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -strong.krumo-array-length, -strong.krumo-string-length { - font-weight: normal; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ diff --git a/gulliver/thirdparty/krumo/skins/green/bg.gif b/gulliver/thirdparty/krumo/skins/green/bg.gif deleted file mode 100755 index aa4e75ec1..000000000 Binary files a/gulliver/thirdparty/krumo/skins/green/bg.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/green/skin.css b/gulliver/thirdparty/krumo/skins/green/skin.css deleted file mode 100755 index d692d41d3..000000000 --- a/gulliver/thirdparty/krumo/skins/green/skin.css +++ /dev/null @@ -1,158 +0,0 @@ -/** -* Krumo "Green" Skin -* -* @version $Id: skin.css 6 2007-06-16 06:37:27Z mrasnika $ -* @author Kaloyan K. Tsvetkov -*/ - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -ul.krumo-node { - margin: 0px; - padding: 0px; - } -ul.krumo-node ul { - margin-left: 20px; - } -* html ul.krumo-node ul { - margin-left: 24px; - } -div.krumo-root { - border: solid 1px black; - margin: 1em 0em; - } -ul.krumo-first { - font: normal 12px arial; - border: solid 2px white; - border-top-width:1px; - background: url(%url%bg.gif); - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-child { - display:block; - list-style: none; - padding: 0px; - margin: 0px; - overflow:hidden; - } -div.krumo-element { - cursor:default; - - line-height: 24px; - display:block; - - clear:both; - white-space:nowrap; - - border-top: solid 1px white; - background: #D7F4CA; - padding-left: 10px; - } -* html div.krumo-element { - padding-bottom: 3px; - } -a.krumo-name { - color:#004000; - font: bold 13px Arial; - } -a.krumo-name big { - font: bold 20pt Georgia; - line-height: 14px; - position:relative; - top:2px; - left:-2px; - } -* html a.krumo-name big { - font: bold 19pt Georgia; - top: 5px; - left: 0px; - line-height: 9px; - height: 12px; - padding: 0px; - margin: 0px; - } -div.krumo-expand { - background: #C0EEAC; - cursor:pointer; - } -div.krumo-hover { - background: gold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-preview { - font: normal 13px courier new; - padding: 5px 5px 14px 5px; - background: white; - border-top: 0px; - overflow:auto; - } -* html div.krumo-preview { - padding-top: 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-footnote { - background:white; - padding: 2px 5px; - list-style:none; - border-top: solid 1px #bebebe; - margin-top:2px; - cursor:default; - } -* html li.krumo-footnote { - line-height: 13px; - } -div.krumo-version { - float:right; - } -li.krumo-footnote h6 { - font: bold 11px verdana; - margin: 0px; - padding: 0px; - color:#008040; - display:inline; - } -* html li.krumo-footnote h6 { - margin-right: 3px; - } -li.krumo-footnote a { - font: bold 10px arial; - color: #434343; - text-decoration:none; - } -li.krumo-footnote a:hover { - color:black; - } - -li.krumo-footnote span.krumo-call { - font:normal 11px verdana; - position: relative; - top: 1px; - } -li.krumo-footnote span.krumo-call code { - font-weight:bold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-title { - font: normal 11px verdana ; - position:relative; - top:9px; - cursor:default; - line-height:2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -strong.krumo-array-length, -strong.krumo-string-length { - font-weight: normal; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ diff --git a/gulliver/thirdparty/krumo/skins/orange/bg.gif b/gulliver/thirdparty/krumo/skins/orange/bg.gif deleted file mode 100755 index 3c71bc920..000000000 Binary files a/gulliver/thirdparty/krumo/skins/orange/bg.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/orange/skin.css b/gulliver/thirdparty/krumo/skins/orange/skin.css deleted file mode 100755 index 779ad08e3..000000000 --- a/gulliver/thirdparty/krumo/skins/orange/skin.css +++ /dev/null @@ -1,158 +0,0 @@ -/** -* Krumo "Orange" Skin -* -* @version $Id: skin.css 6 2007-06-16 06:37:27Z mrasnika $ -* @author Kaloyan K. Tsvetkov -*/ - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -ul.krumo-node { - margin: 0px; - padding: 0px; - } -ul.krumo-node ul { - margin-left: 20px; - } -* html ul.krumo-node ul { - margin-left: 24px; - } -div.krumo-root { - border: solid 1px black; - margin: 1em 0em; - } -ul.krumo-first { - font: normal 12px arial; - border: solid 2px white; - border-top-width:1px; - background: url(%url%bg.gif); - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-child { - display:block; - list-style: none; - padding: 0px; - margin: 0px; - overflow:hidden; - } -div.krumo-element { - cursor:default; - - line-height: 24px; - display:block; - - clear:both; - white-space:nowrap; - - border-top: solid 1px white; - background: #FCEBA9; - padding-left: 10px; - } -* html div.krumo-element { - padding-bottom: 3px; - } -a.krumo-name { - color:#404000; - font: bold 13px Arial; - } -a.krumo-name big { - font: bold 20pt Georgia; - line-height: 14px; - position:relative; - top:2px; - left:-2px; - } -* html a.krumo-name big { - font: bold 19pt Georgia; - top: 5px; - left: 0px; - line-height: 9px; - height: 12px; - padding: 0px; - margin: 0px; - } -div.krumo-expand { - background: #FADB61; - cursor:pointer; - } -div.krumo-hover { - background: #FF8A4B; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-preview { - font: normal 13px courier new; - padding: 5px 5px 14px 5px; - background: white; - border-top: 0px; - overflow:auto; - } -* html div.krumo-preview { - padding-top: 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-footnote { - background:white; - padding: 2px 5px; - list-style:none; - border-top: solid 1px #bebebe; - margin-top:2px; - cursor:default; - } -* html li.krumo-footnote { - line-height: 13px; - } -div.krumo-version { - float:right; - } -li.krumo-footnote h6 { - font: bold 11px verdana; - margin: 0px; - padding: 0px; - color:#E87400; - display:inline; - } -* html li.krumo-footnote h6 { - margin-right: 3px; - } -li.krumo-footnote a { - font: bold 10px arial; - color: #434343; - text-decoration:none; - } -li.krumo-footnote a:hover { - color:black; - } - -li.krumo-footnote span.krumo-call { - font:normal 11px verdana; - position: relative; - top: 1px; - } -li.krumo-footnote span.krumo-call code { - font-weight:bold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-title { - font: normal 11px verdana ; - position:relative; - top:9px; - cursor:default; - line-height:2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -strong.krumo-array-length, -strong.krumo-string-length { - font-weight: normal; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ diff --git a/gulliver/thirdparty/krumo/skins/schablon.com/collapsed.gif b/gulliver/thirdparty/krumo/skins/schablon.com/collapsed.gif deleted file mode 100755 index c1a4e7d5f..000000000 Binary files a/gulliver/thirdparty/krumo/skins/schablon.com/collapsed.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/schablon.com/dotted.gif b/gulliver/thirdparty/krumo/skins/schablon.com/dotted.gif deleted file mode 100755 index e009cf1ea..000000000 Binary files a/gulliver/thirdparty/krumo/skins/schablon.com/dotted.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/schablon.com/empty.gif b/gulliver/thirdparty/krumo/skins/schablon.com/empty.gif deleted file mode 100755 index 51aa91d08..000000000 Binary files a/gulliver/thirdparty/krumo/skins/schablon.com/empty.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/schablon.com/expanded.gif b/gulliver/thirdparty/krumo/skins/schablon.com/expanded.gif deleted file mode 100755 index a0ecb026f..000000000 Binary files a/gulliver/thirdparty/krumo/skins/schablon.com/expanded.gif and /dev/null differ diff --git a/gulliver/thirdparty/krumo/skins/schablon.com/skin.css b/gulliver/thirdparty/krumo/skins/schablon.com/skin.css deleted file mode 100755 index 2a4b88f23..000000000 --- a/gulliver/thirdparty/krumo/skins/schablon.com/skin.css +++ /dev/null @@ -1,166 +0,0 @@ -/** -* Krumo `Schablon.com` Skin -* -* @version $Id: skin.css 6 2007-06-16 06:37:27Z mrasnika $ -* @author Kaloyan K. Tsvetkov -*/ - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -ul.krumo-node { - margin: 0px; - padding: 0px; - background-color: white; - } -ul.krumo-node ul { - margin-left: 20px; - } -* html ul.krumo-node ul { - margin-left: 24px; - } -div.krumo-root { - border: solid 1px black; - margin: 1em 0em; - text-align: left; - } -ul.krumo-first { - font: normal 11px tahoma, verdana; - border: solid 1px white; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-child { - display:block; - list-style: none; - padding: 0px; - margin: 0px; - overflow:hidden; - } -div.krumo-element { - cursor:default; - display:block; - clear:both; - white-space:nowrap; - - background-color: white; - background-image: url(%url%empty.gif); - background-repeat: no-repeat; - background-position: 6px 5px; - padding: 2px 0px 3px 20px; - } -* html div.krumo-element { - padding-bottom: 3px; - line-height: 13px; - } -div.krumo-expand { - background-image: url(%url%collapsed.gif); - cursor:pointer; - } -div.krumo-hover { - background-color: #BFDFFF; - } -div.krumo-opened { - background-image: url(%url%expanded.gif); - } -a.krumo-name { - color:navy; - font: bold 13px courier new; - line-height:12px; - } -a.krumo-name big { - font: bold 16pt Georgia; - line-height: 10px; - position:relative; - top:2px; - left:-2px; - } -* html a.krumo-name big { - font: bold 15pt Georgia; - float:left; - top: -5px; - left: 0px; - padding: 0px; - margin: 0px; - } -em.krumo-type { - font-style:normal; - margin: 0px 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-preview { - font: normal 13px courier new; - padding: 5px ; - background: lightyellow; - border: solid 1px #808000; - overflow:auto; - margin: 5px 1em 1em 0px; - } -* html div.krumo-preview { - padding-top: 2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -li.krumo-footnote { - background: white url(%url%dotted.gif) repeat-x; - padding: 4px 5px 3px 5px; - list-style:none; - cursor:default; - } -* html li.krumo-footnote { - line-height: 13px; - } -div.krumo-version { - float:right; - } -li.krumo-footnote h6 { - font: bold 11px verdana; - margin: 0px; - padding: 0px; - color:navy; - display:inline; - } -* html li.krumo-footnote h6 { - margin-right: 3px; - } -li.krumo-footnote a { - font: bold 10px arial; - color: #434343; - text-decoration:none; - } -li.krumo-footnote a:hover { - color:black; - } - - -li.krumo-footnote span.krumo-call { - font:normal 11px tahoma, verdana; - position: relative; - top: 1px; - } -li.krumo-footnote span.krumo-call code { - font-weight:bold; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -div.krumo-title { - font: normal 11px tahoma, verdana; - position:relative; - top:9px; - cursor:default; - line-height:2px; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ - -strong.krumo-array-length, -strong.krumo-string-length { - font-weight: normal; - color: #000099; - } - -/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */ diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Constants.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Constants.php deleted file mode 100644 index f3bc4ee9c..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Constants.php +++ /dev/null @@ -1,87 +0,0 @@ -_stream->readByte(); - } - - switch($typeMarker) { - case Zend_Amf_Constants::AMF3_UNDEFINED: - return null; - case Zend_Amf_Constants::AMF3_NULL: - return null; - case Zend_Amf_Constants::AMF3_BOOLEAN_FALSE: - return false; - case Zend_Amf_Constants::AMF3_BOOLEAN_TRUE: - return true; - case Zend_Amf_Constants::AMF3_INTEGER: - return $this->readInteger(); - case Zend_Amf_Constants::AMF3_NUMBER: - return $this->_stream->readDouble(); - case Zend_Amf_Constants::AMF3_STRING: - return $this->readString(); - case Zend_Amf_Constants::AMF3_DATE: - return $this->readDate(); - case Zend_Amf_Constants::AMF3_ARRAY: - return $this->readArray(); - case Zend_Amf_Constants::AMF3_OBJECT: - return $this->readObject(); - case Zend_Amf_Constants::AMF3_XML: - case Zend_Amf_Constants::AMF3_XMLSTRING: - return $this->readXmlString(); - case Zend_Amf_Constants::AMF3_BYTEARRAY: - return $this->readString(); - default: - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unsupported type marker: ' . $typeMarker); - } - } - - /** - * Read and deserialize an integer - * - * AMF 3 represents smaller integers with fewer bytes using the most - * significant bit of each byte. The worst case uses 32-bits - * to represent a 29-bit number, which is what we would have - * done with no compression. - * - 0x00000000 - 0x0000007F : 0xxxxxxx - * - 0x00000080 - 0x00003FFF : 1xxxxxxx 0xxxxxxx - * - 0x00004000 - 0x001FFFFF : 1xxxxxxx 1xxxxxxx 0xxxxxxx - * - 0x00200000 - 0x3FFFFFFF : 1xxxxxxx 1xxxxxxx 1xxxxxxx xxxxxxxx - * - 0x40000000 - 0xFFFFFFFF : throw range exception - * - * 0x04 -> integer type code, followed by up to 4 bytes of data. - * - * Parsing integers on OSFlash for the AMF3 integer data format: - * @link http://osflash.org/amf3/parsing_integers - * @return int|float - */ - public function readInteger() - { - $count = 1; - $intReference = $this->_stream->readByte(); - $result = 0; - while ((($intReference & 0x80) != 0) && $count < 4) { - $result <<= 7; - $result |= ($intReference & 0x7f); - $intReference = $this->_stream->readByte(); - $count++; - } - if ($count < 4) { - $result <<= 7; - $result |= $intReference; - } else { - // Use all 8 bits from the 4th byte - $result <<= 8; - $result |= $intReference; - - // Check if the integer should be negative - if (($result & 0x10000000) != 0) { - //and extend the sign bit - $result |= ~0xFFFFFFF; - } - } - return $result; - } - - /** - * Read and deserialize a string - * - * Strings can be sent as a reference to a previously - * occurring String by using an index to the implicit string reference table. - * Strings are encoding using UTF-8 - however the header may either - * describe a string literal or a string reference. - * - * - string = 0x06 string-data - * - string-data = integer-data [ modified-utf-8 ] - * - modified-utf-8 = *OCTET - * - * @return String - */ - public function readString() - { - $stringReference = $this->readInteger(); - - //Check if this is a reference string - if (($stringReference & 0x01) == 0) { - // reference string - $stringReference = $stringReference >> 1; - if ($stringReference >= count($this->_referenceStrings)) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Undefined string reference: ' . $stringReference); - } - // reference string found - return $this->_referenceStrings[$stringReference]; - } - - $length = $stringReference >> 1; - if ($length) { - $string = $this->_stream->readBytes($length); - $this->_referenceStrings[] = $string; - } else { - $string = ""; - } - return $string; - } - - /** - * Read and deserialize a date - * - * Data is the number of milliseconds elapsed since the epoch - * of midnight, 1st Jan 1970 in the UTC time zone. - * Local time zone information is not sent to flash. - * - * - date = 0x08 integer-data [ number-data ] - * - * @return Zend_Date - */ - public function readDate() - { - $dateReference = $this->readInteger(); - if (($dateReference & 0x01) == 0) { - $dateReference = $dateReference >> 1; - if ($dateReference>=count($this->_referenceObjects)) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Undefined date reference: ' . $dateReference); - } - return $this->_referenceObjects[$dateReference]; - } - - $timestamp = floor($this->_stream->readDouble() / 1000); - - require_once 'Zend/Date.php'; - $dateTime = new Zend_Date((int) $timestamp); - $this->_referenceObjects[] = $dateTime; - return $dateTime; - } - - /** - * Read amf array to PHP array - * - * - array = 0x09 integer-data ( [ 1OCTET *amf3-data ] | [OCTET *amf3-data 1] | [ OCTET *amf-data ] ) - * - * @return array - */ - public function readArray() - { - $arrayReference = $this->readInteger(); - if (($arrayReference & 0x01)==0){ - $arrayReference = $arrayReference >> 1; - if ($arrayReference>=count($this->_referenceObjects)) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unknow array reference: ' . $arrayReference); - } - return $this->_referenceObjects[$arrayReference]; - } - - // Create a holder for the array in the reference list - $data = array(); - $this->_referenceObjects[] =& $data; - $key = $this->readString(); - - // Iterating for string based keys. - while ($key != '') { - $data[$key] = $this->readTypeMarker(); - $key = $this->readString(); - } - - $arrayReference = $arrayReference >>1; - - //We have a dense array - for ($i=0; $i < $arrayReference; $i++) { - $data[] = $this->readTypeMarker(); - } - - return $data; - } - - /** - * Read an object from the AMF stream and convert it into a PHP object - * - * @todo Rather than using an array of traitsInfo create Zend_Amf_Value_TraitsInfo - * @return object|array - */ - public function readObject() - { - $traitsInfo = $this->readInteger(); - $storedObject = ($traitsInfo & 0x01)==0; - $traitsInfo = $traitsInfo >> 1; - - // Check if the Object is in the stored Objects reference table - if ($storedObject) { - $ref = $traitsInfo; - if (!isset($this->_referenceObjects[$ref])) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unknown Object reference: ' . $ref); - } - $returnObject = $this->_referenceObjects[$ref]; - } else { - // Check if the Object is in the stored Definitions reference table - $storedClass = ($traitsInfo & 0x01) == 0; - $traitsInfo = $traitsInfo >> 1; - if ($storedClass) { - $ref = $traitsInfo; - if (!isset($this->_referenceDefinitions[$ref])) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unknows Definition reference: '. $ref); - } - // Populate the reference attributes - $className = $this->_referenceDefinitions[$ref]['className']; - $encoding = $this->_referenceDefinitions[$ref]['encoding']; - $propertyNames = $this->_referenceDefinitions[$ref]['propertyNames']; - } else { - // The class was not in the reference tables. Start reading rawdata to build traits. - // Create a traits table. Zend_Amf_Value_TraitsInfo would be ideal - $className = $this->readString(); - $encoding = $traitsInfo & 0x03; - $propertyNames = array(); - $traitsInfo = $traitsInfo >> 2; - } - - // We now have the object traits defined in variables. Time to go to work: - if (!$className) { - // No class name generic object - $returnObject = new stdClass(); - } else { - // Defined object - // Typed object lookup against registered classname maps - if ($loader = Zend_Amf_Parse_TypeLoader::loadType($className)) { - $returnObject = new $loader(); - } else { - //user defined typed object - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Typed object not found: '. $className . ' '); - } - } - - // Add the Object to the reference table - $this->_referenceObjects[] = $returnObject; - - $properties = array(); // clear value - // Check encoding types for additional processing. - switch ($encoding) { - case (Zend_Amf_Constants::ET_EXTERNAL): - // Externalizable object such as {ArrayCollection} and {ObjectProxy} - if (!$storedClass) { - $this->_referenceDefinitions[] = array( - 'className' => $className, - 'encoding' => $encoding, - 'propertyNames' => $propertyNames, - ); - } - $returnObject->externalizedData = $this->readTypeMarker(); - break; - case (Zend_Amf_Constants::ET_DYNAMIC): - // used for Name-value encoding - if (!$storedClass) { - $this->_referenceDefinitions[] = array( - 'className' => $className, - 'encoding' => $encoding, - 'propertyNames' => $propertyNames, - ); - } - // not a reference object read name value properties from byte stream - do { - $property = $this->readString(); - if ($property != "") { - $propertyNames[] = $property; - $properties[$property] = $this->readTypeMarker(); - } - } while ($property !=""); - break; - default: - // basic property list object. - if (!$storedClass) { - $count = $traitsInfo; // Number of properties in the list - for($i=0; $i< $count; $i++) { - $propertyNames[] = $this->readString(); - } - // Add a reference to the class. - $this->_referenceDefinitions[] = array( - 'className' => $className, - 'encoding' => $encoding, - 'propertyNames' => $propertyNames, - ); - } - foreach ($propertyNames as $property) { - $properties[$property] = $this->readTypeMarker(); - } - break; - } - - // Add properties back to the return object. - foreach($properties as $key=>$value) { - if($key) { - $returnObject->$key = $value; - } - } - - - } - - if($returnObject instanceof Zend_Amf_Value_Messaging_ArrayCollection) { - if(isset($returnObject->externalizedData)) { - $returnObject = $returnObject->externalizedData; - } else { - $returnObject = get_object_vars($returnObject); - } - } - - return $returnObject; - } - - /** - * Convert XML to SimpleXml - * If user wants DomDocument they can use dom_import_simplexml - * - * @return SimpleXml Object - */ - public function readXmlString() - { - $xmlReference = $this->readInteger(); - $length = $xmlReference >> 1; - $string = $this->_stream->readBytes($length); - return simplexml_load_string($string); - } -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Amf3/Serializer.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Amf3/Serializer.php deleted file mode 100644 index 031ce7c4f..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Amf3/Serializer.php +++ /dev/null @@ -1,507 +0,0 @@ -_stream->writeByte($markerType); - - switch ($markerType) { - case Zend_Amf_Constants::AMF3_NULL: - break; - case Zend_Amf_Constants::AMF3_BOOLEAN_FALSE: - break; - case Zend_Amf_Constants::AMF3_BOOLEAN_TRUE: - break; - case Zend_Amf_Constants::AMF3_INTEGER: - $this->writeInteger($data); - break; - case Zend_Amf_Constants::AMF3_NUMBER: - $this->_stream->writeDouble($data); - break; - case Zend_Amf_Constants::AMF3_STRING: - $this->writeString($data); - break; - case Zend_Amf_Constants::AMF3_DATE: - $this->writeDate($data); - break; - case Zend_Amf_Constants::AMF3_ARRAY: - $this->writeArray($data); - break; - case Zend_Amf_Constants::AMF3_OBJECT: - $this->writeObject($data); - break; - case Zend_Amf_Constants::AMF3_BYTEARRAY: - $this->writeByteArray($data); - break; - case Zend_Amf_Constants::AMF3_XMLSTRING; - $this->writeXml($data); - break; - default: - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unknown Type Marker: ' . $markerType); - } - } else { - // Detect Type Marker - if(is_resource($data)) { - $data = Zend_Amf_Parse_TypeLoader::handleResource($data); - } - switch (true) { - case (null === $data): - $markerType = Zend_Amf_Constants::AMF3_NULL; - break; - case (is_bool($data)): - if ($data){ - $markerType = Zend_Amf_Constants::AMF3_BOOLEAN_TRUE; - } else { - $markerType = Zend_Amf_Constants::AMF3_BOOLEAN_FALSE; - } - break; - case (is_int($data)): - if (($data > 0xFFFFFFF) || ($data < -268435456)) { - $markerType = Zend_Amf_Constants::AMF3_NUMBER; - } else { - $markerType = Zend_Amf_Constants::AMF3_INTEGER; - } - break; - case (is_float($data)): - $markerType = Zend_Amf_Constants::AMF3_NUMBER; - break; - case (is_string($data)): - $markerType = Zend_Amf_Constants::AMF3_STRING; - break; - case (is_array($data)): - $markerType = Zend_Amf_Constants::AMF3_ARRAY; - break; - case (is_object($data)): - // Handle object types. - if (($data instanceof DateTime) || ($data instanceof Zend_Date)) { - $markerType = Zend_Amf_Constants::AMF3_DATE; - } else if ($data instanceof Zend_Amf_Value_ByteArray) { - $markerType = Zend_Amf_Constants::AMF3_BYTEARRAY; - } else if (($data instanceof DOMDocument) || ($data instanceof SimpleXMLElement)) { - $markerType = Zend_Amf_Constants::AMF3_XMLSTRING; - } else { - $markerType = Zend_Amf_Constants::AMF3_OBJECT; - } - break; - default: - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unsupported data type: ' . gettype($data)); - } - $this->writeTypeMarker($data, $markerType); - } - } - - /** - * Write an AMF3 integer - * - * @param int|float $data - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeInteger($int) - { - if (($int & 0xffffff80) == 0) { - $this->_stream->writeByte($int & 0x7f); - return $this; - } - - if (($int & 0xffffc000) == 0 ) { - $this->_stream->writeByte(($int >> 7 ) | 0x80); - $this->_stream->writeByte($int & 0x7f); - return $this; - } - - if (($int & 0xffe00000) == 0) { - $this->_stream->writeByte(($int >> 14 ) | 0x80); - $this->_stream->writeByte(($int >> 7 ) | 0x80); - $this->_stream->writeByte($int & 0x7f); - return $this; - } - - $this->_stream->writeByte(($int >> 22 ) | 0x80); - $this->_stream->writeByte(($int >> 15 ) | 0x80); - $this->_stream->writeByte(($int >> 8 ) | 0x80); - $this->_stream->writeByte($int & 0xff); - return $this; - } - - /** - * Send string to output stream, without trying to reference it. - * The string is prepended with strlen($string) << 1 | 0x01 - * - * @param string $string - * @return Zend_Amf_Parse_Amf3_Serializer - */ - protected function writeBinaryString($string){ - $ref = strlen($string) << 1 | 0x01; - $this->writeInteger($ref); - $this->_stream->writeBytes($string); - - return $this; - } - - /** - * Send string to output stream - * - * @param string $string - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeString($string) - { - $len = strlen($string); - if(!$len){ - $this->writeInteger(0x01); - return $this; - } - - $ref = array_search($string, $this->_referenceStrings, true); - if($ref === false){ - $this->_referenceStrings[] = $string; - $this->writeBinaryString($string); - } else { - $ref <<= 1; - $this->writeInteger($ref); - } - - return $this; - } - - /** - * Send ByteArray to output stream - * - * @param string|Zend_Amf_Value_ByteArray $data - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeByteArray($data){ - if($this->writeObjectReference($data)){ - return $this; - } - - if(is_string($data)) { - //nothing to do - } else if ($data instanceof Zend_Amf_Value_ByteArray) { - $data = $data->getData(); - } else { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Invalid ByteArray specified; must be a string or Zend_Amf_Value_ByteArray'); - } - - $this->writeBinaryString($data); - - return $this; - } - - /** - * Send xml to output stream - * - * @param DOMDocument|SimpleXMLElement $xml - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeXml($xml) - { - if($this->writeObjectReference($xml)){ - return $this; - } - - if(is_string($xml)) { - //nothing to do - } else if ($xml instanceof DOMDocument) { - $xml = $xml->saveXml(); - } else if ($xml instanceof SimpleXMLElement) { - $xml = $xml->asXML(); - } else { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Invalid xml specified; must be a DOMDocument or SimpleXMLElement'); - } - - $this->writeBinaryString($xml); - - return $this; - } - - /** - * Convert DateTime/Zend_Date to AMF date - * - * @param DateTime|Zend_Date $date - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeDate($date) - { - if($this->writeObjectReference($date)){ - return $this; - } - - if ($date instanceof DateTime) { - $dateString = $date->format('U') * 1000; - } elseif ($date instanceof Zend_Date) { - $dateString = $date->toString('U') * 1000; - } else { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Invalid date specified; must be a string DateTime or Zend_Date object'); - } - - $this->writeInteger(0x01); - // write time to stream minus milliseconds - $this->_stream->writeDouble($dateString); - return $this; - } - - /** - * Write a PHP array back to the amf output stream - * - * @param array $array - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeArray(array $array) - { - // arrays aren't reference here but still counted - $this->_referenceObjects[] = $array; - - // have to seperate mixed from numberic keys. - $numeric = array(); - $string = array(); - foreach ($array as $key => $value) { - if (is_int($key)) { - $numeric[] = $value; - } else { - $string[$key] = $value; - } - } - - // write the preamble id of the array - $length = count($numeric); - $id = ($length << 1) | 0x01; - $this->writeInteger($id); - - //Write the mixed type array to the output stream - foreach($string as $key => $value) { - $this->writeString($key) - ->writeTypeMarker($value); - } - $this->writeString(''); - - // Write the numeric array to ouput stream - foreach($numeric as $value) { - $this->writeTypeMarker($value); - } - return $this; - } - - /** - * Check if the given object is in the reference table, write the reference if it exists, - * otherwise add the object to the reference table - * - * @param mixed $object object to check for reference - * @return Boolean true, if the reference was written, false otherwise - */ - protected function writeObjectReference($object) - { - $ref = array_search($object, $this->_referenceObjects,true); - //quickly handle object references - if($ref !== false){ - $ref <<= 1; - $this->writeInteger($ref); - return true; - } - $this->_referenceObjects[] = $object; - return false; - } - - /** - * Write object to ouput stream - * - * @param mixed $data - * @return Zend_Amf_Parse_Amf3_Serializer - */ - public function writeObject($object) - { - if($this->writeObjectReference($object)){ - return $this; - } - - $className = ''; - - //Check to see if the object is a typed object and we need to change - switch (true) { - // the return class mapped name back to actionscript class name. - case ($className = Zend_Amf_Parse_TypeLoader::getMappedClassName(get_class($object))): - break; - - // Check to see if the user has defined an explicit Action Script type. - case isset($object->_explicitType): - $className = $object->_explicitType; - break; - - // Check if user has defined a method for accessing the Action Script type - case method_exists($object, 'getASClassName'): - $className = $object->getASClassName(); - break; - - // No return class name is set make it a generic object - case ($object instanceof stdClass): - $className = ''; - break; - - // By default, use object's class name - default: - $className = get_class($object); - break; - } - - $writeTraits = true; - - //check to see, if we have a corresponding definition - if(array_key_exists($className, $this->_referenceDefinitions)){ - $traitsInfo = $this->_referenceDefinitions[$className]['id']; - $encoding = $this->_referenceDefinitions[$className]['encoding']; - $propertyNames = $this->_referenceDefinitions[$className]['propertyNames']; - - $traitsInfo = ($traitsInfo << 2) | 0x01; - - $writeTraits = false; - } else { - $propertyNames = array(); - - if($className == ''){ - //if there is no className, we interpret the class as dynamic without any sealed members - $encoding = Zend_Amf_Constants::ET_DYNAMIC; - } else { - $encoding = Zend_Amf_Constants::ET_PROPLIST; - - foreach($object as $key => $value) { - if( $key[0] != "_") { - $propertyNames[] = $key; - } - } - } - - $this->_referenceDefinitions[$className] = array( - 'id' => count($this->_referenceDefinitions), - 'encoding' => $encoding, - 'propertyNames' => $propertyNames, - ); - - $traitsInfo = Zend_Amf_Constants::AMF3_OBJECT_ENCODING; - $traitsInfo |= $encoding << 2; - $traitsInfo |= (count($propertyNames) << 4); - } - - $this->writeInteger($traitsInfo); - - if($writeTraits){ - $this->writeString($className); - foreach ($propertyNames as $value) { - $this->writeString($value); - } - } - - try { - switch($encoding) { - case Zend_Amf_Constants::ET_PROPLIST: - //Write the sealed values to the output stream. - foreach ($propertyNames as $key) { - $this->writeTypeMarker($object->$key); - } - break; - case Zend_Amf_Constants::ET_DYNAMIC: - //Write the sealed values to the output stream. - foreach ($propertyNames as $key) { - $this->writeTypeMarker($object->$key); - } - - //Write remaining properties - foreach($object as $key => $value){ - if(!in_array($key,$propertyNames) && $key[0] != "_"){ - $this->writeString($key); - $this->writeTypeMarker($value); - } - } - - //Write an empty string to end the dynamic part - $this->writeString(''); - break; - case Zend_Amf_Constants::ET_EXTERNAL: - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('External Object Encoding not implemented'); - break; - default: - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unknown Object Encoding type: ' . $encoding); - } - } catch (Exception $e) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unable to writeObject output: ' . $e->getMessage(), 0, $e); - } - - return $this; - } -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Deserializer.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Deserializer.php deleted file mode 100644 index 4f697bb1f..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/Deserializer.php +++ /dev/null @@ -1,65 +0,0 @@ -_stream = $stream; - } - - /** - * Checks for AMF marker types and calls the appropriate methods - * for deserializing those marker types. Markers are the data type of - * the following value. - * - * @param int $typeMarker - * @return mixed Whatever the data type is of the marker in php - */ - public abstract function readTypeMarker($markerType = null); -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/InputStream.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/InputStream.php deleted file mode 100644 index 03dff2f6b..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/InputStream.php +++ /dev/null @@ -1,39 +0,0 @@ -_stream = $stream; - } - - /** - * Find the PHP object type and convert it into an AMF object type - * - * @param mixed $content - * @param int $markerType - * @return void - */ - public abstract function writeTypeMarker($content, $markerType=null); -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/TypeLoader.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/TypeLoader.php deleted file mode 100644 index 85aab3212..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Parse/TypeLoader.php +++ /dev/null @@ -1,231 +0,0 @@ - 'Zend_Amf_Value_Messaging_AcknowledgeMessage', - 'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_AsyncMessage', - 'flex.messaging.messages.CommandMessage' => 'Zend_Amf_Value_Messaging_CommandMessage', - 'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_ErrorMessage', - 'flex.messaging.messages.RemotingMessage' => 'Zend_Amf_Value_Messaging_RemotingMessage', - 'flex.messaging.io.ArrayCollection' => 'Zend_Amf_Value_Messaging_ArrayCollection', - ); - - /** - * @var array Default class map - */ - protected static $_defaultClassMap = array( - 'flex.messaging.messages.AcknowledgeMessage' => 'Zend_Amf_Value_Messaging_AcknowledgeMessage', - 'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_AsyncMessage', - 'flex.messaging.messages.CommandMessage' => 'Zend_Amf_Value_Messaging_CommandMessage', - 'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_ErrorMessage', - 'flex.messaging.messages.RemotingMessage' => 'Zend_Amf_Value_Messaging_RemotingMessage', - 'flex.messaging.io.ArrayCollection' => 'Zend_Amf_Value_Messaging_ArrayCollection', - ); - - /** - * @var Zend_Loader_PluginLoader_Interface - */ - protected static $_resourceLoader = null; - - - /** - * Load the mapped class type into a callback. - * - * @param string $className - * @return object|false - */ - public static function loadType($className) - { - $class = self::getMappedClassName($className); - if(!$class) { - $class = str_replace('.', '_', $className); - } - if (!class_exists($class)) { - return "stdClass"; - } - return $class; - } - - /** - * Looks up the supplied call name to its mapped class name - * - * @param string $className - * @return string - */ - public static function getMappedClassName($className) - { - $mappedName = array_search($className, self::$classMap); - - if ($mappedName) { - return $mappedName; - } - - $mappedName = array_search($className, array_flip(self::$classMap)); - - if ($mappedName) { - return $mappedName; - } - - return false; - } - - /** - * Map PHP class names to ActionScript class names - * - * Allows users to map the class names of there action script classes - * to the equivelent php class name. Used in deserialization to load a class - * and serialiation to set the class name of the returned object. - * - * @param string $asClassName - * @param string $phpClassName - * @return void - */ - public static function setMapping($asClassName, $phpClassName) - { - self::$classMap[$asClassName] = $phpClassName; - } - - /** - * Reset type map - * - * @return void - */ - public static function resetMap() - { - self::$classMap = self::$_defaultClassMap; - } - - /** - * Set loader for resource type handlers - * - * @param Zend_Loader_PluginLoader_Interface $loader - */ - public static function setResourceLoader(Zend_Loader_PluginLoader_Interface $loader) - { - self::$_resourceLoader = $loader; - } - - /** - * Add directory to the list of places where to look for resource handlers - * - * @param string $prefix - * @param string $dir - */ - public static function addResourceDirectory($prefix, $dir) - { - if(self::$_resourceLoader) { - self::$_resourceLoader->addPrefixPath($prefix, $dir); - } - } - - /** - * Get plugin class that handles this resource - * - * @param resource $resource Resource type - * @return string Class name - */ - public static function getResourceParser($resource) - { - if(self::$_resourceLoader) { - $type = preg_replace("/[^A-Za-z0-9_]/", " ", get_resource_type($resource)); - $type = str_replace(" ","", ucwords($type)); - return self::$_resourceLoader->load($type); - } - return false; - } - - /** - * Convert resource to a serializable object - * - * @param resource $resource - * @return mixed - */ - public static function handleResource($resource) - { - if(!self::$_resourceLoader) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Unable to handle resources - resource plugin loader not set'); - } - try { - while(is_resource($resource)) { - $resclass = self::getResourceParser($resource); - if(!$resclass) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource)); - } - $parser = new $resclass(); - if(is_callable(array($parser, 'parse'))) { - $resource = $parser->parse($resource); - } else { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception("Could not call parse() method on class $resclass"); - } - } - return $resource; - } catch(Zend_Amf_Exception $e) { - throw new Zend_Amf_Exception($e->getMessage(), $e->getCode(), $e); - } catch(Exception $e) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource), 0, $e); - } - } -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Util/BinaryStream.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Util/BinaryStream.php deleted file mode 100644 index faa532af4..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Util/BinaryStream.php +++ /dev/null @@ -1,285 +0,0 @@ -_stream = $stream; - $this->_needle = 0; - $this->_streamLength = strlen($stream); - $this->_bigEndian = (pack('l', 1) === "\x00\x00\x00\x01"); - } - - /** - * Returns the current stream - * - * @return string - */ - public function getStream() - { - return $this->_stream; - } - - /** - * Read the number of bytes in a row for the length supplied. - * - * @todo Should check that there are enough bytes left in the stream we are about to read. - * @param int $length - * @return string - * @throws Zend_Amf_Exception for buffer underrun - */ - public function readBytes($length) - { - if (($length + $this->_needle) > $this->_streamLength) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length); - } - $bytes = substr($this->_stream, $this->_needle, $length); - $this->_needle+= $length; - return $bytes; - } - - /** - * Write any length of bytes to the stream - * - * Usually a string. - * - * @param string $bytes - * @return Zend_Amf_Util_BinaryStream - */ - public function writeBytes($bytes) - { - $this->_stream.= $bytes; - return $this; - } - - /** - * Reads a signed byte - * - * @return int Value is in the range of -128 to 127. - */ - public function readByte() - { - if (($this->_needle + 1) > $this->_streamLength) { - require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length); - } - - return ord($this->_stream{$this->_needle++}); - } - - /** - * Writes the passed string into a signed byte on the stream. - * - * @param string $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeByte($stream) - { - $this->_stream.= pack('c', $stream); - return $this; - } - - /** - * Reads a signed 32-bit integer from the data stream. - * - * @return int Value is in the range of -2147483648 to 2147483647 - */ - public function readInt() - { - return ($this->readByte() << 8) + $this->readByte(); - } - - /** - * Write an the integer to the output stream as a 32 bit signed integer - * - * @param int $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeInt($stream) - { - $this->_stream.= pack('n', $stream); - return $this; - } - - /** - * Reads a UTF-8 string from the data stream - * - * @return string A UTF-8 string produced by the byte representation of characters - */ - public function readUtf() - { - $length = $this->readInt(); - return $this->readBytes($length); - } - - /** - * Wite a UTF-8 string to the outputstream - * - * @param string $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeUtf($stream) - { - $this->writeInt(strlen($stream)); - $this->_stream.= $stream; - return $this; - } - - - /** - * Read a long UTF string - * - * @return string - */ - public function readLongUtf() - { - $length = $this->readLong(); - return $this->readBytes($length); - } - - /** - * Write a long UTF string to the buffer - * - * @param string $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeLongUtf($stream) - { - $this->writeLong(strlen($stream)); - $this->_stream.= $stream; - } - - /** - * Read a long numeric value - * - * @return double - */ - public function readLong() - { - return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); - } - - /** - * Write long numeric value to output stream - * - * @param int|string $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeLong($stream) - { - $this->_stream.= pack('N', $stream); - return $this; - } - - /** - * Read a 16 bit unsigned short. - * - * @todo This could use the unpack() w/ S,n, or v - * @return double - */ - public function readUnsignedShort() - { - $byte1 = $this->readByte(); - $byte2 = $this->readByte(); - return (($byte1 << 8) | $byte2); - } - - /** - * Reads an IEEE 754 double-precision floating point number from the data stream. - * - * @return double Floating point number - */ - public function readDouble() - { - $bytes = substr($this->_stream, $this->_needle, 8); - $this->_needle+= 8; - - if (!$this->_bigEndian) { - $bytes = strrev($bytes); - } - - $double = unpack('dflt', $bytes); - return $double['flt']; - } - - /** - * Writes an IEEE 754 double-precision floating point number from the data stream. - * - * @param string|double $stream - * @return Zend_Amf_Util_BinaryStream - */ - public function writeDouble($stream) - { - $stream = pack('d', $stream); - if (!$this->_bigEndian) { - $stream = strrev($stream); - } - $this->_stream.= $stream; - return $this; - } - -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AbstractMessage.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AbstractMessage.php deleted file mode 100644 index 1974405a5..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AbstractMessage.php +++ /dev/null @@ -1,92 +0,0 @@ -clientId = $this->generateId(); - $this->destination = null; - $this->messageId = $this->generateId(); - $this->timestamp = time().'00'; - $this->timeToLive = 0; - $this->headers = new STDClass(); - $this->body = null; - - // correleate the two messages - if ($message && isset($message->messageId)) { - $this->correlationId = $message->messageId; - } - } -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AsyncMessage.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AsyncMessage.php deleted file mode 100644 index 0e02f2ee1..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/AsyncMessage.php +++ /dev/null @@ -1,43 +0,0 @@ -body - * of the message. - */ - const LOGIN_OPERATION = 8; - - /** - * This operation is used to log the user out of the current channel, and - * will invalidate the server session if the channel is HTTP based. - */ - const LOGOUT_OPERATION = 9; - - /** - * This operation is used to indicate that the client's subscription to a - * remote destination has been invalidated. - */ - const SESSION_INVALIDATE_OPERATION = 10; - - /** - * This operation is used by the MultiTopicConsumer to subscribe/unsubscribe - * from multiple subtopics/selectors in the same message. - */ - const MULTI_SUBSCRIBE_OPERATION = 11; - - /** - * This operation is used to indicate that a channel has disconnected - */ - const DISCONNECT_OPERATION = 12; - - /** - * This is the default operation for new CommandMessage instances. - */ - const UNKNOWN_OPERATION = 10000; - - /** - * The operation to execute for messages of this type - * @var int - */ - public $operation = self::UNKNOWN_OPERATION; -} diff --git a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/ErrorMessage.php b/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/ErrorMessage.php deleted file mode 100644 index 93da0e929..000000000 --- a/gulliver/thirdparty/restler/amfformat/Zend/Amf/Value/Messaging/ErrorMessage.php +++ /dev/null @@ -1,67 +0,0 @@ -clientId = $this->generateId(); - $this->destination = null; - $this->messageId = $this->generateId(); - $this->timestamp = time().'00'; - $this->timeToLive = 0; - $this->headers = new stdClass(); - $this->body = null; - } -} diff --git a/gulliver/thirdparty/restler/amfformat/amfformat.php b/gulliver/thirdparty/restler/amfformat/amfformat.php deleted file mode 100644 index d070d2143..000000000 --- a/gulliver/thirdparty/restler/amfformat/amfformat.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ - -class AmfFormat implements iFormat -{ - const PATH = '/Zend/Amf/Parse/'; - const MIME = 'application/x-amf'; - const EXTENSION = 'amf'; - - public $path = ''; - - public function init(){ - $this->path = dirname(__FILE__); - $include_path = get_include_path(); - if(strpos($include_path, 'Zend')===FALSE){ - set_include_path($this->path.':'.$include_path); - } - $this->path .= AmfFormat::PATH; - } - - public function getMIMEMap() - { - return array(AmfFormat::EXTENSION=>AmfFormat::MIME); - } - public function getMIME(){ - return AmfFormat::MIME; - } - public function getExtension(){ - return AmfFormat::EXTENSION; - } - public function setMIME($mime){ - //do nothing - } - public function setExtension($extension){ - //do nothing - } - - public function encode($data, $human_readable=false){ - $this->init(); - require_once $this->path . 'OutputStream.php'; - require_once $this->path . 'Amf3/Serializer.php'; - $stream = new Zend_Amf_Parse_OutputStream(); - $serializer = new Zend_Amf_Parse_Amf3_Serializer($stream); - $serializer->writeTypeMarker($data); - return $stream->getStream(); - } - - public function decode($data){ - $this->init(); - require_once $this->path .'InputStream.php'; - require_once $this->path .'Amf3/Deserializer.php'; - $stream = new Zend_Amf_Parse_InputStream(substr($data, 1)); - $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream); - return $deserializer->readTypeMarker(); - } - - public function __toString(){ - return $this->getExtension(); - } -} \ No newline at end of file diff --git a/gulliver/thirdparty/restler/compat.php b/gulliver/thirdparty/restler/compat.php deleted file mode 100644 index 08a950d20..000000000 --- a/gulliver/thirdparty/restler/compat.php +++ /dev/null @@ -1,58 +0,0 @@ -0){ - die('Restler requires PHP 5.x.x'); -} -#requires 5.3.2 -if(!method_exists('ReflectionMethod', 'setAccessible')){ - #echo'RESTLER_METHOD_UNPROTECTION_MODE'; - function isRestlerCompatibilityModeEnabled(){ - return TRUE; - } - function unprotect($method_info){ - $class_name = $method_info->class_name; - $method = $method_info->method_name; - $params = $method_info->arguments; - $unique = uniqid('Dynamic')."_"; - $class_code = "class $unique$class_name extends $class_name {"; - $p = array(); - for ($i = 0; $i < count($params); $i++) { - $p[]='$'."P$i"; - } - $p = implode(',', $p); - $class_code .= "function $unique$method($p){return parent::$method($p);}"; - $class_code .= "}"; - #echo $class_code; - eval($class_code); - $method_info->class_name = "$unique$class_name"; - $method_info->method_name = "$unique$method"; - return $method_info; - } - function call_protected_user_method_array($class_name, $method, $params) - { - if(is_object($class_name))$class_name = get_class($class_name); - $unique = uniqid('Dynamic')."_"; - $class_code = "class $unique$class_name extends $class_name {"; - $p = array(); - for ($i = 0; $i < count($params); $i++) { - $p[]='$'."P$i"; - } - $p = implode(',', $p); - $class_code .= "function $unique$method($p){return parent::$method($p);}"; - $class_code .= "}"; - #echo $class_code; - eval($class_code); - $obj = $unique.$class_name; - $obj = new $obj(); - return call_user_func_array(array($obj,$unique.$method), $params); - } -} - -#requires 5.2.3 -#if(!method_exists('ReflectionParameter', 'getPosition')){ -#found fix! not using getPosition in restler 2.0 -#} - -#requires 5.3.0 -#if(!defined('__DIR__')){ -# avoided using it in Restler and replaced it with dirname(__FILE__) -#} diff --git a/gulliver/thirdparty/restler/plistformat/CFBinaryPropertyList.php b/gulliver/thirdparty/restler/plistformat/CFBinaryPropertyList.php deleted file mode 100644 index f946193da..000000000 --- a/gulliver/thirdparty/restler/plistformat/CFBinaryPropertyList.php +++ /dev/null @@ -1,970 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @version $Id$ - */ - -/** - * Facility for reading and writing binary PropertyLists. Ported from {@link http://www.opensource.apple.com/source/CF/CF-476.15/CFBinaryPList.c CFBinaryPList.c}. - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @example example-read-02.php Read a Binary PropertyList - * @example example-read-03.php Read a PropertyList without knowing the type - */ -abstract class CFBinaryPropertyList { - /** - * Content of the plist (unparsed string) - * @var string - */ - protected $content = NULL; - - /** - * position in the (unparsed) string - * @var integer - */ - protected $pos = 0; - - /** - * Table containing uniqued objects - * @var array - */ - protected $uniqueTable = Array(); - - /** - * Number of objects in file - * @var integer - */ - protected $countObjects = 0; - - /** - * The length of all strings in the file (byte length, not character length) - * @var integer - */ - protected $stringSize = 0; - - /** - * The length of all ints in file (byte length) - * @var integer - */ - protected $intSize = 0; - - /** - * The length of misc objects (i.e. not integer and not string) in file - * @var integer - */ - protected $miscSize = 0; - - /** - * Number of object references in file (needed to calculate reference byte length) - * @var integer - */ - protected $objectRefs = 0; - - /** - * Number of objects written during save phase; needed to calculate the size of the object table - * @var integer - */ - protected $writtenObjectCount = 0; - - /** - * Table containing all objects in the file - */ - protected $objectTable = Array(); - - /** - * The size of object references - */ - protected $objectRefSize = 0; - - /** - * The „offsets” (i.e. the different entries) in the file - */ - protected $offsets = Array(); - - /** - * Read a „null type” (filler byte, true, false, 0 byte) - * @param $length The byte itself - * @return the byte value (e.g. CFBoolean(true), CFBoolean(false), 0 or 15) - * @throws PListException on encountering an unknown null type - */ - protected function readBinaryNullType($length) { - switch($length) { - case 0: return 0; // null type - case 8: return new CFBoolean(false); - case 9: return new CFBoolean(true); - case 15: return 15; // fill type - } - - throw new PListException("unknown null type: $length"); - } - - /** - * Create an 64 bit integer using bcmath or gmp - * @param int $hi The higher word - * @param int $lo The lower word - * @return mixed The integer (as int if possible, as string if not possible) - * @throws PListException if neither gmp nor bc available - */ - protected static function make64Int($hi,$lo) { - // on x64, we can just use int - if(PHP_INT_SIZE > 4) return (((int)$hi)<<32) | ((int)$lo); - - // lower word has to be unsigned since we don't use bitwise or, we use bcadd/gmp_add - $lo = sprintf("%u", $lo); - - // use GMP or bcmath if possible - if(function_exists("gmp_mul")) return gmp_strval(gmp_add(gmp_mul($hi, "4294967296"), $lo)); - - if(function_exists("bcmul")) return bcadd(bcmul($hi,"4294967296"), $lo); - - if(class_exists('Math_BigInteger')) { - $bi = new Math_BigInteger($hi); - return $bi->multiply("4294967296")->add($lo)->toString(); - } - - throw new PListException("either gmp or bc has to be installed, or the Math_BigInteger has to be available!"); - } - - /** - * Read an integer value - * @param integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” - * @return CFNumber The integer value - * @throws PListException if integer val is invalid - * @throws IOException if read error occurs - * @uses make64Int() to overcome PHP's big integer problems - */ - protected function readBinaryInt($length) { - if($length > 3) throw new PListException("Integer greater than 8 bytes: $length"); - - $nbytes = 1 << $length; - - $val = null; - if(strlen($buff = substr($this->content, $this->pos, $nbytes)) != $nbytes) throw IOException::readError(""); - $this->pos += $nbytes; - - switch($length) { - case 0: - $val = unpack("C", $buff); - $val = $val[1]; - break; - case 1: - $val = unpack("n", $buff); - $val = $val[1]; - break; - case 2: - $val = unpack("N", $buff); - $val = $val[1]; - break; - case 3: - $words = unpack("Nhighword/Nlowword",$buff); - //$val = $words['highword'] << 32 | $words['lowword']; - $val = self::make64Int($words['highword'],$words['lowword']); - break; - } - - return new CFNumber($val); - } - - /** - * Read a real value - * @param integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” - * @return CFNumber The real value - * @throws PListException if real val is invalid - * @throws IOException if read error occurs - */ - protected function readBinaryReal($length) { - if($length > 3) throw new PListException("Real greater than 8 bytes: $length"); - - $nbytes = 1 << $length; - $val = null; - if(strlen($buff = substr($this->content,$this->pos, $nbytes)) != $nbytes) throw IOException::readError(""); - $this->pos += $nbytes; - - switch($length) { - case 0: // 1 byte float? must be an error - case 1: // 2 byte float? must be an error - $x = $length + 1; - throw new PListException("got {$x} byte float, must be an error!"); - case 2: - $val = unpack("f", strrev($buff)); - $val = $val[1]; - break; - case 3: - $val = unpack("d", strrev($buff)); - $val = $val[1]; - break; - } - - return new CFNumber($val); - } - - /** - * Read a date value - * @param integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” - * @return CFDate The date value - * @throws PListException if date val is invalid - * @throws IOException if read error occurs - */ - protected function readBinaryDate($length) { - if($length > 3) throw new PListException("Date greater than 8 bytes: $length"); - - $nbytes = 1 << $length; - $val = null; - if(strlen($buff = substr($this->content, $this->pos, $nbytes)) != $nbytes) throw IOException::readError(""); - $this->pos += $nbytes; - - switch($length) { - case 0: // 1 byte CFDate is an error - case 1: // 2 byte CFDate is an error - $x = $length + 1; - throw new PListException("{$x} byte CFdate, error"); - - case 2: - $val = unpack("f", strrev($buff)); - $val = $val[1]; - break; - case 3: - $val = unpack("d", strrev($buff)); - $val = $val[1]; - break; - } - - return new CFDate($val,CFDate::TIMESTAMP_APPLE); - } - - /** - * Read a data value - * @param integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” - * @return CFData The data value - * @throws IOException if read error occurs - */ - protected function readBinaryData($length) { - if($length == 0) $buff = ""; - else { - $buff = substr($this->content, $this->pos, $length); - if(strlen($buff) != $length) throw IOException::readError(""); - $this->pos += $length; - } - - return new CFData($buff,false); - } - - /** - * Read a string value, usually coded as utf8 - * @param integer $length The length (in bytes) of the string value - * @return CFString The string value, utf8 encoded - * @throws IOException if read error occurs - */ - protected function readBinaryString($length) { - if($length == 0) $buff = ""; - else { - if(strlen($buff = substr($this->content, $this->pos, $length)) != $length) throw IOException::readError(""); - $this->pos += $length; - } - - if(!isset($this->uniqueTable[$buff])) $this->uniqueTable[$buff] = true; - return new CFString($buff); - } - - /** - * Convert the given string from one charset to another. - * Trying to use MBString, Iconv, Recode - in that particular order. - * @param string $string the string to convert - * @param string $fromCharset the charset the given string is currently encoded in - * @param string $toCharset the charset to convert to, defaults to UTF-8 - * @return string the converted string - * @throws PListException on neither MBString, Iconv, Recode being available - */ - public static function convertCharset($string, $fromCharset, $toCharset='UTF-8') { - if(function_exists('mb_convert_encoding')) return mb_convert_encoding($string, $toCharset, $fromCharset); - if(function_exists('iconv')) return iconv($fromCharset, $toCharset, $string); - if(function_exists('recode_string')) return recode_string($fromCharset .'..'. $toCharset, $string); - - throw new PListException('neither iconv nor mbstring supported. how are we supposed to work on strings here?'); - } - - /** - * Count characters considering character set - * Trying to use MBString, Iconv - in that particular order. - * @param string $string the string to convert - * @param string $charset the charset the given string is currently encoded in - * @return integer The number of characters in that string - * @throws PListException on neither MBString, Iconv being available - */ - public static function charsetStrlen($string,$charset="UTF-8") { - if(function_exists('mb_strlen')) return mb_strlen($string, $charset); - if(function_exists('iconv_strlen')) return iconv_strlen($string,$charset); - - throw new PListException('neither iconv nor mbstring supported. how are we supposed to work on strings here?'); - } - - /** - * Read a unicode string value, coded as UTF-16BE - * @param integer $length The length (in bytes) of the string value - * @return CFString The string value, utf8 encoded - * @throws IOException if read error occurs - */ - protected function readBinaryUnicodeString($length) { - /* The problem is: we get the length of the string IN CHARACTERS; - since a char in UTF-16 can be 16 or 32 bit long, we don't really know - how long the string is in bytes */ - if(strlen($buff = substr($this->content, $this->pos, 2*$length)) != 2*$length) throw IOException::readError(""); - $this->pos += 2 * $length; - - if(!isset($this->uniqueTable[$buff])) $this->uniqueTable[$buff] = true; - return new CFString(self::convertCharset($buff, "UTF-16BE", "UTF-8")); - } - - /** - * Read an array value, including contained objects - * @param integer $length The number of contained objects - * @return CFArray The array value, including the objects - * @throws IOException if read error occurs - */ - protected function readBinaryArray($length) { - $ary = new CFArray(); - - // first: read object refs - if($length != 0) { - if(strlen($buff = substr($this->content, $this->pos, $length * $this->objectRefSize)) != $length * $this->objectRefSize) throw IOException::readError(""); - $this->pos += $length * $this->objectRefSize; - - $objects = unpack($this->objectRefSize == 1 ? "C*" : "n*", $buff); - - // now: read objects - for($i=0;$i<$length;++$i) { - $object = $this->readBinaryObjectAt($objects[$i+1]+1,$this->objectRefSize); - $ary->add($object); - } - } - - return $ary; - } - - /** - * Read a dictionary value, including contained objects - * @param integer $length The number of contained objects - * @return CFDictionary The dictionary value, including the objects - * @throws IOException if read error occurs - */ - protected function readBinaryDict($length) { - $dict = new CFDictionary(); - - // first: read keys - if($length != 0) { - if(strlen($buff = substr($this->content, $this->pos, $length * $this->objectRefSize)) != $length * $this->objectRefSize) throw IOException::readError(""); - $this->pos += $length * $this->objectRefSize; - $keys = unpack(($this->objectRefSize == 1 ? "C*" : "n*"), $buff); - - // second: read object refs - if(strlen($buff = substr($this->content, $this->pos, $length * $this->objectRefSize)) != $length * $this->objectRefSize) throw IOException::readError(""); - $this->pos += $length * $this->objectRefSize; - $objects = unpack(($this->objectRefSize == 1 ? "C*" : "n*"), $buff); - - // read real keys and objects - for($i=0;$i<$length;++$i) { - $key = $this->readBinaryObjectAt($keys[$i+1]+1); - $object = $this->readBinaryObjectAt($objects[$i+1]+1); - $dict->add($key->getValue(),$object); - } - } - - return $dict; - } - - /** - * Read an object type byte, decode it and delegate to the correct reader function - * @return mixed The value of the delegate reader, so any of the CFType subclasses - * @throws IOException if read error occurs - */ - function readBinaryObject() { - // first: read the marker byte - if(strlen($buff = substr($this->content,$this->pos,1)) != 1) throw IOException::readError(""); - $this->pos++; - - $object_length = unpack("C*", $buff); - $object_length = $object_length[1] & 0xF; - $buff = unpack("H*", $buff); - $buff = $buff[1]; - - $object_type = substr($buff, 0, 1); - if($object_type != "0" && $object_length == 15) { - $object_length = $this->readBinaryObject($this->objectRefSize); - $object_length = $object_length->getValue(); - } - - $retval = null; - switch($object_type) { - case '0': // null, false, true, fillbyte - $retval = $this->readBinaryNullType($object_length); - break; - case '1': // integer - $retval = $this->readBinaryInt($object_length); - break; - case '2': // real - $retval = $this->readBinaryReal($object_length); - break; - case '3': // date - $retval = $this->readBinaryDate($object_length); - break; - case '4': // data - $retval = $this->readBinaryData($object_length); - break; - case '5': // byte string, usually utf8 encoded - $retval = $this->readBinaryString($object_length); - break; - case '6': // unicode string (utf16be) - $retval = $this->readBinaryUnicodeString($object_length); - break; - case 'a': // array - $retval = $this->readBinaryArray($object_length); - break; - case 'd': // dictionary - $retval = $this->readBinaryDict($object_length); - break; - } - - return $retval; - } - - /** - * Read an object type byte at position $pos, decode it and delegate to the correct reader function - * @param integer $pos The table position in the offsets table - * @return mixed The value of the delegate reader, so any of the CFType subclasses - */ - function readBinaryObjectAt($pos) { - $this->pos = $this->offsets[$pos]; - return $this->readBinaryObject(); - } - - /** - * Parse a binary plist string - * @return void - * @throws IOException if read error occurs - */ - public function parseBinaryString() { - $this->uniqueTable = Array(); - $this->countObjects = 0; - $this->stringSize = 0; - $this->intSize = 0; - $this->miscSize = 0; - $this->objectRefs = 0; - - $this->writtenObjectCount = 0; - $this->objectTable = Array(); - $this->objectRefSize = 0; - - $this->offsets = Array(); - - // first, we read the trailer: 32 byte from the end - $buff = substr($this->content,-32); - - $infos = unpack("x6/Coffset_size/Cobject_ref_size/x4/Nnumber_of_objects/x4/Ntop_object/x4/Ntable_offset",$buff); - - // after that, get the offset table - $coded_offset_table = substr($this->content,$infos['table_offset'],$infos['number_of_objects'] * $infos['offset_size']); - if(strlen($coded_offset_table) != $infos['number_of_objects'] * $infos['offset_size']) throw IOException::readError(""); - $this->countObjects = $infos['number_of_objects']; - - // decode offset table - $formats = Array("","C*","n*",NULL,"N*"); - if($infos['offset_size'] == 3) { # since PHP does not support parenthesis in pack/unpack expressions, - # "(H6)*" does not work and we have to work round this by repeating the - # expression as often as it fits in the string - $this->offsets = array(NULL); - while($coded_offset_table) { - $str = unpack("H6",$coded_offset_table); - $this->offsets[] = hexdec($str[1]); - $coded_offset_table = substr($coded_offset_table,3); - } - } - else $this->offsets = unpack($formats[$infos['offset_size']],$coded_offset_table); - - $this->uniqueTable = Array(); - $this->objectRefSize = $infos['object_ref_size']; - - $top = $this->readBinaryObjectAt($infos['top_object']+1); - $this->add($top); - } - - /** - * Read a binary plist stream - * @param resource $stream The stream to read - * @return void - * @throws IOException if read error occurs - */ - function readBinaryStream($stream) { - $str = stream_get_contents($stream); - $this->parseBinary($str); - } - - /** - * parse a binary plist string - * @param string $content The stream to read, defaults to {@link $this->content} - * @return void - * @throws IOException if read error occurs - */ - function parseBinary($content=NULL) { - if($content !== NULL) $this->content = $content; - $this->pos = 0; - - $this->parseBinaryString(); - } - - /** - * Read a binary plist file - * @param string $file The file to read - * @return void - * @throws IOException if read error occurs - */ - function readBinary($file) { - if(!($fd = fopen($file,"rb"))) throw new IOException("Could not open file {$file}!"); - $this->readBinaryStream($fd); - fclose($fd); - } - - /** - * calculate the bytes needed for a size integer value - * @param integer $int The integer value to calculate - * @return integer The number of bytes needed - */ - public static function bytesSizeInt($int) { - $nbytes = 0; - - if($int > 0xE) $nbytes += 2; // 2 size-bytes - if($int > 0xFF) $nbytes += 1; // 3 size-bytes - if($int > 0xFFFF) $nbytes += 2; // 5 size-bytes - - return $nbytes; - } - - /** - * Calculate the byte needed for a „normal” integer value - * @param integer $int The integer value - * @return integer The number of bytes needed + 1 (because of the „marker byte”) - */ - public static function bytesInt($int) { - $nbytes = 1; - - if($int > 0xFF) $nbytes += 1; // 2 byte integer - if($int > 0xFFFF) $nbytes += 2; // 4 byte integer - if($int > 0xFFFFFFFF) $nbytes += 4; // 8 byte integer - if($int < 0) $nbytes += 7; // 8 byte integer (since it is signed) - - return $nbytes + 1; // one „marker” byte - } - - /** - * „pack” a value (i.e. write the binary representation as big endian to a string) with the specified size - * @param integer $nbytes The number of bytes to pack - * @param integer $int the integer value to pack - * @return string The packed value as string - */ - public static function packItWithSize($nbytes,$int) { - $formats = Array("C", "n", "N", "N"); - $format = $formats[$nbytes-1]; - $ret = ''; - - if($nbytes == 3) return substr(pack($format, $int), -3); - return pack($format, $int); - } - - /** - * Calculate the bytes needed to save the number of objects - * @param integer $count_objects The number of objects - * @return integer The number of bytes - */ - public static function bytesNeeded($count_objects) { - $nbytes = 0; - - while($count_objects >= 1) { - $nbytes++; - $count_objects /= 256; - } - - return $nbytes; - } - - /** - * Code an integer to byte representation - * @param integer $int The integer value - * @return string The packed byte value - */ - public static function intBytes($int) { - $intbytes = ""; - - if($int > 0xFFFF) $intbytes = "\x12".pack("N", $int); // 4 byte integer - elseif($int > 0xFF) $intbytes = "\x11".pack("n", $int); // 2 byte integer - else $intbytes = "\x10".pack("C", $int); // 8 byte integer - - return $intbytes; - } - - /** - * Code an type byte, consisting of the type marker and the length of the type - * @param string $type The type byte value (i.e. "d" for dictionaries) - * @param integer $type_len The length of the type - * @return string The packed type byte value - */ - public static function typeBytes($type,$type_len) { - $optional_int = ""; - - if($type_len < 15) $type .= sprintf("%x", $type_len); - else { - $type .= "f"; - $optional_int = self::intBytes($type_len); - } - - return pack("H*", $type).$optional_int; - } - - /** - * Count number of objects and create a unique table for strings - * @param $value The value to count and unique - * @return void - */ - protected function uniqueAndCountValues($value) { - // no uniquing for other types than CFString and CFData - if($value instanceof CFNumber) { - $val = $value->getValue(); - if(intval($val) == $val && !is_float($val) && strpos($val,'.') === false) $this->intSize += self::bytesInt($val); - else $this->miscSize += 9; // 9 bytes (8 + marker byte) for real - $this->countObjects++; - return; - } - elseif($value instanceof CFDate) { - $this->miscSize += 9; // since date in plist is real, we need 9 byte (8 + marker byte) - $this->countObjects++; - return; - } - elseif($value instanceof CFBoolean) { - $this->countObjects++; - $this->miscSize += 1; - return; - } - elseif($value instanceof CFArray) { - $cnt = 0; - foreach($value as $v) { - ++$cnt; - $this->uniqueAndCountValues($v); - $this->objectRefs++; // each array member is a ref - } - - $this->countObjects++; - $this->intSize += self::bytesSizeInt($cnt); - $this->miscSize++; // marker byte for array - return; - } - elseif($value instanceof CFDictionary) { - $cnt = 0; - foreach($value as $k => $v) { - ++$cnt; - if(!isset($this->uniqueTable[$k])) { - $this->uniqueTable[$k] = 0; - $len = self::binaryStrlen($k); - $this->stringSize += $len + 1; - $this->intSize += self::bytesSizeInt(self::charsetStrlen($k,'UTF-8')); - } - - $this->objectRefs += 2; // both, key and value, are refs - $this->uniqueTable[$k]++; - $this->uniqueAndCountValues($v); - } - - $this->countObjects++; - $this->miscSize++; // marker byte for dict - $this->intSize += self::bytesSizeInt($cnt); - return; - } - elseif($value instanceOf CFData) { - $val = $value->getValue(); - $len = strlen($val); - $this->intSize += self::bytesSizeInt($len); - $this->miscSize += $len + 1; - $this->countObjects++; - return; - } - else $val = $value->getValue(); - - if(!isset($this->uniqueTable[$val])) { - $this->uniqueTable[$val] = 0; - $len = self::binaryStrlen($val); - $this->stringSize += $len + 1; - $this->intSize += self::bytesSizeInt(self::charsetStrlen($val,'UTF-8')); - } - $this->uniqueTable[$val]++; - } - - /** - * Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray - * @return string The binary plist content - */ - public function toBinary() { - $this->uniqueTable = Array(); - $this->countObjects = 0; - $this->stringSize = 0; - $this->intSize = 0; - $this->miscSize = 0; - $this->objectRefs = 0; - - $this->writtenObjectCount = 0; - $this->objectTable = Array(); - $this->objectRefSize = 0; - - $this->offsets = Array(); - - $binary_str = "bplist00"; - $value = $this->getValue(true); - $this->uniqueAndCountValues($value); - - $this->countObjects += count($this->uniqueTable); - $this->objectRefSize = self::bytesNeeded($this->countObjects); - $file_size = $this->stringSize + $this->intSize + $this->miscSize + $this->objectRefs * $this->objectRefSize + 40; - $offset_size = self::bytesNeeded($file_size); - $table_offset = $file_size - 32; - - $this->objectTable = Array(); - $this->writtenObjectCount = 0; - $this->uniqueTable = Array(); // we needed it to calculate several values - $value->toBinary($this); - - $object_offset = 8; - $offsets = Array(); - - for($i=0;$iobjectTable);++$i) { - $binary_str .= $this->objectTable[$i]; - $offsets[$i] = $object_offset; - $object_offset += strlen($this->objectTable[$i]); - } - - for($i=0;$iobjectRefSize); - $binary_str .= pack("x4N", $this->countObjects); - $binary_str .= pack("x4N", 0); - $binary_str .= pack("x4N", $table_offset); - - return $binary_str; - } - - /** - * Counts the number of bytes the string will have when coded; utf-16be if non-ascii characters are present. - * @param string $val The string value - * @return integer The length of the coded string in bytes - */ - protected static function binaryStrlen($val) { - for($i=0;$i= 128) { - $val = self::convertCharset($val, 'UTF-8', 'UTF-16BE'); - return strlen($val); - } - } - - return strlen($val); - } - - /** - * Uniques and transforms a string value to binary format and adds it to the object table - * @param string $val The string value - * @return integer The position in the object table - */ - public function stringToBinary($val) { - $saved_object_count = -1; - - if(!isset($this->uniqueTable[$val])) { - $saved_object_count = $this->writtenObjectCount++; - $this->uniqueTable[$val] = $saved_object_count; - $utf16 = false; - - for($i=0;$i= 128) { - $utf16 = true; - break; - } - } - - if($utf16) { - $bdata = self::typeBytes("6", mb_strlen($val,'UTF-8')); // 6 is 0110, unicode string (utf16be) - $val = self::convertCharset($val, 'UTF-8', 'UTF-16BE'); - $this->objectTable[$saved_object_count] = $bdata.$val; - } - else { - $bdata = self::typeBytes("5", strlen($val)); // 5 is 0101 which is an ASCII string (seems to be ASCII encoded) - $this->objectTable[$saved_object_count] = $bdata.$val; - } - } - else $saved_object_count = $this->uniqueTable[$val]; - - return $saved_object_count; - } - - /** - * Codes an integer to binary format - * @param integer $value The integer value - * @return string the coded integer - */ - protected function intToBinary($value) { - $nbytes = 0; - if($value > 0xFF) $nbytes = 1; // 1 byte integer - if($value > 0xFFFF) $nbytes += 1; // 4 byte integer - if($value > 0xFFFFFFFF) $nbytes += 1; // 8 byte integer - if($value < 0) $nbytes = 3; // 8 byte integer, since signed - - $bdata = self::typeBytes("1", $nbytes); // 1 is 0001, type indicator for integer - $buff = ""; - - if($nbytes < 3) { - if($nbytes == 0) $fmt = "C"; - elseif($nbytes == 1) $fmt = "n"; - else $fmt = "N"; - - $buff = pack($fmt, $value); - } - else { - if(PHP_INT_SIZE > 4) { - // 64 bit signed integer; we need the higher and the lower 32 bit of the value - $high_word = $value >> 32; - $low_word = $value & 0xFFFFFFFF; - } - else { - // since PHP can only handle 32bit signed, we can only get 32bit signed values at this point - values above 0x7FFFFFFF are - // floats. So we ignore the existance of 64bit on non-64bit-machines - if($value < 0) $high_word = 0xFFFFFFFF; - else $high_word = 0; - $low_word = $value; - } - $buff = pack("N", $high_word).pack("N", $low_word); - } - - return $bdata.$buff; - } - - /** - * Codes a real value to binary format - * @param float $val The real value - * @return string The coded real - */ - protected function realToBinary($val) { - $bdata = self::typeBytes("2", 3); // 2 is 0010, type indicator for reals - return $bdata.strrev(pack("d", (float)$val)); - } - - /** - * Converts a numeric value to binary and adds it to the object table - * @param numeric $value The numeric value - * @return integer The position in the object table - */ - public function numToBinary($value) { - $saved_object_count = $this->writtenObjectCount++; - - $val = ""; - if(intval($value) == $value && !is_float($value) && strpos($value,'.') === false) $val = $this->intToBinary($value); - else $val = $this->realToBinary($value); - - $this->objectTable[$saved_object_count] = $val; - return $saved_object_count; - } - - /** - * Convert date value (apple format) to binary and adds it to the object table - * @param integer $value The date value - * @return integer The position of the coded value in the object table - */ - public function dateToBinary($val) { - $saved_object_count = $this->writtenObjectCount++; - - $hour = gmdate("H",$val); - $min = gmdate("i",$val); - $sec = gmdate("s",$val); - $mday = gmdate("j",$val); - $mon = gmdate("n",$val); - $year = gmdate("Y",$val); - - $val = gmmktime($hour,$min,$sec,$mon,$mday,$year) - CFDate::DATE_DIFF_APPLE_UNIX; // CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT - - $bdata = self::typeBytes("3", 3); // 3 is 0011, type indicator for date - $this->objectTable[$saved_object_count] = $bdata.strrev(pack("d", $val)); - - return $saved_object_count; - } - - /** - * Convert a bool value to binary and add it to the object table - * @param bool $val The boolean value - * @return integer The position in the object table - */ - public function boolToBinary($val) { - $saved_object_count = $this->writtenObjectCount++; - $this->objectTable[$saved_object_count] = $val ? "\x9" : "\x8"; // 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false - return $saved_object_count; - } - - /** - * Convert data value to binary format and add it to the object table - * @param string $val The data value - * @return integer The position in the object table - */ - public function dataToBinary($val) { - $saved_object_count = $this->writtenObjectCount++; - - $bdata = self::typeBytes("4", strlen($val)); // a is 1000, type indicator for data - $this->objectTable[$saved_object_count] = $bdata.$val; - - return $saved_object_count; - } - - /** - * Convert array to binary format and add it to the object table - * @param CFArray $val The array to convert - * @return integer The position in the object table - */ - public function arrayToBinary($val) { - $saved_object_count = $this->writtenObjectCount++; - - $bdata = self::typeBytes("a", count($val->getValue())); // a is 1010, type indicator for arrays - - foreach($val as $v) { - $bval = $v->toBinary($this); - $bdata .= self::packItWithSize($this->objectRefSize, $bval); - } - - $this->objectTable[$saved_object_count] = $bdata; - return $saved_object_count; - } - - /** - * Convert dictionary to binary format and add it to the object table - * @param CFDictionary $val The dict to convert - * @return integer The position in the object table - */ - public function dictToBinary($val) { - $saved_object_count = $this->writtenObjectCount++; - $bdata = self::typeBytes("d", count($val->getValue())); // d=1101, type indicator for dictionary - - foreach($val as $k => $v) { - $str = new CFString($k); - $key = $str->toBinary($this); - $bdata .= self::packItWithSize($this->objectRefSize, $key); - } - - foreach($val as $k => $v) { - $bval = $v->toBinary($this); - $bdata .= self::packItWithSize($this->objectRefSize, $bval); - } - - $this->objectTable[$saved_object_count] = $bdata; - return $saved_object_count; - } - -} - - -?> diff --git a/gulliver/thirdparty/restler/plistformat/CFPropertyList.php b/gulliver/thirdparty/restler/plistformat/CFPropertyList.php deleted file mode 100644 index 2f53a3b48..000000000 --- a/gulliver/thirdparty/restler/plistformat/CFPropertyList.php +++ /dev/null @@ -1,586 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @version $Id$ - * @example example-read-01.php Read an XML PropertyList - * @example example-read-02.php Read a Binary PropertyList - * @example example-read-03.php Read a PropertyList without knowing the type - * @example example-create-01.php Using the CFPropertyList API - * @example example-create-02.php Using {@link CFTypeDetector} - * @example example-create-03.php Using {@link CFTypeDetector} with {@link CFDate} and {@link CFData} - * @example example-modify-01.php Read, modify and save a PropertyList - */ - -/** - * Require IOException, PListException, CFType and CFBinaryPropertyList - */ -require_once('IOException.php'); -require_once('PListException.php'); -require_once('CFType.php'); -require_once('CFBinaryPropertyList.php'); -require_once('CFTypeDetector.php'); - -/** - * Property List - * Interface for handling reading, editing and saving Property Lists as defined by Apple. - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @example example-read-01.php Read an XML PropertyList - * @example example-read-02.php Read a Binary PropertyList - * @example example-read-03.php Read a PropertyList without knowing the type - * @example example-create-01.php Using the CFPropertyList API - * @example example-create-02.php Using {@link CFTypeDetector} - * @example example-create-03.php Using {@link CFTypeDetector} with {@link CFDate} and {@link CFData} - * @example example-create-04.php Using and extended {@link CFTypeDetector} - */ -class CFPropertyList extends CFBinaryPropertyList implements Iterator { - /** - * Format constant for binary format - * @var integer - */ - const FORMAT_BINARY = 1; - - /** - * Format constant for xml format - * @var integer - */ - const FORMAT_XML = 2; - - /** - * Format constant for automatic format recognizing - * @var integer - */ - const FORMAT_AUTO = 0; - - /** - * Path of PropertyList - * @var string - */ - protected $file = null; - - /** - * Path of PropertyList - * @var integer - */ - protected $format = null; - - /** - * CFType nodes - * @var array - */ - protected $value = array(); - - /** - * Position of iterator {@link http://php.net/manual/en/class.iterator.php} - * @var integer - */ - protected $iteratorPosition = 0; - - /** - * List of Keys for numerical iterator access {@link http://php.net/manual/en/class.iterator.php} - * @var array - */ - protected $iteratorKeys = null; - - /** - * List of NodeNames to ClassNames for resolving plist-files - * @var array - */ - protected static $types = array( - 'string' => 'CFString', - 'real' => 'CFNumber', - 'integer' => 'CFNumber', - 'date' => 'CFDate', - 'true' => 'CFBoolean', - 'false' => 'CFBoolean', - 'data' => 'CFData', - 'array' => 'CFArray', - 'dict' => 'CFDictionary' - ); - - - /** - * Create new CFPropertyList. - * If a path to a PropertyList is specified, it is loaded automatically. - * @param string $file Path of PropertyList - * @param integer $format he format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link FORMAT_AUTO} - * @throws IOException if file could not be read by {@link load()} - * @uses $file for storing the current file, if specified - * @uses load() for loading the plist-file - */ - public function __construct($file=null,$format=self::FORMAT_AUTO) { - $this->file = $file; - $this->format = $format; - if($this->file) $this->load(); - } - - /** - * Load an XML PropertyList. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @return void - * @throws IOException if file could not be read - * @throws DOMException if XML-file could not be read properly - * @uses load() to actually load the file - */ - public function loadXML($file=null) { - $this->load($file,CFPropertyList::FORMAT_XML); - } - - /** - * Load an XML PropertyList. - * @param resource $stream A stream containing the xml document. - * @return void - * @throws IOException if stream could not be read - * @throws DOMException if XML-stream could not be read properly - */ - public function loadXMLStream($stream) { - if(($contents = stream_get_contents($stream)) === FALSE) throw IOException::notReadable(''); - $this->parse($content,CFPropertyList::FORMAT_XML); - } - - /** - * Load an binary PropertyList. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @return void - * @throws IOException if file could not be read - * @throws PListException if binary plist-file could not be read properly - * @uses load() to actually load the file - */ - public function loadBinary($file=null) { - $this->load($file,CFPropertyList::FORMAT_BINARY); - } - - /** - * Load an binary PropertyList. - * @param stream $stream Stream containing the PropertyList - * @return void - * @throws IOException if file could not be read - * @throws PListException if binary plist-file could not be read properly - * @uses parse() to actually load the file - */ - public function loadBinaryStream($stream) { - if(($contents = stream_get_contents($stream)) === FALSE) throw IOException::notReadable(''); - $this->parse($content,CFPropertyList::FORMAT_BINARY); - } - - /** - * Load a plist file. - * Load and import a plist file. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @param integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format} - * @return void - * @throws PListException if file format version is not 00 - * @throws IOException if file could not be read - * @throws DOMException if plist file could not be parsed properly - * @uses $file if argument $file was not specified - * @uses $value reset to empty array - * @uses import() for importing the values - */ - public function load($file=null,$format=null) { - $file = $file ? $file : $this->file; - $format = $format !== null ? $format : $this->format; - $this->value = array(); - - if(!is_readable($file)) throw IOException::notReadable($file); - - switch($format) { - case CFPropertyList::FORMAT_BINARY: - $this->readBinary($file); - break; - case CFPropertyList::FORMAT_AUTO: // what we now do is ugly, but neccessary to recognize the file format - $fd = fopen($file,"rb"); - if(($magic_number = fread($fd,8)) === false) throw IOException::notReadable($file); - fclose($fd); - - $filetype = substr($magic_number,0,6); - $version = substr($magic_number,-2); - - if($filetype == "bplist") { - if($version != "00") throw new PListException("Wrong file format version! Expected 00, got $version!"); - $this->readBinary($file); - break; - } - // else: xml format, break not neccessary - case CFPropertyList::FORMAT_XML: - $doc = new DOMDocument(); - if(!$doc->load($file)) throw new DOMException(); - $this->import($doc->documentElement, $this); - break; - } - } - - /** - * Parse a plist string. - * Parse and import a plist string. - * @param string $str String containing the PropertyList, defaults to {@link $content} - * @param integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format} - * @return void - * @throws PListException if file format version is not 00 - * @throws IOException if file could not be read - * @throws DOMException if plist file could not be parsed properly - * @uses $content if argument $str was not specified - * @uses $value reset to empty array - * @uses import() for importing the values - */ - public function parse($str=NULL,$format=NULL) { - $format = $format !== null ? $format : $this->format; - $str = $str !== null ? $str : $this->content; - $this->value = array(); - - switch($format) { - case CFPropertyList::FORMAT_BINARY: - $this->parseBinary($str); - break; - case CFPropertyList::FORMAT_AUTO: // what we now do is ugly, but neccessary to recognize the file format - if(($magic_number = substr($str,0,8)) === false) throw IOException::notReadable(""); - - $filetype = substr($magic_number,0,6); - $version = substr($magic_number,-2); - - if($filetype == "bplist") { - if($version != "00") throw new PListException("Wrong file format version! Expected 00, got $version!"); - $this->parseBinary($str); - break; - } - // else: xml format, break not neccessary - case CFPropertyList::FORMAT_XML: - $doc = new DOMDocument(); - if(!$doc->loadXML($str)) throw new DOMException(); - $this->import($doc->documentElement, $this); - break; - } - } - - /** - * Convert a DOMNode into a CFType. - * @param DOMNode $node Node to import children of - * @param CFDictionary|CFArray|CFPropertyList $parent - * @return void - */ - protected function import(DOMNode $node, $parent) { - // abort if there are no children - if(!$node->childNodes->length) return; - - foreach($node->childNodes as $n) { - // skip if we can't handle the element - if(!isset(self::$types[$n->nodeName])) continue; - - $class = self::$types[$n->nodeName]; - $key = null; - - // find previous if possible - $ps = $n->previousSibling; - while($ps && $ps->nodeName == '#text' && $ps->previousSibling) $ps = $ps->previousSibling; - - // read if possible - if($ps && $ps->nodeName == 'key') $key = $ps->firstChild->nodeValue; - - switch($n->nodeName) { - case 'date': - $value = new $class(CFDate::dateValue($n->nodeValue)); - break; - case 'data': - $value = new $class($n->nodeValue,true); - break; - case 'string': - $value = new $class($n->nodeValue); - break; - - case 'real': - case 'integer': - $value = new $class($n->nodeName == 'real' ? floatval($n->nodeValue) : intval($n->nodeValue)); - break; - - case 'true': - case 'false': - $value = new $class($n->nodeName == 'true'); - break; - - case 'array': - case 'dict': - $value = new $class(); - $this->import($n, $value); - break; - } - - // Dictionaries need a key - if($parent instanceof CFDictionary) $parent->add($key, $value); - // others don't - else $parent->add($value); - } - } - - /** - * Convert CFPropertyList to XML and save to file. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @return void - * @throws IOException if file could not be read - * @uses $file if $file was not specified - */ - public function saveXML($file) { - $this->save($file,CFPropertyList::FORMAT_XML); - } - - /** - * Convert CFPropertyList to binary format (bplist00) and save to file. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @return void - * @throws IOException if file could not be read - * @uses $file if $file was not specified - */ - public function saveBinary($file) { - $this->save($file,CFPropertyList::FORMAT_BINARY); - } - - /** - * Convert CFPropertyList to XML or binary and save to file. - * @param string $file Path of PropertyList, defaults to {@link $file} - * @param string $format Format of PropertyList, defaults to {@link $format} - * @return void - * @throws IOException if file could not be read - * @throws PListException if evaluated $format is neither {@link FORMAT_XML} nor {@link FORMAL_BINARY} - * @uses $file if $file was not specified - * @uses $format if $format was not specified - */ - public function save($file=null,$format=null) { - $file = $file ? $file : $this->file; - $format = $format ? $format : $this->format; - - if( !in_array( $format, array( self::FORMAT_BINARY, self::FORMAT_XML ) ) ) - throw new PListException( "format {$format} is not supported, use CFPropertyList::FORMAT_BINARY or CFPropertyList::FORMAT_XML" ); - - if(!file_exists($file)) { - // dirname("file.xml") == "" and is treated as the current working directory - if(!is_writable(dirname($file))) throw IOException::notWritable($file); - } - else if(!is_writable($file)) throw IOException::notWritable($file); - - $content = $format == self::FORMAT_BINARY ? $this->toBinary() : $this->toXML(); - - $fh = fopen($file, 'wb'); - fwrite($fh,$content); - fclose($fh); - } - - /** - * Convert CFPropertyList to XML - * @param bool $formatted Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false - * @return string The XML content - */ - public function toXML($formatted=false) { - $domimpl = new DOMImplementation(); - // - $dtd = $domimpl->createDocumentType('plist', '-//Apple Computer//DTD PLIST 1.0//EN', 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'); - $doc = $domimpl->createDocument(null, "plist", $dtd); - $doc->encoding = "UTF-8"; - - // format output - if($formatted) { - $doc->formatOutput = true; - $doc->preserveWhiteSpace = true; - } - - // get documentElement and set attribs - $plist = $doc->documentElement; - $plist->setAttribute('version', '1.0'); - - // add PropertyList's children - $plist->appendChild($this->getValue(true)->toXML($doc)); - - return $doc->saveXML(); - } - - - /************************************************************************************************ - * M A N I P U L A T I O N - ************************************************************************************************/ - - /** - * Add CFType to collection. - * @param CFType $value CFType to add to collection - * @return void - * @uses $value for adding $value - */ - public function add(CFType $value=null) { - // anything but CFType is null, null is an empty string - sad but true - if( !$value ) - $value = new CFString(); - - $this->value[] = $value; - } - - /** - * Get CFType from collection. - * @param integer $key Key of CFType to retrieve from collection - * @return CFType CFType found at $key, null else - * @uses $value for retrieving CFType of $key - */ - public function get($key) { - if(isset($this->value[$key])) return $this->value[$key]; - return null; - } - - /** - * Generic getter (magic) - * - * @param integer $key Key of CFType to retrieve from collection - * @return CFType CFType found at $key, null else - * @author Sean Coates - * @link http://php.net/oop5.overloading - */ - public function __get($key) { - return $this->get($key); - } - - /** - * Remove CFType from collection. - * @param integer $key Key of CFType to removes from collection - * @return CFType removed CFType, null else - * @uses $value for removing CFType of $key - */ - public function del($key) { - if(isset($this->value[$key])) { - $t = $this->value[$key]; - unset($this->value[$key]); - return $t; - } - - return null; - } - - /** - * Empty the collection - * @return array the removed CFTypes - * @uses $value for removing CFType of $key - */ - public function purge() { - $t = $this->value; - $this->value = array(); - return $t; - } - - /** - * Get first (and only) child, or complete collection. - * @param string $cftype if set to true returned value will be CFArray instead of an array in case of a collection - * @return CFType|array CFType or list of CFTypes known to the PropertyList - * @uses $value for retrieving CFTypes - */ - public function getValue($cftype=false) { - if(count($this->value) === 1) { - $t = array_values( $this->value ); - return $t[0]; - } - if($cftype) { - $t = new CFArray(); - foreach( $this->value as $value ) { - if( $value instanceof CFType ) $t->add($value); - } - return $t; - } - return $this->value; - } - - /** - * Create CFType-structure from guessing the data-types. - * The functionality has been moved to the more flexible {@link CFTypeDetector} facility. - * @param mixed $value Value to convert to CFType - * @param boolean $autoDictionary if true {@link CFArray}-detection is bypassed and arrays will be returned as {@link CFDictionary}. - * @return CFType CFType based on guessed type - * @uses CFTypeDetector for actual type detection - * @deprecated - */ - public static function guess($value, $autoDictionary=false) { - static $t = null; - if( $t === null ) - $t = new CFTypeDetector( $autoDictionary ); - - return $t->toCFType( $value ); - } - - - /************************************************************************************************ - * S E R I A L I Z I N G - ************************************************************************************************/ - - /** - * Get PropertyList as array. - * @return mixed primitive value of first (and only) CFType, or array of primitive values of collection - * @uses $value for retrieving CFTypes - */ - public function toArray() { - $a = array(); - foreach($this->value as $value) $a[] = $value->toArray(); - if(count($a) === 1) return $a[0]; - - return $a; - } - - - /************************************************************************************************ - * I T E R A T O R I N T E R F A C E - ************************************************************************************************/ - - /** - * Rewind {@link $iteratorPosition} to first position (being 0) - * @link http://php.net/manual/en/iterator.rewind.php - * @return void - * @uses $iteratorPosition set to 0 - * @uses $iteratorKeys store keys of {@link $value} - */ - public function rewind() { - $this->iteratorPosition = 0; - $this->iteratorKeys = array_keys($this->value); - } - - /** - * Get Iterator's current {@link CFType} identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.current.php - * @return CFType current Item - * @uses $iteratorPosition identify current key - * @uses $iteratorKeys identify current value - */ - public function current() { - return $this->value[$this->iteratorKeys[$this->iteratorPosition]]; - } - - /** - * Get Iterator's current key identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.key.php - * @return string key of the current Item - * @uses $iteratorPosition identify current key - * @uses $iteratorKeys identify current value - */ - public function key() { - return $this->iteratorKeys[$this->iteratorPosition]; - } - - /** - * Increment {@link $iteratorPosition} to address next {@see CFType} - * @link http://php.net/manual/en/iterator.next.php - * @return void - * @uses $iteratorPosition increment by 1 - */ - public function next() { - $this->iteratorPosition++; - } - - /** - * Test if {@link $iteratorPosition} addresses a valid element of {@link $value} - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean true if current position is valid, false else - * @uses $iteratorPosition test if within {@link $iteratorKeys} - * @uses $iteratorPosition test if within {@link $value} - */ - public function valid() { - return isset($this->iteratorKeys[$this->iteratorPosition]) && isset($this->value[$this->iteratorKeys[$this->iteratorPosition]]); - } - -} - - -?> \ No newline at end of file diff --git a/gulliver/thirdparty/restler/plistformat/CFType.php b/gulliver/thirdparty/restler/plistformat/CFType.php deleted file mode 100644 index 246c22177..000000000 --- a/gulliver/thirdparty/restler/plistformat/CFType.php +++ /dev/null @@ -1,742 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @subpackage plist.types - * @version $Id$ - */ - -/** - * Base-Class of all CFTypes used by CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - * @version $Id$ - * @example example-create-01.php Using the CFPropertyList API - * @example example-create-02.php Using CFPropertyList::guess() - * @example example-create-03.php Using CFPropertyList::guess() with {@link CFDate} and {@link CFData} - */ -abstract class CFType { - /** - * CFType nodes - * @var array - */ - protected $value = null; - - /** - * Create new CFType. - * @param mixed $value Value of CFType - */ - public function __construct($value=null) { - $this->setValue($value); - } - - /************************************************************************************************ - * M A G I C P R O P E R T I E S - ************************************************************************************************/ - - /** - * Get the CFType's value - * @return mixed CFType's value - */ - public function getValue() { - return $this->value; - } - - /** - * Set the CFType's value - * @return void - */ - public function setValue($value) { - $this->value = $value; - } - - /************************************************************************************************ - * S E R I A L I Z I N G - ************************************************************************************************/ - - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName Name of element to create - * @return DOMNode Node created based on CType - * @uses $value as nodeValue - */ - public function toXML(DOMDocument $doc, $nodeName) { - $text = $doc->createTextNode($this->value); - $node = $doc->createElement($nodeName); - $node->appendChild($text); - return $node; - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public abstract function toBinary(CFBinaryPropertyList &$bplist); - - /** - * Get CFType's value. - * @return mixed primitive value - * @uses $value for retrieving primitive of CFType - */ - public function toArray() { - return $this->getValue(); - } - -} - -/** - * String Type of CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFString extends CFType { - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <string>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - return parent::toXML($doc, 'string'); - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->stringToBinary($this->value); - } -} - -/** - * Number Type of CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFNumber extends CFType { - /** - * Get XML-Node. - * Returns <real> if $value is a float, <integer> if $value is an integer. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <real> or <integer>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - $ret = 'real'; - if(intval($this->value) == $this->value && !is_float($this->value) && strpos($this->value,'.') === false) { - $this->value = intval($this->value); - $ret = 'integer'; - } - return parent::toXML($doc, $ret); - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->numToBinary($this->value); - } -} - -/** - * Date Type of CFPropertyList - * Note: CFDate uses Unix timestamp (epoch) to store dates internally - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFDate extends CFType { - const TIMESTAMP_APPLE = 0; - const TIMESTAMP_UNIX = 1; - const DATE_DIFF_APPLE_UNIX = 978307200; - - /** - * Create new Date CFType. - * @param integer $value timestamp to set - * @param integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_APPLE} - * @uses setValue() to convert the timestamp - */ - function __construct($value,$format=CFDate::TIMESTAMP_UNIX) { - $this->setValue($value,$format); - } - - /** - * Set the Date CFType's value. - * @param integer $value timestamp to set - * @param integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_UNIX} - * @return void - * @uses TIMESTAMP_APPLE to determine timestamp type - * @uses TIMESTAMP_UNIX to determine timestamp type - * @uses DATE_DIFF_APPLE_UNIX to convert Apple-timestamp to Unix-timestamp - */ - function setValue($value,$format=CFDate::TIMESTAMP_UNIX) { - if($format == CFDate::TIMESTAMP_UNIX) $this->value = $value; - else $this->value = $value + CFDate::DATE_DIFF_APPLE_UNIX; - } - - /** - * Get the Date CFType's value. - * @param integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_UNIX} - * @return integer Unix timestamp - * @uses TIMESTAMP_APPLE to determine timestamp type - * @uses TIMESTAMP_UNIX to determine timestamp type - * @uses DATE_DIFF_APPLE_UNIX to convert Unix-timestamp to Apple-timestamp - */ - function getValue($format=CFDate::TIMESTAMP_UNIX) { - if($format == CFDate::TIMESTAMP_UNIX) return $this->value; - else return $this->value - CFDate::DATE_DIFF_APPLE_UNIX; - } - - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <date>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - $text = $doc->createTextNode(gmdate("Y-m-d\TH:i:s\Z",$this->getValue())); - $node = $doc->createElement("date"); - $node->appendChild($text); - return $node; - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->dateToBinary($this->value); - } - - /** - * Create a UNIX timestamp from a PList date string - * @param string $val The date string (e.g. "2009-05-13T20:23:43Z") - * @return integer The UNIX timestamp - * @throws PListException when encountering an unknown date string format - */ - public static function dateValue($val) { - //2009-05-13T20:23:43Z - if(!preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z/',$val,$matches)) throw new PListException("Unknown date format: $val"); - return gmmktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]); - } -} - -/** - * Boolean Type of CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFBoolean extends CFType { - /** - * Get XML-Node. - * Returns <true> if $value is a true, <false> if $value is false. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <true> or <false>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - return $doc->createElement($this->value ? 'true' : 'false'); - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->boolToBinary($this->value); - } - -} - -/** - * Data Type of CFPropertyList - * Note: Binary data is base64-encoded. - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFData extends CFType { - /** - * Create new Data CFType - * @param string $value data to be contained by new object - * @param boolean $already_coded if true $value will not be base64-encoded, defaults to false - */ - public function __construct($value=null,$already_coded=false) { - if($already_coded) $this->value = $value; - else $this->setValue($value); - } - - /** - * Set the CFType's value and base64-encode it. - * Note: looks like base64_encode has troubles with UTF-8 encoded strings - * @return void - */ - public function setValue($value) { - //if(function_exists('mb_check_encoding') && mb_check_encoding($value, 'UTF-8')) $value = utf8_decode($value); - $this->value = base64_encode($value); - } - - /** - * Get base64 encoded data - * @return string The base64 encoded data value - */ - public function getCodedValue() { - return $this->value; - } - - /** - * Get the base64-decoded CFType's value. - * @return mixed CFType's value - */ - public function getValue() { - return base64_decode($this->value); - } - - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <data>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - return parent::toXML($doc, 'data'); - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->dataToBinary($this->getValue()); - } -} - -/** - * Array Type of CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFArray extends CFType implements Iterator, ArrayAccess { - /** - * Position of iterator {@link http://php.net/manual/en/class.iterator.php} - * @var integer - */ - protected $iteratorPosition = 0; - - - /** - * Create new CFType. - * @param array $value Value of CFType - */ - public function __construct($value=array()) { - $this->value = $value; - } - - /** - * Set the CFType's value - * Note: this dummy does nothing - * @return void - */ - public function setValue($value) { - } - - /** - * Add CFType to collection. - * @param CFType $value CFType to add to collection, defaults to null which results in an empty {@link CFString} - * @return void - * @uses $value for adding $value - */ - public function add(CFType $value=null) { - // anything but CFType is null, null is an empty string - sad but true - if( !$value ) - $value = new CFString(); - - $this->value[] = $value; - } - - /** - * Get CFType from collection. - * @param integer $key Key of CFType to retrieve from collection - * @return CFType CFType found at $key, null else - * @uses $value for retrieving CFType of $key - */ - public function get($key) { - if(isset($this->value[$key])) return $this->value[$key]; - return null; - } - - /** - * Remove CFType from collection. - * @param integer $key Key of CFType to removes from collection - * @return CFType removed CFType, null else - * @uses $value for removing CFType of $key - */ - public function del($key) { - if(isset($this->value[$key])) unset($this->value[$key]); - } - - - /************************************************************************************************ - * S E R I A L I Z I N G - ************************************************************************************************/ - - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <array>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - $node = $doc->createElement('array'); - - foreach($this->value as $value) $node->appendChild($value->toXML($doc)); - return $node; - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->arrayToBinary($this); - } - - /** - * Get CFType's value. - * @return array primitive value - * @uses $value for retrieving primitive of CFType - */ - public function toArray() { - $a = array(); - foreach($this->value as $value) $a[] = $value->toArray(); - return $a; - } - - - /************************************************************************************************ - * I T E R A T O R I N T E R F A C E - ************************************************************************************************/ - - /** - * Rewind {@link $iteratorPosition} to first position (being 0) - * @link http://php.net/manual/en/iterator.rewind.php - * @return void - * @uses $iteratorPosition set to 0 - */ - public function rewind() { - $this->iteratorPosition = 0; - } - - /** - * Get Iterator's current {@link CFType} identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.current.php - * @return CFType current Item - * @uses $iteratorPosition identify current key - */ - public function current() { - return $this->value[$this->iteratorPosition]; - } - - /** - * Get Iterator's current key identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.key.php - * @return string key of the current Item - * @uses $iteratorPosition identify current key - */ - public function key() { - return $this->iteratorPosition; - } - - /** - * Increment {@link $iteratorPosition} to address next {@see CFType} - * @link http://php.net/manual/en/iterator.next.php - * @return void - * @uses $iteratorPosition increment by 1 - */ - public function next() { - $this->iteratorPosition++; - } - - /** - * Test if {@link $iteratorPosition} addresses a valid element of {@link $value} - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean true if current position is valid, false else - * @uses $iteratorPosition test if within {@link $iteratorKeys} - * @uses $iteratorPosition test if within {@link $value} - */ - public function valid() { - return isset($this->value[$this->iteratorPosition]); - } - - /************************************************************************************************ - * ArrayAccess I N T E R F A C E - ************************************************************************************************/ - - /** - * Determine if the array's key exists - * @param string $key the key to check - * @return bool true if the offset exists, false if not - * @link http://php.net/manual/en/arrayaccess.offsetexists.php - * @uses $value to check if $key exists - * @author Sean Coates - */ - public function offsetExists($key) { - return isset($this->value[$key]); - } - - /** - * Fetch a specific key from the CFArray - * @param string $key the key to check - * @return mixed the value associated with the key; null if the key is not found - * @link http://php.net/manual/en/arrayaccess.offsetget.php - * @uses get() to get the key's value - * @author Sean Coates - */ - public function offsetGet($key) { - return $this->get($key); - } - - /** - * Set a value in the array - * @param string $key the key to set - * @param string $value the value to set - * @return void - * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @uses setValue() to set the key's new value - * @author Sean Coates - */ - public function offsetSet($key, $value) { - return $this->setValue($value); - } - - /** - * Unsets a value in the array - * Note: this dummy does nothing - * @param string $key the key to set - * @return void - * @link http://php.net/manual/en/arrayaccess.offsetunset.php - * @author Sean Coates - */ - public function offsetUnset($key) { - - } - - -} - -/** - * Array Type of CFPropertyList - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - * @subpackage plist.types - */ -class CFDictionary extends CFType implements Iterator { - /** - * Position of iterator {@link http://php.net/manual/en/class.iterator.php} - * @var integer - */ - protected $iteratorPosition = 0; - - /** - * List of Keys for numerical iterator access {@link http://php.net/manual/en/class.iterator.php} - * @var array - */ - protected $iteratorKeys = null; - - - /** - * Create new CFType. - * @param array $value Value of CFType - */ - public function __construct($value=array()) { - $this->value = $value; - } - - /** - * Set the CFType's value - * Note: this dummy does nothing - * @return void - */ - public function setValue($value) { - } - - /** - * Add CFType to collection. - * @param string $key Key to add to collection - * @param CFType $value CFType to add to collection, defaults to null which results in an empty {@link CFString} - * @return void - * @uses $value for adding $key $value pair - */ - public function add($key, CFType $value=null) { - // anything but CFType is null, null is an empty string - sad but true - if( !$value ) - $value = new CFString(); - - $this->value[$key] = $value; - } - - /** - * Get CFType from collection. - * @param string $key Key of CFType to retrieve from collection - * @return CFType CFType found at $key, null else - * @uses $value for retrieving CFType of $key - */ - public function get($key) { - if(isset($this->value[$key])) return $this->value[$key]; - return null; - } - - /** - * Generic getter (magic) - * @param integer $key Key of CFType to retrieve from collection - * @return CFType CFType found at $key, null else - * @link http://php.net/oop5.overloading - * @uses get() to retrieve the key's value - * @author Sean Coates - */ - public function __get($key) { - return $this->get($key); - } - - /** - * Remove CFType from collection. - * @param string $key Key of CFType to removes from collection - * @return CFType removed CFType, null else - * @uses $value for removing CFType of $key - */ - public function del($key) { - if(isset($this->value[$key])) unset($this->value[$key]); - } - - - /************************************************************************************************ - * S E R I A L I Z I N G - ************************************************************************************************/ - - /** - * Get XML-Node. - * @param DOMDocument $doc DOMDocument to create DOMNode in - * @param string $nodeName For compatibility reasons; just ignore it - * @return DOMNode <dict>-Element - */ - public function toXML(DOMDocument $doc,$nodeName="") { - $node = $doc->createElement('dict'); - - foreach($this->value as $key => $value) { - $node->appendChild($doc->createElement('key', $key)); - $node->appendChild($value->toXML($doc)); - } - - return $node; - } - - /** - * convert value to binary representation - * @param CFBinaryPropertyList The binary property list object - * @return The offset in the object table - */ - public function toBinary(CFBinaryPropertyList &$bplist) { - return $bplist->dictToBinary($this); - } - - /** - * Get CFType's value. - * @return array primitive value - * @uses $value for retrieving primitive of CFType - */ - public function toArray() { - $a = array(); - - foreach($this->value as $key => $value) $a[$key] = $value->toArray(); - return $a; - } - - - /************************************************************************************************ - * I T E R A T O R I N T E R F A C E - ************************************************************************************************/ - - /** - * Rewind {@link $iteratorPosition} to first position (being 0) - * @link http://php.net/manual/en/iterator.rewind.php - * @return void - * @uses $iteratorPosition set to 0 - * @uses $iteratorKeys store keys of {@link $value} - */ - public function rewind() { - $this->iteratorPosition = 0; - $this->iteratorKeys = array_keys($this->value); - } - - /** - * Get Iterator's current {@link CFType} identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.current.php - * @return CFType current Item - * @uses $iteratorPosition identify current key - * @uses $iteratorKeys identify current value - */ - public function current() { - return $this->value[$this->iteratorKeys[$this->iteratorPosition]]; - } - - /** - * Get Iterator's current key identified by {@link $iteratorPosition} - * @link http://php.net/manual/en/iterator.key.php - * @return string key of the current Item - * @uses $iteratorPosition identify current key - * @uses $iteratorKeys identify current value - */ - public function key() { - return $this->iteratorKeys[$this->iteratorPosition]; - } - - /** - * Increment {@link $iteratorPosition} to address next {@see CFType} - * @link http://php.net/manual/en/iterator.next.php - * @return void - * @uses $iteratorPosition increment by 1 - */ - public function next() { - $this->iteratorPosition++; - } - - /** - * Test if {@link $iteratorPosition} addresses a valid element of {@link $value} - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean true if current position is valid, false else - * @uses $iteratorPosition test if within {@link $iteratorKeys} - * @uses $iteratorPosition test if within {@link $value} - */ - public function valid() { - return isset($this->iteratorKeys[$this->iteratorPosition]) && isset($this->value[$this->iteratorKeys[$this->iteratorPosition]]); - } - -} - -?> \ No newline at end of file diff --git a/gulliver/thirdparty/restler/plistformat/CFTypeDetector.php b/gulliver/thirdparty/restler/plistformat/CFTypeDetector.php deleted file mode 100644 index 996439326..000000000 --- a/gulliver/thirdparty/restler/plistformat/CFTypeDetector.php +++ /dev/null @@ -1,167 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @subpackage plist.types - * @example example-create-02.php Using {@link CFTypeDetector} - * @example example-create-03.php Using {@link CFTypeDetector} with {@link CFDate} and {@link CFData} - * @example example-create-04.php Using and extended {@link CFTypeDetector} - */ -class CFTypeDetector { - - /** - * flag stating if all arrays should automatically be converted to {@link CFDictionary} - * @var boolean - */ - protected $autoDictionary = false; - - /** - * flag stating if exceptions should be suppressed or thrown - * @var boolean - */ - protected $suppressExceptions = false; - - /** - * name of a method that will be used for array to object conversations - * @var boolean - */ - protected $objectToArrayMethod = false; - - - /** - * Create new CFTypeDetector - * @param boolean $autoDicitionary if set to true all arrays will be converted to {@link CFDictionary} - * @param boolean $suppressExceptions if set to true toCFType() will not throw any exceptions - * @param boolean $objectToArrayMethod if non-null, this method will be called on objects (if possible) to convert the object to an array - */ - public function __construct($autoDicitionary=false,$suppressExceptions=false,$objectToArrayMethod=null) { - $this->autoDicitionary = $autoDicitionary; - $this->suppressExceptions = $suppressExceptions; - $this->objectToArrayMethod = $objectToArrayMethod; - } - - /** - * Determine if an array is associative or numerical. - * Numerical Arrays have incrementing index-numbers that don't contain gaps. - * @param array $value Array to check indexes of - * @return boolean true if array is associative, false if array has numeric indexes - */ - protected function isAssociativeArray($value) { - $numericKeys = true; - $previousKey = null; - foreach($value as $key => $v) { - if(!is_numeric($key) || ($previousKey !== null && $previousKey != $key-1)) { - $numericKeys = false; - break; - } - - $previousKey = $key; - } - return !$numericKeys; - } - - /** - * Get the default value - * @return CFType the default value to return if no suitable type could be determined - */ - protected function defaultValue() { - return new CFString(); - } - - /** - * Create CFType-structure by guessing the data-types. - * {@link CFArray}, {@link CFDictionary}, {@link CFBoolean}, {@link CFNumber} and {@link CFString} can be created, {@link CFDate} and {@link CFData} cannot. - *
    Note:Distinguishing between {@link CFArray} and {@link CFDictionary} is done by examining the keys. - * Keys must be strictly incrementing integers to evaluate to a {@link CFArray}. - * Since PHP does not offer a function to test for associative arrays, - * this test causes the input array to be walked twice and thus work rather slow on large collections. - * If you work with large arrays and can live with all arrays evaluating to {@link CFDictionary}, - * feel free to set the appropriate flag. - *
    Note: If $value is an instance of CFType it is simply returned. - *
    Note: If $value is neither a CFType, array, numeric, boolean nor string, it is omitted. - * @param mixed $value Value to convert to CFType - * @param boolean $autoDictionary if true {@link CFArray}-detection is bypassed and arrays will be returned as {@link CFDictionary}. - * @return CFType CFType based on guessed type - * @uses isAssociativeArray() to check if an array only has numeric indexes - */ - public function toCFType($value) { - switch(true) { - case $value instanceof CFType: - return $value; - break; - - case is_object($value): - // DateTime should be CFDate - if(class_exists( 'DateTime' ) && $value instanceof DateTime){ - return new CFDate($value->getTimestamp()); - } - - // convert possible objects to arrays, arrays will be arrays - if($this->objectToArrayMethod && is_callable(array($value, $this->objectToArrayMethod))){ - $value = call_user_func( array( $value, $this->objectToArrayMethod ) ); - } - - if(!is_array($value)){ - if($this->suppressExceptions) - return $this->defaultValue(); - - throw new PListException('Could not determine CFType for object of type '. get_class($value)); - } - /* break; omitted */ - - case $value instanceof Iterator: - case is_array($value): - // test if $value is simple or associative array - if(!$this->autoDictionary) { - if(!$this->isAssociativeArray($value)) { - $t = new CFArray(); - foreach($value as $v) $t->add($this->toCFType($v)); - return $t; - } - } - - $t = new CFDictionary(); - foreach($value as $k => $v) $t->add($k, $this->toCFType($v)); - - return $t; - break; - - case is_numeric($value): - return new CFNumber($value); - break; - - case is_bool($value): - return new CFBoolean($value); - break; - - case is_string($value): - return new CFString($value); - break; - - case is_null($value): - return new CFString(); - break; - - case is_resource($value): - if( $this->suppressExceptions ) - return $this->defaultValue(); - - throw new PListException('Could not determine CFType for resource of type '. get_resource_type($value)); - break; - - default: - if( $this->suppressExceptions ) - return $this->defaultValue(); - - throw new PListException('Could not determine CFType for '. gettype($value)); - break; - } - } - -} - -?> \ No newline at end of file diff --git a/gulliver/thirdparty/restler/plistformat/IOException.php b/gulliver/thirdparty/restler/plistformat/IOException.php deleted file mode 100644 index 991855394..000000000 --- a/gulliver/thirdparty/restler/plistformat/IOException.php +++ /dev/null @@ -1,99 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @version $Id$ - */ - -/** - * Basic Input / Output Exception - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - */ -class IOException extends Exception { - /** - * Flag telling the File could not be found - */ - const NOT_FOUND = 1; - - /** - * Flag telling the File is not readable - */ - const NOT_READABLE = 2; - - /** - * Flag telling the File is not writable - */ - const NOT_WRITABLE = 3; - - /** - * Flag telling there was a read error - */ - const READ_ERROR = 4; - - /** - * Flag telling there was a read error - */ - const WRITE_ERROR = 5; - - /** - * Create new IOException - * @param string $path Source of the problem - * @param integer $type Type of the problem - */ - public function __construct($path, $type=null) { - parent::__construct( $path, $type ); - } - - /** - * Create new FileNotFound-Exception - * @param string $path Source of the problem - * @return IOException new FileNotFound-Exception - */ - public static function notFound($path) { - return new IOException( $path, self::NOT_FOUND ); - } - - /** - * Create new FileNotReadable-Exception - * @param string $path Source of the problem - * @return IOException new FileNotReadable-Exception - */ - public static function notReadable($path) { - return new IOException( $path, self::NOT_READABLE ); - } - - /** - * Create new FileNotWritable-Exception - * @param string $path Source of the problem - * @return IOException new FileNotWritable-Exception - */ - public static function notWritable($path) { - return new IOException( $path, self::NOT_WRITABLE ); - } - - /** - * Create new ReadError-Exception - * @param string $path Source of the problem - * @return IOException new ReadError-Exception - */ - public static function readError($path) { - return new IOException( $path, self::READ_ERROR ); - } - - /** - * Create new WriteError-Exception - * @param string $path Source of the problem - * @return IOException new WriteError-Exception - */ - public static function writeError($path) { - return new IOException( $path, self::WRITE_ERROR ); - } -} - - -?> \ No newline at end of file diff --git a/gulliver/thirdparty/restler/plistformat/PListException.php b/gulliver/thirdparty/restler/plistformat/PListException.php deleted file mode 100644 index b738d2382..000000000 --- a/gulliver/thirdparty/restler/plistformat/PListException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * @author Christian Kruse - * @package plist - * @version $Id$ - */ - -/** - * Exception for errors with the PList format - * @author Rodney Rehm - * @author Christian Kruse - * @package plist - */ -class PListException extends Exception { - -} - - -?> \ No newline at end of file diff --git a/gulliver/thirdparty/restler/plistformat/plistformat.php b/gulliver/thirdparty/restler/plistformat/plistformat.php deleted file mode 100644 index a68c9e78d..000000000 --- a/gulliver/thirdparty/restler/plistformat/plistformat.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class PlistFormat implements iFormat -{ - public static $binary_mode = false; - - const MIME_BINARY = 'application/x-plist'; - const MIME_XML = 'application/xml'; - - const EXTENSION_BINARY = 'bplist'; - const EXTENSION_XML = 'plist'; - - public function getMIMEMap(){ - return array( - PlistFormat::EXTENSION_BINARY=>PlistFormat::MIME_BINARY, - PlistFormat::EXTENSION_XML=>PlistFormat::MIME_XML - ); - } - - public function getMIME(){ - return PlistFormat::$binary_mode ? PlistFormat::MIME_BINARY : PlistFormat::MIME_XML; - } - public function getExtension(){ - return PlistFormat::$binary_mode ? PlistFormat::EXTENSION_BINARY : PlistFormat::EXTENSION_XML; - } - public function setMIME($mime){ - PlistFormat::$binary_mode = $mime==PlistFormat::MIME_BINARY; - } - public function setExtension($extension){ - PlistFormat::$binary_mode = $extension==PlistFormat::EXTENSION_BINARY; - } - - /** - * Encode the given data in plist format - * @param array $data resulting data that needs to - * be encoded in plist format - * @param boolean $human_readable set to true when restler - * is not running in production mode. Formatter has to - * make the encoded output more human readable - * @return string encoded string - */ - public function encode($data, $human_readable=false){ - require_once'CFPropertyList.php'; - if(!PlistFormat::$binary_mode) { - PlistFormat::$binary_mode = !$human_readable; - } else { - $human_readable=false; - } - /** - * @var CFPropertyList - */ - $plist = new CFPropertyList(); - $td = new CFTypeDetector(); - $guessedStructure = $td->toCFType(object_to_array($data)); - $plist->add( $guessedStructure ); - return $human_readable ? $plist->toXML(true) : $plist->toBinary(); - } - - /** - * Decode the given data from plist format - * @param string $data data sent from client to - * the api in the given format. - * @return array associative array of the parsed data - */ - public function decode($data){ - require_once'CFPropertyList.php'; - $plist = new CFPropertyList(); - $plist->parse($data); - return $plist->toArray(); - } - public function __toString(){ - return $this->getExtension(); - } -} \ No newline at end of file diff --git a/gulliver/thirdparty/restler/restler.php b/gulliver/thirdparty/restler/restler.php deleted file mode 100644 index edeb08960..000000000 --- a/gulliver/thirdparty/restler/restler.php +++ /dev/null @@ -1,1454 +0,0 @@ - - * - * @category Framework - * @package restler - * @author Jac Wright - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - * @version 2.2.0 - */ -class Restler -{ - // ================================================================== - // - // Public variables - // - // ------------------------------------------------------------------ - - const VERSION = '2.2.0'; - - /** - * URL of the currently mapped service - * @var string - */ - public $url; - - /** - * Http request method of the current request. - * Any value between [GET, PUT, POST, DELETE] - * @var string - */ - public $request_method; - - /** - * Requested data format. Instance of the current format class - * which implements the iFormat interface - * @var iFormat - * @example jsonFormat, xmlFormat, yamlFormat etc - */ - public $request_format; - - /** - * Data sent to the service - * @var array - */ - public $request_data = array(); - - /** - * Used in production mode to store the URL Map to disk - * @var string - */ - public $cache_dir; - - /** - * base directory to locate format and auth files - * @var string - */ - public $base_dir; - - /** - * Name of an iRespond implementation class - * @var string - */ - public $response = 'DefaultResponse'; - - /** - * Response data format. Instance of the current format class - * which implements the iFormat interface - * @var iFormat - * @example jsonFormat, xmlFormat, yamlFormat etc - */ - public $response_format; - - // ================================================================== - // - // Private & Protected variables - // - // ------------------------------------------------------------------ - - /** - * When set to FALSE, it will run in debug mode and parse the - * class files every time to map it to the URL - * @var boolean - */ - protected $production_mode; - - /** - * Associated array that maps urls to their respective class and method - * @var array - */ - protected $routes = array(); - - /** - * Associated array that maps formats to their respective format class name - * @var array - */ - protected $format_map = array(); - - /** - * Instance of the current api service class - * @var object - */ - protected $service_class_instance; - - /** - * Name of the api method being called - * @var string - */ - protected $service_method; - - /** - * list of authentication classes - * @var array - */ - protected $auth_classes = array(); - - /** - * list of error handling classes - * @var array - */ - protected $error_classes = array(); - - /** - * HTTP status codes - * @var array - */ - private $codes = array( - 100 => 'Continue', - 101 => 'Switching Protocols', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => '(Unused)', - 307 => 'Temporary Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 417 => 'Record not found', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported' - ); - - /** - * Caching of url map is enabled or not - * @var boolean - */ - protected $cached; - - // ================================================================== - // - // Public functions - // - // ------------------------------------------------------------------ - - /** - * Constructor - * @param boolean $production_mode When set to FALSE, it will run in - * debug mode and parse the class files every time to map it to the URL - */ - public function __construct($production_mode = FALSE) - { - $this->production_mode = $production_mode; - $this->cache_dir = getcwd(); - $this->base_dir = RESTLER_PATH; - } - - /** - * Store the url map cache if needed - */ - public function __destruct() - { - if ($this->production_mode && !($this->cached)) { - $this->saveCache(); - } - } - - /** - * Use it in production mode to refresh the url map cache - */ - public function refreshCache() - { - $this->routes = array(); - $this->cached = FALSE; - } - - /** - * Call this method and pass all the formats that should be - * supported by the API. Accepts multiple parameters - * @param string class name of the format class that implements iFormat - * @example $restler->setSupportedFormats('JsonFormat', 'XmlFormat'...); - */ - public function setSupportedFormats() - { - $args = func_get_args(); - $extensions = array(); - foreach ($args as $class_name) { - if (!is_string($class_name) || !class_exists($class_name)) { - throw new Exception("$class_name is not a vaild Format Class."); - } - $obj = new $class_name; - if (!($obj instanceof iFormat)) { - throw new Exception('Invalid format class; must implement ' - . 'iFormat interface'); - } - foreach ($obj->getMIMEMap() as $extension => $mime) { - if (!isset($this->format_map[$extension])) { - $this->format_map[$extension] = $class_name; - } - $mime = explode(',', $mime); - if (!is_array($mime)) { - $mime = array($mime); - } - foreach ($mime as $value) { - if (!isset($this->format_map[$value])) - $this->format_map[$value] = $class_name; - } - $extensions[".$extension"] = TRUE; - } - } - $this->format_map['default'] = $args[0]; - $this->format_map['extensions'] = array_keys($extensions); - } - - /** - * Add api classes throgh this method. All the public methods - * that do not start with _ (underscore) will be will be exposed - * as the public api by default. - * - * All the protected methods that do not start with _ (underscore) - * will exposed as protected api which will require authentication - * @param string $class name of the service class - * @param string $basePath optional url prefix for mapping, uses - * lowercase version of the class name when not specified - * @throws Exception when supplied with invalid class name - */ - public function addAPIClass($class_name, $base_path = NULL) - { - if (!class_exists($class_name)) { - throw new Exception("API class $class_name is missing."); - } - $this->loadCache(); - if (!$this->cached) { - if (is_null($base_path)) { - $base_path = strtolower($class_name); - $index = strrpos($class_name, '\\'); - if ($index !== FALSE) { - $base_path = substr($base_path, $index + 1); - } - } else { - $base_path = trim($base_path,'/'); - } - if (strlen($base_path) > 0) { - $base_path .= '/'; - } - $this->generateMap($class_name, $base_path); - } - } - - /** - * protected methods will need atleast one authentication class to be set - * in order to allow that method to be executed - * @param string $class_name of the authentication class - * @param string $base_path optional url prefix for mapping - */ - public function addAuthenticationClass($class_name, $base_path = NULL) - { - $this->auth_classes[] = $class_name; - $this->addAPIClass($class_name, $base_path); - } - - /** - * Add class for custom error handling - * @param string $class_name of the error handling class - */ - public function addErrorClass($class_name) - { - $this->error_classes[] = $class_name; - } - - /** - * Convenience method to respond with an error message - * @param int $statusCode http error code - * @param string $errorMessage optional custom error message - */ - public function handleError($status_code, $error_message = NULL) - { - $method = "handle$status_code"; - $handled = FALSE; - foreach ($this->error_classes as $class_name) { - if (method_exists($class_name, $method)) { - $obj = new $class_name(); - $obj->restler = $this; - $obj->$method(); - $handled = TRUE; - } - } - if ($handled) { - return; - } - $message = $this->codes[$status_code] - . (!$error_message ? '' : ': ' . $error_message); - $this->setStatus($status_code); - $responder = new $this->response(); - $responder->restler = $this; - $this->sendData($responder->__formatError($status_code, $message)); - } - - /** - * Main function for processing the api request - * and return the response - * @throws Exception when the api service class is missing - * @throws RestException to send error response - */ - public function handle() - { - if (empty($this->format_map)) { - $this->setSupportedFormats('JsonFormat'); - } - $this->url = $this->getPath(); - $this->request_method = $this->getRequestMethod(); - $this->response_format = $this->getResponseFormat(); - $this->request_format = $this->getRequestFormat(); - if (is_null($this->request_format)) { - $this->request_format = $this->response_format; - } - if ($this->request_method == 'PUT' || $this->request_method == 'POST') { - $this->request_data = $this->getRequestData(); - } - $o = $this->mapUrlToMethod(); - if (!isset($o->class_name)) { - $this->handleError(404); - } else { - try { - if ($o->method_flag) { - $auth_method = '__isAuthenticated'; - if (!count($this->auth_classes)) { - throw new RestException(401); - } - foreach ($this->auth_classes as $auth_class) { - $auth_obj = new $auth_class(); - $auth_obj->restler = $this; - $this->applyClassMetadata($auth_class, $auth_obj, $o); - if (!method_exists($auth_obj, $auth_method)) { - throw new RestException(401, 'Authentication Class ' - . 'should implement iAuthenticate'); - } else if (!$auth_obj->$auth_method()) { - throw new RestException(401); - } - } - } - - $this->applyClassMetadata(get_class($this->request_format), - $this->request_format, $o); - $pre_process = '_' . $this->request_format->getExtension() . '_' - . $o->method_name; - $this->service_method = $o->method_name; - if ($o->method_flag == 2) { - $o = unprotect($o); - } - $object = $this->service_class_instance = new $o->class_name(); - $object->restler = $this; - if (method_exists($o->class_name, $pre_process)) { - call_user_func_array(array($object, $pre_process), - $o->arguments); - } - switch ($o->method_flag) { - case 3: - $reflection_method = new ReflectionMethod($object, - $o->method_name); - $reflection_method->setAccessible(TRUE); - $result = $reflection_method->invokeArgs($object, - $o->arguments); - break; - case 2: - case 1: - default: - $result = call_user_func_array(array( - $object, - $o->method_name), - $o->arguments - ); - break; - } - } catch (RestException $e) { - $this->handleError($e->getCode(), $e->getMessage()); - } - } - $responder = new $this->response(); - $responder->restler = $this; - $this->applyClassMetadata($this->response, $responder, $o); - if (isset($result) && $result !== NULL) { - $result = $responder->__formatResponse($result); - $this->sendData($result); - } - } - - /** - * Encodes the response in the prefered format - * and sends back - * @param $data array php data - */ - public function sendData($data) - { - $data = $this->response_format->encode($data, !($this->production_mode)); - $post_process = '_' . $this->service_method . '_' - . $this->response_format->getExtension(); - if (isset($this->service_class_instance) - && method_exists($this->service_class_instance,$post_process) - ) { - $data = call_user_func(array($this->service_class_instance, - $post_process), $data); - } - header("Cache-Control: no-cache, must-revalidate"); - header("Expires: 0"); - header('Content-Type: ' . $this->response_format->getMIME()); - //header('Content-Type: ' . $this->response_format->getMIME().'; charset=utf-8'); - header("X-Powered-By: Luracast Restler v" . Restler::VERSION); - die($data); - } - - /** - * Sets the HTTP response status - * @param int $code response code - */ - public function setStatus($code) - { - header("{$_SERVER['SERVER_PROTOCOL']} $code " . $this->codes[strval($code)]); - } - - /** - * Compare two strings and remove the common - * sub string from the first string and return it - * @param string $first - * @param string $second - * @param string $char optional, set it as - * blank string for char by char comparison - * @return string - */ - public function removeCommonPath($first, $second, $char = '/') - { - $first = explode($char, $first); - $second = explode($char, $second); - while (count($second)) { - if ($first[0] == $second[0]) { - array_shift($first); - } else { - break; - } - array_shift($second); - } - return implode($char, $first); - } - - /** - * Save cache to file - */ - public function saveCache() - { - $file = $this->cache_dir . '/routes.php'; - $s = '$o=array();' . PHP_EOL; - foreach ($this->routes as $key => $value) { - $s .= PHP_EOL . PHP_EOL . PHP_EOL . "############### $key ###############" - . PHP_EOL . PHP_EOL; - $s .= '$o[\'' . $key . '\']=array();'; - foreach ($value as $ke => $va) { - $s .= PHP_EOL . PHP_EOL . "#==== $key $ke" . PHP_EOL . PHP_EOL; - $s .= '$o[\'' . $key . '\'][\'' . $ke . '\']=' . str_replace( - PHP_EOL, - PHP_EOL . "\t", - var_export($va, TRUE) - ) . ';'; - } - } - $s .= PHP_EOL . 'return $o;'; - $r = @file_put_contents($file, "cache_dir' needs to have " - . "the permissions set to read/write/execute for everyone in order " - . "to save cache and improve performance."); - } - } - - // ================================================================== - // - // Protected functions - // - // ------------------------------------------------------------------ - - /** - * Parses the requst url and get the api path - * @return string api path - */ - protected function getPath() - { - $path = urldecode($this->removeCommonPath($_SERVER['REQUEST_URI'], - $_SERVER['SCRIPT_NAME'])); - $path = preg_replace('/(\/*\?.*$)|(\/$)/', '', $path); - $path = str_replace($this->format_map['extensions'], '', $path); - return $path; - } - - /** - * Parses the request to figure out the http request type - * @return string which will be one of the following - * [GET, POST, PUT, DELETE] - * @example GET - */ - protected function getRequestMethod() - { - $method = $_SERVER['REQUEST_METHOD']; - if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { - $method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']; - } - //support for HEAD request - if ($method == 'HEAD') { - $method = 'GET'; - } - return $method; - } - - /** - * Parses the request to figure out format of the request data - * @return iFormat any class that implements iFormat - * @example JsonFormat - */ - protected function getRequestFormat() - { - $format = NULL; - //check if client has sent any information on request format - if (isset($_SERVER['CONTENT_TYPE'])) { - $mime = explode(';', $_SERVER['CONTENT_TYPE']); - $mime = $mime[0]; - if ($mime == UrlEncodedFormat::MIME) { - $format = new UrlEncodedFormat(); - } else { - if (isset($this->format_map[$mime])) { - $format = $this->format_map[$mime]; - $format = is_string($format) ? new $format : $format; - $format->setMIME($mime); - } - } - } - return $format; - } - - /** - * Parses the request to figure out the best format for response - * @return iFormat any class that implements iFormat - * @example JsonFormat - */ - protected function getResponseFormat() - { - //check if client has specified an extension - /** - * @var iFormat - */ - $format = NULL; - $extensions = explode('.', parse_url($_SERVER['REQUEST_URI'], - PHP_URL_PATH)); - while($extensions) { - $extension = array_pop($extensions); - $extension = explode('/', $extension); - $extension = array_shift($extension); - if ($extension && isset($this->format_map[$extension])) { - $format = $this->format_map[$extension]; - $format = is_string($format) ? new $format : $format; - $format->setExtension($extension); - //echo "Extension $extension"; - return $format; - } - } - //check if client has sent list of accepted data formats - if (isset($_SERVER['HTTP_ACCEPT'])) { - $acceptList = array(); - $accepts = explode(',', strtolower($_SERVER['HTTP_ACCEPT'])); - if (!is_array($accepts)) { - $accepts = array($accepts); - } - foreach ($accepts as $pos => $accept) { - $parts = explode(';q=', trim($accept)); - $type = array_shift($parts); - $quality = count($parts) - ? floatval(array_shift($parts)) - : (1000 - $pos) / 1000; - $acceptList[$type] = $quality; - } - arsort($acceptList); - foreach ($acceptList as $accept => $quality) { - if (isset($this->format_map[$accept])) { - $format = $this->format_map[$accept]; - $format = is_string($format) ? new $format : $format; - $format->setMIME($accept); - //echo "MIME $accept"; - header("Vary: Accept"); // Tell cache content is based on Accept header - return $format; - } - } - } else { - // RFC 2616: If no Accept header field is - // present, then it is assumed that the - // client accepts all media types. - $_SERVER['HTTP_ACCEPT'] = '*/*'; - } - if (strpos($_SERVER['HTTP_ACCEPT'], '*') !== FALSE) { - if (strpos($_SERVER['HTTP_ACCEPT'], 'application/*') !== FALSE) { - $format = new JsonFormat; - } - else if (strpos($_SERVER['HTTP_ACCEPT'], 'text/*') !== FALSE) { - $format = new XmlFormat; - } - else if (strpos($_SERVER['HTTP_ACCEPT'], '*/*') !== FALSE) { - $format = new $this->format_map['default']; - } - } - if (empty($format)) { - // RFC 2616: If an Accept header field is present, and if the server - // cannot send a response which is acceptable according to the combined - // Accept field value, then the server SHOULD send a 406 (not acceptable) - // response. - header('HTTP/1.1 406 Not Acceptable'); - die('406 Not Acceptable: The server was unable to negotiate content for this request.'); - } else { - header("Vary: Accept"); // Tell cache content is based ot Accept header - return $format; - } - } - - /** - * Parses the request data and returns it - * @return array php data - */ - protected function getRequestData() - { - try{ - $r = file_get_contents('php://input'); - if (is_null($r)) { - return $_GET; - } - $r = $this->request_format->decode($r); - return is_null($r) ? array() : $r; - } catch (RestException $e) { - $this->handleError($e->getCode(), $e->getMessage()); - } - } - - protected function mapUrlToMethod() - { - if (!isset($this->routes[$this->request_method])) { - return array(); - } - $urls = $this->routes[$this->request_method]; - if (!$urls) { - return array(); - } - - $found = FALSE; - $this->request_data += $_GET; - $params = array('request_data' => $this->request_data); - $params += $this->request_data; - $lc = strtolower($this->url); - foreach ($urls as $url => $call) { - //echo PHP_EOL.$url.' = '.$this->url.PHP_EOL; - $call = (object) $call; - if (strstr($url, ':')) { - $regex = preg_replace('/\\\:([^\/]*)/', '(?P<$1>[^/]*)', - preg_quote($url)); - if (preg_match(":^$regex$:i", $this->url, $matches)) { - foreach ($matches as $arg => $match) { - if (isset($call->arguments[$arg])) { - //flog("$arg => $match $args[$arg]"); - $params[$arg] = $match; - } - } - $found = TRUE; - break; - } - } else if ($url == $lc) { - $found = TRUE; - break; - } - } - if ($found) { - $p = $call->defaults; - foreach ($call->arguments as $key => $value) { - //echo "$key => $value \n"; - if (isset($params[$key])) { - $p[$value] = $params[$key]; - } - } - $call->arguments = $p; - return $call; - } - - } - - /** - * Apply static and non-static properties defined in - * the method information anotation - * @param String $class_name - * @param Object $instance instance of that class - * @param Object $method_info method information and metadata - */ - protected function applyClassMetadata($class_name, $instance, $method_info) - { - if (isset($method_info->metadata[$class_name]) - && is_array($method_info->metadata[$class_name]) - ) { - foreach ($method_info->metadata[$class_name] as $property => $value ) { - if (property_exists($class_name, $property)) { - $reflection_property = new ReflectionProperty($class_name, $property); - $reflection_property->setValue($instance, $value); - } - } - } - } - - protected function loadCache() - { - if ($this->cached !== NULL) { - return; - } - $file = $this->cache_dir . '/routes.php'; - $this->cached = FALSE; - - if ($this->production_mode) { - if (file_exists($file)) { - $routes = include($file); - } - if (isset($routes) && is_array($routes)) { - $this->routes = $routes; - $this->cached = TRUE; - } - } else { - //@unlink($this->cache_dir . "/$name.php"); - } - } - - /** - * Generates cachable url to method mapping - * @param string $class_name - * @param string $base_path - */ - protected function generateMap ($class_name, $base_path = '') - { - $reflection = new ReflectionClass($class_name); - $class_metadata = parse_doc($reflection->getDocComment()); - $methods = $reflection->getMethods( - ReflectionMethod::IS_PUBLIC + ReflectionMethod::IS_PROTECTED - ); - foreach ($methods as $method) { - $doc = $method->getDocComment(); - $arguments = array(); - $defaults = array(); - $metadata = $class_metadata + parse_doc($doc); - $params = $method->getParameters(); - $position = 0; - foreach ($params as $param) { - $arguments[$param->getName()] = $position; - $defaults[$position] = $param->isDefaultValueAvailable() - ? $param->getDefaultValue() : NULL; - $position++; - } - $method_flag = $method->isProtected() - ? (isRestlerCompatibilityModeEnabled() ? 2 : 3) - : (isset($metadata['protected']) ? 1 : 0); - - //take note of the order - $call = array( - 'class_name' => $class_name, - 'method_name' => $method->getName(), - 'arguments' => $arguments, - 'defaults' => $defaults, - 'metadata' => $metadata, - 'method_flag' => $method_flag - ); - $method_url = strtolower($method->getName()); - if (preg_match_all( - '/@url\s+(GET|POST|PUT|DELETE|HEAD|OPTIONS)[ \t]*\/?(\S*)/s', - $doc, - $matches, - PREG_SET_ORDER) - ) { - foreach ($matches as $match) { - $http_method = $match[1]; - $url = rtrim($base_path . $match[2],'/'); - $this->routes[$http_method][$url] = $call; - } - } else if ($method_url[0] != '_') { //not prefixed with underscore - // no configuration found so use convention - if (preg_match_all('/^(GET|POST|PUT|DELETE|HEAD|OPTIONS)/i', - $method_url, - $matches) - ) { - $http_method = strtoupper($matches[0][0]); - $method_url = substr($method_url, strlen($http_method)); - } else { - $http_method = 'GET'; - } - $url = $base_path - . ($method_url == 'index' || $method_url == 'default' ? '' : $method_url); - $url = rtrim($url,'/'); - $this->routes[$http_method][$url] = $call; - foreach ($params as $param) { - if ($param->getName() == 'request_data') { - break; - } - $url .= $url == '' ? ':' : '/:'; - $url .= $param->getName(); - $this->routes[$http_method][$url] = $call; - } - } - } - } -} - -if (version_compare(PHP_VERSION, '5.3.0') < 0) { - require_once 'compat.php'; -} - -// ================================================================== -// -// Secondary classes -// -// ------------------------------------------------------------------ - -/** - * Special Exception for raising API errors - * that can be used in API methods - * @category Framework - * @package restler - * @subpackage exception - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class RestException extends Exception -{ - - public function __construct($http_status_code, $error_message = NULL) - { - parent::__construct($error_message, $http_status_code); - } - -} - -/** - * Interface for creating response classes - * @category Framework - * @package restler - * @subpackage result - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -interface iRespond -{ - /** - * Result of an api call is passed to this method - * to create a standard structure for the data - * @param unknown_type $result can be a primitive or array or object - */ - public function __formatResponse($result); - - /** - * When the api call results in RestException this method - * will be called to return the error message - * @param int $status_code - * @param String $message - */ - public function __formatError($status_code, $message); -} - -/** - * Default response formating class - * @category Framework - * @package restler - * @subpackage result - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class DefaultResponse implements iRespond -{ - function __formatResponse($result) - { - return $result; - } - function __formatError($statusCode, $message) - { - return array( - 'error' => array( - 'code' => $statusCode, - 'message' => $message - ) - ); - } -} - -/** - * Interface for creating authentication classes - * @category Framework - * @package restler - * @subpackage auth - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -interface iAuthenticate -{ - /** - * Auth function that is called when a protected method is requested - * @return boolean TRUE or FALSE - */ - public function __isAuthenticated(); -} - -/** - * Interface for creating custom data formats - * like xml, json, yaml, amf etc - * @category Framework - * @package restler - * @subpackage format - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -interface iFormat -{ - /** - * Get Extension => MIME type mappings as an associative array - * @return array list of mime strings for the format - * @example array('json'=>'application/json'); - */ - public function getMIMEMap(); - - /** - * Set the selected MIME type - * @param string $mime MIME type - */ - public function setMIME($mime); - /** - * Get selected MIME type - */ - public function getMIME(); - - /** - * Set the selected file extension - * @param string $extension file extension - */ - public function setExtension($extension); - - /** - * Get the selected file extension - * @return string file extension - */ - public function getExtension(); - - /** - * Encode the given data in the format - * @param array $data resulting data that needs to - * be encoded in the given format - * @param boolean $human_readable set to TRUE when restler - * is not running in production mode. Formatter has to - * make the encoded output more human readable - * @return string encoded string - */ - public function encode($data, $human_readable = FALSE); - - /** - * Decode the given data from the format - * @param string $data data sent from client to - * the api in the given format. - * @return array associative array of the parsed data - */ - public function decode($data); -} - -/** - * URL Encoded String Format - * @category Framework - * @package restler - * @subpackage format - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class UrlEncodedFormat implements iFormat -{ - const MIME = 'application/x-www-form-urlencoded'; - const EXTENSION = 'post'; - - public function getMIMEMap() - { - return array(self::EXTENSION => self::MIME); - } - - public function getMIME() - { - return self::MIME; - } - - public function getExtension() - { - return self::EXTENSION; - } - - public function setMIME($mime) - { - //do nothing - } - - public function setExtension($extension) - { - //do nothing - } - - public function encode($data, $human_readable = FALSE) - { - return http_build_query($data); - } - - public function decode($data) - { - parse_str($data,$r); - return $r; - } - - public function __toString() - { - return $this->getExtension(); - } -} - -/** - * Javascript Object Notation Format - * @category Framework - * @package restler - * @subpackage format - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class JsonFormat implements iFormat -{ - const MIME = 'application/json,application/javascript'; - static $mime = 'application/json'; - const EXTENSION = 'json'; - - public function getMIMEMap() - { - return array(self::EXTENSION => self::MIME); - } - - public function getMIME() - { - return self::$mime; - } - - public function getExtension() - { - return self::EXTENSION; - } - - public function setMIME($mime) - { - self::$mime = $mime; - } - - public function setExtension($extension) - { - //do nothing - } - - public function encode($data, $human_readable = FALSE) - { - return $human_readable - ? $this->json_format(json_encode(object_to_array($data))) - : json_encode(object_to_array($data)); - } - - public function decode($data) - { - $decoded = json_decode ($data); - if (function_exists ('json_last_error')) { - $message = ''; - switch (json_last_error ()) { - case JSON_ERROR_NONE: - return object_to_array ($decoded); - break; - case JSON_ERROR_DEPTH: - $message = 'maximum stack depth exceeded'; - break; - case JSON_ERROR_STATE_MISMATCH: - $message = 'underflow or the modes mismatch'; - break; - case JSON_ERROR_CTRL_CHAR: - $message = 'unexpected control character found'; - break; - case JSON_ERROR_SYNTAX: - $message = 'malformed JSON'; - break; - case JSON_ERROR_UTF8: - $message = 'malformed UTF-8 characters, possibly incorrectly encoded'; - break; - default: - $message = 'unknown error'; - break; - } - throw new RestException (400, 'Error parsing JSON, ' . $message); - } else if (strlen ($data) && $decoded === NULL || $decoded === $data) { - throw new RestException (400, 'Error parsing JSON'); - } - return object_to_array ($decoded); - } - - /** - * Pretty print JSON string - * @param string $json - * @return string formated json - */ - private function json_format($json) - { - $tab = " "; - $new_json = ""; - $indent_level = 0; - $in_string = FALSE; - $len = strlen($json); - - for($c = 0; $c < $len; $c++) { - $char = $json[$c]; - switch($char) { - case '{': - case '[': - if (!$in_string) { - $new_json .= $char . "\n" . - str_repeat($tab, $indent_level + 1); - $indent_level++; - } else { - $new_json .= $char; - } - break; - case '}': - case ']': - if (!$in_string) { - $indent_level--; - $new_json .= "\n" . str_repeat($tab, $indent_level) . $char; - } else { - $new_json .= $char; - } - break; - case ',': - if (!$in_string) { - $new_json .= ",\n" . str_repeat($tab, $indent_level); - } else { - $new_json .= $char; - } - break; - case ':': - if (!$in_string) { - $new_json .= ": "; - } else { - $new_json .= $char; - } - break; - case '"': - if ($c==0) { - $in_string = TRUE; - } else if ($c > 0 && $json[$c-1] != '\\') { - $in_string = !$in_string; - } - default: - $new_json .= $char; - break; - } - } - - return $new_json; - } - - public function __toString() - { - return $this->getExtension(); - } -} - -/** - * Parses the PHPDoc comments for metadata. Inspired by Documentor code base - * @category Framework - * @package restler - * @subpackage helper - * @author Murray Picton - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.gnu.org/licenses/ GNU General Public License - * @link https://github.com/murraypicton/Doqumentor - */ -class DocParser -{ - private $params = array(); - - function parse($doc = '') { - if ($doc == '') { - return $this->params; - } - //Get the comment - if (preg_match('#^/\*\*(.*)\*/#s', $doc, $comment) === false) { - return $this->params; - } - $comment = trim($comment[1]); - //Get all the lines and strip the * from the first character - if (preg_match_all('#^\s*\*(.*)#m', $comment, $lines) === false) { - return $this->params; - } - $this->parseLines($lines[1]); - return $this->params; - } - - private function parseLines($lines) - { - foreach($lines as $line) { - $parsedLine = $this->parseLine($line); //Parse the line - - if ($parsedLine === false && !isset($this->params['description'])) { - if (isset($desc)) { - //Store the first line in the short description - $this->params['description'] = implode(PHP_EOL, $desc); - } - $desc = array(); - } else if ($parsedLine !== false) { - $desc[] = $parsedLine; //Store the line in the long description - } - } - $desc = implode(' ', $desc); - if (!empty($desc)) { - $this->params['long_description'] = $desc; - } - } - - private function parseLine($line) - { - //trim the whitespace from the line - $line = trim($line); - - if (empty($line)) { - return false; //Empty line - } - - if (strpos($line, '@') === 0) { - if (strpos($line, ' ') > 0) { - //Get the parameter name - $param = substr($line, 1, strpos($line, ' ') - 1); - $value = substr($line, strlen($param) + 2); //Get the value - } else { - $param = substr($line, 1); - $value = ''; - } - //Parse the line and return false if the parameter is valid - if ($this->setParam($param, $value)) return false; - } - return $line; - } - - private function setParam($param, $value) - { - if ($param == 'param' || $param == 'return') { - $value = $this->formatParamOrReturn($value); - } - if ($param == 'class') { - list($param, $value) = $this->formatClass($value); - } - - if (empty($this->params[$param])) { - $this->params[$param] = $value; - } else if ($param == 'param') { - $arr = array($this->params[$param], $value); - $this->params[$param] = $arr; - } else { - $this->params[$param] = $value + $this->params[$param]; - } - return true; - } - - private function formatClass($value) - { - $r = preg_split("[\(|\)]", $value); - if (count($r) > 1) { - $param = $r[0]; - parse_str($r[1],$value); - foreach ($value as $key => $val) { - $val = explode(',', $val); - if (count($val) > 1) { - $value[$key] = $val; - } - } - } else { - $param = 'Unknown'; - } - return array($param, $value); - } - - private function formatParamOrReturn($string) - { - $pos = strpos($string, ' '); - $type = substr($string, 0, $pos); - return '(' . $type . ')' . substr($string, $pos + 1); - } -} - - -// ================================================================== -// -// Individual functions -// -// ------------------------------------------------------------------ - -function parse_doc($php_doc_comment) -{ - $p = new DocParser(); - return $p->parse($php_doc_comment); - - $p = new Parser($php_doc_comment); - return $p; - - $php_doc_comment = preg_replace( - "/(^[\\s]*\\/\\*\\*) - |(^[\\s]\\*\\/) - |(^[\\s]*\\*?\\s) - |(^[\\s]*) - |(^[\\t]*)/ixm", "", $php_doc_comment); - $php_doc_comment = str_replace("\r", "", $php_doc_comment); - $php_doc_comment = preg_replace("/([\\t])+/", "\t", $php_doc_comment); - return explode("\n", $php_doc_comment); - - $php_doc_comment = trim(preg_replace('/\r?\n *\* */', ' ', - $php_doc_comment)); - return $php_doc_comment; - - preg_match_all('/@([a-z]+)\s+(.*?)\s*(?=$|@[a-z]+\s)/s', - $php_doc_comment, $matches); - return array_combine($matches[1], $matches[2]); -} - -/** - * Conveniance function that converts the given object - * in to associative array, leaves object alone if - * JsonSerializable interface is detected - * @param object $object that needs to be converted - * @category Framework - * @package restler - * @subpackage format - * @author R.Arul Kumaran - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -function object_to_array($object, $utf_encode = FALSE) -{ - if (is_array($object) - || (is_object($object) - && !($object instanceof JsonSerializable)) - ) { - $array = array(); - foreach($object as $key => $value) { - $value = object_to_array($value, $utf_encode); - if ($utf_encode && is_string($value)) { - $value = utf8_encode($value); - } - $array[$key] = $value; - } - return $array; - } - return $object; -} - -/** - * an autoloader function for loading format classes - * @param String $class_name class name of a class that implements iFormat - */ -function autoload_formats($class_name) -{ - $class_name = strtolower($class_name); - $file = RESTLER_PATH . "/$class_name/$class_name.php"; - if (file_exists ($file)) { - require_once ($file); - } else { - $file = RESTLER_PATH . "/$class_name.php"; - if (file_exists ($file)) { - require_once ($file); - } elseif (file_exists ("$class_name.php")) { - require_once ("$class_name.php"); - } - } -} - -// ================================================================== -// -// Autoload -// -// ------------------------------------------------------------------ - -spl_autoload_register('autoload_formats'); - -/** - * Manage compatibility with PHP 5 < PHP 5.3 - */ -if (!function_exists('isRestlerCompatibilityModeEnabled')) { - function isRestlerCompatibilityModeEnabled() - { - return FALSE; - } -} -define('RESTLER_PATH', dirname(__FILE__)); diff --git a/gulliver/thirdparty/restler/xmlformat.php b/gulliver/thirdparty/restler/xmlformat.php deleted file mode 100644 index 67465d651..000000000 --- a/gulliver/thirdparty/restler/xmlformat.php +++ /dev/null @@ -1,213 +0,0 @@ - - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class XmlFormat implements iFormat -{ - public static $parse_attributes=true; - public static $parse_namespaces=false; - public static $attribute_names=array('xmlns'); - /** - * Default name for the root node. - * @var string $rootNodeName - */ - public static $root_name='response'; - public static $default_tag_name='item'; - public static $mime = 'application/xml'; - const MIME = 'application/xml,text/xml'; - const EXTENSION = 'xml'; - - public function getMIMEMap() - { - return array(self::EXTENSION=>self::MIME); - } - public function getMIME(){ - return self::$mime; - } - public function getExtension(){ - return self::EXTENSION; - } - public function setMIME($mime){ - self::$mime = $mime; - } - public function setExtension($extension){ - //do nothing - } - - public function encode($data, $human_readable=false){ - return $this->toXML( object_to_array($data, false), - self::$root_name, $human_readable); - } - - public function decode($data){ - try { - if($data=='')return array(); - return $this->toArray($data); - } catch (Exception $e) { - throw new RestException(400, "Error decoding request. ". - $e->getMessage()); - } - } - - public function __toString(){ - return $this->getExtension(); - } - - /** - * determine if a variable is an associative array - */ - public function isAssoc( $array ) { - return (is_array($array) && 0 !== count(array_diff_key($array, - array_keys(array_keys($array))))); - } - - /** - * The main function for converting to an XML document. - * Pass in a multi dimensional array and this recrusively loops through - * and builds up an XML document. - * @param array $data - * @param string $rootNodeName - what you want the root node to be - - * defaults to data. - * @param SimpleXMLElement $xml - should only be used recursively - * @return string XML - * @link http://bit.ly/n85yLi - */ - public function toXML( $data, $root_node_name = 'result', - $human_readable=false, &$xml=null) { - // turn off compatibility mode as simple xml - //throws a wobbly if you don't. - if (ini_get('zend.ze1_compatibility_mode') == 1) - ini_set ('zend.ze1_compatibility_mode', 0); - if (is_null($xml)) - $xml = @simplexml_load_string("<$root_node_name/>"); - if(is_array($data)){ - $numeric=0; - // loop through the data passed in. - foreach( $data as $key => $value ) { - - // no numeric keys in our xml please! - if ( is_numeric( $key ) ) { - $numeric = 1; - $key = self::$root_name == $root_node_name ? - self::$default_tag_name : $root_node_name; - } - - // delete any char not allowed in XML element names - $key = preg_replace('/[^a-z0-9\-\_\.\:]/i', '', $key); - - // if there is another array found recrusively - //call this function - if ( is_array( $value ) ) { - $node = $this->isAssoc( $value ) || $numeric ? - $xml->addChild( $key ) : $xml; - - // recrusive call. - if ( $numeric ) $key = 'anon'; - $this->toXML($value, $key, $human_readable, $node); - } else { - // add single node or attribute - $value=htmlspecialchars($value); - in_array($key,self::$attribute_names) ? - $xml->addAttribute($key,$value) : - $xml->addChild( $key, $value); - } - } - }else{ //if given data is a string or number - //simply wrap it as text node to root - if(is_bool($data)) $data = $data ? 'true' : 'false'; - $xml = @simplexml_load_string( - "<$root_node_name>".htmlspecialchars($data).""); - //$xml->{0} = $data; - } - if(!$human_readable){ - return $xml->asXML(); - }else{ - $dom = dom_import_simplexml($xml)->ownerDocument; - $dom->formatOutput = true; - return $dom->saveXML(); - } - } - - /** - * Convert an XML document to a multi dimensional array - * Pass in an XML document (or SimpleXMLElement object) and this - * recrusively loops through and builds a representative array - * - * @param string $xml - XML document - can optionally be a - * SimpleXMLElement object - * @return array ARRAY - * @link http://bit.ly/n85yLi - */ - public function toArray( $xml, $firstCall=true) { - if ( is_string( $xml ) ) $xml = new SimpleXMLElement( $xml ); - $children = $xml->children(); - if ( !$children ) { - $r = (string) $xml; - if($r=='true' || $r=='false')$r=$r=='true'; - return $r; - } - $arr = array(); - - if($firstCall){ - //reset the attribute names list - self::$attribute_names=array(); - self::$root_name = $xml->getName(); - if (self::$parse_namespaces){ - foreach($xml->getDocNamespaces(TRUE) as $namepace => $uri) { - $arr[$namepace=='' ? 'xmlns' : - 'xmlns:'.$namepace] = (string)$uri; - } - } - } - if(self::$parse_attributes){ - foreach($xml->attributes() as $attName => $attValue) { - $arr[$attName] = (string)$attValue; - //add to attribute list for round trip support - self::$attribute_names[]=$attName; - } - } - foreach ($children as $key => $node) { - $node = $this->toArray($node, false); - // support for 'anon' non-associative arrays - if ($key == 'anon') $key = count($arr); - - // if the node is already set, put it into an array - if (isset($arr[$key])) { - if ( !is_array($arr[$key]) || @$arr[$key][0] == null ) - $arr[$key] = array($arr[$key]); - $arr[$key][] = $node; - } else { - $arr[$key] = $node; - } - } - return $arr; - } - - /** - * When you decode an XML its structure is copied to the static vars - * we can use this function to echo them out and then copy paste inside - * our service methods - * @return string PHP source code to reproduce the configuration - */ - public static function exportCurrentSettings() { - $s = 'self::$root_name = "'. - (self::$root_name)."\";\n"; - $s .= 'self::$attribute_names = '. - (var_export(self::$attribute_names, true)).";\n"; - $s .= 'self::$default_tag_name = "'. - self::$default_tag_name."\";\n"; - $s .= 'self::$parse_attributes = '. - (self::$parse_attributes ? 'true' : 'false').";\n"; - $s .= 'self::$parse_namespaces = '. - (self::$parse_namespaces ? 'true' : 'false').";\n\n\n"; - return $s; - } - -} diff --git a/gulliver/thirdparty/restler/yamlformat/LICENSE b/gulliver/thirdparty/restler/yamlformat/LICENSE deleted file mode 100644 index 3cef85317..000000000 --- a/gulliver/thirdparty/restler/yamlformat/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2008-2009 Fabien Potencier - -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. diff --git a/gulliver/thirdparty/restler/yamlformat/README.markdown b/gulliver/thirdparty/restler/yamlformat/README.markdown deleted file mode 100644 index e4f80cfba..000000000 --- a/gulliver/thirdparty/restler/yamlformat/README.markdown +++ /dev/null @@ -1,15 +0,0 @@ -Symfony YAML: A PHP library that speaks YAML -============================================ - -Symfony YAML is a PHP library that parses YAML strings and converts them to -PHP arrays. It can also converts PHP arrays to YAML strings. Its official -website is at http://components.symfony-project.org/yaml/. - -The documentation is to be found in the `doc/` directory. - -Symfony YAML is licensed under the MIT license (see LICENSE file). - -The Symfony YAML library is developed and maintained by the -[symfony](http://www.symfony-project.org/) project team. It has been extracted -from symfony to be used as a standalone library. Symfony YAML is part of the -[symfony components project](http://components.symfony-project.org/). diff --git a/gulliver/thirdparty/restler/yamlformat/sfyaml.php b/gulliver/thirdparty/restler/yamlformat/sfyaml.php deleted file mode 100644 index 9e4b46203..000000000 --- a/gulliver/thirdparty/restler/yamlformat/sfyaml.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include_once 'sfyamlinline.php'; - -/** - * sfYaml offers convenience methods to load and dump YAML. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier - * @version SVN: $Id: sfYaml.class.php 8988 2008-05-15 20:24:26Z fabien $ - */ -class sfYaml -{ - static protected - $spec = '1.2'; - - /** - * Sets the YAML specification version to use. - * - * @param string $version The YAML specification version - */ - static public function setSpecVersion($version) - { - if (!in_array($version, array('1.1', '1.2'))) - { - throw new InvalidArgumentException(sprintf('Version %s of the YAML specifications is not supported', $version)); - } - - self::$spec = $version; - } - - /** - * Gets the YAML specification version to use. - * - * @return string The YAML specification version - */ - static public function getSpecVersion() - { - return self::$spec; - } - - /** - * Loads YAML into a PHP array. - * - * The load method, when supplied with a YAML stream (string or file), - * will do its best to convert YAML in a file into a PHP array. - * - * Usage: - * - * $array = sfYaml::load('config.yml'); - * print_r($array); - * - * - * @param string $input Path of YAML file or string containing YAML - * - * @return array The YAML converted to a PHP array - * - * @throws InvalidArgumentException If the YAML is not valid - */ - public static function load($input) - { - $file = ''; - - // if input is a file, process it - if (strpos($input, "\n") === false && is_file($input)) - { - $file = $input; - - ob_start(); - $retval = include($input); - $content = ob_get_clean(); - - // if an array is returned by the config file assume it's in plain php form else in YAML - $input = is_array($retval) ? $retval : $content; - } - - // if an array is returned by the config file assume it's in plain php form else in YAML - if (is_array($input)) - { - return $input; - } - - require_once dirname(__FILE__).'/sfYamlParser.php'; - - $yaml = new sfYamlParser(); - - try - { - $ret = $yaml->parse($input); - } - catch (Exception $e) - { - throw new InvalidArgumentException(sprintf('Unable to parse %s: %s', $file ? sprintf('file "%s"', $file) : 'string', $e->getMessage())); - } - - return $ret; - } - - /** - * Dumps a PHP array to a YAML string. - * - * The dump method, when supplied with an array, will do its best - * to convert the array into friendly YAML. - * - * @param array $array PHP array - * @param integer $inline The level where you switch to inline YAML - * - * @return string A YAML string representing the original PHP array - */ - public static function dump($array, $inline = 2) - { - require_once dirname(__FILE__).'/sfyamldumper.php'; - - $yaml = new sfYamlDumper(); - - return $yaml->dump($array, $inline); - } -} - -/** - * Wraps echo to automatically provide a newline. - * - * @param string $string The string to echo with new line - */ -function echoln($string) -{ - echo $string."\n"; -} diff --git a/gulliver/thirdparty/restler/yamlformat/sfyamldumper.php b/gulliver/thirdparty/restler/yamlformat/sfyamldumper.php deleted file mode 100644 index 56e4a234f..000000000 --- a/gulliver/thirdparty/restler/yamlformat/sfyamldumper.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -//require_once(dirname(__FILE__).'/sfYamlInline.php'); - -/** - * sfYamlDumper dumps PHP variables to YAML strings. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier - * @version SVN: $Id: sfYamlDumper.class.php 10575 2008-08-01 13:08:42Z nicolas $ - */ -class sfYamlDumper -{ - /** - * Dumps a PHP value to YAML. - * - * @param mixed $input The PHP value - * @param integer $inline The level where you switch to inline YAML - * @param integer $indent The level o indentation indentation (used internally) - * - * @return string The YAML representation of the PHP value - */ - public function dump($input, $inline = 0, $indent = 0) - { - $output = ''; - $prefix = $indent ? str_repeat(' ', $indent) : ''; - - if ($inline <= 0 || !is_array($input) || empty($input)) - { - $output .= $prefix.sfYamlInline::dump($input); - } - else - { - $isAHash = array_keys($input) !== range(0, count($input) - 1); - - foreach ($input as $key => $value) - { - $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); - - $output .= sprintf('%s%s%s%s', - $prefix, - $isAHash ? sfYamlInline::dump($key).':' : '-', - $willBeInlined ? ' ' : "\n", - $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + 2) - ).($willBeInlined ? "\n" : ''); - } - } - - return $output; - } -} diff --git a/gulliver/thirdparty/restler/yamlformat/sfyamlinline.php b/gulliver/thirdparty/restler/yamlformat/sfyamlinline.php deleted file mode 100644 index bc8397ab4..000000000 --- a/gulliver/thirdparty/restler/yamlformat/sfyamlinline.php +++ /dev/null @@ -1,442 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -//require_once dirname(__FILE__).'/sfYaml.php'; - -/** - * sfYamlInline implements a YAML parser/dumper for the YAML inline syntax. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier - * @version SVN: $Id: sfYamlInline.class.php 16177 2009-03-11 08:32:48Z fabien $ - */ -class sfYamlInline -{ - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; - - /** - * Convert a YAML string to a PHP array. - * - * @param string $value A YAML string - * - * @return array A PHP array representing the YAML string - */ - static public function load($value) - { - $value = trim($value); - - if (0 == strlen($value)) - { - return ''; - } - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) - { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - switch ($value[0]) - { - case '[': - $result = self::parseSequence($value); - break; - case '{': - $result = self::parseMapping($value); - break; - default: - $result = self::parseScalar($value); - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return $result; - } - - /** - * Dumps a given PHP variable to a YAML string. - * - * @param mixed $value The PHP variable to convert - * - * @return string The YAML string representing the PHP array - */ - static public function dump($value) - { - if ('1.1' === sfYaml::getSpecVersion()) - { - $trueValues = array('true', 'on', '+', 'yes', 'y'); - $falseValues = array('false', 'off', '-', 'no', 'n'); - } - else - { - $trueValues = array('true'); - $falseValues = array('false'); - } - - switch (true) - { - case is_resource($value): - throw new InvalidArgumentException('Unable to dump PHP resources in a YAML file.'); - case is_object($value): - return '!!php/object:'.serialize($value); - case is_array($value): - return self::dumpArray($value); - case null === $value: - return 'null'; - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case ctype_digit($value): - return is_string($value) ? "'$value'" : (int) $value; - case is_numeric($value): - return is_infinite($value) ? str_ireplace('INF', '.Inf', strval($value)) : (is_string($value) ? "'$value'" : $value); - case false !== strpos($value, "\n") || false !== strpos($value, "\r"): - return sprintf('"%s"', str_replace(array('"', "\n", "\r"), array('\\"', '\n', '\r'), $value)); - case preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value): - return sprintf("'%s'", str_replace('\'', '\'\'', $value)); - case '' == $value: - return "''"; - case preg_match(self::getTimestampRegex(), $value): - return "'$value'"; - case in_array(strtolower($value), $trueValues): - return "'$value'"; - case in_array(strtolower($value), $falseValues): - return "'$value'"; - case in_array(strtolower($value), array('null', '~')): - return "'$value'"; - default: - return $value; - } - } - - /** - * Dumps a PHP array to a YAML string. - * - * @param array $value The PHP array to dump - * - * @return string The YAML string representing the PHP array - */ - static protected function dumpArray($value) - { - // array - $keys = array_keys($value); - if ( - (1 == count($keys) && '0' == $keys[0]) - || - (count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2)) - { - $output = array(); - foreach ($value as $val) - { - $output[] = self::dump($val); - } - - return sprintf('[%s]', implode(', ', $output)); - } - - // mapping - $output = array(); - foreach ($value as $key => $val) - { - $output[] = sprintf('%s: %s', self::dump($key), self::dump($val)); - } - - return sprintf('{ %s }', implode(', ', $output)); - } - - /** - * Parses a scalar to a YAML string. - * - * @param scalar $scalar - * @param string $delimiters - * @param array $stringDelimiter - * @param integer $i - * @param boolean $evaluate - * - * @return string A YAML string - */ - static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) - { - if (in_array($scalar[$i], $stringDelimiters)) - { - // quoted scalar - $output = self::parseQuotedScalar($scalar, $i); - } - else - { - // "normal" string - if (!$delimiters) - { - $output = substr($scalar, $i); - $i += strlen($output); - - // remove comments - if (false !== $strpos = strpos($output, ' #')) - { - $output = rtrim(substr($output, 0, $strpos)); - } - } - else if (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) - { - $output = $match[1]; - $i += strlen($output); - } - else - { - throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', $scalar)); - } - - $output = $evaluate ? self::evaluateScalar($output) : $output; - } - - return $output; - } - - /** - * Parses a quoted scalar to YAML. - * - * @param string $scalar - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseQuotedScalar($scalar, &$i) - { - if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) - { - throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i))); - } - - $output = substr($match[0], 1, strlen($match[0]) - 2); - - if ('"' == $scalar[$i]) - { - // evaluate the string - $output = str_replace(array('\\"', '\\n', '\\r'), array('"', "\n", "\r"), $output); - } - else - { - // unescape ' - $output = str_replace('\'\'', '\'', $output); - } - - $i += strlen($match[0]); - - return $output; - } - - /** - * Parses a sequence to a YAML string. - * - * @param string $sequence - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseSequence($sequence, &$i = 0) - { - $output = array(); - $len = strlen($sequence); - $i += 1; - - // [foo, bar, ...] - while ($i < $len) - { - switch ($sequence[$i]) - { - case '[': - // nested sequence - $output[] = self::parseSequence($sequence, $i); - break; - case '{': - // nested mapping - $output[] = self::parseMapping($sequence, $i); - break; - case ']': - return $output; - case ',': - case ' ': - break; - default: - $isQuoted = in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i); - - if (!$isQuoted && false !== strpos($value, ': ')) - { - // embedded mapping? - try - { - $value = self::parseMapping('{'.$value.'}'); - } - catch (InvalidArgumentException $e) - { - // no, it's not - } - } - - $output[] = $value; - - --$i; - } - - ++$i; - } - - throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $sequence)); - } - - /** - * Parses a mapping to a YAML string. - * - * @param string $mapping - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseMapping($mapping, &$i = 0) - { - $output = array(); - $len = strlen($mapping); - $i += 1; - - // {foo: bar, bar:foo, ...} - while ($i < $len) - { - switch ($mapping[$i]) - { - case ' ': - case ',': - ++$i; - continue 2; - case '}': - return $output; - } - - // key - $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false); - - // value - $done = false; - while ($i < $len) - { - switch ($mapping[$i]) - { - case '[': - // nested sequence - $output[$key] = self::parseSequence($mapping, $i); - $done = true; - break; - case '{': - // nested mapping - $output[$key] = self::parseMapping($mapping, $i); - $done = true; - break; - case ':': - case ' ': - break; - default: - $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i); - $done = true; - --$i; - } - - ++$i; - - if ($done) - { - continue 2; - } - } - } - - throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $mapping)); - } - - /** - * Evaluates scalars and replaces magic values. - * - * @param string $scalar - * - * @return string A YAML string - */ - static protected function evaluateScalar($scalar) - { - $scalar = trim($scalar); - - if ('1.1' === sfYaml::getSpecVersion()) - { - $trueValues = array('true', 'on', '+', 'yes', 'y'); - $falseValues = array('false', 'off', '-', 'no', 'n'); - } - else - { - $trueValues = array('true'); - $falseValues = array('false'); - } - - switch (true) - { - case 'null' == strtolower($scalar): - case '' == $scalar: - case '~' == $scalar: - return null; - case 0 === strpos($scalar, '!str'): - return (string) substr($scalar, 5); - case 0 === strpos($scalar, '! '): - return intval(self::parseScalar(substr($scalar, 2))); - case 0 === strpos($scalar, '!!php/object:'): - return unserialize(substr($scalar, 13)); - case ctype_digit($scalar): - $raw = $scalar; - $cast = intval($scalar); - return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case in_array(strtolower($scalar), $trueValues): - return true; - case in_array(strtolower($scalar), $falseValues): - return false; - case is_numeric($scalar): - return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : floatval($scalar); - case 0 == strcasecmp($scalar, '.inf'): - case 0 == strcasecmp($scalar, '.NaN'): - return -log(0); - case 0 == strcasecmp($scalar, '-.inf'): - return log(0); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): - return floatval(str_replace(',', '', $scalar)); - case preg_match(self::getTimestampRegex(), $scalar): - return strtotime($scalar); - default: - return (string) $scalar; - } - } - - static protected function getTimestampRegex() - { - return <<[0-9][0-9][0-9][0-9]) - -(?P[0-9][0-9]?) - -(?P[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P[0-9][0-9]?) - :(?P[0-9][0-9]) - :(?P[0-9][0-9]) - (?:\.(?P[0-9]*))? - (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) - (?::(?P[0-9][0-9]))?))?)? - $~x -EOF; - } -} diff --git a/gulliver/thirdparty/restler/yamlformat/sfyamlparser.php b/gulliver/thirdparty/restler/yamlformat/sfyamlparser.php deleted file mode 100644 index a10286b2d..000000000 --- a/gulliver/thirdparty/restler/yamlformat/sfyamlparser.php +++ /dev/null @@ -1,622 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -//require_once(dirname(__FILE__).'/sfYamlInline.php'); - -if (!defined('PREG_BAD_UTF8_OFFSET_ERROR')) -{ - define('PREG_BAD_UTF8_OFFSET_ERROR', 5); -} - -/** - * sfYamlParser parses YAML strings to convert them to PHP arrays. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier - * @version SVN: $Id: sfYamlParser.class.php 10832 2008-08-13 07:46:08Z fabien $ - */ -class sfYamlParser -{ - protected - $offset = 0, - $lines = array(), - $currentLineNb = -1, - $currentLine = '', - $refs = array(); - - /** - * Constructor - * - * @param integer $offset The offset of YAML document (used for line numbers in error messages) - */ - public function __construct($offset = 0) - { - $this->offset = $offset; - } - - /** - * Parses a YAML string to a PHP value. - * - * @param string $value A YAML string - * - * @return mixed A PHP value - * - * @throws InvalidArgumentException If the YAML is not valid - */ - public function parse($value) - { - $this->currentLineNb = -1; - $this->currentLine = ''; - $this->lines = explode("\n", $this->cleanup($value)); - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) - { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - } - - $data = array(); - while ($this->moveToNextLine()) - { - if ($this->isCurrentLineEmpty()) - { - continue; - } - - // tab? - if (preg_match('#^\t+#', $this->currentLine)) - { - throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - - $isRef = $isInPlace = $isProcessed = false; - if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) - { - if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) - { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - // array - if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) - { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $data[] = $parser->parse($this->getNextEmbedBlock()); - } - else - { - if (isset($values['leadspaces']) - && ' ' == $values['leadspaces'] - && preg_match('#^(?P'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"\{].*?) *\:(\s+(?P.+?))?\s*$#u', $values['value'], $matches)) - { - // this is a compact notation element, add to next block and parse - $c = $this->getRealCurrentLineNb(); - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - - $block = $values['value']; - if (!$this->isNextLineIndented()) - { - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + 2); - } - - $data[] = $parser->parse($block); - } - else - { - $data[] = $this->parseValue($values['value']); - } - } - } - else if (preg_match('#^(?P'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values)) - { - $key = sfYamlInline::parseScalar($values['key']); - - if ('<<' === $key) - { - if (isset($values['value']) && '*' === substr($values['value'], 0, 1)) - { - $isInPlace = substr($values['value'], 1); - if (!array_key_exists($isInPlace, $this->refs)) - { - throw new InvalidArgumentException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - else - { - if (isset($values['value']) && $values['value'] !== '') - { - $value = $values['value']; - } - else - { - $value = $this->getNextEmbedBlock(); - } - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $parsed = $parser->parse($value); - - $merged = array(); - if (!is_array($parsed)) - { - throw new InvalidArgumentException(sprintf("YAML merge keys used with a scalar value instead of an array at line %s (%s)", $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - else if (isset($parsed[0])) - { - // Numeric array, merge individual elements - foreach (array_reverse($parsed) as $parsedItem) - { - if (!is_array($parsedItem)) - { - throw new InvalidArgumentException(sprintf("Merge items must be arrays at line %s (%s).", $this->getRealCurrentLineNb() + 1, $parsedItem)); - } - $merged = array_merge($parsedItem, $merged); - } - } - else - { - // Associative array, merge - $merged = array_merge($merged, $parsed); - } - - $isProcessed = $merged; - } - } - else if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) - { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - if ($isProcessed) - { - // Merge keys - $data = $isProcessed; - } - // hash - else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) - { - // if next line is less indented or equal, then it means that the current value is null - if ($this->isNextLineIndented()) - { - $data[$key] = null; - } - else - { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $data[$key] = $parser->parse($this->getNextEmbedBlock()); - } - } - else - { - if ($isInPlace) - { - $data = $this->refs[$isInPlace]; - } - else - { - $data[$key] = $this->parseValue($values['value']); - } - } - } - else - { - // 1-liner followed by newline - if (2 == count($this->lines) && empty($this->lines[1])) - { - $value = sfYamlInline::load($this->lines[0]); - if (is_array($value)) - { - $first = reset($value); - if ('*' === substr($first, 0, 1)) - { - $data = array(); - foreach ($value as $alias) - { - $data[] = $this->refs[substr($alias, 1)]; - } - $value = $data; - } - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return $value; - } - - switch (preg_last_error()) - { - case PREG_INTERNAL_ERROR: - $error = 'Internal PCRE error on line'; - break; - case PREG_BACKTRACK_LIMIT_ERROR: - $error = 'pcre.backtrack_limit reached on line'; - break; - case PREG_RECURSION_LIMIT_ERROR: - $error = 'pcre.recursion_limit reached on line'; - break; - case PREG_BAD_UTF8_ERROR: - $error = 'Malformed UTF-8 data on line'; - break; - case PREG_BAD_UTF8_OFFSET_ERROR: - $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point on line'; - break; - default: - $error = 'Unable to parse line'; - } - - throw new InvalidArgumentException(sprintf('%s %d (%s).', $error, $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - - if ($isRef) - { - $this->refs[$isRef] = end($data); - } - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return empty($data) ? null : $data; - } - - /** - * Returns the current line number (takes the offset into account). - * - * @return integer The current line number - */ - protected function getRealCurrentLineNb() - { - return $this->currentLineNb + $this->offset; - } - - /** - * Returns the current line indentation. - * - * @return integer The current line indentation - */ - protected function getCurrentLineIndentation() - { - return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' ')); - } - - /** - * Returns the next embed block of YAML. - * - * @param integer $indentation The indent level at which the block is to be read, or null for default - * - * @return string A YAML string - */ - protected function getNextEmbedBlock($indentation = null) - { - $this->moveToNextLine(); - - if (null === $indentation) - { - $newIndent = $this->getCurrentLineIndentation(); - - if (!$this->isCurrentLineEmpty() && 0 == $newIndent) - { - throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - else - { - $newIndent = $indentation; - } - - $data = array(substr($this->currentLine, $newIndent)); - - while ($this->moveToNextLine()) - { - if ($this->isCurrentLineEmpty()) - { - if ($this->isCurrentLineBlank()) - { - $data[] = substr($this->currentLine, $newIndent); - } - - continue; - } - - $indent = $this->getCurrentLineIndentation(); - - if (preg_match('#^(?P *)$#', $this->currentLine, $match)) - { - // empty line - $data[] = $match['text']; - } - else if ($indent >= $newIndent) - { - $data[] = substr($this->currentLine, $newIndent); - } - else if (0 == $indent) - { - $this->moveToPreviousLine(); - - break; - } - else - { - throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - - return implode("\n", $data); - } - - /** - * Moves the parser to the next line. - */ - protected function moveToNextLine() - { - if ($this->currentLineNb >= count($this->lines) - 1) - { - return false; - } - - $this->currentLine = $this->lines[++$this->currentLineNb]; - - return true; - } - - /** - * Moves the parser to the previous line. - */ - protected function moveToPreviousLine() - { - $this->currentLine = $this->lines[--$this->currentLineNb]; - } - - /** - * Parses a YAML value. - * - * @param string $value A YAML value - * - * @return mixed A PHP value - */ - protected function parseValue($value) - { - if ('*' === substr($value, 0, 1)) - { - if (false !== $pos = strpos($value, '#')) - { - $value = substr($value, 1, $pos - 2); - } - else - { - $value = substr($value, 1); - } - - if (!array_key_exists($value, $this->refs)) - { - throw new InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine)); - } - return $this->refs[$value]; - } - - if (preg_match('/^(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?$/', $value, $matches)) - { - $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - - return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers))); - } - else - { - return sfYamlInline::load($value); - } - } - - /** - * Parses a folded scalar. - * - * @param string $separator The separator that was used to begin this folded scalar (| or >) - * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) - * @param integer $indentation The indentation that was used to begin this folded scalar - * - * @return string The text value - */ - protected function parseFoldedScalar($separator, $indicator = '', $indentation = 0) - { - $separator = '|' == $separator ? "\n" : ' '; - $text = ''; - - $notEOF = $this->moveToNextLine(); - - while ($notEOF && $this->isCurrentLineBlank()) - { - $text .= "\n"; - - $notEOF = $this->moveToNextLine(); - } - - if (!$notEOF) - { - return ''; - } - - if (!preg_match('#^(?P'.($indentation ? str_repeat(' ', $indentation) : ' +').')(?P.*)$#u', $this->currentLine, $matches)) - { - $this->moveToPreviousLine(); - - return ''; - } - - $textIndent = $matches['indent']; - $previousIndent = 0; - - $text .= $matches['text'].$separator; - while ($this->currentLineNb + 1 < count($this->lines)) - { - $this->moveToNextLine(); - - if (preg_match('#^(?P {'.strlen($textIndent).',})(?P.+)$#u', $this->currentLine, $matches)) - { - if (' ' == $separator && $previousIndent != $matches['indent']) - { - $text = substr($text, 0, -1)."\n"; - } - $previousIndent = $matches['indent']; - - $text .= str_repeat(' ', $diff = strlen($matches['indent']) - strlen($textIndent)).$matches['text'].($diff ? "\n" : $separator); - } - else if (preg_match('#^(?P *)$#', $this->currentLine, $matches)) - { - $text .= preg_replace('#^ {1,'.strlen($textIndent).'}#', '', $matches['text'])."\n"; - } - else - { - $this->moveToPreviousLine(); - - break; - } - } - - if (' ' == $separator) - { - // replace last separator by a newline - $text = preg_replace('/ (\n*)$/', "\n$1", $text); - } - - switch ($indicator) - { - case '': - $text = preg_replace('#\n+$#s', "\n", $text); - break; - case '+': - break; - case '-': - $text = preg_replace('#\n+$#s', '', $text); - break; - } - - return $text; - } - - /** - * Returns true if the next line is indented. - * - * @return Boolean Returns true if the next line is indented, false otherwise - */ - protected function isNextLineIndented() - { - $currentIndentation = $this->getCurrentLineIndentation(); - $notEOF = $this->moveToNextLine(); - - while ($notEOF && $this->isCurrentLineEmpty()) - { - $notEOF = $this->moveToNextLine(); - } - - if (false === $notEOF) - { - return false; - } - - $ret = false; - if ($this->getCurrentLineIndentation() <= $currentIndentation) - { - $ret = true; - } - - $this->moveToPreviousLine(); - - return $ret; - } - - /** - * Returns true if the current line is blank or if it is a comment line. - * - * @return Boolean Returns true if the current line is empty or if it is a comment line, false otherwise - */ - protected function isCurrentLineEmpty() - { - return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); - } - - /** - * Returns true if the current line is blank. - * - * @return Boolean Returns true if the current line is blank, false otherwise - */ - protected function isCurrentLineBlank() - { - return '' == trim($this->currentLine, ' '); - } - - /** - * Returns true if the current line is a comment line. - * - * @return Boolean Returns true if the current line is a comment line, false otherwise - */ - protected function isCurrentLineComment() - { - //checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = ltrim($this->currentLine, ' '); - return $ltrimmedLine[0] === '#'; - } - - /** - * Cleanups a YAML string to be parsed. - * - * @param string $value The input YAML string - * - * @return string A cleaned up YAML string - */ - protected function cleanup($value) - { - $value = str_replace(array("\r\n", "\r"), "\n", $value); - - if (!preg_match("#\n$#", $value)) - { - $value .= "\n"; - } - - // strip YAML header - $count = 0; - $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#su', '', $value, -1, $count); - $this->offset += $count; - - // remove leading comments - $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); - if ($count == 1) - { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - } - - // remove start of the document marker (---) - $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); - if ($count == 1) - { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - - // remove end of the document marker (...) - $value = preg_replace('#\.\.\.\s*$#s', '', $value); - } - - return $value; - } -} diff --git a/gulliver/thirdparty/restler/yamlformat/yamlformat.php b/gulliver/thirdparty/restler/yamlformat/yamlformat.php deleted file mode 100644 index 52abcbf1b..000000000 --- a/gulliver/thirdparty/restler/yamlformat/yamlformat.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright 2010 Luracast - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://luracast.com/products/restler/ - */ -class YamlFormat implements iFormat -{ - const MIME ='text/plain'; - const EXTENSION = 'yaml'; - - public function getMIMEMap() - { - return array(YamlFormat::EXTENSION=>YamlFormat::MIME); - } - public function getMIME(){ - return YamlFormat::MIME; - } - public function getExtension(){ - return YamlFormat::EXTENSION; - } - public function setMIME($mime){ - //do nothing - } - public function setExtension($extension){ - //do nothing - } - - public function encode($data, $human_readable=false){ - require_once 'sfyaml.php'; - return sfYaml::dump(object_to_array($data)); - } - - public function decode($data){ - require_once 'sfyaml.php'; - return sfYaml::load($data); - } - - public function __toString(){ - return $this->getExtension(); - } -} \ No newline at end of file