diff --git a/.gitignore b/.gitignore index eb02d2d..65374fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -vendor +vendor/ +tools/ composer.lock .phpunit.cache/ tools-libs/ diff --git a/.phive/phars.xml b/.phive/phars.xml index da47c6c..31b5fe6 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,4 +1,8 @@ - + + + + + diff --git a/ReadMe.md b/ReadMe.md index 5c57200..dcb7d58 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -29,12 +29,11 @@ Alternative setup composer local zip file repot: ## How to update -1) update the original composer for ^5 - 1) Located in `Smarty/Smarty-Composer/vendor/smarty/smarty/src/` -2) Alternative is to checkout master branch from git +1) Alternative is to checkout master branch from git 1) Located in `Smarty/Smarty-git/src/` -3) Copy the `src/` folder as is over the `Smarty/Smarty-Extended/src` folder -4) From the `update/` folder copy + 2) Run `git pull smarty master` +2) Copy the `src/` folder as is over the `Smarty/Smarty-Extended/src` folder +3) From the `update/` folder copy 1) copy over the following into `src/BlockHandler/`: 1) T.php 2) copy over the following into `src/FunctionHandler`: @@ -45,7 +44,7 @@ Alternative setup composer local zip file repot: 2) `getBlockHandler`: t 4) check either `src/FunctionHander/HtmlCheckboxes.php`, `src/FunctionHander/HtmlOptions.php` and `src/FunctionHander/HtmlBase.php` have changed 1) Update and leep the label/pos changes -5) Create new release version as official relase number +4) Create new release version as official relase number ## Test @@ -63,7 +62,9 @@ Intelephense cannot directly access the phar file, if phpunit was installed as a In the base folder: ```sh -php -r "(new Phar('/path/to/phive/folder/.phive/phars/phpunit-10.3.5.phar'))->extractTo('tools-libs/phpunit');" +php -r "(new Phar('/path/to/phive/folder/.phive/phars/phpunit-X.Y.Z.phar'))->extractTo('tools-libs/phpunit');" +// Example, must point to the .phar file itself +php -r "(new Phar('/storage/home/clemens/.phive/phars/phpunit-11.5.46.phar'))->extractTo('tools-libs/phpunit');" ``` Then open the vscode settings and set for the Folder (if multiple folders are in the workspace) or the Workspace the following setting diff --git a/publish/publish.sh b/publish/publish.sh index 33ac354..5d7e07c 100755 --- a/publish/publish.sh +++ b/publish/publish.sh @@ -62,7 +62,7 @@ function gitlab_publish _PACKAGE_DOWNLOAD="${4}" _VERSION="${5}" _file_last_published="${6}" - if [ -z "${GITLAB_PUBLISH}" ]; then + if [ -z "${_GITLAB_PUBLISH}" ]; then return; fi; if [ -n "${_GITLAB_URL}" ] && [ -n "${_GITLAB_DEPLOY_TOKEN}" ]; then diff --git a/src/Compile/AttributeCompiler.php b/src/Compile/AttributeCompiler.php new file mode 100644 index 0000000..077c4cf --- /dev/null +++ b/src/Compile/AttributeCompiler.php @@ -0,0 +1,144 @@ +required_attributes = $required_attributes; + $this->optional_attributes = $optional_attributes; + $this->shorttag_order = $shorttag_order; + $this->option_flags = $option_flags; + } + + /** + * This function checks if the attributes passed are valid + * The attributes passed for the tag to compile are checked against the list of required and + * optional attributes. Required attributes must be present. Optional attributes are check against + * the corresponding list. The keyword '_any' specifies that any attribute will be accepted + * as valid + * + * @param object $compiler compiler object + * @param array $attributes attributes applied to the tag + * + * @return array of mapped attributes for further processing + */ + public function getAttributes($compiler, $attributes) + { + $_indexed_attr = []; + $options = array_fill_keys($this->option_flags, true); + foreach ($attributes as $key => $mixed) { + // shorthand ? + if (!is_array($mixed)) { + // options flag ? + if (isset($options[trim($mixed, '\'"')])) { + $_indexed_attr[trim($mixed, '\'"')] = true; + // shorthand attribute ? + } elseif (isset($this->shorttag_order[$key])) { + $_indexed_attr[$this->shorttag_order[$key]] = $mixed; + } else { + // too many shorthands + $compiler->trigger_template_error('too many shorthand attributes', null, true); + } + // named attribute + } else { + foreach ($mixed as $k => $v) { + // options flag? + if (isset($options[$k])) { + if (is_bool($v)) { + $_indexed_attr[$k] = $v; + } else { + if (is_string($v)) { + $v = trim($v, '\'" '); + } + + // Mapping array for boolean option value + static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false]; + + if (isset($optionMap[$v])) { + $_indexed_attr[$k] = $optionMap[$v]; + } else { + $compiler->trigger_template_error( + "illegal value '" . var_export($v, true) . + "' for options flag '{$k}'", + null, + true + ); + } + } + // must be named attribute + } else { + $_indexed_attr[$k] = $v; + } + } + } + } + // check if all required attributes present + foreach ($this->required_attributes as $attr) { + if (!isset($_indexed_attr[$attr])) { + $compiler->trigger_template_error("missing '{$attr}' attribute", null, true); + } + } + // check for not allowed attributes + if ($this->optional_attributes !== ['_any']) { + $allowedAttributes = array_fill_keys( + array_merge( + $this->required_attributes, + $this->optional_attributes, + $this->option_flags + ), + true + ); + foreach ($_indexed_attr as $key => $dummy) { + if (!isset($allowedAttributes[$key]) && $key !== 0) { + $compiler->trigger_template_error("unexpected '{$key}' attribute", null, true); + } + } + } + // default 'false' for all options flags not set + foreach ($this->option_flags as $flag) { + if (!isset($_indexed_attr[$flag])) { + $_indexed_attr[$flag] = false; + } + } + + return $_indexed_attr; + } +} diff --git a/src/Compile/Base.php b/src/Compile/Base.php index 2d5c0c0..1015350 100644 --- a/src/Compile/Base.php +++ b/src/Compile/Base.php @@ -82,84 +82,12 @@ abstract class Base implements CompilerInterface { * @return array of mapped attributes for further processing */ protected function getAttributes($compiler, $attributes) { - $_indexed_attr = []; - $options = array_fill_keys($this->option_flags, true); - foreach ($attributes as $key => $mixed) { - // shorthand ? - if (!is_array($mixed)) { - // options flag ? - if (isset($options[trim($mixed, '\'"')])) { - $_indexed_attr[trim($mixed, '\'"')] = true; - // shorthand attribute ? - } elseif (isset($this->shorttag_order[$key])) { - $_indexed_attr[$this->shorttag_order[$key]] = $mixed; - } else { - // too many shorthands - $compiler->trigger_template_error('too many shorthand attributes', null, true); - } - // named attribute - } else { - foreach ($mixed as $k => $v) { - // options flag? - if (isset($options[$k])) { - if (is_bool($v)) { - $_indexed_attr[$k] = $v; - } else { - if (is_string($v)) { - $v = trim($v, '\'" '); - } - - // Mapping array for boolean option value - static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false]; - - if (isset($optionMap[$v])) { - $_indexed_attr[$k] = $optionMap[$v]; - } else { - $compiler->trigger_template_error( - "illegal value '" . var_export($v, true) . - "' for options flag '{$k}'", - null, - true - ); - } - } - // must be named attribute - } else { - $_indexed_attr[$k] = $v; - } - } - } - } - // check if all required attributes present - foreach ($this->required_attributes as $attr) { - if (!isset($_indexed_attr[$attr])) { - $compiler->trigger_template_error("missing '{$attr}' attribute", null, true); - } - } - // check for not allowed attributes - if ($this->optional_attributes !== ['_any']) { - $allowedAttributes = array_fill_keys( - array_merge( - $this->required_attributes, - $this->optional_attributes, - $this->option_flags - ), - true - ); - foreach ($_indexed_attr as $key => $dummy) { - if (!isset($allowedAttributes[$key]) && $key !== 0) { - $compiler->trigger_template_error("unexpected '{$key}' attribute", null, true); - } - } - } - // default 'false' for all options flags not set - foreach ($this->option_flags as $flag) { - if (!isset($_indexed_attr[$flag])) { - $_indexed_attr[$flag] = false; - } - } - - return $_indexed_attr; + return (new AttributeCompiler( + $this->required_attributes, + $this->optional_attributes, + $this->shorttag_order, + $this->option_flags + ))->getAttributes($compiler, $attributes); } /** diff --git a/src/Compile/FunctionCallCompiler.php b/src/Compile/FunctionCallCompiler.php index 107dd98..3ce50da 100644 --- a/src/Compile/FunctionCallCompiler.php +++ b/src/Compile/FunctionCallCompiler.php @@ -3,24 +3,18 @@ * Smarty Internal Plugin Compile Registered Function * Compiles code for the execution of a registered function * - - * @author Uwe Tews */ namespace Smarty\Compile; use Smarty\Compiler\Template; -use Smarty\CompilerException; +use Smarty\FunctionHandler\AttributeFunctionHandlerInterface; /** * Smarty Internal Plugin Compile Registered Function Class - * - - */ class FunctionCallCompiler extends Base { - /** * Attribute definition: Overwrites base class. * @@ -51,17 +45,27 @@ class FunctionCallCompiler extends Base { */ public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string { - - // check and get attributes - $_attr = $this->getAttributes($compiler, $args); - unset($_attr['nocache']); - - $_paramsArray = $this->formatParamsArray($_attr); - $_params = 'array(' . implode(',', $_paramsArray) . ')'; - - if ($functionHandler = $compiler->getSmarty()->getFunctionHandler($function)) { + $attribute_overrides = []; + + if ($functionHandler instanceof AttributeFunctionHandlerInterface) { + $attribute_overrides = $functionHandler->getSupportedAttributes(); + } + + // check and get attributes + $_attr = (new AttributeCompiler( + $attribute_overrides['required_attributes'] ?? $this->required_attributes, + $attribute_overrides['optional_attributes'] ?? $this->optional_attributes, + $attribute_overrides['shorttag_order'] ?? $this->shorttag_order, + $attribute_overrides['option_flags'] ?? $this->option_flags + ))->getAttributes($compiler, $args); + + unset($_attr['nocache']); + + $_paramsArray = $this->formatParamsArray($_attr); + $_params = 'array(' . implode(',', $_paramsArray) . ')'; + // not cacheable? $compiler->tag_nocache = $compiler->tag_nocache || !$functionHandler->isCacheable(); $output = "\$_smarty_tpl->getSmarty()->getFunctionHandler(" . var_export($function, true) . ")"; diff --git a/src/Compiler/Template.php b/src/Compiler/Template.php index 237407c..efc5216 100644 --- a/src/Compiler/Template.php +++ b/src/Compiler/Template.php @@ -1146,12 +1146,12 @@ class Template extends BaseCompiler { } // check if tag is a function - if ($this->smarty->getFunctionHandler($base_tag)) { - if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($base_tag, $this)) { + if ($this->smarty->getFunctionHandler($tag)) { + if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) { return (new \Smarty\Compile\PrintExpressionCompiler())->compile( ['nofilter'], // functions are never auto-escaped $this, - ['value' => $this->compileFunctionCall($base_tag, $args, $parameter)] + ['value' => $this->compileFunctionCall($tag, $args, $parameter)] ); } } @@ -1164,16 +1164,16 @@ class Template extends BaseCompiler { } // the default plugin handler is a handler of last resort, it may also handle not specifically registered tags. - if ($callback = $this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_COMPILER)) { + if ($callback = $this->getPluginFromDefaultHandler($tag, Smarty::PLUGIN_COMPILER)) { if (!empty($parameter['modifierlist'])) { - throw new CompilerException('No modifiers allowed on ' . $base_tag); + throw new CompilerException('No modifiers allowed on ' . $tag); } $tagCompiler = new \Smarty\Compile\Tag\BCPluginWrapper($callback); return $tagCompiler->compile($args, $this, $parameter); } if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_FUNCTION)) { - return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $base_tag); + return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $tag); } if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_BLOCK)) { diff --git a/src/Extension/BCPluginsAdapter.php b/src/Extension/BCPluginsAdapter.php index aa0eefe..77b47f8 100644 --- a/src/Extension/BCPluginsAdapter.php +++ b/src/Extension/BCPluginsAdapter.php @@ -168,7 +168,6 @@ class BCPluginsAdapter extends Base { } public function loadPluginsFromDir(string $path) { - foreach([ 'function', 'modifier', @@ -177,6 +176,7 @@ class BCPluginsAdapter extends Base { 'prefilter', 'postfilter', 'outputfilter', + 'modifiercompiler', ] as $type) { foreach (glob($path . $type . '.?*.php') as $filename) { $pluginName = $this->getPluginNameFromFilename($filename); @@ -226,4 +226,4 @@ class BCPluginsAdapter extends Base { return $matches[1]; } -} \ No newline at end of file +} diff --git a/src/Extension/DefaultExtension.php b/src/Extension/DefaultExtension.php index 156e4ec..50a3017 100644 --- a/src/Extension/DefaultExtension.php +++ b/src/Extension/DefaultExtension.php @@ -323,7 +323,7 @@ class DefaultExtension extends Base { break; } foreach ($var as $curr_key => $curr_val) { - $results .= '
' . str_repeat(' ', $depth * 2) . '' . strtr($curr_key, $_replace) . + $results .= '
' . str_repeat(' ', $depth * 2) . '' . htmlspecialchars(strtr($curr_key, $_replace)) . ' => ' . $this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; @@ -341,7 +341,7 @@ class DefaultExtension extends Base { } $objects[] = $var; foreach ($object_vars as $curr_key => $curr_val) { - $results .= '
' . str_repeat(' ', $depth * 2) . ' ->' . strtr($curr_key, $_replace) . + $results .= '
' . str_repeat(' ', $depth * 2) . ' ->' . htmlspecialchars(strtr($curr_key, $_replace)) . ' = ' . $this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; } diff --git a/src/FunctionHandler/AttributeBase.php b/src/FunctionHandler/AttributeBase.php new file mode 100644 index 0000000..71a035d --- /dev/null +++ b/src/FunctionHandler/AttributeBase.php @@ -0,0 +1,77 @@ +cacheable; + } + + /** + * Function body + * @param mixed $params The supplied parameters. + * @param Smarty\Template $template + * @return mixed + */ + abstract public function handle($params, Template $template): ?string; + + /** + * Return the support attributes for this function. + * @return array + */ + public function getSupportedAttributes(): array + { + return [ + 'required_attributes' => $this->required_attributes, + 'optional_attributes' => $this->optional_attributes, + 'shorttag_order' => $this->shorttag_order, + 'option_flags' => $this->option_flags, + ]; + } +} diff --git a/src/FunctionHandler/AttributeFunctionHandlerInterface.php b/src/FunctionHandler/AttributeFunctionHandlerInterface.php new file mode 100644 index 0000000..f76259e --- /dev/null +++ b/src/FunctionHandler/AttributeFunctionHandlerInterface.php @@ -0,0 +1,15 @@ + + */ + public function getSupportedAttributes(): array; +} diff --git a/src/Parser/TemplateParser.php b/src/Parser/TemplateParser.php index 1a9ea97..772df98 100644 --- a/src/Parser/TemplateParser.php +++ b/src/Parser/TemplateParser.php @@ -263,9 +263,9 @@ class TemplateParser const TP_ARRAYOPEN = 57; const TP_QUOTE = 58; const TP_BACKTICK = 59; - const YY_NO_ACTION = 541; - const YY_ACCEPT_ACTION = 540; - const YY_ERROR_ACTION = 539; + const YY_NO_ACTION = 542; + const YY_ACCEPT_ACTION = 541; + const YY_ERROR_ACTION = 540; const YY_SZ_ACTTAB = 2565; public static $yy_action = array( @@ -286,7 +286,7 @@ public static $yy_action = array( 278, 226, 302, 282, 200, 203, 446, 53, 4, 115, 302, 47, 22, 285, 41, 5, 54, 247, 248, 249, 1, 139, 137, 267, 202, 141, 6, 87, 14, 222, - 540, 99, 112, 151, 15, 446, 217, 261, 218, 314, + 541, 99, 112, 151, 15, 446, 217, 261, 218, 314, 224, 216, 21, 256, 233, 44, 9, 446, 45, 46, 278, 226, 325, 282, 268, 203, 53, 53, 4, 302, 302, 152, 257, 361, 320, 5, 54, 247, 248, 249, @@ -338,194 +338,194 @@ public static $yy_action = array( 288, 362, 216, 327, 200, 114, 396, 362, 201, 119, 72, 336, 396, 37, 259, 101, 393, 19, 273, 274, 154, 258, 228, 339, 94, 281, 204, 283, 393, 289, - 256, 300, 298, 301, 393, 38, 313, 288, 313, 216, - 313, 313, 114, 207, 319, 201, 119, 72, 313, 313, - 313, 313, 101, 221, 184, 273, 274, 156, 313, 313, - 313, 95, 281, 204, 283, 313, 289, 256, 300, 298, - 301, 313, 313, 313, 288, 313, 216, 313, 313, 108, - 206, 319, 201, 122, 51, 313, 120, 313, 313, 101, - 313, 184, 273, 274, 313, 313, 313, 313, 313, 281, - 204, 283, 313, 289, 313, 300, 298, 301, 288, 313, - 216, 313, 313, 114, 313, 313, 201, 122, 67, 313, - 313, 313, 313, 101, 313, 313, 273, 274, 313, 313, - 313, 313, 313, 281, 204, 283, 313, 289, 313, 300, - 298, 301, 288, 313, 216, 313, 313, 114, 212, 313, - 201, 122, 67, 313, 313, 313, 313, 101, 313, 313, - 273, 274, 313, 313, 313, 313, 313, 281, 204, 283, - 313, 289, 313, 300, 298, 301, 288, 313, 216, 313, - 313, 114, 205, 313, 201, 119, 72, 313, 313, 313, - 313, 101, 313, 313, 273, 274, 313, 313, 313, 313, - 313, 281, 204, 283, 313, 289, 313, 300, 298, 301, - 313, 313, 313, 288, 313, 216, 313, 313, 114, 313, - 318, 201, 122, 78, 313, 313, 313, 313, 101, 313, - 482, 273, 274, 482, 313, 313, 313, 482, 281, 204, - 283, 313, 289, 209, 211, 298, 301, 288, 313, 216, - 313, 313, 108, 313, 313, 201, 122, 58, 313, 238, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 482, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 118, 64, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 196, 117, 59, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 104, 84, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 300, 298, 301, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 105, 83, 313, 313, 313, 313, 101, 313, - 313, 273, 274, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 122, 55, 313, 313, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 122, 66, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 201, 104, 56, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 122, 65, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 300, 298, 301, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 122, 57, 313, 313, 313, 313, 101, 313, - 313, 273, 274, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 122, 58, 313, 313, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 122, 68, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 201, 122, 69, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 122, 70, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 300, 298, 301, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 122, 71, 313, 313, 313, 313, 101, 313, - 313, 273, 274, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 122, 73, 313, 313, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 195, - 122, 61, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 201, 122, 62, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 122, 63, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 300, 298, 301, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 122, 74, 313, 313, 313, 313, 101, 313, - 313, 273, 274, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 122, 75, 313, 313, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 122, 76, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 201, 122, 77, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 122, 79, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 210, 298, 301, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 122, 80, 313, 313, 313, 313, 101, 313, - 313, 273, 274, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 122, 81, 313, 313, - 313, 313, 101, 313, 313, 273, 274, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 122, 82, 313, 313, 313, 313, 101, 313, 313, 273, - 274, 313, 313, 313, 313, 313, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 288, 313, 216, 313, 313, - 114, 313, 313, 201, 122, 50, 313, 313, 313, 313, - 101, 313, 313, 273, 274, 313, 313, 313, 313, 313, - 281, 204, 283, 313, 289, 313, 300, 298, 301, 288, - 313, 216, 313, 313, 114, 313, 313, 201, 122, 52, - 313, 313, 313, 313, 101, 313, 313, 273, 274, 313, - 313, 313, 313, 313, 281, 204, 283, 313, 289, 313, - 300, 298, 301, 288, 313, 216, 168, 313, 114, 313, - 313, 201, 134, 313, 313, 313, 256, 313, 101, 47, - 22, 285, 41, 313, 313, 313, 313, 333, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 288, 313, 216, - 145, 313, 114, 313, 313, 201, 128, 313, 313, 313, - 256, 313, 101, 47, 22, 285, 41, 313, 313, 313, - 313, 287, 281, 204, 283, 315, 289, 313, 300, 298, - 301, 247, 248, 249, 2, 313, 313, 313, 313, 313, - 6, 87, 259, 313, 313, 19, 112, 313, 14, 258, - 217, 261, 218, 313, 15, 39, 313, 14, 14, 42, - 43, 286, 12, 15, 15, 313, 313, 313, 42, 43, - 286, 12, 313, 313, 313, 313, 293, 294, 295, 296, - 308, 27, 313, 313, 315, 293, 294, 295, 296, 313, - 247, 248, 249, 2, 313, 313, 313, 110, 313, 6, - 87, 313, 313, 313, 313, 112, 313, 313, 148, 217, - 261, 218, 313, 42, 43, 286, 12, 313, 42, 43, - 286, 12, 313, 313, 313, 313, 313, 313, 313, 313, - 293, 294, 295, 296, 313, 293, 294, 295, 296, 309, - 27, 313, 313, 240, 241, 242, 133, 223, 313, 247, - 248, 249, 1, 313, 482, 313, 313, 482, 6, 87, - 3, 482, 466, 313, 112, 313, 276, 313, 217, 261, - 218, 288, 313, 216, 313, 313, 114, 313, 313, 201, - 132, 313, 313, 313, 313, 313, 101, 313, 466, 313, - 313, 466, 313, 482, 313, 466, 281, 204, 283, 313, - 289, 313, 300, 298, 301, 313, 288, 313, 216, 313, - 200, 114, 313, 313, 201, 123, 313, 313, 313, 313, - 313, 101, 365, 313, 313, 313, 230, 313, 313, 313, - 313, 281, 204, 283, 14, 289, 313, 300, 298, 301, - 15, 313, 288, 446, 216, 313, 169, 114, 313, 313, - 201, 124, 313, 313, 313, 446, 256, 101, 313, 47, - 22, 285, 41, 313, 313, 313, 313, 281, 204, 283, - 313, 289, 313, 300, 298, 301, 313, 288, 313, 216, - 313, 313, 114, 313, 313, 201, 125, 313, 313, 313, - 313, 313, 101, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 281, 204, 283, 313, 289, 313, 300, 298, - 301, 313, 313, 288, 313, 216, 313, 313, 114, 313, - 313, 201, 126, 313, 313, 313, 313, 313, 101, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 281, 204, - 283, 313, 289, 313, 300, 298, 301, 313, 288, 313, - 216, 313, 313, 114, 313, 313, 201, 127, 313, 313, - 313, 313, 313, 101, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 281, 204, 283, 313, 289, 313, 300, - 298, 301, 313, 313, 288, 313, 216, 223, 313, 114, - 313, 313, 201, 131, 482, 313, 313, 482, 313, 101, - 313, 482, 466, 313, 313, 313, 276, 313, 313, 281, - 204, 283, 313, 289, 313, 300, 298, 301, 313, 313, - 409, 313, 313, 313, 313, 313, 313, 313, 466, 313, - 313, 466, 313, 482, 223, 466, 292, 313, 313, 313, - 313, 482, 313, 313, 482, 313, 313, 36, 482, 466, - 313, 223, 446, 276, 409, 409, 409, 409, 482, 313, - 313, 482, 313, 313, 446, 482, 466, 313, 313, 30, - 276, 409, 409, 409, 409, 466, 482, 313, 466, 482, - 482, 313, 466, 482, 466, 313, 313, 313, 276, 313, - 313, 313, 466, 313, 313, 466, 332, 482, 313, 466, - 313, 313, 313, 313, 313, 331, 42, 43, 286, 12, - 466, 313, 313, 466, 313, 482, 313, 466, 313, 42, - 43, 286, 12, 293, 294, 295, 296, 307, 313, 42, - 43, 286, 12, 185, 313, 313, 293, 294, 295, 296, - 186, 313, 313, 313, 322, 313, 293, 294, 295, 296, - 42, 43, 286, 12, 31, 313, 42, 43, 286, 12, - 313, 334, 313, 42, 43, 286, 12, 293, 294, 295, - 296, 313, 313, 293, 294, 295, 296, 313, 313, 313, + 256, 300, 298, 301, 393, 38, 314, 288, 314, 216, + 314, 314, 114, 207, 319, 201, 119, 72, 314, 314, + 314, 314, 101, 221, 184, 273, 274, 156, 314, 314, + 314, 95, 281, 204, 283, 314, 289, 256, 300, 298, + 301, 314, 314, 314, 288, 314, 216, 314, 314, 108, + 206, 319, 201, 122, 51, 314, 120, 314, 314, 101, + 314, 184, 273, 274, 314, 314, 314, 314, 314, 281, + 204, 283, 314, 289, 314, 300, 298, 301, 288, 314, + 216, 314, 314, 114, 314, 314, 201, 122, 67, 314, + 314, 314, 314, 101, 314, 314, 273, 274, 314, 314, + 314, 314, 314, 281, 204, 283, 314, 289, 314, 300, + 298, 301, 288, 314, 216, 314, 314, 114, 212, 314, + 201, 122, 67, 314, 314, 314, 314, 101, 314, 314, + 273, 274, 314, 314, 314, 314, 314, 281, 204, 283, + 314, 289, 314, 300, 298, 301, 288, 314, 216, 314, + 314, 114, 205, 314, 201, 119, 72, 314, 314, 314, + 314, 101, 314, 314, 273, 274, 314, 314, 314, 314, + 314, 281, 204, 283, 314, 289, 314, 300, 298, 301, + 314, 314, 314, 288, 314, 216, 314, 314, 114, 314, + 318, 201, 122, 78, 314, 314, 314, 314, 101, 314, + 482, 273, 274, 482, 314, 314, 314, 482, 281, 204, + 283, 314, 289, 209, 211, 298, 301, 288, 314, 216, + 314, 314, 108, 314, 314, 201, 122, 58, 314, 238, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 482, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 118, 64, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 196, 117, 59, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 104, 84, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 300, 298, 301, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 105, 83, 314, 314, 314, 314, 101, 314, + 314, 273, 274, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 122, 55, 314, 314, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 122, 66, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 201, 104, 56, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 122, 65, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 300, 298, 301, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 122, 57, 314, 314, 314, 314, 101, 314, + 314, 273, 274, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 122, 58, 314, 314, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 122, 68, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 201, 122, 69, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 122, 70, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 300, 298, 301, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 122, 71, 314, 314, 314, 314, 101, 314, + 314, 273, 274, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 122, 73, 314, 314, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 195, + 122, 61, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 201, 122, 62, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 122, 63, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 300, 298, 301, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 122, 74, 314, 314, 314, 314, 101, 314, + 314, 273, 274, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 122, 75, 314, 314, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 122, 76, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 201, 122, 77, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 122, 79, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 210, 298, 301, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 122, 80, 314, 314, 314, 314, 101, 314, + 314, 273, 274, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 122, 81, 314, 314, + 314, 314, 101, 314, 314, 273, 274, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 122, 82, 314, 314, 314, 314, 101, 314, 314, 273, + 274, 314, 314, 314, 314, 314, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 288, 314, 216, 314, 314, + 114, 314, 314, 201, 122, 50, 314, 314, 314, 314, + 101, 314, 314, 273, 274, 314, 314, 314, 314, 314, + 281, 204, 283, 314, 289, 314, 300, 298, 301, 288, + 314, 216, 314, 314, 114, 314, 314, 201, 122, 52, + 314, 314, 314, 314, 101, 314, 314, 273, 274, 314, + 314, 314, 314, 314, 281, 204, 283, 314, 289, 314, + 300, 298, 301, 288, 314, 216, 168, 314, 114, 314, + 314, 201, 134, 314, 314, 314, 256, 314, 101, 47, + 22, 285, 41, 314, 314, 314, 314, 333, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 288, 314, 216, + 145, 314, 114, 314, 314, 201, 128, 314, 314, 314, + 256, 314, 101, 47, 22, 285, 41, 314, 314, 314, + 314, 287, 281, 204, 283, 315, 289, 314, 300, 298, + 301, 247, 248, 249, 2, 314, 313, 314, 314, 314, + 6, 87, 259, 314, 314, 19, 112, 314, 14, 258, + 217, 261, 218, 314, 15, 39, 314, 14, 14, 42, + 43, 286, 12, 15, 15, 314, 314, 314, 42, 43, + 286, 12, 314, 314, 314, 314, 293, 294, 295, 296, + 308, 27, 314, 314, 315, 293, 294, 295, 296, 314, + 247, 248, 249, 2, 314, 313, 314, 110, 314, 6, + 87, 314, 314, 314, 314, 112, 314, 314, 148, 217, + 261, 218, 314, 42, 43, 286, 12, 314, 42, 43, + 286, 12, 314, 314, 314, 314, 314, 314, 314, 314, + 293, 294, 295, 296, 314, 293, 294, 295, 296, 309, + 27, 314, 314, 240, 241, 242, 133, 223, 314, 247, + 248, 249, 1, 314, 482, 314, 314, 482, 6, 87, + 3, 482, 466, 314, 112, 314, 276, 314, 217, 261, + 218, 288, 314, 216, 314, 314, 114, 314, 314, 201, + 132, 314, 314, 314, 314, 314, 101, 314, 466, 314, + 314, 466, 314, 482, 314, 466, 281, 204, 283, 314, + 289, 314, 300, 298, 301, 314, 288, 314, 216, 314, + 200, 114, 314, 314, 201, 123, 314, 314, 314, 314, + 314, 101, 365, 314, 314, 314, 230, 314, 314, 314, + 314, 281, 204, 283, 14, 289, 314, 300, 298, 301, + 15, 314, 288, 446, 216, 314, 169, 114, 314, 314, + 201, 124, 314, 314, 314, 446, 256, 101, 314, 47, + 22, 285, 41, 314, 314, 314, 314, 281, 204, 283, + 314, 289, 314, 300, 298, 301, 314, 288, 314, 216, + 314, 314, 114, 314, 314, 201, 125, 314, 314, 314, + 314, 314, 101, 314, 314, 314, 314, 314, 314, 314, + 314, 314, 281, 204, 283, 314, 289, 314, 300, 298, + 301, 314, 314, 288, 314, 216, 314, 314, 114, 314, + 314, 201, 126, 314, 314, 314, 314, 314, 101, 314, + 314, 314, 314, 314, 314, 314, 314, 314, 281, 204, + 283, 314, 289, 314, 300, 298, 301, 314, 288, 314, + 216, 314, 314, 114, 314, 314, 201, 127, 314, 314, + 314, 314, 314, 101, 314, 314, 314, 314, 314, 314, + 314, 314, 314, 281, 204, 283, 314, 289, 314, 300, + 298, 301, 314, 314, 288, 314, 216, 223, 314, 114, + 314, 314, 201, 131, 482, 314, 314, 482, 314, 101, + 314, 482, 466, 314, 314, 314, 276, 314, 314, 281, + 204, 283, 314, 289, 314, 300, 298, 301, 314, 314, + 409, 314, 314, 314, 314, 314, 314, 314, 466, 314, + 314, 466, 314, 482, 223, 466, 292, 314, 314, 314, + 314, 482, 314, 314, 482, 314, 314, 36, 482, 466, + 314, 223, 446, 276, 409, 409, 409, 409, 482, 314, + 314, 482, 314, 314, 446, 482, 466, 314, 314, 30, + 276, 409, 409, 409, 409, 466, 482, 314, 466, 482, + 482, 314, 466, 482, 466, 314, 314, 314, 276, 314, + 314, 314, 466, 314, 314, 466, 332, 482, 314, 466, + 314, 314, 314, 314, 314, 331, 42, 43, 286, 12, + 466, 314, 314, 466, 314, 482, 314, 466, 314, 42, + 43, 286, 12, 293, 294, 295, 296, 307, 314, 42, + 43, 286, 12, 185, 314, 314, 293, 294, 295, 296, + 186, 314, 314, 314, 322, 314, 293, 294, 295, 296, + 42, 43, 286, 12, 31, 314, 42, 43, 286, 12, + 314, 334, 314, 42, 43, 286, 12, 293, 294, 295, + 296, 314, 314, 293, 294, 295, 296, 314, 314, 314, 293, 294, 295, 296, 42, 43, 286, 12, 42, 43, - 286, 12, 482, 313, 313, 482, 313, 313, 313, 482, - 466, 293, 294, 295, 296, 293, 294, 295, 296, 313, - 313, 313, 259, 313, 313, 19, 313, 313, 313, 258, - 313, 313, 313, 313, 313, 313, 466, 313, 14, 466, - 150, 482, 313, 466, 15, + 286, 12, 482, 314, 314, 482, 314, 314, 314, 482, + 466, 293, 294, 295, 296, 293, 294, 295, 296, 314, + 314, 314, 259, 314, 314, 19, 314, 314, 314, 258, + 314, 314, 314, 314, 314, 314, 466, 314, 14, 466, + 150, 482, 314, 466, 15, ); public static $yy_lookahead = array( 2, 80, 100, 13, 102, 103, 1, 9, 10, 11, @@ -1180,45 +1180,45 @@ public static $yy_action = array( array(), ); public static $yy_default = array( - 350, 539, 539, 539, 524, 524, 539, 501, 501, 539, - 452, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 539, - 390, 369, 390, 539, 539, 539, 395, 539, 539, 539, - 363, 539, 539, 539, 539, 539, 374, 500, 413, 420, - 499, 525, 527, 526, 419, 421, 418, 422, 451, 449, - 397, 401, 402, 392, 395, 363, 433, 539, 390, 539, - 390, 390, 514, 454, 390, 390, 539, 539, 381, 340, - 453, 466, 539, 404, 404, 404, 466, 466, 454, 390, - 539, 390, 390, 384, 454, 539, 539, 404, 404, 404, + 350, 540, 540, 540, 525, 525, 540, 501, 501, 524, + 452, 540, 540, 540, 540, 540, 540, 540, 540, 540, + 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, + 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, + 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, + 390, 369, 390, 540, 540, 540, 395, 540, 540, 540, + 363, 540, 540, 540, 540, 540, 374, 500, 413, 420, + 499, 526, 528, 527, 419, 421, 418, 422, 451, 449, + 397, 401, 402, 392, 395, 363, 433, 540, 390, 540, + 390, 390, 514, 454, 390, 390, 540, 540, 381, 340, + 453, 466, 540, 404, 404, 404, 466, 466, 454, 390, + 540, 390, 390, 384, 454, 540, 540, 404, 404, 404, 371, 386, 404, 411, 424, 425, 426, 412, 417, 454, 511, 424, 410, 348, 508, 453, 453, 453, 453, 453, - 539, 468, 466, 482, 360, 370, 539, 373, 539, 378, - 539, 379, 463, 464, 364, 366, 367, 368, 492, 466, + 540, 468, 466, 482, 360, 370, 540, 373, 540, 378, + 540, 379, 463, 464, 364, 366, 367, 368, 492, 466, 491, 494, 493, 457, 458, 459, 460, 380, 376, 377, 372, 382, 502, 385, 387, 503, 442, 466, 488, 515, 512, 348, 507, 507, 507, 466, 466, 433, 429, 433, - 423, 423, 467, 433, 433, 423, 423, 346, 539, 539, - 539, 423, 433, 443, 539, 539, 539, 539, 429, 539, - 461, 461, 539, 429, 539, 539, 539, 539, 539, 539, - 539, 539, 539, 539, 429, 431, 539, 513, 539, 482, - 539, 539, 539, 539, 539, 438, 539, 539, 539, 398, + 423, 423, 467, 433, 433, 423, 423, 346, 540, 540, + 540, 423, 433, 443, 540, 540, 540, 540, 429, 540, + 461, 461, 540, 429, 540, 540, 540, 540, 540, 540, + 540, 540, 540, 540, 429, 431, 540, 513, 540, 482, + 540, 540, 540, 540, 540, 438, 540, 540, 540, 398, 341, 342, 343, 344, 345, 347, 349, 351, 352, 353, 354, 355, 356, 357, 359, 388, 389, 484, 485, 486, 506, 383, 504, 505, 427, 436, 437, 446, 447, 465, 469, 470, 471, 405, 406, 407, 408, 409, 428, 430, 432, 434, 438, 439, 440, 414, 415, 416, 441, 444, 445, 479, 477, 516, 517, 518, 519, 455, 456, 490, - 461, 462, 483, 498, 358, 489, 535, 536, 528, 529, - 530, 533, 532, 534, 537, 538, 531, 521, 523, 522, + 461, 462, 483, 498, 358, 489, 536, 537, 529, 530, + 531, 534, 533, 535, 538, 539, 532, 521, 523, 522, 520, 495, 480, 478, 476, 473, 474, 475, 481, 496, 497, 435, 472, 510, 487, 482, 391, 375, 399, 403, ); const YYNOCODE = 113; const YYSTACKDEPTH = 500; const YYNSTATE = 340; - const YYNRULE = 199; + const YYNRULE = 200; const YYERRORSYMBOL = 60; const YYERRSYMDT = 'yy0'; const YYFALLBACK = 0; @@ -1463,6 +1463,7 @@ public static $yy_action = array( 'arraydef ::= ARRAYOPEN arrayelements CLOSEP', 'arrayelements ::= arrayelement', 'arrayelements ::= arrayelements COMMA arrayelement', + 'arrayelements ::= arrayelements COMMA', 'arrayelements ::=', 'arrayelement ::= value APTR expr', 'arrayelement ::= ID APTR expr', @@ -1977,6 +1978,7 @@ public static $yy_action = array( array( 0 => 94, 1 => 3 ), array( 0 => 108, 1 => 1 ), array( 0 => 108, 1 => 3 ), + array( 0 => 108, 1 => 2 ), array( 0 => 108, 1 => 0 ), array( 0 => 109, 1 => 3 ), array( 0 => 109, 1 => 3 ), @@ -2022,7 +2024,7 @@ public static $yy_action = array( 106 => 6, 122 => 6, 182 => 6, - 187 => 6, + 188 => 6, 7 => 7, 8 => 8, 9 => 9, @@ -2131,7 +2133,7 @@ public static $yy_action = array( 123 => 123, 124 => 124, 126 => 126, - 184 => 126, + 185 => 126, 127 => 127, 128 => 128, 129 => 129, @@ -2149,7 +2151,7 @@ public static $yy_action = array( 141 => 141, 142 => 142, 143 => 143, - 188 => 143, + 189 => 143, 144 => 144, 146 => 146, 147 => 147, @@ -2181,18 +2183,19 @@ public static $yy_action = array( 180 => 180, 181 => 180, 183 => 183, - 185 => 185, + 184 => 184, 186 => 186, - 189 => 189, + 187 => 187, 190 => 190, 191 => 191, 192 => 192, - 195 => 192, 193 => 193, 196 => 193, 194 => 194, - 197 => 197, + 197 => 194, + 195 => 195, 198 => 198, + 199 => 199, ); // line 245 "src/Parser/TemplateParser.y" public function yy_r0(){ @@ -2961,46 +2964,50 @@ public static $yy_action = array( public function yy_r183(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; } -// line 1328 "src/Parser/TemplateParser.y" - public function yy_r185(){ - $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; +// line 1324 "src/Parser/TemplateParser.y" + public function yy_r184(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.','; } // line 1332 "src/Parser/TemplateParser.y" - public function yy_r186(){ + public function yy_r186(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1336 "src/Parser/TemplateParser.y" + public function yy_r187(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; } -// line 1348 "src/Parser/TemplateParser.y" - public function yy_r189(){ +// line 1352 "src/Parser/TemplateParser.y" + public function yy_r190(){ $this->compiler->leaveDoubleQuote(); $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php($this); } -// line 1354 "src/Parser/TemplateParser.y" - public function yy_r190(){ +// line 1358 "src/Parser/TemplateParser.y" + public function yy_r191(){ $this->yystack[$this->yyidx + -1]->minor->append_subtree($this, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } -// line 1359 "src/Parser/TemplateParser.y" - public function yy_r191(){ - $this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor); - } // line 1363 "src/Parser/TemplateParser.y" public function yy_r192(){ - $this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor); + $this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor); } // line 1367 "src/Parser/TemplateParser.y" public function yy_r193(){ - $this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')'); + $this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor); } // line 1371 "src/Parser/TemplateParser.y" public function yy_r194(){ - $this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')'); + $this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')'); } -// line 1383 "src/Parser/TemplateParser.y" - public function yy_r197(){ - $this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor); +// line 1375 "src/Parser/TemplateParser.y" + public function yy_r195(){ + $this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')'); } // line 1387 "src/Parser/TemplateParser.y" public function yy_r198(){ + $this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor); + } +// line 1391 "src/Parser/TemplateParser.y" + public function yy_r199(){ $this->_retvalue = new DqContent($this->yystack[$this->yyidx + 0]->minor); } diff --git a/src/Parser/TemplateParser.y b/src/Parser/TemplateParser.y index 58d115f..544148f 100644 --- a/src/Parser/TemplateParser.y +++ b/src/Parser/TemplateParser.y @@ -1321,6 +1321,10 @@ arrayelements(res) ::= arrayelements(a1) COMMA arrayelement(a). { res = a1.','.a; } +arrayelements(res) ::= arrayelements(a) COMMA. { + res = a.','; +} + arrayelements ::= . { return; } diff --git a/src/Resource/StringEval.php b/src/Resource/StringEval.php index 5c35e74..2aa60ff 100644 --- a/src/Resource/StringEval.php +++ b/src/Resource/StringEval.php @@ -31,7 +31,7 @@ class StringEval extends RecompiledPlugin * * @return void */ - public function populate(\Smarty\Template\Source $source, \Smarty\Template $_template = null) + public function populate(\Smarty\Template\Source $source, ?\Smarty\Template $_template = null) { $source->uid = sha1($source->name); $source->timestamp = $source->exists = true; diff --git a/src/Smarty.php b/src/Smarty.php index 15baba8..b53a36c 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -54,7 +54,7 @@ class Smarty extends \Smarty\TemplateBase { /** * smarty version */ - const SMARTY_VERSION = '5.4.3'; + const SMARTY_VERSION = '5.7.0'; /** * define caching modes diff --git a/src/Template.php b/src/Template.php index b2a732e..242fb23 100644 --- a/src/Template.php +++ b/src/Template.php @@ -154,7 +154,6 @@ class Template extends TemplateBase { if ($this->smarty->debugging) { $this->smarty->getDebug()->start_template($this, $display); } - // exit; // checks if template exists if ($this->compile_check && !$this->getSource()->exists) { throw new Exception( diff --git a/src/TemplateBase.php b/src/TemplateBase.php index f01d110..e06b591 100644 --- a/src/TemplateBase.php +++ b/src/TemplateBase.php @@ -104,7 +104,7 @@ abstract class TemplateBase extends Data { } // register the object $smarty->registered_objects[$object_name] = - [$object, (array)$allowed_methods_properties, (boolean)$format, (array)$block_methods]; + [$object, (array)$allowed_methods_properties, (bool)$format, (array)$block_methods]; return $this; } diff --git a/src/debug.tpl b/src/debug.tpl index 3dd25bf..ab09358 100644 --- a/src/debug.tpl +++ b/src/debug.tpl @@ -108,7 +108,7 @@ -

