diff options
| -rw-r--r-- | change_log.txt | 6 | ||||
| -rw-r--r-- | lexer/smarty_internal_templatelexer.plex | 120 | ||||
| -rw-r--r-- | lexer/smarty_internal_templateparser.y | 62 | ||||
| -rw-r--r-- | libs/Smarty.class.php | 614 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_templatecompilerbase.php | 121 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_templatelexer.php | 238 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_templateparser.php | 359 |
7 files changed, 724 insertions, 796 deletions
diff --git a/change_log.txt b/change_log.txt index 1745cce7..982085f6 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,10 @@ ===== 3.1.32 - dev === +21.10.2017 + - bugfix custom delimiters could fail since modification of version 3.1.32-dev-23 + https://github.com/smarty-php/smarty/issues/394 + 18.10.2017 - -bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017 + - bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017 https://github.com/smarty-php/smarty/issues/396 https://github.com/smarty-php/smarty/issues/397 https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392 diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex index ea53f9e8..a92653d0 100644 --- a/lexer/smarty_internal_templatelexer.plex +++ b/lexer/smarty_internal_templatelexer.plex @@ -74,42 +74,7 @@ class Smarty_Internal_Templatelexer */ public $phpType = ''; - /** - * escaped left delimiter - * - * @var string - */ - public $ldel = ''; - - /** - * escaped left delimiter with space - * - * @var string - */ - public $ldel_q = ''; - - /** - * escaped left delimiter length - * - * @var int - */ - public $ldel_length = 0; - - /** - * escaped right delimiter - * - * @var string - */ - public $rdel = ''; - - /** - * escaped right delimiter length - * - * @var int - */ - public $rdel_length = 0; - - /** + /** * state number * * @var int @@ -203,13 +168,6 @@ class Smarty_Internal_Templatelexer ); /** - * preg string of user defined litereals - * - * @var string - */ - public $literals = ''; - - /** * literal tag nesting level * * @var int @@ -266,29 +224,11 @@ class Smarty_Internal_Templatelexer $this->counter += strlen($match[0]); } $this->line = 1; - $this->smarty = $compiler->smarty; + $this->smarty = $compiler->template->smarty; $this->compiler = $compiler; - $this->ldel = preg_quote($this->smarty->left_delimiter, '/') . ($this->smarty->auto_literal ? '' : '\\s*'); - $this->ldel_length = strlen($this->smarty->left_delimiter); - $this->rdel = preg_quote($this->smarty->right_delimiter, '/'); - $this->rdel_length = strlen($this->smarty->right_delimiter); - $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter; - $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter; - $literals = $this->smarty->getLiterals(); - if (!empty($literals)) { - foreach ($literals as $key => $literal) { - $literals[$key] = preg_quote($literal, '/'); - } - } - - if ($this->smarty->auto_literal) { - $literals[] = $this->ldel . '{1,}\\s+'; - } - if (!empty($literals)) { - $this->literals = implode('|', $literals); - } else { - $this->literals = preg_quote('^$', '/'); - } + $this->compiler->initDelimiterPreg(); + $this->smarty_token_names['LDEL'] = $this->smarty->getLeftDelimiter(); + $this->smarty_token_names['RDEL'] = $this->smarty->getRightDelimiter(); } /** @@ -304,15 +244,13 @@ class Smarty_Internal_Templatelexer /** * replace placeholders with runtime preg code * - * @param string $input + * @param string $preg * * @return string */ - public function replace($input) + public function replace($preg) { - return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel'), - array($this->ldel, $this->literals, $this->rdel), - $input); + return $this->compiler->replaceDelimiter($preg); } /** @@ -322,8 +260,8 @@ class Smarty_Internal_Templatelexer */ public function isAutoLiteral() { - return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false; + return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ? + strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false; } /*!lex2php @@ -332,22 +270,22 @@ class Smarty_Internal_Templatelexer %token $this->token %value $this->value %line $this->line - userliteral = ~SMARTYliteral~ + userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~ char = ~[\S\s]~ - textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYliteral|SMARTYldel|\$|`\$|"))~ + textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~ namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~ emptyjava = ~[{][}]~ - phptag = ~(SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[/]phpSMARTYrdel)~ - phpstart = ~([<][?]((php\s+|=)|\s+))|([<][%])|([<][?]xml\s+)|([<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>])|([?][>])|([%][>])~ + phptag = ~(SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[/]phpSMARTYrdel~ + phpstart = ~[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]~ slash = ~[/]~ - ldel = ~SMARTYldel~ + ldel = ~(SMARTYldel)SMARTYal~ rdel = ~\s*SMARTYrdel~ nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~ notblockid = ~(?:(?!block)[0-9]*[a-zA-Z_]\w*)~ integer = ~\d+~ hex = ~0[xX][0-9a-fA-F]+~ math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~ - comment = ~SMARTYldel[*]~ + comment = ~(SMARTYldel)SMARTYal[*]~ incdec = ~([+]|[-]){2}~ unimath = ~\s*([+]|[-])\s*~ openP = ~\s*[(]\s*~ @@ -370,14 +308,14 @@ class Smarty_Internal_Templatelexer backtick = ~[`]~ vert = ~[|]~ qmark = ~\s*[?]\s*~ - constant = ~([_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*)(?![0-9A-Z_]*[a-z])~ + constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~ attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~ id = ~[0-9]*[a-zA-Z_]\w*~ literal = ~literal~ strip = ~strip~ - lop = ~\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\s*~ + lop = ~\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\s*~ slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~ - tlop = ~\s+(is\s+(not\s+)?(odd|even|div)\s+by)\s+~ + tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~ scond = ~\s+is\s+(not\s+)?(odd|even)~ isin = ~\s+is\s+in\s+~ as = ~\s+as\s+~ @@ -390,12 +328,11 @@ class Smarty_Internal_Templatelexer foreach = ~foreach(?![^\s])~ setfilter = ~setfilter\s+~ instanceof = ~\s+instanceof\s+~ - not = ~([!]\s*)|(not\s+)~ + not = ~[!]\s*|not\s+~ typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~ double_quote = ~["]~ - text = ~((.*?)(?=(SMARTYliteral|[{]|([<][?]((php\s+|=)|\s+))|([<][%])|([<][?]xml\s+)|([<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>])|([?][>])|([%][>]))))|(.*)~ - literaltext = ~(.*?)(?=SMARTYldel[/]?literalSMARTYrdel)~ - anytext = ~.*~ + text = ~(.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+~ + literaltext = ~(.*?)(?=(SMARTYldel)SMARTYal[/]?literalSMARTYrdel)~ */ /*!lex2php %statename TEXT @@ -403,11 +340,11 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_TEXT; } comment { - preg_match("/[*]{$this->rdel}/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + preg_match("/[*]{$this->compiler->getRdelPreg()}/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); if (isset($match[0][1])) { $to = $match[0][1] + strlen($match[0][0]); } else { - $this->compiler->trigger_template_error ("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'"); + $this->compiler->trigger_template_error ("missing or misspelled comment closing tag '*{$this->smarty->getRightDelimiter()}'"); } $this->value = substr($this->data,$this->counter,$to-$this->counter); return false; @@ -475,12 +412,12 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } ldel dollar id nocacherdel { - if ($this->_yy_stack[count($this->_yy_stack)-1] == self::TEXT) { + if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->taglineno = $this->line; } else { - $this->value = $this->smarty->left_delimiter; + $this->value = $this->smarty->getLeftDelimiter(); $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; @@ -592,7 +529,7 @@ class Smarty_Internal_Templatelexer } attr { // resolve conflicts with shorttag and right_delimiter starting with '=' - if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) { + if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) { preg_match("/\s+/",$this->value,$match); $this->value = $match[0]; $this->token = Smarty_Internal_Templateparser::TP_SPACE; @@ -663,9 +600,6 @@ class Smarty_Internal_Templatelexer literaltext { $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } - anytext { - $this->token = Smarty_Internal_Templateparser::TP_LITERAL; - } */ /*!lex2php %statename DOUBLEQUOTEDSTRING diff --git a/lexer/smarty_internal_templateparser.y b/lexer/smarty_internal_templateparser.y index 2ed1fa83..0a11a0cd 100644 --- a/lexer/smarty_internal_templateparser.y +++ b/lexer/smarty_internal_templateparser.y @@ -157,7 +157,7 @@ class Smarty_Internal_Templateparser $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template(); } - /** + /** * insert PHP code in current buffer * * @param string $code @@ -167,7 +167,21 @@ class Smarty_Internal_Templateparser $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $code)); } - /** + /** + * error rundown + * + */ + public function errorRunDown() + { + while ($this->yystack !== Array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + /** * merge PHP code with prefix code and return parse tree tag object * * @param string $code @@ -176,13 +190,13 @@ class Smarty_Internal_Templateparser */ public function mergePrefixCode($code) { - $tmp =''; + $tmp = ''; foreach ($this->compiler->prefix_code as $preCode) { $tmp .= $preCode; } - $this->compiler->prefix_code=array(); + $this->compiler->prefix_code = array(); $tmp .= $code; - return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp,true)); + return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true)); } } @@ -327,7 +341,7 @@ smartytag(res) ::= tag(t) RDEL. { // output tags start here // smartytag(res) ::= SIMPELOUTPUT(i). { - $var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $'); + $var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $'); if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\''))); } else { @@ -381,8 +395,8 @@ tag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). { // simple tag like {name} smartytag(res)::= SIMPLETAG(t). { - $tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length)); - if ($tag == 'strip') { + $tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength())); + if ($tag === 'strip') { $this->strip = true; res = null;; } else { @@ -453,23 +467,23 @@ tag(res) ::= LDELMAKENOCACHE DOLLARID(i). { // {if}, {elseif} and {while} tag tag(res) ::= LDELIF(i) expr(ie). { - $tag = trim(substr(i,$this->lex->ldel_length)); - res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); + $tag = trim(substr(i,$this->compiler->getLdelLength())); + res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); } tag(res) ::= LDELIF(i) expr(ie) attributes(a). { - $tag = trim(substr(i,$this->lex->ldel_length)); - res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); + $tag = trim(substr(i,$this->compiler->getLdelLength())); + res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); } tag(res) ::= LDELIF(i) statement(ie). { - $tag = trim(substr(i,$this->lex->ldel_length)); - res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); + $tag = trim(substr(i,$this->compiler->getLdelLength())); + res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); } tag(res) ::= LDELIF(i) statement(ie) attributes(a). { - $tag = trim(substr(i,$this->lex->ldel_length)); - res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); + $tag = trim(substr(i,$this->compiler->getLdelLength())); + res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); } // {for} tag @@ -517,8 +531,8 @@ tag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). { // end of block tag {/....} smartytag(res)::= CLOSETAG(t). { - $tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length), ' /'); - if ($tag == 'strip') { + $tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' /'); + if ($tag === 'strip') { $this->strip = false; res = null; } else { @@ -785,7 +799,7 @@ value(res) ::= doublequoted_with_quotes(s). { value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). { $prefixVar = $this->compiler->getNewPrefixVariable(); - if (vi['var'] == '\'smarty\'') { + if (vi['var'] === '\'smarty\'') { $this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>'); } else { $this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>'); @@ -845,7 +859,7 @@ variable(res) ::= DOLLARID(i). { res = $this->compiler->compileVariable('\''.substr(i,1).'\''); } variable(res) ::= varindexed(vi). { - if (vi['var'] == '\'smarty\'') { + if (vi['var'] === '\'smarty\'') { $smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']); res = $smarty_var; } else { @@ -987,7 +1001,7 @@ varvarele(res) ::= ID(s). { res = '\''.s.'\''; } varvarele(res) ::= SIMPELOUTPUT(i). { - $var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $'); + $var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $'); res = $this->compiler->compileVariable('\''.$var.'\''); } @@ -1000,7 +1014,7 @@ varvarele(res) ::= LDEL expr(e) RDEL. { // objects // object(res) ::= varindexed(vi) objectchain(oc). { - if (vi['var'] == '\'smarty\'') { + if (vi['var'] === '\'smarty\'') { res = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).oc; } else { res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].oc; @@ -1019,7 +1033,7 @@ objectchain(res) ::= objectchain(oc) objectelement(oe). { // variable objectelement(res)::= PTR ID(i) arrayindex(a). { - if ($this->security && substr(i,0,1) == '_') { + if ($this->security && substr(i,0,1) === '_') { $this->compiler->trigger_template_error (self::Err1); } res = '->'.i.a; @@ -1064,7 +1078,7 @@ function(res) ::= ns1(f) OPENP params(p) CLOSEP. { // method // method(res) ::= ID(f) OPENP params(p) CLOSEP. { - if ($this->security && substr(f,0,1) == '_') { + if ($this->security && substr(f,0,1) === '_') { $this->compiler->trigger_template_error (self::Err1); } res = f . "(". implode(',',p) .")"; diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index c5216d26..e357bf27 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -29,7 +29,6 @@ * @package Smarty * @version 3.1.32-dev */ - /** * set SMARTY_DIR to absolute path to Smarty library files. * Sets SMARTY_DIR only if user application has not already defined it. @@ -37,7 +36,6 @@ if (!defined('SMARTY_DIR')) { define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); } - /** * set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins. * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it. @@ -64,14 +62,12 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { */ define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); } - /** * Load Smarty_Autoloader */ if (!class_exists('Smarty_Autoloader')) { include dirname(__FILE__) . '/bootstrap.php'; } - /** * Load always needed external class files */ @@ -95,337 +91,218 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php'; * * @method int clearAllCache(int $exp_time = null, string $type = null) * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) - * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) - * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, $max_errors = null) + * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, $max_errors = null) * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) */ class Smarty extends Smarty_Internal_TemplateBase { - /**#@+ - * constant definitions - */ - /** * smarty version */ - const SMARTY_VERSION = '3.1.32-dev-26'; - + const SMARTY_VERSION = '3.1.32-dev-27'; /** * define variable scopes */ - const SCOPE_LOCAL = 1; - - const SCOPE_PARENT = 2; - + const SCOPE_LOCAL = 1; + const SCOPE_PARENT = 2; const SCOPE_TPL_ROOT = 4; - - const SCOPE_ROOT = 8; - - const SCOPE_SMARTY = 16; - - const SCOPE_GLOBAL = 32; - + const SCOPE_ROOT = 8; + const SCOPE_SMARTY = 16; + const SCOPE_GLOBAL = 32; /** * define caching modes */ - const CACHING_OFF = 0; - + const CACHING_OFF = 0; const CACHING_LIFETIME_CURRENT = 1; - - const CACHING_LIFETIME_SAVED = 2; - + const CACHING_LIFETIME_SAVED = 2; /** * define constant for clearing cache files be saved expiration dates */ - const CLEAR_EXPIRED = - 1; - + const CLEAR_EXPIRED = -1; /** * define compile check modes */ - const COMPILECHECK_OFF = 0; - - const COMPILECHECK_ON = 1; - + const COMPILECHECK_OFF = 0; + const COMPILECHECK_ON = 1; const COMPILECHECK_CACHEMISS = 2; - /** * define debug modes */ - const DEBUG_OFF = 0; - - const DEBUG_ON = 1; - + const DEBUG_OFF = 0; + const DEBUG_ON = 1; const DEBUG_INDIVIDUAL = 2; - /** * modes for handling of "<?php ... ?>" tags in templates. */ const PHP_PASSTHRU = 0; //-> print tags as plain text - - const PHP_QUOTE = 1; //-> escape tags as entities - - const PHP_REMOVE = 2; //-> escape tags as entities - - const PHP_ALLOW = 3; //-> escape tags as entities - + const PHP_QUOTE = 1; //-> escape tags as entities + const PHP_REMOVE = 2; //-> escape tags as entities + const PHP_ALLOW = 3; //-> escape tags as entities /** * filter types */ - const FILTER_POST = 'post'; - - const FILTER_PRE = 'pre'; - - const FILTER_OUTPUT = 'output'; - + const FILTER_POST = 'post'; + const FILTER_PRE = 'pre'; + const FILTER_OUTPUT = 'output'; const FILTER_VARIABLE = 'variable'; - /** * plugin types */ - const PLUGIN_FUNCTION = 'function'; - - const PLUGIN_BLOCK = 'block'; - - const PLUGIN_COMPILER = 'compiler'; - - const PLUGIN_MODIFIER = 'modifier'; - + const PLUGIN_FUNCTION = 'function'; + const PLUGIN_BLOCK = 'block'; + const PLUGIN_COMPILER = 'compiler'; + const PLUGIN_MODIFIER = 'modifier'; const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; - /** * Resource caching modes * (not used since 3.1.30) */ - const RESOURCE_CACHE_OFF = 0; - + const RESOURCE_CACHE_OFF = 0; const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules - - const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects - - const RESOURCE_CACHE_ON = 4; // cache source and compiled resources - - /**#@-*/ - + const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects + const RESOURCE_CACHE_ON = 4; // cache source and compiled resources /** * assigned global tpl vars */ public static $global_tpl_vars = array(); - /** * error handler returned by set_error_handler() in Smarty::muteExpectedErrors() */ public static $_previous_error_handler = null; - /** * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() */ public static $_muted_directories = array(); - /** * Flag denoting if Multibyte String functions are available */ public static $_MBSTRING = SMARTY_MBSTRING; - /** * The character set to adhere to (e.g. "UTF-8") */ public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; - /** * The date format to be used internally * (accepts date() and strftime()) */ public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; - /** * Flag denoting if PCRE should run in UTF-8 mode */ public static $_UTF8_MODIFIER = 'u'; - /** * Flag denoting if operating system is windows */ public static $_IS_WINDOWS = false; - - /**#@+ - * variables - */ - /** * auto literal on delimiters with whitespace * * @var boolean */ public $auto_literal = true; - /** * display error on not assigned variables * * @var boolean */ public $error_unassigned = false; - /** * look up relative file path in include_path * * @var boolean */ public $use_include_path = false; - - /** - * template directory - * - * @var array - */ - protected $template_dir = array('./templates/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedTemplateDir = array(); - /** * flag if template_dir is normalized * * @var bool */ public $_templateDirNormalized = false; - /** * joined template directory string used in cache keys * * @var string */ public $_joined_template_dir = null; - - /** - * config directory - * - * @var array - */ - protected $config_dir = array('./configs/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedConfigDir = array(); - /** * flag if config_dir is normalized * * @var bool */ public $_configDirNormalized = false; - /** * joined config directory string used in cache keys * * @var string */ public $_joined_config_dir = null; - /** * default template handler * * @var callable */ public $default_template_handler_func = null; - /** * default config handler * * @var callable */ public $default_config_handler_func = null; - /** * default plugin handler * * @var callable */ public $default_plugin_handler_func = null; - - /** - * compile directory - * - * @var string - */ - protected $compile_dir = './templates_c/'; - /** * flag if template_dir is normalized * * @var bool */ public $_compileDirNormalized = false; - - /** - * plugins directory - * - * @var array - */ - protected $plugins_dir = array(); - /** * flag if plugins_dir is normalized * * @var bool */ public $_pluginsDirNormalized = false; - - /** - * cache directory - * - * @var string - */ - protected $cache_dir = './cache/'; - /** * flag if template_dir is normalized * * @var bool */ public $_cacheDirNormalized = false; - /** * force template compiling? * * @var boolean */ public $force_compile = false; - /** * check template for modifications? * * @var boolean */ public $compile_check = true; - /** * use sub dirs for compiled/cached files? * * @var boolean */ public $use_sub_dirs = false; - /** * allow ambiguous resources (that are made unique by the resource handler) * * @var boolean */ public $allow_ambiguous_resources = false; - /** * merge compiled includes * * @var boolean */ public $merge_compiled_includes = false; - /* * flag for behaviour when extends: resource and {extends} tag are used simultaneous * if false disable execution of {extends} in templates called by extends resource. @@ -434,38 +311,30 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $extends_recursion = true; - /** * force cache file creation * * @var boolean */ public $force_cache = false; - /** * template left-delimiter * * @var string */ public $left_delimiter = "{"; - /** * template right-delimiter * * @var string */ public $right_delimiter = "}"; - /** * array of strings which shall be treated as literal by compiler * * @var array string */ public $literals = array(); - - /**#@+ - * security - */ /** * class name * This should be instance of Smarty_Security. @@ -474,29 +343,24 @@ class Smarty extends Smarty_Internal_TemplateBase * @see Smarty_Security */ public $security_class = 'Smarty_Security'; - /** * implementation of security class * * @var Smarty_Security */ public $security_policy = null; - /** * controls handling of PHP-blocks * * @var integer */ public $php_handling = self::PHP_PASSTHRU; - /** * controls if the php template file resource is allowed * * @var bool */ public $allow_php_templates = false; - - /**#@-*/ /** * debug mode * Setting this to true enables the debug-console. @@ -504,7 +368,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $debugging = false; - /** * This determines if debugging is enable-able from the browser. * <ul> @@ -515,7 +378,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $debugging_ctrl = 'NONE'; - /** * Name of debugging URL-param. * Only used when $debugging_ctrl is set to 'URL'. @@ -524,75 +386,54 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $smarty_debug_id = 'SMARTY_DEBUG'; - /** * Path of debug template. * * @var string */ public $debug_tpl = null; - /** * When set, smarty uses this value as error_reporting-level. * * @var int */ public $error_reporting = null; - - /**#@+ - * config var settings - */ - /** * Controls whether variables with the same name overwrite each other. * * @var boolean */ public $config_overwrite = true; - /** * Controls whether config values of on/true/yes and off/false/no get converted to boolean. * * @var boolean */ public $config_booleanize = true; - /** * Controls whether hidden config sections/vars are read from the file. * * @var boolean */ public $config_read_hidden = false; - - /**#@-*/ - - /**#@+ - * resource locking - */ - /** * locking concurrent compiles * * @var boolean */ public $compile_locking = true; - /** * Controls whether cache resources should use locking mechanism * * @var boolean */ public $cache_locking = false; - /** * seconds to wait for acquiring a lock before ignoring the write lock * * @var float */ public $locking_timeout = 10; - - /**#@-*/ - /** * resource type used if none given * Must be an valid key of $registered_resources. @@ -600,7 +441,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $default_resource_type = 'file'; - /** * caching type * Must be an element of $cache_resource_types. @@ -608,145 +448,166 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $caching_type = 'file'; - /** * config type * * @var string */ public $default_config_type = 'file'; - /** * check If-Modified-Since headers * * @var boolean */ public $cache_modified_check = false; - /** * registered plugins * * @var array */ public $registered_plugins = array(); - /** * registered objects * * @var array */ public $registered_objects = array(); - /** * registered classes * * @var array */ public $registered_classes = array(); - /** * registered filters * * @var array */ public $registered_filters = array(); - /** * registered resources * * @var array */ public $registered_resources = array(); - /** * registered cache resources * * @var array */ public $registered_cache_resources = array(); - /** * autoload filter * * @var array */ public $autoload_filters = array(); - /** * default modifier * * @var array */ public $default_modifiers = array(); - /** * autoescape variable output * * @var boolean */ public $escape_html = false; - /** * start time for execution time calculation * * @var int */ public $start_time = 0; - /** * required by the compiler for BC * * @var string */ public $_current_file = null; - /** * internal flag to enable parser debugging * * @var bool */ public $_parserdebug = false; - /** * This object type (Smarty = 1, template = 2, data = 4) * * @var int */ public $_objType = 1; - /** * Debug object * * @var Smarty_Internal_Debug */ public $_debug = null; - /** * Directory separator * * @var string */ public $ds = DIRECTORY_SEPARATOR; - + /** + * template directory + * + * @var array + */ + protected $template_dir = array('./templates/'); + /** + * flags for normalized template directory entries + * + * @var array + */ + protected $_processedTemplateDir = array(); + /** + * config directory + * + * @var array + */ + protected $config_dir = array('./configs/'); + /** + * flags for normalized template directory entries + * + * @var array + */ + protected $_processedConfigDir = array(); + /** + * compile directory + * + * @var string + */ + protected $compile_dir = './templates_c/'; + /** + * plugins directory + * + * @var array + */ + protected $plugins_dir = array(); + /** + * cache directory + * + * @var string + */ + protected $cache_dir = './cache/'; /** * removed properties * * @var string[] */ protected $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security', - '_dir_perms', '_file_perms', 'plugin_search_order', - 'inheritance_merge_compiled_includes', 'resource_cache_mode',); - + '_dir_perms', '_file_perms', 'plugin_search_order', + 'inheritance_merge_compiled_includes', 'resource_cache_mode',); /** * List of private properties which will call getter/setter on a direct access * * @var string[] */ protected $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', - 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', - 'cache_dir' => 'CacheDir',); - - /**#@-*/ + 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', + 'cache_dir' => 'CacheDir',); /** * Initialize new Smarty object @@ -759,11 +620,9 @@ class Smarty extends Smarty_Internal_TemplateBase mb_internal_encoding(Smarty::$_CHARSET); } $this->start_time = microtime(true); - if (isset($_SERVER[ 'SCRIPT_NAME' ])) { Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]); } - // Check if we're running on windows Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8 @@ -773,6 +632,105 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Error Handler to mute expected messages + * + * @link http://php.net/set_error_handler + * + * @param integer $errno Error level + * @param $errstr + * @param $errfile + * @param $errline + * @param $errcontext + * + * @return bool|void + */ + public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) + { + $_is_muted_directory = false; + // add the SMARTY_DIR to the list of muted directories + if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) { + $smarty_dir = realpath(SMARTY_DIR); + if ($smarty_dir !== false) { + Smarty::$_muted_directories[ SMARTY_DIR ] = + array('file' => $smarty_dir, 'length' => strlen($smarty_dir),); + } + } + // walk the muted directories and test against $errfile + foreach (Smarty::$_muted_directories as $key => &$dir) { + if (!$dir) { + // resolve directory and length for speedy comparisons + $file = realpath($key); + if ($file === false) { + // this directory does not exist, remove and skip it + unset(Smarty::$_muted_directories[ $key ]); + continue; + } + $dir = array('file' => $file, 'length' => strlen($file),); + } + if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) { + $_is_muted_directory = true; + break; + } + } + // pass to next error handler if this error did not occur inside SMARTY_DIR + // or the error was within smarty but masked to be ignored + if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { + if (Smarty::$_previous_error_handler) { + return call_user_func(Smarty::$_previous_error_handler, + $errno, + $errstr, + $errfile, + $errline, + $errcontext); + } else { + return false; + } + } + return; + } + + /** + * Enable error handler to mute expected messages + * + * @return void + */ + public static function muteExpectedErrors() + { + /* + error muting is done because some people implemented custom error_handlers using + http://php.net/set_error_handler and for some reason did not understand the following paragraph: + + It is important to remember that the standard PHP error handler is completely bypassed for the + error types specified by error_types unless the callback function returns FALSE. + error_reporting() settings will have no effect and your error handler will be called regardless - + however you are still able to read the current value of error_reporting and act appropriately. + Of particular note is that this value will be 0 if the statement that caused the error was + prepended by the @ error-control operator. + + Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include + - @filemtime() is almost twice as fast as using an additional file_exists() + - between file_exists() and filemtime() a possible race condition is opened, + which does not exist using the simple @filemtime() approach. + */ + $error_handler = array('Smarty', 'mutingErrorHandler'); + $previous = set_error_handler($error_handler); + // avoid dead loops + if ($previous !== $error_handler) { + Smarty::$_previous_error_handler = $previous; + } + } + + /** + * Disable error handler muting expected messages + * + * @return void + */ + public static function unmuteExpectedErrors() + { + restore_error_handler(); + } + + /** * Check if a template resource exists * * @param string $resource_name template name @@ -808,7 +766,6 @@ class Smarty extends Smarty_Internal_TemplateBase public function disableSecurity() { $this->security_policy = null; - return $this; } @@ -947,7 +904,7 @@ class Smarty extends Smarty_Internal_TemplateBase */ public function setPluginsDir($plugins_dir) { - $this->plugins_dir = (array) $plugins_dir; + $this->plugins_dir = (array)$plugins_dir; $this->_pluginsDirNormalized = false; return $this; } @@ -964,7 +921,7 @@ class Smarty extends Smarty_Internal_TemplateBase if (empty($this->plugins_dir)) { $this->plugins_dir[] = SMARTY_PLUGINS_DIR; } - $this->plugins_dir = array_merge($this->plugins_dir, (array) $plugins_dir); + $this->plugins_dir = array_merge($this->plugins_dir, (array)$plugins_dir); $this->_pluginsDirNormalized = false; return $this; } @@ -982,7 +939,7 @@ class Smarty extends Smarty_Internal_TemplateBase } if (!$this->_pluginsDirNormalized) { if (!is_array($this->plugins_dir)) { - $this->plugins_dir = (array) $this->plugins_dir; + $this->plugins_dir = (array)$this->plugins_dir; } foreach ($this->plugins_dir as $k => $v) { $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . $this->ds, true); @@ -1049,49 +1006,6 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Normalize and set directory string - * - * @param string $dirName cache_dir or compile_dir - * @param string $dir filepath of folder - */ - private function _normalizeDir($dirName, $dir) - { - $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . $this->ds, true); - if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) { - Smarty::$_muted_directories[ $this->{$dirName} ] = null; - } - } - - /** - * Normalize template_dir or config_dir - * - * @param bool $isConfig true for config_dir - * - */ - private function _normalizeTemplateConfig($isConfig) - { - if ($isConfig) { - $processed = &$this->_processedConfigDir; - $dir = &$this->config_dir; - } else { - $processed = &$this->_processedTemplateDir; - $dir = &$this->template_dir; - } - if (!is_array($dir)) { - $dir = (array) $dir; - } - foreach ($dir as $k => $v) { - if (!isset($processed[ $k ])) { - $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . $this->ds, true); - $processed[ $k ] = true; - } - } - $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true; - $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : - $this->_joined_template_dir = join('#', $this->template_dir); - } - - /** * creates a template object * * @param string $template the resource handle of the template file @@ -1181,15 +1095,17 @@ class Smarty extends Smarty_Internal_TemplateBase * * @return string */ - public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null, + public function _getTemplateId($template_name, + $cache_id = null, + $compile_id = null, + $caching = null, Smarty_Internal_Template $template = null) { $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name; $cache_id = $cache_id === null ? $this->cache_id : $cache_id; $compile_id = $compile_id === null ? $this->compile_id : $compile_id; - $caching = (int) ($caching === null ? $this->caching : $caching); - + $caching = (int)($caching === null ? $this->caching : $caching); if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) { $_templateId = Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) . @@ -1221,7 +1137,8 @@ class Smarty extends Smarty_Internal_TemplateBase // normalize $this->ds $path = str_replace($nds, $this->ds, $path); preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', - $path, $parts); + $path, + $parts); $path = $parts[ 'path' ]; if ($parts[ 'root' ] == '\\') { $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ]; @@ -1238,16 +1155,16 @@ class Smarty extends Smarty_Internal_TemplateBase ) { $counts = array(); foreach ($match[ 0 ] as $m) { - $counts[] = (int) ((strlen($m) - 1) / 3); + $counts[] = (int)((strlen($m) - 1) / 3); } sort($counts); foreach ($counts as $count) { $path = preg_replace('#(([\\\\/]([.]?[\\\\/])*[^\\\\/.]+){' . $count . '}[\\\\/]([.]?[\\\\/])*([.][.][\\\\/]([.]?[\\\\/])*){' . $count . '})(?=[^.])#u', - $this->ds, $path); + $this->ds, + $path); } } - return $parts[ 'root' ] . $path; } @@ -1293,14 +1210,26 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Set auto_literal flag + * * @param boolean $auto_literal */ - public function setAutoLiteral($auto_literal) + public function setAutoLiteral($auto_literal = true) { $this->auto_literal = $auto_literal; } /** + * Return auto_literal flag + * + * @return boolean + */ + public function getAutoLiteral() + { + return $this->auto_literal; + } + + /** * @param boolean $force_compile */ public function setForceCompile($force_compile) @@ -1317,6 +1246,8 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Set left delimiter + * * @param string $left_delimiter */ public function setLeftDelimiter($left_delimiter) @@ -1325,7 +1256,19 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * @param string $right_delimiter + * Get left delimiter + * + * @return string + */ + public function getLeftDelimiter() + { + return $this->left_delimiter; + } + + /** + * Set right delimiter + * + * @param string */ public function setRightDelimiter($right_delimiter) { @@ -1333,6 +1276,16 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Get right delimiter + * + * @return string $right_delimiter + */ + public function getRightDelimiter() + { + return $this->right_delimiter; + } + + /** * @param boolean $debugging */ public function setDebugging($debugging) @@ -1412,9 +1365,9 @@ class Smarty extends Smarty_Internal_TemplateBase if (isset($this->accessMap[ $name ])) { $method = 'get' . $this->accessMap[ $name ]; return $this->{$method}(); - } elseif (isset($this->_cache[ $name ])) { + } else if (isset($this->_cache[ $name ])) { return $this->_cache[ $name ]; - } elseif (in_array($name, $this->obsoleteProperties)) { + } else if (in_array($name, $this->obsoleteProperties)) { return null; } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); @@ -1435,7 +1388,7 @@ class Smarty extends Smarty_Internal_TemplateBase if (isset($this->accessMap[ $name ])) { $method = 'set' . $this->accessMap[ $name ]; $this->{$method}($value); - } elseif (in_array($name, $this->obsoleteProperties)) { + } else if (in_array($name, $this->obsoleteProperties)) { return; } else { if (is_object($value) && method_exists($value, $name)) { @@ -1447,100 +1400,45 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Error Handler to mute expected messages - * - * @link http://php.net/set_error_handler - * - * @param integer $errno Error level - * @param $errstr - * @param $errfile - * @param $errline - * @param $errcontext + * Normalize and set directory string * - * @return bool|void + * @param string $dirName cache_dir or compile_dir + * @param string $dir filepath of folder */ - public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) + private function _normalizeDir($dirName, $dir) { - $_is_muted_directory = false; - - // add the SMARTY_DIR to the list of muted directories - if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) { - $smarty_dir = realpath(SMARTY_DIR); - if ($smarty_dir !== false) { - Smarty::$_muted_directories[ SMARTY_DIR ] = - array('file' => $smarty_dir, 'length' => strlen($smarty_dir),); - } - } - - // walk the muted directories and test against $errfile - foreach (Smarty::$_muted_directories as $key => &$dir) { - if (!$dir) { - // resolve directory and length for speedy comparisons - $file = realpath($key); - if ($file === false) { - // this directory does not exist, remove and skip it - unset(Smarty::$_muted_directories[ $key ]); - continue; - } - $dir = array('file' => $file, 'length' => strlen($file),); - } - if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) { - $_is_muted_directory = true; - break; - } - } - // pass to next error handler if this error did not occur inside SMARTY_DIR - // or the error was within smarty but masked to be ignored - if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { - if (Smarty::$_previous_error_handler) { - return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline, - $errcontext); - } else { - return false; - } + $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . $this->ds, true); + if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) { + Smarty::$_muted_directories[ $this->{$dirName} ] = null; } - return; } /** - * Enable error handler to mute expected messages + * Normalize template_dir or config_dir * - * @return void - */ - public static function muteExpectedErrors() - { - /* - error muting is done because some people implemented custom error_handlers using - http://php.net/set_error_handler and for some reason did not understand the following paragraph: - - It is important to remember that the standard PHP error handler is completely bypassed for the - error types specified by error_types unless the callback function returns FALSE. - error_reporting() settings will have no effect and your error handler will be called regardless - - however you are still able to read the current value of error_reporting and act appropriately. - Of particular note is that this value will be 0 if the statement that caused the error was - prepended by the @ error-control operator. - - Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include - - @filemtime() is almost twice as fast as using an additional file_exists() - - between file_exists() and filemtime() a possible race condition is opened, - which does not exist using the simple @filemtime() approach. - */ - $error_handler = array('Smarty', 'mutingErrorHandler'); - $previous = set_error_handler($error_handler); - - // avoid dead loops - if ($previous !== $error_handler) { - Smarty::$_previous_error_handler = $previous; - } - } - - /** - * Disable error handler muting expected messages + * @param bool $isConfig true for config_dir * - * @return void */ - public static function unmuteExpectedErrors() + private function _normalizeTemplateConfig($isConfig) { - restore_error_handler(); + if ($isConfig) { + $processed = &$this->_processedConfigDir; + $dir = &$this->config_dir; + } else { + $processed = &$this->_processedTemplateDir; + $dir = &$this->template_dir; + } + if (!is_array($dir)) { + $dir = (array)$dir; + } + foreach ($dir as $k => $v) { + if (!isset($processed[ $k ])) { + $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . $this->ds, true); + $processed[ $k ] = true; + } + } + $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true; + $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : + $this->_joined_template_dir = join('#', $this->template_dir); } } diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 24f44577..8a38bb87 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -270,6 +270,36 @@ abstract class Smarty_Internal_TemplateCompilerBase * @var array */ public $_cache = array(); + /** + * Lexer preg pattern for left delimiter + * + * @var string + */ + private $ldelPreg = '[{]'; + /** + * Lexer preg pattern for right delimiter + * + * @var string + */ + private $rdelPreg = '[}]'; + /** + * Length of right delimiter + * + * @var int + */ + private $rdelLength = 0; + /** + * Length of left delimiter + * + * @var int + */ + private $ldelLength = 0; + /** + * Lexer preg pattern for user literals + * + * @var string + */ + private $literalPreg = ''; /** * Initialize compiler @@ -1002,6 +1032,11 @@ abstract class Smarty_Internal_TemplateCompilerBase $error_text .= ', expected one of: ' . implode(' , ', $expect); } } + if ($this->smarty->_parserdebug) { + $this->parser->errorRunDown(); + echo ob_get_clean(); + flush(); + } $e = new SmartyCompilerException($error_text); $e->line = $line; $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])); @@ -1042,6 +1077,52 @@ abstract class Smarty_Internal_TemplateCompilerBase } /** + * @param $lexerPreg + * + * @return mixed + */ + public function replaceDelimiter($lexerPreg) + { + return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), + array($this->ldelPreg, $this->literalPreg, $this->rdelPreg, + $this->smarty->getAutoLiteral() ? '{1,}' : '{9}', + $this->smarty->getAutoLiteral() ? '' : '\\s*'), + $lexerPreg); + } + + /** + * Build lexer regular expressions for left and right delimiter and user defined literals + */ + public function initDelimiterPreg() + { + $ldel = $this->smarty->getLeftDelimiter(); + $this->ldelLength = strlen($ldel); + $this->ldelPreg = ''; + foreach (str_split($ldel, 1) as $chr) { + $this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $rdel = $this->smarty->getRightDelimiter(); + $this->rdelLength = strlen($rdel); + $this->rdelPreg = ''; + foreach (str_split($rdel, 1) as $chr) { + $this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $literals = $this->smarty->getLiterals(); + if (!empty($literals)) { + foreach ($literals as $key => $literal) { + $literalPreg = ''; + foreach (str_split($literal, 1) as $chr) { + $literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $literals[ $key ] = $literalPreg; + } + $this->literalPreg = '|' . implode('|', $literals); + } else { + $this->literalPreg = ''; + } + } + + /** * leave double quoted string * - throw exception if block in string was not closed * @@ -1058,6 +1139,46 @@ abstract class Smarty_Internal_TemplateCompilerBase } /** + * Get left delimiter preg + * + * @return string + */ + public function getLdelPreg() + { + return $this->ldelPreg; + } + + /** + * Get right delimiter preg + * + * @return string + */ + public function getRdelPreg() + { + return $this->rdelPreg; + } + + /** + * Get length of left delimiter + * + * @return int + */ + public function getLdelLength() + { + return $this->ldelLength; + } + + /** + * Get length of right delimiter + * + * @return int + */ + public function getRdelLength() + { + return $this->rdelLength; + } + + /** * Get name of current open block tag * * @return string|boolean diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 1afedc38..06317c82 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -72,36 +72,6 @@ class Smarty_Internal_Templatelexer */ public $phpType = ''; /** - * escaped left delimiter - * - * @var string - */ - public $ldel = ''; - /** - * escaped left delimiter with space - * - * @var string - */ - public $ldel_q = ''; - /** - * escaped left delimiter length - * - * @var int - */ - public $ldel_length = 0; - /** - * escaped right delimiter - * - * @var string - */ - public $rdel = ''; - /** - * escaped right delimiter length - * - * @var int - */ - public $rdel_length = 0; - /** * state number * * @var int @@ -187,12 +157,6 @@ class Smarty_Internal_Templatelexer 'SCOND' => '"is even" ... if condition', ); /** - * preg string of user defined litereals - * - * @var string - */ - public $literals = ''; - /** * literal tag nesting level * * @var int @@ -246,28 +210,11 @@ class Smarty_Internal_Templatelexer $this->counter += strlen($match[ 0 ]); } $this->line = 1; - $this->smarty = $compiler->smarty; + $this->smarty = $compiler->template->smarty; $this->compiler = $compiler; - $this->ldel = preg_quote($this->smarty->left_delimiter, '/') . ($this->smarty->auto_literal ? '' : '\\s*'); - $this->ldel_length = strlen($this->smarty->left_delimiter); - $this->rdel = preg_quote($this->smarty->right_delimiter, '/'); - $this->rdel_length = strlen($this->smarty->right_delimiter); - $this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter; - $this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter; - $literals = $this->smarty->getLiterals(); - if (!empty($literals)) { - foreach ($literals as $key => $literal) { - $literals[ $key ] = preg_quote($literal, '/'); - } - } - if ($this->smarty->auto_literal) { - $literals[] = $this->ldel . '{1,}\\s+'; - } - if (!empty($literals)) { - $this->literals = implode('|', $literals); - } else { - $this->literals = preg_quote('^$', '/'); - } + $this->compiler->initDelimiterPreg(); + $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter(); + $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter(); } /** @@ -283,15 +230,13 @@ class Smarty_Internal_Templatelexer /** * replace placeholders with runtime preg code * - * @param string $input + * @param string $preg * * @return string */ - public function replace($input) + public function replace($preg) { - return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel'), - array($this->ldel, $this->literals, $this->rdel), - $input); + return $this->compiler->replaceDelimiter($preg); } /** @@ -301,8 +246,8 @@ class Smarty_Internal_Templatelexer */ public function isAutoLiteral() { - return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false; + return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ? + strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false; } // end function public function yylex() @@ -365,7 +310,7 @@ class Smarty_Internal_Templatelexer { if (!isset($this->yy_global_pattern1)) { $this->yy_global_pattern1 = - $this->replace("/\G([{][}])|\G(SMARTYldel[*])|\G((SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[\/]phpSMARTYrdel))|\G(SMARTYliteral)|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel)|\G(([<][?]((php\\s+|=)|\\s+))|([<][%])|([<][?]xml\\s+)|([<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>])|([?][>])|([%][>]))|\G(((.*?)(?=(SMARTYliteral|[{]|([<][?]((php\\s+|=)|\\s+))|([<][%])|([<][?]xml\\s+)|([<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>])|([?][>])|([%][>]))))|(.*))/isS"); + $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -423,50 +368,50 @@ class Smarty_Internal_Templatelexer function yy_r1_2() { - preg_match("/[*]{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); + preg_match("/[*]{$this->compiler->getRdelPreg()}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); if (isset($match[ 0 ][ 1 ])) { $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]); } else { - $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'"); + $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->getRightDelimiter()}'"); } $this->value = substr($this->data, $this->counter, $to - $this->counter); return false; } - function yy_r1_3() + function yy_r1_4() { $this->compiler->getTagCompiler('private_php')->parsePhp($this); } - function yy_r1_7() + function yy_r1_8() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_8() + function yy_r1_10() { $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->yypushstate(self::LITERAL); } - function yy_r1_9() + function yy_r1_12() { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->yypushstate(self::LITERAL); } // end function - function yy_r1_10() + function yy_r1_14() { $this->yypushstate(self::TAG); return true; } - function yy_r1_11() + function yy_r1_16() { $this->compiler->getTagCompiler('private_php')->parsePhp($this); } - function yy_r1_20() + function yy_r1_19() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } @@ -475,7 +420,7 @@ class Smarty_Internal_Templatelexer { if (!isset($this->yy_global_pattern2)) { $this->yy_global_pattern2 = - $this->replace("/\G(SMARTYldel(if|elseif|else if|while)\\s+)|\G(SMARTYldelfor\\s+)|\G(SMARTYldelforeach(?![^\s]))|\G(SMARTYldelsetfilter\\s+)|\G(SMARTYldelmake_nocache\\s+)|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G(SMARTYldel[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel)/isS"); + $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -533,70 +478,70 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } - function yy_r2_3() + function yy_r2_4() { $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_4() + function yy_r2_6() { $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_5() + function yy_r2_8() { $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_6() + function yy_r2_10() { $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_7() + function yy_r2_12() { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; $this->taglineno = $this->line; } - function yy_r2_9() + function yy_r2_15() { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->taglineno = $this->line; } - function yy_r2_10() + function yy_r2_17() { - if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) { + if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->taglineno = $this->line; } else { - $this->value = $this->smarty->left_delimiter; + $this->value = $this->smarty->getLeftDelimiter(); $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } } // end function - function yy_r2_12() + function yy_r2_20() { $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_13() + function yy_r2_22() { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); @@ -607,7 +552,7 @@ class Smarty_Internal_Templatelexer { if (!isset($this->yy_global_pattern3)) { $this->yy_global_pattern3 = - $this->replace("/\G(\\s*SMARTYrdel)|\G(SMARTYldel)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+(is\\s+(not\\s+)?(odd|even|div)\\s+by)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"); + $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -670,148 +615,148 @@ class Smarty_Internal_Templatelexer return true; } - function yy_r3_3() + function yy_r3_4() { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->compiler->enterDoubleQuote(); } - function yy_r3_4() + function yy_r3_5() { $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; } - function yy_r3_5() + function yy_r3_6() { $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r3_6() + function yy_r3_7() { $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; } - function yy_r3_7() + function yy_r3_8() { $this->token = Smarty_Internal_Templateparser::TP_ISIN; } - function yy_r3_8() + function yy_r3_9() { $this->token = Smarty_Internal_Templateparser::TP_AS; } - function yy_r3_9() + function yy_r3_10() { $this->token = Smarty_Internal_Templateparser::TP_TO; } - function yy_r3_10() + function yy_r3_11() { $this->token = Smarty_Internal_Templateparser::TP_STEP; } - function yy_r3_11() + function yy_r3_12() { $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; } - function yy_r3_12() + function yy_r3_13() { $this->token = Smarty_Internal_Templateparser::TP_LOGOP; } - function yy_r3_17() + function yy_r3_15() { $this->token = Smarty_Internal_Templateparser::TP_SLOGOP; } - function yy_r3_19() + function yy_r3_17() { $this->token = Smarty_Internal_Templateparser::TP_TLOGOP; } - function yy_r3_23() + function yy_r3_20() { $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; } - function yy_r3_26() + function yy_r3_23() { $this->token = Smarty_Internal_Templateparser::TP_NOT; } - function yy_r3_29() + function yy_r3_24() { $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; } - function yy_r3_33() + function yy_r3_28() { $this->token = Smarty_Internal_Templateparser::TP_OPENP; } - function yy_r3_34() + function yy_r3_29() { $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; } - function yy_r3_35() + function yy_r3_30() { $this->token = Smarty_Internal_Templateparser::TP_OPENB; } - function yy_r3_36() + function yy_r3_31() { $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; } - function yy_r3_37() + function yy_r3_32() { $this->token = Smarty_Internal_Templateparser::TP_PTR; } - function yy_r3_38() + function yy_r3_33() { $this->token = Smarty_Internal_Templateparser::TP_APTR; } - function yy_r3_39() + function yy_r3_34() { $this->token = Smarty_Internal_Templateparser::TP_EQUAL; } - function yy_r3_40() + function yy_r3_35() { $this->token = Smarty_Internal_Templateparser::TP_INCDEC; } - function yy_r3_42() + function yy_r3_37() { $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; } - function yy_r3_44() + function yy_r3_39() { $this->token = Smarty_Internal_Templateparser::TP_MATH; } - function yy_r3_46() + function yy_r3_41() { $this->token = Smarty_Internal_Templateparser::TP_AT; } - function yy_r3_47() + function yy_r3_42() { $this->token = Smarty_Internal_Templateparser::TP_HATCH; } - function yy_r3_48() + function yy_r3_43() { // resolve conflicts with shorttag and right_delimiter starting with '=' - if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == - $this->smarty->right_delimiter) { + if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === + $this->smarty->getRightDelimiter()) { preg_match("/\s+/", $this->value, $match); $this->value = $match[ 0 ]; $this->token = Smarty_Internal_Templateparser::TP_SPACE; @@ -820,73 +765,73 @@ class Smarty_Internal_Templatelexer } } - function yy_r3_49() + function yy_r3_44() { $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; } - function yy_r3_52() + function yy_r3_47() { $this->token = Smarty_Internal_Templateparser::TP_ID; } - function yy_r3_53() + function yy_r3_48() { $this->token = Smarty_Internal_Templateparser::TP_INTEGER; } - function yy_r3_54() + function yy_r3_49() { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->yypopstate(); } - function yy_r3_55() + function yy_r3_50() { $this->token = Smarty_Internal_Templateparser::TP_VERT; } - function yy_r3_56() + function yy_r3_51() { $this->token = Smarty_Internal_Templateparser::TP_DOT; } - function yy_r3_57() + function yy_r3_52() { $this->token = Smarty_Internal_Templateparser::TP_COMMA; } - function yy_r3_58() + function yy_r3_53() { $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; } - function yy_r3_59() + function yy_r3_54() { $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; } - function yy_r3_60() + function yy_r3_55() { $this->token = Smarty_Internal_Templateparser::TP_COLON; } - function yy_r3_61() + function yy_r3_56() { $this->token = Smarty_Internal_Templateparser::TP_QMARK; } - function yy_r3_62() + function yy_r3_57() { $this->token = Smarty_Internal_Templateparser::TP_HEX; } - function yy_r3_63() + function yy_r3_58() { $this->token = Smarty_Internal_Templateparser::TP_SPACE; } // end function - function yy_r3_64() + function yy_r3_59() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } @@ -895,7 +840,7 @@ class Smarty_Internal_Templatelexer { if (!isset($this->yy_global_pattern4)) { $this->yy_global_pattern4 = - $this->replace("/\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=SMARTYldel[\/]?literalSMARTYrdel))|\G(.*)/isS"); + $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -952,7 +897,7 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } - function yy_r4_2() + function yy_r4_3() { if ($this->literal_cnt) { $this->literal_cnt--; @@ -963,11 +908,6 @@ class Smarty_Internal_Templatelexer } } - function yy_r4_3() - { - $this->token = Smarty_Internal_Templateparser::TP_LITERAL; - } - function yy_r4_5() { $this->token = Smarty_Internal_Templateparser::TP_LITERAL; @@ -977,7 +917,7 @@ class Smarty_Internal_Templatelexer { if (!isset($this->yy_global_pattern5)) { $this->yy_global_pattern5 = - $this->replace("/\G(SMARTYliteral)|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*)|\G(SMARTYldel)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(SMARTYliteral|SMARTYldel|\\$|`\\$|\")))/isS"); + $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -1033,42 +973,42 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_2() + function yy_r5_3() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_3() + function yy_r5_5() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_4() + function yy_r5_7() { $this->yypushstate(self::TAG); return true; } - function yy_r5_5() + function yy_r5_9() { $this->yypushstate(self::TAG); return true; } - function yy_r5_6() + function yy_r5_11() { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->taglineno = $this->line; $this->yypushstate(self::TAGBODY); } - function yy_r5_7() + function yy_r5_13() { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypopstate(); } - function yy_r5_8() + function yy_r5_14() { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->value = substr($this->value, 0, -1); @@ -1076,17 +1016,17 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } - function yy_r5_9() + function yy_r5_15() { $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r5_10() + function yy_r5_16() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_11() + function yy_r5_17() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php index b0a493ee..65697f84 100644 --- a/libs/sysplugins/smarty_internal_templateparser.php +++ b/libs/sysplugins/smarty_internal_templateparser.php @@ -1704,14 +1704,14 @@ class Smarty_Internal_Templateparser 'objectelement', 'method', 'params', 'modifier', 'modparameter', 'arrayelements', 'arrayelement', 'doublequoted', 'doublequotedcontent', - ); /* Index of top element in stack */ + ); /** * internal error flag * * @var bool */ - private $internalError = false; /* Shifts left before out of the error */ - private $_retvalue; /* The parser's stack */ + private $internalError = false; /* Index of top element in stack */ + private $_retvalue; /* Shifts left before out of the error */ /** * constructor * @@ -1726,8 +1726,7 @@ class Smarty_Internal_Templateparser $this->smarty = $this->template->smarty; $this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false; $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template(); - } - + } /* The parser's stack */ public static function yy_destructor($yymajor, $yypminor) { switch ($yymajor) { @@ -1747,6 +1746,20 @@ class Smarty_Internal_Templateparser } /** + * error rundown + * + */ + public function errorRunDown() + { + while ($this->yystack !== Array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + /** * merge PHP code with prefix code and return parse tree tag object * * @param string $code @@ -2049,7 +2062,7 @@ class Smarty_Internal_Templateparser } } - #line 220 "../smarty/lexer/smarty_internal_templateparser.y" + #line 234 "../smarty/lexer/smarty_internal_templateparser.y" public function yy_shift($yyNewState, $yyMajor, $yypMinor) { $this->yyidx++; @@ -2061,7 +2074,7 @@ class Smarty_Internal_Templateparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 207 "../smarty/lexer/smarty_internal_templateparser.y" + #line 221 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->compiler->trigger_template_error("Stack overflow in template parser"); return; @@ -2086,7 +2099,7 @@ class Smarty_Internal_Templateparser } } - #line 230 "../smarty/lexer/smarty_internal_templateparser.y" + #line 244 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r0() { $this->root_buffer->prepend_array($this, $this->template_prefix); @@ -2094,7 +2107,7 @@ class Smarty_Internal_Templateparser $this->_retvalue = $this->root_buffer->to_smarty_php($this); } - #line 237 "../smarty/lexer/smarty_internal_templateparser.y" + #line 251 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r1() { if ($this->yystack[ $this->yyidx + 0 ]->minor != null) { @@ -2102,7 +2115,7 @@ class Smarty_Internal_Templateparser } } - #line 251 "../smarty/lexer/smarty_internal_templateparser.y" + #line 265 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r2() { if ($this->yystack[ $this->yyidx + 0 ]->minor != null) { @@ -2111,7 +2124,7 @@ class Smarty_Internal_Templateparser } } - #line 262 "../smarty/lexer/smarty_internal_templateparser.y" + #line 276 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r4() { if ($this->compiler->has_code) { @@ -2123,13 +2136,13 @@ class Smarty_Internal_Templateparser $this->block_nesting_level = count($this->compiler->_tag_stack); } - #line 266 "../smarty/lexer/smarty_internal_templateparser.y" + #line 280 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r5() { $this->_retvalue = new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 277 "../smarty/lexer/smarty_internal_templateparser.y" + #line 291 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r6() { $code = $this->compiler->compileTag('private_php', @@ -2149,66 +2162,67 @@ class Smarty_Internal_Templateparser } } - #line 281 "../smarty/lexer/smarty_internal_templateparser.y" + #line 295 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r7() { $this->_retvalue = $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 285 "../smarty/lexer/smarty_internal_templateparser.y" + #line 299 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r8() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 290 "../smarty/lexer/smarty_internal_templateparser.y" + #line 304 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r9() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 294 "../smarty/lexer/smarty_internal_templateparser.y" + #line 308 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r10() { $this->strip = true; } - #line 299 "../smarty/lexer/smarty_internal_templateparser.y" + #line 313 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r11() { $this->strip = false; } - #line 303 "../smarty/lexer/smarty_internal_templateparser.y" + #line 317 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r12() { $this->_retvalue = ''; } - #line 307 "../smarty/lexer/smarty_internal_templateparser.y" + #line 321 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r13() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 323 "../smarty/lexer/smarty_internal_templateparser.y" + #line 337 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r14() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 329 "../smarty/lexer/smarty_internal_templateparser.y" + #line 343 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r18() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 339 "../smarty/lexer/smarty_internal_templateparser.y" + #line 353 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r19() { - $var = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, -$this->lex->rdel_length), - ' $'); + $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' $'); if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { $this->_retvalue = $this->compiler->compileTag('private_print_expression', array('nocache'), @@ -2224,7 +2238,7 @@ class Smarty_Internal_Templateparser } } - #line 343 "../smarty/lexer/smarty_internal_templateparser.y" + #line 357 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r20() { $this->_retvalue = $this->compiler->compileTag('private_print_expression', @@ -2232,7 +2246,7 @@ class Smarty_Internal_Templateparser array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 366 "../smarty/lexer/smarty_internal_templateparser.y" + #line 380 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r21() { $this->_retvalue = $this->compiler->compileTag('private_print_expression', @@ -2240,7 +2254,7 @@ class Smarty_Internal_Templateparser array('value' => $this->yystack[ $this->yyidx + -1 ]->minor)); } - #line 374 "../smarty/lexer/smarty_internal_templateparser.y" + #line 388 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r26() { $this->_retvalue = $this->compiler->compileTag('assign', @@ -2251,7 +2265,7 @@ class Smarty_Internal_Templateparser 1) . '\''))); } - #line 378 "../smarty/lexer/smarty_internal_templateparser.y" + #line 392 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r28() { $this->_retvalue = $this->compiler->compileTag('assign', @@ -2264,7 +2278,7 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 383 "../smarty/lexer/smarty_internal_templateparser.y" + #line 397 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r29() { $this->_retvalue = $this->compiler->compileTag('assign', @@ -2277,12 +2291,13 @@ class Smarty_Internal_Templateparser -3 ]->minor[ 'smarty_internal_index' ])); } - #line 405 "../smarty/lexer/smarty_internal_templateparser.y" + #line 419 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r30() { - $tag = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, -$this->lex->rdel_length)); - if ($tag == 'strip') { + $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength())); + if ($tag === 'strip') { $this->strip = true; $this->_retvalue = null;; } else { @@ -2302,7 +2317,7 @@ class Smarty_Internal_Templateparser } } - #line 415 "../smarty/lexer/smarty_internal_templateparser.y" + #line 429 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r31() { if (defined($this->yystack[ $this->yyidx + -1 ]->minor)) { @@ -2319,7 +2334,7 @@ class Smarty_Internal_Templateparser } } - #line 428 "../smarty/lexer/smarty_internal_templateparser.y" + #line 442 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r32() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { @@ -2334,7 +2349,7 @@ class Smarty_Internal_Templateparser } } - #line 440 "../smarty/lexer/smarty_internal_templateparser.y" + #line 454 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r33() { if (defined($this->yystack[ $this->yyidx + -2 ]->minor)) { @@ -2355,7 +2370,7 @@ class Smarty_Internal_Templateparser } } - #line 445 "../smarty/lexer/smarty_internal_templateparser.y" + #line 459 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r34() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor, @@ -2364,7 +2379,7 @@ class Smarty_Internal_Templateparser -1 ]->minor)); } - #line 450 "../smarty/lexer/smarty_internal_templateparser.y" + #line 464 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r35() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor, @@ -2375,7 +2390,7 @@ class Smarty_Internal_Templateparser -2 ]->minor)); } - #line 455 "../smarty/lexer/smarty_internal_templateparser.y" + #line 469 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r36() { $this->_retvalue = $this->compiler->compileTag('make_nocache', @@ -2384,37 +2399,37 @@ class Smarty_Internal_Templateparser 1) . '\''))); } - #line 460 "../smarty/lexer/smarty_internal_templateparser.y" + #line 474 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r37() { - $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, + $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(), array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 465 "../smarty/lexer/smarty_internal_templateparser.y" + #line 479 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r38() { - $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, + $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, $this->yystack[ $this->yyidx + 0 ]->minor, array('if condition' => $this->yystack[ $this->yyidx + -1 ]->minor)); } - #line 476 "../smarty/lexer/smarty_internal_templateparser.y" + #line 490 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r39() { - $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, + $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(), array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 480 "../smarty/lexer/smarty_internal_templateparser.y" + #line 494 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r41() { $this->_retvalue = $this->compiler->compileTag('for', @@ -2430,13 +2445,13 @@ class Smarty_Internal_Templateparser 1); } - #line 488 "../smarty/lexer/smarty_internal_templateparser.y" + #line 502 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r42() { $this->_retvalue = '=' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 492 "../smarty/lexer/smarty_internal_templateparser.y" + #line 506 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r44() { $this->_retvalue = $this->compiler->compileTag('for', @@ -2448,7 +2463,7 @@ class Smarty_Internal_Templateparser 0); } - #line 497 "../smarty/lexer/smarty_internal_templateparser.y" + #line 511 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r45() { $this->_retvalue = $this->compiler->compileTag('for', @@ -2462,7 +2477,7 @@ class Smarty_Internal_Templateparser 0); } - #line 501 "../smarty/lexer/smarty_internal_templateparser.y" + #line 515 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r46() { $this->_retvalue = $this->compiler->compileTag('foreach', @@ -2473,7 +2488,7 @@ class Smarty_Internal_Templateparser -1 ]->minor)))); } - #line 504 "../smarty/lexer/smarty_internal_templateparser.y" + #line 518 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r47() { $this->_retvalue = $this->compiler->compileTag('foreach', @@ -2486,13 +2501,13 @@ class Smarty_Internal_Templateparser -3 ]->minor)))); } - #line 509 "../smarty/lexer/smarty_internal_templateparser.y" + #line 523 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r48() { $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 513 "../smarty/lexer/smarty_internal_templateparser.y" + #line 527 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r49() { $this->_retvalue = $this->compiler->compileTag('setfilter', @@ -2503,7 +2518,7 @@ class Smarty_Internal_Templateparser 0 ]->minor)))); } - #line 519 "../smarty/lexer/smarty_internal_templateparser.y" + #line 533 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r50() { $this->_retvalue = $this->compiler->compileTag('setfilter', @@ -2516,13 +2531,14 @@ class Smarty_Internal_Templateparser 0 ]->minor))); } - #line 528 "../smarty/lexer/smarty_internal_templateparser.y" + #line 542 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r51() { - $tag = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, -$this->lex->rdel_length), - ' /'); - if ($tag == 'strip') { + $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' /'); + if ($tag === 'strip') { $this->strip = false; $this->_retvalue = null; } else { @@ -2530,13 +2546,13 @@ class Smarty_Internal_Templateparser } } - #line 532 "../smarty/lexer/smarty_internal_templateparser.y" + #line 546 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r52() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor . 'close', array()); } - #line 537 "../smarty/lexer/smarty_internal_templateparser.y" + #line 551 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r53() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', @@ -2545,7 +2561,7 @@ class Smarty_Internal_Templateparser 0 ]->minor)); } - #line 541 "../smarty/lexer/smarty_internal_templateparser.y" + #line 555 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r54() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', @@ -2554,7 +2570,7 @@ class Smarty_Internal_Templateparser 0 ]->minor)); } - #line 549 "../smarty/lexer/smarty_internal_templateparser.y" + #line 563 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r55() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', @@ -2565,26 +2581,26 @@ class Smarty_Internal_Templateparser 0 ]->minor)); } - #line 555 "../smarty/lexer/smarty_internal_templateparser.y" + #line 569 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r56() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; $this->_retvalue[] = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 560 "../smarty/lexer/smarty_internal_templateparser.y" + #line 574 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r57() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 565 "../smarty/lexer/smarty_internal_templateparser.y" + #line 579 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r58() { $this->_retvalue = array(); } - #line 576 "../smarty/lexer/smarty_internal_templateparser.y" + #line 590 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r59() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { @@ -2600,7 +2616,7 @@ class Smarty_Internal_Templateparser } } - #line 584 "../smarty/lexer/smarty_internal_templateparser.y" + #line 598 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r60() { $this->_retvalue = @@ -2608,41 +2624,41 @@ class Smarty_Internal_Templateparser 0 ]->minor); } - #line 596 "../smarty/lexer/smarty_internal_templateparser.y" + #line 610 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r62() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\''; } - #line 609 "../smarty/lexer/smarty_internal_templateparser.y" + #line 623 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r65() { $this->_retvalue = array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 614 "../smarty/lexer/smarty_internal_templateparser.y" + #line 628 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r67() { $this->yystack[ $this->yyidx + -2 ]->minor[] = $this->yystack[ $this->yyidx + 0 ]->minor; $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor; } - #line 621 "../smarty/lexer/smarty_internal_templateparser.y" + #line 635 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r68() { $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'', 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 645 "../smarty/lexer/smarty_internal_templateparser.y" + #line 659 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r70() { $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -2 ]->minor, 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 650 "../smarty/lexer/smarty_internal_templateparser.y" + #line 664 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r74() { $this->_retvalue = @@ -2650,7 +2666,7 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor . '\')'; } - #line 664 "../smarty/lexer/smarty_internal_templateparser.y" + #line 678 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r75() { $this->_retvalue = @@ -2658,7 +2674,7 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 670 "../smarty/lexer/smarty_internal_templateparser.y" + #line 684 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r78() { $this->_retvalue = $this->compiler->compileTag('private_modifier', @@ -2669,7 +2685,7 @@ class Smarty_Internal_Templateparser 0 ]->minor)); } - #line 674 "../smarty/lexer/smarty_internal_templateparser.y" + #line 688 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r79() { $this->_retvalue = @@ -2677,20 +2693,20 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 678 "../smarty/lexer/smarty_internal_templateparser.y" + #line 692 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r80() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 682 "../smarty/lexer/smarty_internal_templateparser.y" + #line 696 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r81() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 686 "../smarty/lexer/smarty_internal_templateparser.y" + #line 700 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r82() { $this->_retvalue = @@ -2698,14 +2714,14 @@ class Smarty_Internal_Templateparser ')'; } - #line 694 "../smarty/lexer/smarty_internal_templateparser.y" + #line 708 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r83() { $this->_retvalue = 'in_array(' . $this->yystack[ $this->yyidx + -2 ]->minor . ',(array)' . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 698 "../smarty/lexer/smarty_internal_templateparser.y" + #line 712 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r84() { $this->_retvalue = $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->compiler->compileVariable('\'' . @@ -2716,7 +2732,7 @@ class Smarty_Internal_Templateparser ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 713 "../smarty/lexer/smarty_internal_templateparser.y" + #line 727 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r85() { $this->_retvalue = @@ -2724,31 +2740,31 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 734 "../smarty/lexer/smarty_internal_templateparser.y" + #line 748 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r88() { $this->_retvalue = '!' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 738 "../smarty/lexer/smarty_internal_templateparser.y" + #line 752 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r93() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 742 "../smarty/lexer/smarty_internal_templateparser.y" + #line 756 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r94() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.'; } - #line 747 "../smarty/lexer/smarty_internal_templateparser.y" + #line 761 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r95() { $this->_retvalue = '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 764 "../smarty/lexer/smarty_internal_templateparser.y" + #line 778 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r96() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { @@ -2761,24 +2777,24 @@ class Smarty_Internal_Templateparser } } - #line 768 "../smarty/lexer/smarty_internal_templateparser.y" + #line 782 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r98() { $this->_retvalue = "(" . $this->yystack[ $this->yyidx + -1 ]->minor . ")"; } - #line 786 "../smarty/lexer/smarty_internal_templateparser.y" + #line 800 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r99() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 797 "../smarty/lexer/smarty_internal_templateparser.y" + #line 811 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r103() { $prefixVar = $this->compiler->getNewPrefixVariable(); - if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] == '\'smarty\'') { + if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] === '\'smarty\'') { $this->compiler->appendPrefixCode("<?php $prefixVar" . ' = ' . $this->compiler->compileTag('private_special_variable', array(), @@ -2796,7 +2812,7 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } - #line 814 "../smarty/lexer/smarty_internal_templateparser.y" + #line 828 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r104() { $prefixVar = $this->compiler->getNewPrefixVariable(); @@ -2805,7 +2821,7 @@ class Smarty_Internal_Templateparser $this->_retvalue = $prefixVar; } - #line 833 "../smarty/lexer/smarty_internal_templateparser.y" + #line 847 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r107() { if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) && @@ -2827,23 +2843,23 @@ class Smarty_Internal_Templateparser } } - #line 844 "../smarty/lexer/smarty_internal_templateparser.y" + #line 858 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r109() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 847 "../smarty/lexer/smarty_internal_templateparser.y" + #line 861 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r110() { $this->_retvalue = $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''); } - #line 860 "../smarty/lexer/smarty_internal_templateparser.y" + #line 874 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r111() { - if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] == '\'smarty\'') { + if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] === '\'smarty\'') { $smarty_var = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[ $this->yyidx + @@ -2858,21 +2874,21 @@ class Smarty_Internal_Templateparser } } - #line 870 "../smarty/lexer/smarty_internal_templateparser.y" + #line 884 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r112() { $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[ $this->yyidx + -2 ]->minor . ']->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 874 "../smarty/lexer/smarty_internal_templateparser.y" + #line 888 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r114() { $this->_retvalue = $this->compiler->compileConfigVariable("'" . $this->yystack[ $this->yyidx + -1 ]->minor . "'"); } - #line 878 "../smarty/lexer/smarty_internal_templateparser.y" + #line 892 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r115() { $this->_retvalue = '(is_array($tmp = ' . @@ -2881,13 +2897,13 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor . ' :null)'; } - #line 882 "../smarty/lexer/smarty_internal_templateparser.y" + #line 896 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r116() { $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 886 "../smarty/lexer/smarty_internal_templateparser.y" + #line 900 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r117() { $this->_retvalue = @@ -2895,7 +2911,7 @@ class Smarty_Internal_Templateparser ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' : null)'; } - #line 889 "../smarty/lexer/smarty_internal_templateparser.y" + #line 903 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r118() { $this->_retvalue = array('var' => '\'' . @@ -2904,20 +2920,20 @@ class Smarty_Internal_Templateparser 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 902 "../smarty/lexer/smarty_internal_templateparser.y" + #line 916 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r119() { $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -1 ]->minor, 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 908 "../smarty/lexer/smarty_internal_templateparser.y" + #line 922 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r121() { return; } - #line 911 "../smarty/lexer/smarty_internal_templateparser.y" + #line 925 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r122() { $this->_retvalue = @@ -2925,38 +2941,38 @@ class Smarty_Internal_Templateparser ']'; } - #line 915 "../smarty/lexer/smarty_internal_templateparser.y" + #line 929 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r123() { $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor) . ']'; } - #line 919 "../smarty/lexer/smarty_internal_templateparser.y" + #line 933 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r124() { $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + -2 ]->minor) . '->' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 923 "../smarty/lexer/smarty_internal_templateparser.y" + #line 937 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r125() { $this->_retvalue = "['" . $this->yystack[ $this->yyidx + 0 ]->minor . "']"; } - #line 928 "../smarty/lexer/smarty_internal_templateparser.y" + #line 942 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r126() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 933 "../smarty/lexer/smarty_internal_templateparser.y" + #line 947 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r127() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 937 "../smarty/lexer/smarty_internal_templateparser.y" + #line 951 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r128() { $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', @@ -2966,7 +2982,7 @@ class Smarty_Internal_Templateparser '\'][\'index\']') . ']'; } - #line 940 "../smarty/lexer/smarty_internal_templateparser.y" + #line 954 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r129() { $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', @@ -2976,13 +2992,13 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + -1 ]->minor . '\']') . ']'; } - #line 946 "../smarty/lexer/smarty_internal_templateparser.y" + #line 960 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r130() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 962 "../smarty/lexer/smarty_internal_templateparser.y" + #line 976 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r132() { $this->_retvalue = '[' . $this->compiler->compileVariable('\'' . @@ -2990,49 +3006,50 @@ class Smarty_Internal_Templateparser 1) . '\'') . ']';; } - #line 972 "../smarty/lexer/smarty_internal_templateparser.y" + #line 986 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r136() { $this->_retvalue = '[]'; } - #line 976 "../smarty/lexer/smarty_internal_templateparser.y" + #line 990 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r137() { $this->_retvalue = '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''; } - #line 981 "../smarty/lexer/smarty_internal_templateparser.y" + #line 995 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r138() { $this->_retvalue = "''"; } - #line 989 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1003 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r139() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 995 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1009 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r141() { - $var = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, -$this->lex->rdel_length), - ' $'); + $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' $'); $this->_retvalue = $this->compiler->compileVariable('\'' . $var . '\''); } - #line 1002 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1016 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r142() { $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1011 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1025 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r143() { - if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] == '\'smarty\'') { + if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] === '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[ $this->yyidx + @@ -3045,29 +3062,29 @@ class Smarty_Internal_Templateparser } } - #line 1016 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1030 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r144() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1021 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1035 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r145() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1028 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1042 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r146() { - if ($this->security && substr($this->yystack[ $this->yyidx + -1 ]->minor, 0, 1) == '_') { + if ($this->security && substr($this->yystack[ $this->yyidx + -1 ]->minor, 0, 1) === '_') { $this->compiler->trigger_template_error(self::Err1); } $this->_retvalue = '->' . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1035 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1049 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r147() { if ($this->security) { @@ -3077,7 +3094,7 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1042 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1056 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r148() { if ($this->security) { @@ -3087,7 +3104,7 @@ class Smarty_Internal_Templateparser '->{' . $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1050 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1064 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r149() { if ($this->security) { @@ -3098,30 +3115,30 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1058 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1072 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r150() { $this->_retvalue = '->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1066 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1080 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r151() { $this->_retvalue = $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1073 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1087 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r152() { - if ($this->security && substr($this->yystack[ $this->yyidx + -3 ]->minor, 0, 1) == '_') { + if ($this->security && substr($this->yystack[ $this->yyidx + -3 ]->minor, 0, 1) === '_') { $this->compiler->trigger_template_error(self::Err1); } $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . "(" . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ")"; } - #line 1084 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1098 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r153() { if ($this->security) { @@ -3136,14 +3153,14 @@ class Smarty_Internal_Templateparser $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1101 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1115 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r154() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1105 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1119 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r157() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, @@ -3151,53 +3168,53 @@ class Smarty_Internal_Templateparser $this->yystack[ $this->yyidx + 0 ]->minor))); } - #line 1113 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1127 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r158() { $this->_retvalue = array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1121 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1135 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r160() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1140 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1154 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r161() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1145 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1159 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r165() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '', 'method'); } - #line 1150 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1164 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r166() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method'); } - #line 1155 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1169 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r167() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, ''); } - #line 1160 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1174 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r168() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); } - #line 1166 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1180 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r169() { $this->_retvalue = array($this->yystack[ $this->yyidx + -2 ]->minor, @@ -3205,13 +3222,13 @@ class Smarty_Internal_Templateparser 'property'); } - #line 1170 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1184 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r170() { $this->_retvalue = ' ' . trim($this->yystack[ $this->yyidx + 0 ]->minor) . ' '; } - #line 1189 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1203 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r171() { static $lops = array( @@ -3233,7 +3250,7 @@ class Smarty_Internal_Templateparser $this->_retvalue = $lops[ $op ]; } - #line 1202 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1216 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r172() { static $tlops = array( @@ -3248,7 +3265,7 @@ class Smarty_Internal_Templateparser $this->_retvalue = $tlops[ $op ]; } - #line 1216 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1230 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r173() { static $scond = array( @@ -3261,59 +3278,59 @@ class Smarty_Internal_Templateparser $this->_retvalue = $scond[ $op ]; } - #line 1224 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1238 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r174() { $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1232 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1246 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r176() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1236 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1250 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r178() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1252 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1266 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r179() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1258 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1272 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r182() { $this->compiler->leaveDoubleQuote(); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor->to_smarty_php($this); } - #line 1263 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1277 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r183() { $this->yystack[ $this->yyidx + -1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 1267 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1281 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r184() { $this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1275 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1289 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r185() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1283 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1297 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r187() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' . @@ -3321,14 +3338,14 @@ class Smarty_Internal_Templateparser '\']->value'); } - #line 1287 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1301 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r189() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'); } - #line 1291 "../smarty/lexer/smarty_internal_templateparser.y" + #line 1305 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r190() { $this->_retvalue = new Smarty_Internal_ParseTree_Tag($this, $this->yystack[ $this->yyidx + 0 ]->minor); @@ -3392,7 +3409,7 @@ class Smarty_Internal_Templateparser public function yy_syntax_error($yymajor, $TOKEN) { - #line 200 "../smarty/lexer/smarty_internal_templateparser.y" + #line 214 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_template_error(); @@ -3406,7 +3423,7 @@ class Smarty_Internal_Templateparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 193 "../smarty/lexer/smarty_internal_templateparser.y" + #line 207 "../smarty/lexer/smarty_internal_templateparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; |