Smarty {\Smarty\Smarty::SMARTY_VERSION} Debug Console +

Smarty {$smarty.version} Debug Console - {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}

{if !empty($template_data)} diff --git a/test/SmartyExtendedTest.php b/test/SmartyExtendedTest.php index c42c033..21d1adc 100644 --- a/test/SmartyExtendedTest.php +++ b/test/SmartyExtendedTest.php @@ -5,22 +5,26 @@ declare(strict_types=1); namespace tests; use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; +use PHPUnit\Framework\Attributes\CoversClass; /** * Test class for Smarty * @coversDefaultClass \Smarty - * @testdox \Smarty method tests for extended smarty plugins */ +#[TestDox("\Smarty method tests for extended smarty plugins")] +#[CoversClass(\Smarty\Smarty::class)] final class SmartyExtendedTest extends TestCase { /** * Undocumented function * - * @testdox Output\Form\Elements Class tests - * * @return void */ - public function testSmartyExtended() + #[Test] + #[TestDox("Test Smarty Extended rendering")] + public function testSmartyExtended(): void { define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR); $locale = 'ja_JP.UTF-8'; @@ -49,6 +53,8 @@ final class SmartyExtendedTest extends TestCase 'HTML_TITLE' => 'Smarty v5 tst', // smarty test 'SMARTY_TEST' => 'Test Data', + 'TRANSLATED_ORIGINAL' => 'Are we translated?', + 'TRANSLATED_REPLACED' => 'Yes, we are translated!', 'TRANSLATE_TEST' => $l10n->__('Are we translated?'), 'TRANSLATE_TEST_FUNCTION' => _gettext('Are we translated?'), 'TRANSLATE_TEST_SMARTY' => $l10n->__('Are we translated?'), @@ -153,13 +159,16 @@ final class SmartyExtendedTest extends TestCase
Outside translation test
- TRANSLATION CLASS (OUT): Are we translated?
- TRANSLATION CLASS (OUT FUNCTION): Are we translated?
- TRANSLATION CLASS (SMARTY): Are we translated?
+ TRANSLATED ORIGINAL: Are we translated?
+ TRANSLATED REPLACED: Yes, we are translated!
+ TRANSLATION CLASS (OUT): Yes, we are translated!
+ TRANSLATION CLASS (OUT FUNCTION): Yes, we are translated!
+ TRANSLATION CLASS (SMARTY): Yes, we are translated!
Translate Test with replace:
ORIGINAL: Original with string: %1 (Replaced)
+ TRANSLATED: Translated with string: %1 (Replaced)
TRANSLATED: Translated with string: Replaced
TRANSLATED (escape): Translated with string: on
Capture test: INPUT TEST
@@ -196,6 +205,9 @@ final class SmartyExtendedTest extends TestCase
LOOP OUTPUT: 4
LOOP OUTPUT: 5
+
+ Drop Down simple +
+
+ Drop Down nested +
+
+ radio plain +
+
+ checkbox plain +
- - + checkbox pos +
+
+ +
diff --git a/test/includes/locale/ja_JP.frontend.UTF-8.po b/test/includes/locale/ja_JP.frontend.UTF-8.po index 4427b56..9b28ec1 100644 --- a/test/includes/locale/ja_JP.frontend.UTF-8.po +++ b/test/includes/locale/ja_JP.frontend.UTF-8.po @@ -23,5 +23,8 @@ msgstr "Translated" msgid "Original with string: %1" msgstr "Translated with string: %1" +msgid "Are we translated?" +msgstr "Yes, we are translated!" + #msgid "" #msgstr "" diff --git a/test/includes/locale/ja_JP/LC_MESSAGES/frontend.mo b/test/includes/locale/ja_JP/LC_MESSAGES/frontend.mo index 1e0a4ff..fdeb974 100644 Binary files a/test/includes/locale/ja_JP/LC_MESSAGES/frontend.mo and b/test/includes/locale/ja_JP/LC_MESSAGES/frontend.mo differ diff --git a/test/includes/templates/frontend/test.full.tpl b/test/includes/templates/frontend/test.full.tpl index d38322e..65bc814 100644 --- a/test/includes/templates/frontend/test.full.tpl +++ b/test/includes/templates/frontend/test.full.tpl @@ -26,6 +26,8 @@ BASE: {$BASE}
Outside translation test
+ TRANSLATED ORIGINAL: {$TRANSLATED_ORIGINAL}
+ TRANSLATED REPLACED: {$TRANSLATED_REPLACED}
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
@@ -33,6 +35,7 @@ BASE: {$BASE}
Translate Test with replace:
ORIGINAL: Original with string: %1 ({$replace})
+ TRANSLATED: Translated with string: %1 ({$replace})
TRANSLATED: {t 1=$replace}Original with string: %1{/t}
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture} diff --git a/test/includes/templates/frontend/test.simple.tpl b/test/includes/templates/frontend/test.simple.tpl index 4afe87b..142f750 100644 --- a/test/includes/templates/frontend/test.simple.tpl +++ b/test/includes/templates/frontend/test.simple.tpl @@ -18,6 +18,8 @@ BASE: {$BASE}
Outside translation test
+ TRANSLATED ORIGINAL: {$TRANSLATED_ORIGINAL}
+ TRANSLATED REPLACED: {$TRANSLATED_REPLACED}
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}
@@ -25,6 +27,7 @@ BASE: {$BASE}
Translate Test with replace:
ORIGINAL: Original with string: %1 ({$replace})
+ TRANSLATED: Translated with string: %1 ({$replace})
TRANSLATED: {t 1=$replace}Original with string: %1{/t}
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture} diff --git a/test/index.php b/test/index.php index 20dbd9c..510e735 100644 --- a/test/index.php +++ b/test/index.php @@ -74,6 +74,8 @@ $CONTENT_DATA = [ 'HTML_TITLE' => 'Smarty v5 tst', // smarty test 'SMARTY_TEST' => 'Test Data', + 'TRANSLATED_ORIGINAL' => 'Are we translated?', + 'TRANSLATED_REPLACED' => 'Yes, we are translated!', 'TRANSLATE_TEST' => $l10n->__('Are we translated?'), 'TRANSLATE_TEST_FUNCTION' => _gettext('Are we translated?'), 'TRANSLATE_TEST_SMARTY' => $l10n->__('Are we translated?'), diff --git a/tools/phpunit b/tools/phpunit deleted file mode 120000 index f1897d5..0000000 --- a/tools/phpunit +++ /dev/null @@ -1 +0,0 @@ -/home/clemens/.phive/phars/phpunit-10.3.5.phar \ No newline at end of file