aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
committerMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
commitbafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch)
tree8929845be585b09d0f420621281c5531e1efad3e /vendor/smarty
parent6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff)
parentfdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff)
downloadvolse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.gz
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.bz2
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.zip
Merge branch '5.0RC'5.0
Diffstat (limited to 'vendor/smarty')
-rw-r--r--vendor/smarty/smarty/CHANGELOG.md (renamed from vendor/smarty/smarty/change_log.txt)135
-rw-r--r--vendor/smarty/smarty/README.md6
-rw-r--r--vendor/smarty/smarty/composer.json3
-rw-r--r--vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php22
-rw-r--r--vendor/smarty/smarty/error_reporting.ini1
-rw-r--r--vendor/smarty/smarty/lexer/smarty_internal_configfilelexer.plex318
-rw-r--r--vendor/smarty/smarty/lexer/smarty_internal_configfileparser.y346
-rw-r--r--vendor/smarty/smarty/lexer/smarty_internal_templatelexer.plex696
-rw-r--r--vendor/smarty/smarty/lexer/smarty_internal_templateparser.y1271
-rw-r--r--vendor/smarty/smarty/libs/Smarty.class.php2
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php2
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php10
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php2
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php116
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php29
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php4
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php146
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php12
-rw-r--r--vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php11
19 files changed, 2932 insertions, 200 deletions
diff --git a/vendor/smarty/smarty/change_log.txt b/vendor/smarty/smarty/CHANGELOG.md
index aeb17e4d9..7eb151bf8 100644
--- a/vendor/smarty/smarty/change_log.txt
+++ b/vendor/smarty/smarty/CHANGELOG.md
@@ -1,4 +1,35 @@
-===== 3.1.34-dev-6 =====
+# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [3.1.36] - 2020-04-14
+
+### Fixed
+ - Smarty::SMARTY_VERSION wasn't updated in v3.1.35 https://github.com/smarty-php/smarty/issues/584
+
+## [3.1.35] - 2020-04-14
+ - remove whitespaces after comments https://github.com/smarty-php/smarty/issues/447
+ - fix foreachelse on arrayiterators https://github.com/smarty-php/smarty/issues/506
+ - fix files contained in git export archive for package maintainers https://github.com/smarty-php/smarty/issues/325
+ - throw SmartyException when setting caching attributes for cacheable plugin https://github.com/smarty-php/smarty/issues/457
+ - fix errors that occured where isset was replaced with null check such as https://github.com/smarty-php/smarty/issues/453
+ - unit tests are now in the repository
+
+## 3.1.34 release - 05.11.2019
+13.01.2020
+ - fix typo in exception message (JercSi)
+ - fix typehint warning with callable (bets4breakfast)
+ - add travis badge and compatability info to readme (matks)
+ - fix stdClass cast when compiling foreach (carpii)
+ - fix wrong set/get methods for memcached (IT-Experte)
+ - fix pborm assigning value to object variables in smarty_internal_compile_assign (Hunman)
+ - exclude error_reporting.ini from git export (glensc)
+
+## 3.1.34-dev-6 -
30.10.2018
- bugfix a nested subblock in an inheritance child template was not replace by
outer level block with same name in same child template https://github.com/smarty-php/smarty/issues/500
@@ -26,8 +57,8 @@
could fail in version 3.1.32 and 3.1.33 because PHP preg_match() restrictions
https://github.com/smarty-php/smarty/issues/488
-===== 3.1.33 release ===== 12.09.2018
-===== 3.1.33-dev-12 =====
+## 3.1.33 release - 12.09.2018
+## 3.1.33-dev-12 -
03.09.2018
- bugfix {foreach} using new style property access like {$item@property} on
Smarty 2 style named foreach loop could produce errors https://github.com/smarty-php/smarty/issues/484
@@ -49,14 +80,14 @@
- bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable
like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481
-===== 3.1.33-dev-6 =====
+## 3.1.33-dev-6 -
19.08.2018
- fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452
https://github.com/smarty-php/smarty/pull/475
https://github.com/smarty-php/smarty/pull/473
- bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472
-===== 3.1.33-dev-4 =====
+## 3.1.33-dev-4 -
17.05.2018
- bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436
- bugfix Smarty::compileAllTemplates ignores `$extension` parameter https://github.com/smarty-php/smarty/issues/437
@@ -68,7 +99,7 @@
- bugfix regarding Security Vulnerability did not solve the problem under Linux.
Security issue CVE-2018-16831
-===== 3.1.32 ===== (24.04.2018)
+## 3.1.32 - (24.04.2018)
24.04.2018
- bugfix possible Security Vulnerability in Smarty_Security class.
@@ -209,7 +240,7 @@
13.4.2017
- bugfix array_merge() parameter should be checked https://github.com/smarty-php/smarty/issues/350
-===== 3.1.31 ===== (14.12.2016)
+## 3.1.31 - (14.12.2016)
23.11.2016
- move template object cache into static variables
@@ -323,7 +354,7 @@
compiled or cached template files https://github.com/smarty-php/smarty/issues/269
- optimization remove unneeded call to update acopes when {assign} scope and template scope was local (default)
-===== 3.1.30 ===== (07.08.2016)
+## 3.1.30 - (07.08.2016)
07.08.2016
- bugfix update of 04.08.2016 was incomplete
@@ -546,7 +577,7 @@
- optimization of filepath normalization
- bugfix {strip} must remove all blanks between html tags https://github.com/smarty-php/smarty/issues/136
- ===== 3.1.29 ===== (21.12.2015)
+ - 3.1.29 - (21.12.2015)
21.12.2015
- optimization improve speed of filetime checks on extends and extendsall resource
@@ -582,7 +613,7 @@
- bugfix {$smarty.config.foo} broken in 3.1.28 https://github.com/smarty-php/smarty/issues/120
- bugfix multiple calls of {section} with same name droped E_NOTICE error https://github.com/smarty-php/smarty/issues/118
- ===== 3.1.28 ===== (13.12.2015)
+ - 3.1.28 - (13.12.2015)
13.12.2015
- bugfix {foreach} and {section} with uppercase characters in name attribute did not work (forum topic 25819)
- bugfix $smarty->debugging_ctrl = 'URL' did not work (forum topic 25811)
@@ -761,18 +792,18 @@
19.06.2015
- improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59
- ===== 3.1.27===== (18.06.2015)
+ - 3.1.27- (18.06.2015)
18.06.2015
- bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
- ===== 3.1.26===== (18.06.2015)
+ - 3.1.26- (18.06.2015)
18.06.2015
- bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
17.06.2015
- bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55
- ===== 3.1.25===== (15.06.2015)
+ - 3.1.25- (15.06.2015)
15.06.2015
- optimization of smarty_cachereource_keyvaluestore.php code
@@ -802,7 +833,7 @@
24.05.2015
- bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42
- ===== 3.1.24===== (23.05.2015)
+ - 3.1.24- (23.05.2015)
23.05.2015
- improvement on php_handling to allow very large PHP sections, better error handling
- improvement allow extreme large comment sections (forum 25538)
@@ -840,12 +871,12 @@
- bugfix access to undefined config variable like {#undef#} did fail https://github.com/smarty-php/smarty/issues/29
- bugfix in nested {foreach} saved item attributes got overwritten https://github.com/smarty-php/smarty/issues/33
- ===== 3.1.23 ===== (12.05.2015)
+ - 3.1.23 - (12.05.2015)
12.05.2015
- bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled
- bugfix missig entry for smarty-temmplate-config in autoloader
- ===== 3.1.22 ===== tag was deleted because 3.1.22 did fail caused by the missing entry for smarty-temmplate-config in autoloader
+ - 3.1.22 - tag was deleted because 3.1.22 did fail caused by the missing entry for smarty-temmplate-config in autoloader
10.05.2015
- bugfix custom cache resource did not observe compile_id and cache_id when $cache_locking == true
- bugfix cache lock was not handled correctly after timeout when $cache_locking == true
@@ -997,7 +1028,7 @@
- bugfix E_NOTICE message was created during compilation when ASP tags '<%' or '%>' are in template source text
- bugfix merge_compiled_includes option failed when caching enables and same subtemplate was included cached and not cached
- ===== 3.1.21 ===== (18.10.2014)
+ - 3.1.21 - (18.10.2014)
18.10.2014
- composer moved to github
@@ -1020,7 +1051,7 @@
- bugfix change of 08.10.2014 could create E_NOTICE meassage when using "<?php" tags
- bugfix "<script language=php>" with $php_handling PHP_PASSTHRU was executed in {nocache} sections
- ===== 3.1.20 ===== (09.10.2014)
+ - 3.1.20 - (09.10.2014)
08.10.2014
- bugfix security mode of "<script language=php>" must be controlled by $php_handling property (Thue Kristensen)
@@ -1040,7 +1071,7 @@
04.07.2014
- bugfix the bufix of 02.06.2014 broke correct handling of child templates with same name but different template folders in extends resource (issue 194 and topic 25099)
- ===== 3.1.19 ===== (30.06.2014)
+ - 3.1.19 - (30.06.2014)
20.06.2014
- bugfix template variables could not be passed as parameter in {include} when the include was in a {nocache} section (topic 25131)
@@ -1067,7 +1098,7 @@
18.04.2014
- revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems
- ===== 3.1.18 ===== (07.04.2014)
+ - 3.1.18 - (07.04.2014)
06.04.2014
- bugfix template inheritance fail when using custom resource after patch of 8.3.2014 (Issue 187)
- bugfix update of composer file (Issue 168 and 184)
@@ -1096,7 +1127,7 @@
13.03.2014
- bugfix clearXxx() change of 27.1.2014 did not work when specifing cache_id or compile_id (forum topic 24868 and 24867)
- ===== 3.1.17 =====
+ - 3.1.17 -
08.03.2014
- bugfix relative file path {include} within {block} of child templates did throw exception on first call (Issue 177)
@@ -1127,7 +1158,7 @@
- bugfix Smarty_CacheResource_Custom did not handle template resource type specifications on clearCache() calls (Issue 169)
- bugfix SmartyBC.class.php should use require_once to load Smarty.class.php (forum topic 24683)
- ===== 3.1.16 =====
+ - 3.1.16 -
15.12.2013
- bugfix {include} with {block} tag handling (forum topic 24599, 24594, 24682) (Issue 161)
Read 3.1.16_RELEASE_NOTES for more details
@@ -1160,13 +1191,13 @@
03.10.2013
- bugfix loops using modifier capitalize did eat up memory (issue 159)
- ===== Smarty 3.1.15 =====
+ - Smarty 3.1.15 -
01.10.2013
- use current delimiters in compiler error messages (issue 157)
- improvement on performance when using error handler and multiple template folders (issue 152)
17.09.2013
- - improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559)
+ - improvement added patch for additional SmartyCompilerException properties for better access to source information (forum topic 24559)
16.09.2013
- bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320)
@@ -1224,7 +1255,7 @@
2.7.2013
- bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387)
-===== Smarty-3.1.14 =====
+## Smarty-3.1.14 -
27.06.2013
- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
@@ -1257,7 +1288,7 @@
24.01.2013
- bugfix wrong tag type in smarty_internal_templatecompilerbase.php could cause wrong plugin search order (Forum Topic 24028)
-===== Smarty-3.1.13 =====
+## Smarty-3.1.13 -
13.01.2013
- enhancement allow to disable exception message escaping by SmartyException::$escape = false; (Issue #130)
@@ -1288,7 +1319,7 @@
01.11.2012
- bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118)
-===== Smarty-3.1.12 =====
+## Smarty-3.1.12 -
14.09.2012
- bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008)
@@ -1333,7 +1364,7 @@
- bugfix the default plugin handler did create wrong compiled code for static class methods
from external script files (issue 108)
-===== Smarty-3.1.11 =====
+## Smarty-3.1.11 -
30.06.2012
- bugfix {block.. hide} did not work as nested child (Forum Topic 22216)
@@ -1346,12 +1377,12 @@
11.06.2012
- bugfix the patch for Topic 21856 did break tabs between tag attributes (Forum Topic 22124)
-===== Smarty-3.1.10 =====
+## Smarty-3.1.10 -
09.06.2012
- bugfix the compiler did ignore registered compiler plugins for closing tags (Forum Topic 22094)
- bugfix the patch for Topic 21856 did break multiline tags (Forum Topic 22124)
-===== Smarty-3.1.9 =====
+## Smarty-3.1.9 -
07.06.2012
- bugfix fetch() and display() with relative paths (Issue 104)
- bugfix treat "0000-00-00" as 0 in modifier.date_format (Issue 103)
@@ -1405,7 +1436,7 @@
- enhancement the default plugin handler can now also resolve undefined modifier (Smarty::PLUGIN_MODIFIER)
(Issue 85)
-===== Smarty-3.1.8 =====
+## Smarty-3.1.8 -
19.02.2012
- bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags
(reported by mh and Issue 83)
@@ -1452,7 +1483,7 @@
- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return
content after {$smarty.block.child} (Forum Topic 20564)
-===== Smarty-3.1.7 =====
+## Smarty-3.1.7 -
18.12.2011
- bugfix strings ending with " in multiline strings of config files failed to compile (issue #67)
- added chaining to Smarty_Internal_Templatebase
@@ -1477,7 +1508,7 @@
- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return expected
result (Forum Topic 20564)
-===== Smarty-3.1.6 =====
+## Smarty-3.1.6 -
30.11.2011
- bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce
an exception (Forum Topic 20531)
@@ -1502,7 +1533,7 @@
- bugfix Smarty_Resource::load() did not always return a proper resource handler (Forum Topic 20414)
- added escape argument to html_checkboxes and html_radios (Forum Topic 20425)
-===== Smarty-3.1.5 =====
+## Smarty-3.1.5 -
14.11.2011
- bugfix allow space between function name and open bracket (forum topic 20375)
@@ -1534,7 +1565,7 @@
- revert PHP4 constructor message
- fixed PHP4 constructor message
-===== Smarty-3.1.4 =====
+## Smarty-3.1.4 -
19.10.2011
- added exception when using PHP4 style constructor
@@ -1563,7 +1594,7 @@
- bugfix <?xml> tag did create wrong output when caching enabled and the tag was in included subtemplate
- bugfix Smarty_CacheResource_mysql example was missing strtotime() calls
-===== Smarty-3.1.3 =====
+## Smarty-3.1.3 -
07.10.2011
- improvement removed html comments from {mailto} (Forum Topic 20092)
- bugfix testInstall() would not show path to internal plugins_dir (Forum Post 74627)
@@ -1590,7 +1621,7 @@
- add unloadFilter() method
- bugfix has_nocache_code flag was not reset before compilation
-===== Smarty-3.1.2 =====
+## Smarty-3.1.2 -
03.10.2011
- improvement add internal $joined_template_dir property instead computing it on the fly several times
@@ -1630,7 +1661,7 @@
extended Smarty class created problems
- bugfix error muting was not implemented for cache locking
-===== Smarty 3.1.1 =====
+## Smarty 3.1.1 -
22.09.2011
- bugfix {foreachelse} does fail if {section} was nested inside {foreach}
- bugfix debug.tpl did not display correctly when it was compiled with escape_html = true
@@ -1663,7 +1694,7 @@
- bugfix lock_id for file resource would create invalid filepath
- bugfix resource caching did not care about file.tpl in different template_dir
-===== Smarty 3.1.0 =====
+## Smarty 3.1.0 -
15/09/2011
- optimization of {foreach}; call internal _count() method only when "total" or "last" {foreach} properties are used
@@ -1756,7 +1787,7 @@
- update of README_3_1_DEV.txt and moved into the distribution folder
- improvement show first characters of eval and string templates instead sha1 Uid in debug window
-===== Smarty 3.1-RC1 =====
+## Smarty 3.1-RC1 -
25/06/2011
- revert change of 17/06/2011. $_smarty varibale removed. call loadPlugin() from inside plugin code if required
- code cleanup, remove no longer used properties and methods
@@ -1957,7 +1988,7 @@
24/12/2010
- optimize smarty_function_escape_special_chars() for PHP >= 5.2.3
-===== SVN 3.0 trunk =====
+## SVN 3.0 trunk -
14/05/2011
- bugfix error handling at stream resources
@@ -2017,7 +2048,7 @@
- removed obsolete {popup_init..} plugin from demo templates
- bugfix replace $smarty->triggerError() by exception in smarty_internal_resource_extends.php
-===== Smarty 3.0.7 =====
+## Smarty 3.0.7 -
09/02/2011
- patched vulnerability when using {$smarty.template}
@@ -2071,7 +2102,7 @@
- bugfix {$smarty.template} in child template did not return right content
- bugfix Smarty3 did not search the PHP include_path for template files
-===== Smarty 3.0.6 =====
+## Smarty 3.0.6 -
12/12/2010
- bugfix fixed typo regarding yesterdays change to allow streamWrapper
@@ -2106,7 +2137,7 @@
- bugfix on template inheritance when an {extends} tag was inserted by a prefilter
- added error message for illegal variable file attributes at {extends...} tags
-===== Smarty 3.0.5 =====
+## Smarty 3.0.5 -
19/11/2010
@@ -2133,7 +2164,7 @@
- bugfix captured content could not be accessed globally
- bugfix Smarty2 wrapper functions could not be call from within plugins
-===== Smarty 3.0.4 =====
+## Smarty 3.0.4 -
14/11/2010
- bugfix isset() did not allow multiple parameter
@@ -2146,7 +2177,7 @@
(introduced with 3.0.2)
- code cleanup
-===== Smarty 3.0.3 =====
+## Smarty 3.0.3 -
13/11/2010
- bugfix on {debug}
@@ -2155,7 +2186,7 @@
- fixed internal_config (removed unwanted code line)
- improvement remove last linebreak from {function} definition
-===== Smarty 3.0.2 =====
+## Smarty 3.0.2 -
12/11/2010
- reactivated $error_reporting property handling
@@ -2165,7 +2196,7 @@
with transparent access to Smarty object
- fixed {config_load} scoping form compile time to run time
-===== Smarty 3.0.0 =====
+## Smarty 3.0.0 -
@@ -2207,7 +2238,7 @@ request_use_auto_globals
- bugfix on template inheritance using nested eval or string resource in {extends} tags
- bugfix on output buffer handling in isCached() method
-===== RC4 =====
+## RC4 -
01/10/2010
- added {break} and {continue} tags for flow control of {foreach},{section},{for} and {while} loops
@@ -2304,7 +2335,7 @@ request_use_auto_globals
15/07/2010
- bufix {$smarty.template} does include now the relative path, not just filename
-===== RC3 =====
+## RC3 -
@@ -2358,7 +2389,7 @@ request_use_auto_globals
- make handling of Smarty comments followed by newline BC to Smarty2
-===== RC2 =====
+## RC2 -
@@ -2430,7 +2461,7 @@ request_use_auto_globals
- bugfix on {function} tag with name attribute in doublequoted strings
- fix to make calling of template functions unambiguously by madatory usage of the {call} tag
-===== RC1 =====
+## RC1 -
27/04/2010
- change default of $debugging_ctrl to 'NONE'
diff --git a/vendor/smarty/smarty/README.md b/vendor/smarty/smarty/README.md
index 24baae4c2..ee7edb1ab 100644
--- a/vendor/smarty/smarty/README.md
+++ b/vendor/smarty/smarty/README.md
@@ -1,11 +1,17 @@
# Smarty 3 template engine
[smarty.net](https://www.smarty.net/)
+[![Build Status](https://travis-ci.org/smarty-php/smarty.svg?branch=master)](https://travis-ci.org/smarty-php/smarty)
+
## Documentation
For documentation see
[www.smarty.net/docs/en/](https://www.smarty.net/docs/en/)
+## Requirements
+
+Smarty can be run with PHP 5.2 to PHP 7.4.
+
## Distribution repository
> Smarty 3.1.28 introduces run time template inheritance
diff --git a/vendor/smarty/smarty/composer.json b/vendor/smarty/smarty/composer.json
index 28c392c95..889cb9444 100644
--- a/vendor/smarty/smarty/composer.json
+++ b/vendor/smarty/smarty/composer.json
@@ -40,6 +40,7 @@
}
},
"require-dev": {
- "phpunit/phpunit": "6.4.1"
+ "phpunit/phpunit": "6.4.1",
+ "smarty/smarty-lexer": "^3.1"
}
}
diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php b/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php
index 9c8855c31..71fe9d3f1 100644
--- a/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php
+++ b/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php
@@ -42,18 +42,12 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
*/
protected function read(array $keys)
{
- $_keys = $lookup = array();
- foreach ($keys as $k) {
- $_k = sha1($k);
- $_keys[] = $_k;
- $lookup[ $_k ] = $k;
- }
- $_res = array();
- $res = $this->memcache->get($_keys);
- foreach ($res as $k => $v) {
- $_res[ $lookup[ $k ] ] = $v;
+ $res = array();
+ foreach ($keys as $key) {
+ $k = sha1($key);
+ $res[$key] = $this->memcache->get($k);
}
- return $_res;
+ return $res;
}
/**
@@ -68,7 +62,11 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
{
foreach ($keys as $k => $v) {
$k = sha1($k);
- $this->memcache->set($k, $v, 0, $expire);
+ if (class_exists('Memcached')) {
+ $this->memcache->set($k, $v, $expire);
+ } else {
+ $this->memcache->set($k, $v, 0, $expire);
+ }
}
return true;
}
diff --git a/vendor/smarty/smarty/error_reporting.ini b/vendor/smarty/smarty/error_reporting.ini
deleted file mode 100644
index 496bbf5c2..000000000
--- a/vendor/smarty/smarty/error_reporting.ini
+++ /dev/null
@@ -1 +0,0 @@
-error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT \ No newline at end of file
diff --git a/vendor/smarty/smarty/lexer/smarty_internal_configfilelexer.plex b/vendor/smarty/smarty/lexer/smarty_internal_configfilelexer.plex
new file mode 100644
index 000000000..7a86fadc4
--- /dev/null
+++ b/vendor/smarty/smarty/lexer/smarty_internal_configfilelexer.plex
@@ -0,0 +1,318 @@
+<?php
+/**
+* Smarty Internal Plugin Configfilelexer
+*
+* This is the lexer to break the config file source into tokens
+* @package Smarty
+* @subpackage Config
+* @author Uwe Tews
+*/
+/**
+* Smarty_Internal_Configfilelexer
+*
+* This is the config file lexer.
+* It is generated from the smarty_internal_configfilelexer.plex file
+*
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+class Smarty_Internal_Configfilelexer
+{
+ /**
+ * Source
+ *
+ * @var string
+ */
+ public $data;
+ /**
+ * Source length
+ *
+ * @var int
+ */
+ public $dataLength = null;
+ /**
+ * byte counter
+ *
+ * @var int
+ */
+ public $counter;
+ /**
+ * token number
+ *
+ * @var int
+ */
+ public $token;
+ /**
+ * token value
+ *
+ * @var string
+ */
+ public $value;
+ /**
+ * current line
+ *
+ * @var int
+ */
+ public $line;
+ /**
+ * state number
+ *
+ * @var int
+ */
+ public $state = 1;
+ /**
+ * Smarty object
+ *
+ * @var Smarty
+ */
+ public $smarty = null;
+ /**
+ * compiler object
+ *
+ * @var Smarty_Internal_Config_File_Compiler
+ */
+ private $compiler = null;
+ /**
+ * copy of config_booleanize
+ *
+ * @var bool
+ */
+ private $configBooleanize = false;
+ /**
+ * trace file
+ *
+ * @var resource
+ */
+ public $yyTraceFILE;
+ /**
+ * trace prompt
+ *
+ * @var string
+ */
+ public $yyTracePrompt;
+ /**
+ * state names
+ *
+ * @var array
+ */
+ public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
+
+ /**
+ * storage for assembled token patterns
+ *
+ * @var string
+ */
+ private $yy_global_pattern1 = null;
+ private $yy_global_pattern2 = null;
+ private $yy_global_pattern3 = null;
+ private $yy_global_pattern4 = null;
+ private $yy_global_pattern5 = null;
+ private $yy_global_pattern6 = null;
+
+ /**
+ * token names
+ *
+ * @var array
+ */
+ public $smarty_token_names = array( // Text for parser error messages
+ );
+
+ /**
+ * constructor
+ *
+ * @param string $data template source
+ * @param Smarty_Internal_Config_File_Compiler $compiler
+ */
+ public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
+ {
+ $this->data = $data . "\n"; //now all lines are \n-terminated
+ $this->dataLength = strlen($data);
+ $this->counter = 0;
+ if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
+ $this->counter += strlen($match[0]);
+ }
+ $this->line = 1;
+ $this->compiler = $compiler;
+ $this->smarty = $compiler->smarty;
+ $this->configBooleanize = $this->smarty->config_booleanize;
+ }
+
+ public function replace ($input) {
+ return $input;
+ }
+
+ public function PrintTrace()
+ {
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
+ }
+
+
+/*!lex2php
+%input $this->data
+%counter $this->counter
+%token $this->token
+%value $this->value
+%line $this->line
+commentstart = /#|;/
+openB = /\[/
+closeB = /\]/
+section = /.*?(?=[\.=\[\]\r\n])/
+equal = /=/
+whitespace = /[ \t\r]+/
+dot = /\./
+id = /[0-9]*[a-zA-Z_]\w*/
+newline = /\n/
+single_quoted_string = /'[^'\\]*(?:\\.[^'\\]*)*'(?=[ \t\r]*[\n#;])/
+double_quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"(?=[ \t\r]*[\n#;])/
+tripple_quotes = /"""/
+tripple_quotes_end = /"""(?=[ \t\r]*[\n#;])/
+text = /[\S\s]/
+float = /\d+\.\d+(?=[ \t\r]*[\n#;])/
+int = /\d+(?=[ \t\r]*[\n#;])/
+maybe_bool = /[a-zA-Z]+(?=[ \t\r]*[\n#;])/
+naked_string = /[^\n]+?(?=[ \t\r]*\n)/
+*/
+
+/*!lex2php
+%statename START
+
+commentstart {
+ $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
+ $this->yypushstate(self::COMMENT);
+}
+openB {
+ $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
+ $this->yypushstate(self::SECTION);
+}
+closeB {
+ $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
+}
+equal {
+ $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
+ $this->yypushstate(self::VALUE);
+}
+whitespace {
+ return false;
+}
+newline {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+}
+id {
+ $this->token = Smarty_Internal_Configfileparser::TPC_ID;
+}
+text {
+ $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
+}
+
+*/
+
+/*!lex2php
+%statename VALUE
+
+whitespace {
+ return false;
+}
+float {
+ $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
+ $this->yypopstate();
+}
+int {
+ $this->token = Smarty_Internal_Configfileparser::TPC_INT;
+ $this->yypopstate();
+}
+tripple_quotes {
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
+ $this->yypushstate(self::TRIPPLE);
+}
+single_quoted_string {
+ $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
+ $this->yypopstate();
+}
+double_quoted_string {
+ $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
+ $this->yypopstate();
+}
+maybe_bool {
+ if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) {
+ $this->yypopstate();
+ $this->yypushstate(self::NAKED_STRING_VALUE);
+ return true; //reprocess in new state
+ } else {
+ $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
+ $this->yypopstate();
+ }
+}
+naked_string {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->yypopstate();
+}
+newline {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->value = '';
+ $this->yypopstate();
+}
+
+*/
+
+/*!lex2php
+%statename NAKED_STRING_VALUE
+
+naked_string {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->yypopstate();
+}
+
+*/
+
+/*!lex2php
+%statename COMMENT
+
+whitespace {
+ return false;
+}
+naked_string {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+}
+newline {
+ $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+ $this->yypopstate();
+}
+
+*/
+
+/*!lex2php
+%statename SECTION
+
+dot {
+ $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
+}
+section {
+ $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
+ $this->yypopstate();
+}
+
+*/
+/*!lex2php
+%statename TRIPPLE
+
+tripple_quotes_end {
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
+ $this->yypopstate();
+ $this->yypushstate(self::START);
+}
+text {
+ $to = strlen($this->data);
+ preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ } else {
+ $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
+ }
+ $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
+}
+*/
+
+}
diff --git a/vendor/smarty/smarty/lexer/smarty_internal_configfileparser.y b/vendor/smarty/smarty/lexer/smarty_internal_configfileparser.y
new file mode 100644
index 000000000..c981b58e9
--- /dev/null
+++ b/vendor/smarty/smarty/lexer/smarty_internal_configfileparser.y
@@ -0,0 +1,346 @@
+/**
+* Smarty Internal Plugin Configfileparser
+*
+* This is the config file parser
+*
+*
+* @package Smarty
+* @subpackage Config
+* @author Uwe Tews
+*/
+%name TPC_
+%declare_class {
+/**
+* Smarty Internal Plugin Configfileparse
+*
+* This is the config file parser.
+* It is generated from the smarty_internal_configfileparser.y file
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+class Smarty_Internal_Configfileparser
+}
+%include_class
+{
+ /**
+ * result status
+ *
+ * @var bool
+ */
+ public $successful = true;
+ /**
+ * return value
+ *
+ * @var mixed
+ */
+ public $retvalue = 0;
+ /**
+ * @var
+ */
+ public $yymajor;
+ /**
+ * lexer object
+ *
+ * @var Smarty_Internal_Configfilelexer
+ */
+ private $lex;
+ /**
+ * internal error flag
+ *
+ * @var bool
+ */
+ private $internalError = false;
+ /**
+ * compiler object
+ *
+ * @var Smarty_Internal_Config_File_Compiler
+ */
+ public $compiler = null;
+ /**
+ * smarty object
+ *
+ * @var Smarty
+ */
+ public $smarty = null;
+ /**
+ * copy of config_overwrite property
+ *
+ * @var bool
+ */
+ private $configOverwrite = false;
+ /**
+ * copy of config_read_hidden property
+ *
+ * @var bool
+ */
+ private $configReadHidden = false;
+ /**
+ * helper map
+ *
+ * @var array
+ */
+ private static $escapes_single = array('\\' => '\\',
+ '\'' => '\'');
+
+ /**
+ * constructor
+ *
+ * @param Smarty_Internal_Configfilelexer $lex
+ * @param Smarty_Internal_Config_File_Compiler $compiler
+ */
+ public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
+ {
+ $this->lex = $lex;
+ $this->smarty = $compiler->smarty;
+ $this->compiler = $compiler;
+ $this->configOverwrite = $this->smarty->config_overwrite;
+ $this->configReadHidden = $this->smarty->config_read_hidden;
+ }
+
+ /**
+ * parse optional boolean keywords
+ *
+ * @param string $str
+ *
+ * @return bool
+ */
+ private function parse_bool($str)
+ {
+ $str = strtolower($str);
+ if (in_array($str, array('on', 'yes', 'true'))) {
+ $res = true;
+ } else {
+ $res = false;
+ }
+ return $res;
+ }
+
+ /**
+ * parse single quoted string
+ * remove outer quotes
+ * unescape inner quotes
+ *
+ * @param string $qstr
+ *
+ * @return string
+ */
+ private static function parse_single_quoted_string($qstr)
+ {
+ $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
+
+ $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
+
+ $str = '';
+ foreach ($ss as $s) {
+ if (strlen($s) === 2 && $s[0] === '\\') {
+ if (isset(self::$escapes_single[$s[1]])) {
+ $s = self::$escapes_single[$s[1]];
+ }
+ }
+ $str .= $s;
+ }
+ return $str;
+ }
+
+ /**
+ * parse double quoted string
+ *
+ * @param string $qstr
+ *
+ * @return string
+ */
+ private static function parse_double_quoted_string($qstr)
+ {
+ $inner_str = substr($qstr, 1, strlen($qstr) - 2);
+ return stripcslashes($inner_str);
+ }
+
+ /**
+ * parse triple quoted string
+ *
+ * @param string $qstr
+ *
+ * @return string
+ */
+ private static function parse_tripple_double_quoted_string($qstr)
+ {
+ return stripcslashes($qstr);
+ }
+
+ /**
+ * set a config variable in target array
+ *
+ * @param array $var
+ * @param array $target_array
+ */
+ private function set_var(array $var, array &$target_array)
+ {
+ $key = $var['key'];
+ $value = $var['value'];
+
+ if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
+ $target_array['vars'][$key] = $value;
+ } else {
+ settype($target_array['vars'][$key], 'array');
+ $target_array['vars'][$key][] = $value;
+ }
+ }
+
+ /**
+ * add config variable to global vars
+ *
+ * @param array $vars
+ */
+ private function add_global_vars(array $vars)
+ {
+ if (!isset($this->compiler->config_data['vars'])) {
+ $this->compiler->config_data['vars'] = array();
+ }
+ foreach ($vars as $var) {
+ $this->set_var($var, $this->compiler->config_data);
+ }
+ }
+
+ /**
+ * add config variable to section
+ *
+ * @param string $section_name
+ * @param array $vars
+ */
+ private function add_section_vars($section_name, array $vars)
+ {
+ if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
+ $this->compiler->config_data['sections'][$section_name]['vars'] = array();
+ }
+ foreach ($vars as $var) {
+ $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
+ }
+ }
+}
+
+%token_prefix TPC_
+
+%parse_accept
+{
+ $this->successful = !$this->internalError;
+ $this->internalError = false;
+ $this->retvalue = $this->_retvalue;
+}
+
+%syntax_error
+{
+ $this->internalError = true;
+ $this->yymajor = $yymajor;
+ $this->compiler->trigger_config_file_error();
+}
+
+%stack_overflow
+{
+ $this->internalError = true;
+ $this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
+}
+
+// Complete config file
+start(res) ::= global_vars sections. {
+ res = null;
+}
+
+// Global vars
+global_vars(res) ::= var_list(vl). {
+ $this->add_global_vars(vl);
+ res = null;
+}
+
+// Sections
+sections(res) ::= sections section. {
+ res = null;
+}
+
+sections(res) ::= . {
+ res = null;
+}
+
+section(res) ::= OPENB SECTION(i) CLOSEB newline var_list(vars). {
+ $this->add_section_vars(i, vars);
+ res = null;
+}
+
+section(res) ::= OPENB DOT SECTION(i) CLOSEB newline var_list(vars). {
+ if ($this->configReadHidden) {
+ $this->add_section_vars(i, vars);
+ }
+ res = null;
+}
+
+// Var list
+var_list(res) ::= var_list(vl) newline. {
+ res = vl;
+}
+
+var_list(res) ::= var_list(vl) var(v). {
+ res = array_merge(vl, array(v));
+}
+
+var_list(res) ::= . {
+ res = array();
+}
+
+
+// Var
+var(res) ::= ID(id) EQUAL value(v). {
+ res = array('key' => id, 'value' => v);
+}
+
+
+value(res) ::= FLOAT(i). {
+ res = (float) i;
+}
+
+value(res) ::= INT(i). {
+ res = (int) i;
+}
+
+value(res) ::= BOOL(i). {
+ res = $this->parse_bool(i);
+}
+
+value(res) ::= SINGLE_QUOTED_STRING(i). {
+ res = self::parse_single_quoted_string(i);
+}
+
+value(res) ::= DOUBLE_QUOTED_STRING(i). {
+ res = self::parse_double_quoted_string(i);
+}
+
+value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_TEXT(c) TRIPPLE_QUOTES_END(ii). {
+ res = self::parse_tripple_double_quoted_string(c);
+}
+
+value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_QUOTES_END(ii). {
+ res = '';
+}
+
+value(res) ::= NAKED_STRING(i). {
+ res = i;
+}
+
+// NOTE: this is not a valid rule
+// It is added hier to produce a usefull error message on a missing '=';
+value(res) ::= OTHER(i). {
+ res = i;
+}
+
+
+// Newline and comments
+newline(res) ::= NEWLINE. {
+ res = null;
+}
+
+newline(res) ::= COMMENTSTART NEWLINE. {
+ res = null;
+}
+
+newline(res) ::= COMMENTSTART NAKED_STRING NEWLINE. {
+ res = null;
+}
diff --git a/vendor/smarty/smarty/lexer/smarty_internal_templatelexer.plex b/vendor/smarty/smarty/lexer/smarty_internal_templatelexer.plex
new file mode 100644
index 000000000..ac1250255
--- /dev/null
+++ b/vendor/smarty/smarty/lexer/smarty_internal_templatelexer.plex
@@ -0,0 +1,696 @@
+<?php
+/*
+ * This file is part of Smarty.
+ *
+ * (c) 2015 Uwe Tews
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Smarty_Internal_Templatelexer
+ * This is the template file lexer.
+ * It is generated from the smarty_internal_templatelexer.plex file
+ *
+ *
+ * @author Uwe Tews <uwe.tews@googlemail.com>
+ */
+class Smarty_Internal_Templatelexer
+{
+ /**
+ * Source
+ *
+ * @var string
+ */
+ public $data;
+
+ /**
+ * Source length
+ *
+ * @var int
+ */
+ public $dataLength = null;
+
+ /**
+ * byte counter
+ *
+ * @var int
+ */
+ public $counter;
+
+ /**
+ * token number
+ *
+ * @var int
+ */
+ public $token;
+
+ /**
+ * token value
+ *
+ * @var string
+ */
+ public $value;
+
+ /**
+ * current line
+ *
+ * @var int
+ */
+ public $line;
+
+ /**
+ * tag start line
+ *
+ * @var
+ */
+ public $taglineno;
+
+ /**
+ * php code type
+ *
+ * @var string
+ */
+ public $phpType = '';
+
+ /**
+ * state number
+ *
+ * @var int
+ */
+ public $state = 1;
+
+ /**
+ * Smarty object
+ *
+ * @var Smarty
+ */
+ public $smarty = null;
+
+ /**
+ * compiler object
+ *
+ * @var Smarty_Internal_TemplateCompilerBase
+ */
+ public $compiler = null;
+
+ /**
+ * trace file
+ *
+ * @var resource
+ */
+ public $yyTraceFILE;
+
+ /**
+ * trace prompt
+ *
+ * @var string
+ */
+ public $yyTracePrompt;
+
+ /**
+ * XML flag true while processing xml
+ *
+ * @var bool
+ */
+ public $is_xml = false;
+
+ /**
+ * state names
+ *
+ * @var array
+ */
+ public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
+
+ /**
+ * token names
+ *
+ * @var array
+ */
+ public $smarty_token_names = array( // Text for parser error messages
+ 'NOT' => '(!,not)',
+ 'OPENP' => '(',
+ 'CLOSEP' => ')',
+ 'OPENB' => '[',
+ 'CLOSEB' => ']',
+ 'PTR' => '->',
+ 'APTR' => '=>',
+ 'EQUAL' => '=',
+ 'NUMBER' => 'number',
+ 'UNIMATH' => '+" , "-',
+ 'MATH' => '*" , "/" , "%',
+ 'INCDEC' => '++" , "--',
+ 'SPACE' => ' ',
+ 'DOLLAR' => '$',
+ 'SEMICOLON' => ';',
+ 'COLON' => ':',
+ 'DOUBLECOLON' => '::',
+ 'AT' => '@',
+ 'HATCH' => '#',
+ 'QUOTE' => '"',
+ 'BACKTICK' => '`',
+ 'VERT' => '"|" modifier',
+ 'DOT' => '.',
+ 'COMMA' => '","',
+ 'QMARK' => '"?"',
+ 'ID' => 'id, name',
+ 'TEXT' => 'text',
+ 'LDELSLASH' => '{/..} closing tag',
+ 'LDEL' => '{...} Smarty tag',
+ 'COMMENT' => 'comment',
+ 'AS' => 'as',
+ 'TO' => 'to',
+ 'PHP' => '"<?php", "<%", "{php}" tag',
+ 'LOGOP' => '"<", "==" ... logical operator',
+ 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
+ 'SCOND' => '"is even" ... if condition',
+ );
+
+ /**
+ * literal tag nesting level
+ *
+ * @var int
+ */
+ private $literal_cnt = 0;
+
+ /**
+ * preg token pattern for state TEXT
+ *
+ * @var string
+ */
+ private $yy_global_pattern1 = null;
+
+ /**
+ * preg token pattern for state TAG
+ *
+ * @var string
+ */
+ private $yy_global_pattern2 = null;
+
+ /**
+ * preg token pattern for state TAGBODY
+ *
+ * @var string
+ */
+ private $yy_global_pattern3 = null;
+
+ /**
+ * preg token pattern for state LITERAL
+ *
+ * @var string
+ */
+ private $yy_global_pattern4 = null;
+
+ /**
+ * preg token pattern for state DOUBLEQUOTEDSTRING
+ *
+ * @var null
+ */
+ private $yy_global_pattern5 = null;
+
+ /**
+ * preg token pattern for text
+ *
+ * @var null
+ */
+ private $yy_global_text = null;
+
+ /**
+ * preg token pattern for literal
+ *
+ * @var null
+ */
+ private $yy_global_literal = null;
+
+ /**
+ * constructor
+ *
+ * @param string $source template source
+ * @param Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+ $this->data = $source;
+ $this->dataLength = strlen($this->data);
+ $this->counter = 0;
+ if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
+ $this->counter += strlen($match[0]);
+ }
+ $this->line = 1;
+ $this->smarty = $compiler->template->smarty;
+ $this->compiler = $compiler;
+ $this->compiler->initDelimiterPreg();
+ $this->smarty_token_names['LDEL'] = $this->smarty->getLeftDelimiter();
+ $this->smarty_token_names['RDEL'] = $this->smarty->getRightDelimiter();
+ }
+
+ /**
+ * open lexer/parser trace file
+ *
+ */
+ public function PrintTrace()
+ {
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
+ }
+
+ /**
+ * replace placeholders with runtime preg code
+ *
+ * @param string $preg
+ *
+ * @return string
+ */
+ public function replace($preg)
+ {
+ return $this->compiler->replaceDelimiter($preg);
+ }
+
+ /**
+ * check if current value is an autoliteral left delimiter
+ *
+ * @return bool
+ */
+ public function isAutoLiteral()
+ {
+ return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
+ strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
+ }
+
+ /*!lex2php
+ %input $this->data
+ %counter $this->counter
+ %token $this->token
+ %value $this->value
+ %line $this->line
+ userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~
+ char = ~[\S\s]~
+ textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~
+ namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
+ emptyjava = ~[{][}]~
+ 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)SMARTYal~
+ rdel = ~\s*SMARTYrdel~
+ nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
+ smartyblockchildparent = ~[\$]smarty\.block\.(child|parent)~
+ integer = ~\d+~
+ hex = ~0[xX][0-9a-fA-F]+~
+ math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~
+ comment = ~(SMARTYldel)SMARTYal[*]~
+ incdec = ~([+]|[-]){2}~
+ unimath = ~\s*([+]|[-])\s*~
+ openP = ~\s*[(]\s*~
+ closeP = ~\s*[)]~
+ openB = ~\[\s*~
+ closeB = ~\s*\]~
+ dollar = ~[$]~
+ dot = ~[.]~
+ comma = ~\s*[,]\s*~
+ doublecolon = ~[:]{2}~
+ colon = ~\s*[:]\s*~
+ at = ~[@]~
+ hatch = ~[#]~
+ semicolon = ~\s*[;]\s*~
+ equal = ~\s*[=]\s*~
+ space = ~\s+~
+ ptr = ~\s*[-][>]\s*~
+ aptr = ~\s*[=][>]\s*~
+ singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~
+ backtick = ~[`]~
+ vert = ~[|][@]?~
+ qmark = ~\s*[?]\s*~
+ 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*~
+ 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+~
+ scond = ~\s+is\s+(not\s+)?(odd|even)~
+ isin = ~\s+is\s+in\s+~
+ as = ~\s+as\s+~
+ to = ~\s+to\s+~
+ step = ~\s+step\s+~
+ if = ~(if|elseif|else if|while)\s+~
+ for = ~for\s+~
+ makenocache = ~make_nocache\s+~
+ array = ~array~
+ foreach = ~foreach(?![^\s])~
+ setfilter = ~setfilter\s+~
+ instanceof = ~\s+instanceof\s+~
+ not = ~[!]\s*|not\s+~
+ typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
+ double_quote = ~["]~
+ */
+ /*!lex2php
+ %statename TEXT
+ emptyjava {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ comment {
+ $to = $this->dataLength;
+ preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$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->getRightDelimiter()}'");
+ }
+ $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ return false;
+ }
+ phptag {
+ $this->compiler->getTagCompiler('private_php')->parsePhp($this);
+ }
+ userliteral {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ ldel literal rdel {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+ $this->yypushstate(self::LITERAL);
+ }
+ ldel slash literal rdel {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+ $this->yypushstate(self::LITERAL);
+ }
+ ldel {
+ $this->yypushstate(self::TAG);
+ return true;
+ }
+ phpstart {
+ $this->compiler->getTagCompiler('private_php')->parsePhp($this);
+ }
+ char {
+ if (!isset($this->yy_global_text)) {
+ $this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
+ }
+ $to = $this->dataLength;
+ preg_match($this->yy_global_text, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ }
+ $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ */
+ /*!lex2php
+ %statename TAG
+ ldel if {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel for {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel foreach {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel setfilter {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel makenocache {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel id nocacherdel {
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
+ $this->taglineno = $this->line;
+ }
+ ldel smartyblockchildparent rdel {
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
+ $this->taglineno = $this->line;
+ }
+ ldel slash id rdel {
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
+ $this->taglineno = $this->line;
+ }
+ ldel dollar id nocacherdel {
+ 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->getLeftDelimiter();
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ }
+ ldel slash {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ ldel {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ */
+ /*!lex2php
+ %statename TAGBODY
+ rdel {
+ $this->token = Smarty_Internal_Templateparser::TP_RDEL;
+ $this->yypopstate();
+ }
+ ldel {
+ $this->yypushstate(self::TAG);
+ return true;
+ }
+ double_quote {
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypushstate(self::DOUBLEQUOTEDSTRING);
+ $this->compiler->enterDoubleQuote();
+ }
+ singlequotestring {
+ $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
+ }
+ dollar id {
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+ }
+ dollar {
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
+ }
+ isin {
+ $this->token = Smarty_Internal_Templateparser::TP_ISIN;
+ }
+ as {
+ $this->token = Smarty_Internal_Templateparser::TP_AS;
+ }
+ to {
+ $this->token = Smarty_Internal_Templateparser::TP_TO;
+ }
+ step {
+ $this->token = Smarty_Internal_Templateparser::TP_STEP;
+ }
+ instanceof {
+ $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
+ }
+ lop {
+ $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
+ }
+ slop {
+ $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
+ }
+ tlop {
+ $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
+ }
+ scond {
+ $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
+ }
+ not{
+ $this->token = Smarty_Internal_Templateparser::TP_NOT;
+ }
+ typecast {
+ $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
+ }
+ openP {
+ $this->token = Smarty_Internal_Templateparser::TP_OPENP;
+ }
+ closeP {
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
+ }
+ openB {
+ $this->token = Smarty_Internal_Templateparser::TP_OPENB;
+ }
+ closeB {
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
+ }
+ ptr {
+ $this->token = Smarty_Internal_Templateparser::TP_PTR;
+ }
+ aptr {
+ $this->token = Smarty_Internal_Templateparser::TP_APTR;
+ }
+ equal {
+ $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
+ }
+ incdec {
+ $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
+ }
+ unimath {
+ $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
+ }
+ math {
+ $this->token = Smarty_Internal_Templateparser::TP_MATH;
+ }
+ at {
+ $this->token = Smarty_Internal_Templateparser::TP_AT;
+ }
+ array openP {
+ $this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
+ }
+ hatch {
+ $this->token = Smarty_Internal_Templateparser::TP_HATCH;
+ }
+ attr {
+ // resolve conflicts with shorttag and right_delimiter starting with '='
+ 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;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_ATTR;
+ }
+ }
+ namespace {
+ $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
+ }
+ id {
+ $this->token = Smarty_Internal_Templateparser::TP_ID;
+ }
+ integer {
+ $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
+ }
+ backtick {
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->yypopstate();
+ }
+ vert {
+ $this->token = Smarty_Internal_Templateparser::TP_VERT;
+ }
+ dot {
+ $this->token = Smarty_Internal_Templateparser::TP_DOT;
+ }
+ comma {
+ $this->token = Smarty_Internal_Templateparser::TP_COMMA;
+ }
+ semicolon {
+ $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
+ }
+ doublecolon {
+ $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
+ }
+ colon {
+ $this->token = Smarty_Internal_Templateparser::TP_COLON;
+ }
+ qmark {
+ $this->token = Smarty_Internal_Templateparser::TP_QMARK;
+ }
+ hex {
+ $this->token = Smarty_Internal_Templateparser::TP_HEX;
+ }
+ space {
+ $this->token = Smarty_Internal_Templateparser::TP_SPACE;
+ }
+ char {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ */
+
+ /*!lex2php
+ %statename LITERAL
+ ldel literal rdel {
+ $this->literal_cnt++;
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ }
+ ldel slash literal rdel {
+ if ($this->literal_cnt) {
+ $this->literal_cnt--;
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+ $this->yypopstate();
+ }
+ }
+ char {
+ if (!isset($this->yy_global_literal)) {
+ $this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
+ }
+ $to = $this->dataLength;
+ preg_match($this->yy_global_literal, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ } else {
+ $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
+ }
+ $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ }
+ */
+ /*!lex2php
+ %statename DOUBLEQUOTEDSTRING
+ userliteral {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ ldel literal rdel {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ ldel slash literal rdel {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ ldel slash {
+ $this->yypushstate(self::TAG);
+ return true;
+ }
+ ldel id {
+ $this->yypushstate(self::TAG);
+ return true;
+ }
+ ldel {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->taglineno = $this->line;
+ $this->yypushstate(self::TAGBODY);
+ }
+ double_quote {
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypopstate();
+ }
+ backtick dollar {
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->value = substr($this->value,0,-1);
+ $this->yypushstate(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
+ dollar id {
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+ }
+ dollar {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ textdoublequoted {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ char {
+ $to = $this->dataLength;
+ $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+ */
+ }
+
+ \ No newline at end of file
diff --git a/vendor/smarty/smarty/lexer/smarty_internal_templateparser.y b/vendor/smarty/smarty/lexer/smarty_internal_templateparser.y
new file mode 100644
index 000000000..b8c00e5d9
--- /dev/null
+++ b/vendor/smarty/smarty/lexer/smarty_internal_templateparser.y
@@ -0,0 +1,1271 @@
+/*
+ * This file is part of Smarty.
+ *
+ * (c) 2015 Uwe Tews
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+%stack_size 500
+%name TP_
+%declare_class {
+/**
+* Smarty Template Parser Class
+*
+* This is the template parser.
+* It is generated from the smarty_internal_templateparser.y file
+*
+* @author Uwe Tews <uwe.tews@googlemail.com>
+*/
+class Smarty_Internal_Templateparser
+}
+%include_class
+{
+ const ERR1 = 'Security error: Call to private object member not allowed';
+ const ERR2 = 'Security error: Call to dynamic object member not allowed';
+ const ERR3 = 'PHP in template not allowed. Use SmartyBC to enable it';
+
+ /**
+ * result status
+ *
+ * @var bool
+ */
+ public $successful = true;
+
+ /**
+ * return value
+ *
+ * @var mixed
+ */
+ public $retvalue = 0;
+
+ /**
+ * @var
+ */
+ public $yymajor;
+
+ /**
+ * last index of array variable
+ *
+ * @var mixed
+ */
+ public $last_index;
+
+ /**
+ * last variable name
+ *
+ * @var string
+ */
+ public $last_variable;
+
+ /**
+ * root parse tree buffer
+ *
+ * @var Smarty_Internal_ParseTree_Template
+ */
+ public $root_buffer;
+
+ /**
+ * current parse tree object
+ *
+ * @var Smarty_Internal_ParseTree
+ */
+ public $current_buffer;
+
+ /**
+ * lexer object
+ *
+ * @var Smarty_Internal_Templatelexer
+ */
+ public $lex;
+
+ /**
+ * internal error flag
+ *
+ * @var bool
+ */
+ private $internalError = false;
+
+ /**
+ * {strip} status
+ *
+ * @var bool
+ */
+ public $strip = false;
+ /**
+ * compiler object
+ *
+ * @var Smarty_Internal_TemplateCompilerBase
+ */
+ public $compiler = null;
+
+ /**
+ * smarty object
+ *
+ * @var Smarty
+ */
+ public $smarty = null;
+
+ /**
+ * template object
+ *
+ * @var Smarty_Internal_Template
+ */
+ public $template = null;
+
+ /**
+ * block nesting level
+ *
+ * @var int
+ */
+ public $block_nesting_level = 0;
+
+ /**
+ * security object
+ *
+ * @var Smarty_Security
+ */
+ public $security = null;
+
+ /**
+ * template prefix array
+ *
+ * @var \Smarty_Internal_ParseTree[]
+ */
+ public $template_prefix = array();
+
+ /**
+ * template prefix array
+ *
+ * @var \Smarty_Internal_ParseTree[]
+ */
+ public $template_postfix = array();
+
+ /**
+ * constructor
+ *
+ * @param Smarty_Internal_Templatelexer $lex
+ * @param Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+ $this->lex = $lex;
+ $this->compiler = $compiler;
+ $this->template = $this->compiler->template;
+ $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();
+ }
+
+ /**
+ * insert PHP code in current buffer
+ *
+ * @param string $code
+ */
+ public function insertPhpCode($code)
+ {
+ $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
+ *
+ * @return Smarty_Internal_ParseTree_Tag
+ */
+ public function mergePrefixCode($code)
+ {
+ $tmp = '';
+ foreach ($this->compiler->prefix_code as $preCode) {
+ $tmp .= $preCode;
+ }
+ $this->compiler->prefix_code = array();
+ $tmp .= $code;
+ return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true));
+ }
+
+}
+
+%token_prefix TP_
+
+%parse_accept
+{
+ $this->successful = !$this->internalError;
+ $this->internalError = false;
+ $this->retvalue = $this->_retvalue;
+}
+
+%syntax_error
+{
+ $this->internalError = true;
+ $this->yymajor = $yymajor;
+ $this->compiler->trigger_template_error();
+}
+
+%stack_overflow
+{
+ $this->internalError = true;
+ $this->compiler->trigger_template_error('Stack overflow in template parser');
+}
+
+
+%right VERT.
+%left COLON.
+
+
+ //
+ // complete template
+ //
+start(res) ::= template. {
+ $this->root_buffer->prepend_array($this, $this->template_prefix);
+ $this->root_buffer->append_array($this, $this->template_postfix);
+ res = $this->root_buffer->to_smarty_php($this);
+}
+
+
+ // php tags
+template ::= template PHP(B). {
+ $code = $this->compiler->compileTag('private_php',array(array('code' => B), array('type' => $this->lex->phpType )),array());
+ if ($this->compiler->has_code && !empty($code)) {
+ $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();
+ $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp.$code,true)));
+ }
+}
+
+ // template text
+template ::= template TEXT(B). {
+ $this->current_buffer->append_subtree($this, $this->compiler->processText(B));
+}
+ // strip on
+template ::= template STRIPON. {
+ $this->strip = true;
+}
+ // strip off
+template ::= template STRIPOFF. {
+ $this->strip = false;
+}
+
+ // Literal
+template ::= template LITERALSTART literal_e2(B) LITERALEND. {
+ $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text(B));
+}
+
+
+literal_e2(A) ::= literal_e1(B) LITERALSTART literal_e1(C) LITERALEND. {
+ A = B.C;
+}
+literal_e2(A) ::= literal_e1(B). {
+ A = B;
+}
+
+literal_e1(A) ::= literal_e1(B) LITERAL(C). {
+ A = B.C;
+
+}
+
+literal_e1(A) ::= . {
+ A = '';
+}
+ // Smarty tag
+template ::= template smartytag(B). {
+ if ($this->compiler->has_code) {
+ $this->current_buffer->append_subtree($this, $this->mergePrefixCode(B));
+ }
+ $this->compiler->has_variable_string = false;
+ $this->block_nesting_level = count($this->compiler->_tag_stack);
+}
+
+
+ // empty template
+template ::= .
+
+smartytag(A) ::= SIMPELOUTPUT(B). {
+ $var = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
+ if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
+ A = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
+ } else {
+ A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\'')));
+ }
+}
+
+// simple tag like {name}
+smartytag(A)::= SIMPLETAG(B). {
+ $tag = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
+ if ($tag == 'strip') {
+ $this->strip = true;
+ A = null;;
+ } else {
+ if (defined($tag)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant($tag, $this->compiler);
+ }
+ A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
+ } else {
+ if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
+ A = $this->compiler->compileTag($match[1],array('\'nocache\''));
+ } else {
+ A = $this->compiler->compileTag($tag,array());
+ }
+ }
+ }
+}
+ // {$smarty.block.child} or {$smarty.block.parent}
+smartytag(A) ::= SMARTYBLOCKCHILDPARENT(i). {
+ $j = strrpos(i,'.');
+ if (i[$j+1] == 'c') {
+ // {$smarty.block.child}
+ A = $this->compiler->compileTag('child',array(),array(i));
+ } else {
+ // {$smarty.block.parent}
+ A = $this->compiler->compileTag('parent',array(),array(i));
+ }
+}
+
+smartytag(A) ::= LDEL tagbody(B) RDEL. {
+ A = B;
+}
+
+ smartytag(A) ::= tag(B) RDEL. {
+ A = B;
+ }
+ // output with optional attributes
+tagbody(A) ::= outattr(B). {
+ A = $this->compiler->compileTag('private_print_expression',B[1],array('value'=>B[0]));
+}
+
+//
+// Smarty tags start here
+//
+
+ // assign new style
+tagbody(A) ::= DOLLARID(B) eqoutattr(C). {
+ A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>'\''.substr(B,1).'\'')),C[1]));
+}
+
+tagbody(A) ::= varindexed(B) eqoutattr(C). {
+ A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>B['var'])),C[1]),array('smarty_internal_index'=>B['smarty_internal_index']));
+}
+
+eqoutattr(A) ::= EQUAL outattr(B). {
+ A = B;
+}
+
+outattr(A) ::= output(B) attributes(C). {
+ A = array(B,C);
+}
+
+output(A) ::= variable(B). {
+ A = B;
+}
+output(A) ::= value(B). {
+ A = B;
+}
+output(A) ::= expr(B). {
+ A = B;
+}
+
+ // tag with optional Smarty2 style attributes
+tag(res) ::= LDEL ID(i) attributes(a). {
+ if (defined(i)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant(i, $this->compiler);
+ }
+ res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i));
+ } else {
+ res = $this->compiler->compileTag(i,a);
+ }
+}
+tag(res) ::= LDEL ID(i). {
+ if (defined(i)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant(i, $this->compiler);
+ }
+ res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>i));
+ } else {
+ res = $this->compiler->compileTag(i,array());
+ }
+}
+
+
+ // tag with modifier and optional Smarty2 style attributes
+tag(res) ::= LDEL ID(i) modifierlist(l)attributes(a). {
+ if (defined(i)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant(i, $this->compiler);
+ }
+ res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i, 'modifierlist'=>l));
+ } else {
+ res = $this->compiler->compileTag(i,a, array('modifierlist'=>l));
+ }
+}
+
+ // registered object tag
+tag(res) ::= LDEL ID(i) PTR ID(m) attributes(a). {
+ res = $this->compiler->compileTag(i,a,array('object_method'=>m));
+}
+
+ // registered object tag with modifiers
+tag(res) ::= LDEL ID(i) PTR ID(me) modifierlist(l) attributes(a). {
+ res = $this->compiler->compileTag(i,a,array('modifierlist'=>l, 'object_method'=>me));
+}
+
+ // nocache tag
+tag(res) ::= LDELMAKENOCACHE DOLLARID(i). {
+ res = $this->compiler->compileTag('make_nocache',array(array('var'=>'\''.substr(i,1).'\'')));
+}
+
+ // {if}, {elseif} and {while} tag
+tag(res) ::= LDELIF(i) expr(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->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->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->compiler->getLdelLength()));
+ res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
+}
+
+ // {for} tag
+tag(res) ::= LDELFOR statements(st) SEMICOLON expr(ie) SEMICOLON varindexed(v2) foraction(e2) attributes(a). {
+ res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('ifexp'=>ie),array('var'=>v2),array('step'=>e2))),1);
+}
+
+ foraction(res) ::= EQUAL expr(e). {
+ res = '='.e;
+}
+
+ foraction(res) ::= INCDEC(e). {
+ res = e;
+}
+
+tag(res) ::= LDELFOR statement(st) TO expr(v) attributes(a). {
+ res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v))),0);
+}
+
+tag(res) ::= LDELFOR statement(st) TO expr(v) STEP expr(v2) attributes(a). {
+ res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v),array('step'=>v2))),0);
+}
+
+ // {foreach} tag
+tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v0) attributes(a). {
+ res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0))));
+}
+
+tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v1) APTR varvar(v0) attributes(a). {
+ res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0),array('key'=>v1))));
+}
+tag(res) ::= LDELFOREACH attributes(a). {
+ res = $this->compiler->compileTag('foreach',a);
+}
+
+ // {setfilter}
+tag(res) ::= LDELSETFILTER ID(m) modparameters(p). {
+ res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array(m),p))));
+}
+
+tag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). {
+ res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array(m),p)),l)));
+}
+
+
+ // end of block tag {/....}
+smartytag(res)::= CLOSETAG(t). {
+ $tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' /');
+ if ($tag === 'strip') {
+ $this->strip = false;
+ res = null;
+ } else {
+ res = $this->compiler->compileTag($tag.'close',array());
+ }
+ }
+tag(res) ::= LDELSLASH ID(i). {
+ res = $this->compiler->compileTag(i.'close',array());
+}
+
+tag(res) ::= LDELSLASH ID(i) modifierlist(l). {
+ res = $this->compiler->compileTag(i.'close',array(),array('modifier_list'=>l));
+}
+
+ // end of block object tag {/....}
+tag(res) ::= LDELSLASH ID(i) PTR ID(m). {
+ res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m));
+}
+
+tag(res) ::= LDELSLASH ID(i) PTR ID(m) modifierlist(l). {
+ res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m, 'modifier_list'=>l));
+}
+
+//
+//Attributes of Smarty tags
+//
+ // list of attributes
+attributes(res) ::= attributes(a1) attribute(a2). {
+ res = a1;
+ res[] = a2;
+}
+
+ // single attribute
+attributes(res) ::= attribute(a). {
+ res = array(a);
+}
+
+ // no attributes
+attributes(res) ::= . {
+ res = array();
+}
+
+ // attribute
+attribute(res) ::= SPACE ID(v) EQUAL ID(id). {
+ if (defined(id)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant(id, $this->compiler);
+ }
+ res = array(v=>id);
+ } else {
+ res = array(v=>'\''.id.'\'');
+ }
+}
+
+attribute(res) ::= ATTR(v) expr(e). {
+ res = array(trim(v," =\n\r\t")=>e);
+}
+
+attribute(res) ::= ATTR(v) value(e). {
+ res = array(trim(v," =\n\r\t")=>e);
+}
+
+attribute(res) ::= SPACE ID(v). {
+ res = '\''.v.'\'';
+}
+
+attribute(res) ::= SPACE expr(e). {
+ res = e;
+}
+
+attribute(res) ::= SPACE value(v). {
+ res = v;
+}
+
+attribute(res) ::= SPACE INTEGER(i) EQUAL expr(e). {
+ res = array(i=>e);
+}
+
+
+
+//
+// statement
+//
+statements(res) ::= statement(s). {
+ res = array(s);
+}
+
+statements(res) ::= statements(s1) COMMA statement(s). {
+ s1[]=s;
+ res = s1;
+}
+
+statement(res) ::= DOLLARID(i) EQUAL INTEGER(e). {
+ res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
+}
+statement(res) ::= DOLLARID(i) EQUAL expr(e). {
+ res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
+}
+
+statement(res) ::= varindexed(vi) EQUAL expr(e). {
+ res = array('var' => vi, 'value'=>e);
+}
+
+statement(res) ::= OPENP statement(st) CLOSEP. {
+ res = st;
+}
+
+
+//
+// expressions
+//
+
+ // single value
+expr(res) ::= value(v). {
+ res = v;
+}
+
+ // ternary
+expr(res) ::= ternary(v). {
+ res = v;
+}
+
+ // resources/streams
+expr(res) ::= DOLLARID(i) COLON ID(i2). {
+ res = '$_smarty_tpl->getStreamVariable(\''.substr(i,1).'://' . i2 . '\')';
+}
+
+ // arithmetic expression
+expr(res) ::= expr(e) MATH(m) value(v). {
+ res = e . trim(m) . v;
+}
+
+expr(res) ::= expr(e) UNIMATH(m) value(v). {
+ res = e . trim(m) . v;
+}
+
+// if expression
+ // special conditions
+expr(res) ::= expr(e1) tlop(c) value(e2). {
+ res = c['pre']. e1.c['op'].e2 .')';
+}
+ // simple expression
+expr(res) ::= expr(e1) lop(c) expr(e2). {
+ res = e1.c.e2;
+}
+
+expr(res) ::= expr(e1) scond(c). {
+ res = c . e1 . ')';
+}
+
+expr(res) ::= expr(e1) ISIN array(a). {
+ res = 'in_array('.e1.','.a.')';
+}
+
+expr(res) ::= expr(e1) ISIN value(v). {
+ res = 'in_array('.e1.',(array)'.v.')';
+}
+
+
+//
+// ternary
+//
+ternary(res) ::= OPENP expr(v) CLOSEP QMARK DOLLARID(e1) COLON expr(e2). {
+ res = v.' ? '. $this->compiler->compileVariable('\''.substr(e1,1).'\'') . ' : '.e2;
+}
+
+ternary(res) ::= OPENP expr(v) CLOSEP QMARK expr(e1) COLON expr(e2). {
+ res = v.' ? '.e1.' : '.e2;
+}
+
+ // value
+value(res) ::= variable(v). {
+ res = v;
+}
+
+ // +/- value
+value(res) ::= UNIMATH(m) value(v). {
+ res = m.v;
+}
+
+ // logical negation
+value(res) ::= NOT value(v). {
+ res = '!'.v;
+}
+
+value(res) ::= TYPECAST(t) value(v). {
+ res = t.v;
+}
+
+value(res) ::= variable(v) INCDEC(o). {
+ res = v.o;
+}
+
+ // numeric
+value(res) ::= HEX(n). {
+ res = n;
+}
+
+value(res) ::= INTEGER(n). {
+ res = n;
+}
+
+value(res) ::= INTEGER(n1) DOT INTEGER(n2). {
+ res = n1.'.'.n2;
+}
+
+value(res) ::= INTEGER(n1) DOT. {
+ res = n1.'.';
+}
+
+value(res) ::= DOT INTEGER(n1). {
+ res = '.'.n1;
+}
+
+ // ID, true, false, null
+value(res) ::= ID(id). {
+ if (defined(id)) {
+ if ($this->security) {
+ $this->security->isTrustedConstant(id, $this->compiler);
+ }
+ res = id;
+ } else {
+ res = '\''.id.'\'';
+ }
+}
+
+ // function call
+value(res) ::= function(f). {
+ res = f;
+}
+
+ // expression
+value(res) ::= OPENP expr(e) CLOSEP. {
+ res = '('. e .')';
+}
+
+value(res) ::= variable(v1) INSTANCEOF(i) ns1(v2). {
+ res = v1.i.v2;
+}
+value(res) ::= variable(v1) INSTANCEOF(i) variable(v2). {
+ res = v1.i.v2;
+}
+
+ // singele quoted string
+value(res) ::= SINGLEQUOTESTRING(t). {
+ res = t;
+}
+
+ // double quoted string
+value(res) ::= doublequoted_with_quotes(s). {
+ res = s;
+}
+
+
+value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
+ $prefixVar = $this->compiler->getNewPrefixVariable();
+ 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'].';?>');
+ }
+ res = $prefixVar .'::'.r[0].r[1];
+}
+
+ // Smarty tag
+value(res) ::= smartytag(st). {
+ $prefixVar = $this->compiler->getNewPrefixVariable();
+ $tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
+ $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>"));
+ res = $prefixVar;
+}
+
+value(res) ::= value(v) modifierlist(l). {
+ res = $this->compiler->compileTag('private_modifier',array(),array('value'=>v,'modifierlist'=>l));
+}
+ // name space constant
+value(res) ::= NAMESPACE(c). {
+ res = c;
+}
+
+ // array
+value(res) ::= arraydef(a). {
+ res = a;
+}
+ // static class access
+value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
+ if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) {
+ if (isset($this->smarty->registered_classes[c])) {
+ res = $this->smarty->registered_classes[c].'::'.s[0].s[1];
+ } else {
+ res = c.'::'.s[0].s[1];
+ }
+ } else {
+ $this->compiler->trigger_template_error ('static class \''.c.'\' is undefined or not allowed by security setting');
+ }
+}
+//
+// namespace stuff
+//
+
+ns1(res) ::= ID(i). {
+ res = i;
+}
+
+ns1(res) ::= NAMESPACE(i). {
+ res = i;
+ }
+
+
+
+
+//
+// variables
+//
+ // Smarty variable (optional array)
+variable(res) ::= DOLLARID(i). {
+ res = $this->compiler->compileVariable('\''.substr(i,1).'\'');
+}
+variable(res) ::= varindexed(vi). {
+ if (vi['var'] === '\'smarty\'') {
+ $smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']);
+ res = $smarty_var;
+ } else {
+ // used for array reset,next,prev,end,current
+ $this->last_variable = vi['var'];
+ $this->last_index = vi['smarty_internal_index'];
+ res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'];
+ }
+}
+
+ // variable with property
+variable(res) ::= varvar(v) AT ID(p). {
+ res = '$_smarty_tpl->tpl_vars['. v .']->'.p;
+}
+
+ // object
+variable(res) ::= object(o). {
+ res = o;
+}
+
+ // config variable
+variable(res) ::= HATCH ID(i) HATCH. {
+ res = $this->compiler->compileConfigVariable('\'' . i . '\'');
+}
+
+variable(res) ::= HATCH ID(i) HATCH arrayindex(a). {
+ res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable('\'' . i . '\'') . ') ? $tmp'.a.' :null)';
+}
+
+variable(res) ::= HATCH variable(v) HATCH. {
+ res = $this->compiler->compileConfigVariable(v);
+}
+
+variable(res) ::= HATCH variable(v) HATCH arrayindex(a). {
+ res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable(v) . ') ? $tmp'.a.' : null)';
+}
+
+varindexed(res) ::= DOLLARID(i) arrayindex(a). {
+ res = array('var'=>'\''.substr(i,1).'\'', 'smarty_internal_index'=>a);
+}
+varindexed(res) ::= varvar(v) arrayindex(a). {
+ res = array('var'=>v, 'smarty_internal_index'=>a);
+}
+
+//
+// array index
+//
+ // multiple array index
+arrayindex(res) ::= arrayindex(a1) indexdef(a2). {
+ res = a1.a2;
+}
+
+ // no array index
+arrayindex ::= . {
+ return;
+}
+
+// single index definition
+ // Smarty2 style index
+indexdef(res) ::= DOT DOLLARID(i). {
+ res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
+}
+indexdef(res) ::= DOT varvar(v). {
+ res = '['.$this->compiler->compileVariable(v).']';
+}
+
+indexdef(res) ::= DOT varvar(v) AT ID(p). {
+ res = '['.$this->compiler->compileVariable(v).'->'.p.']';
+}
+
+indexdef(res) ::= DOT ID(i). {
+ res = '[\''. i .'\']';
+}
+
+indexdef(res) ::= DOT INTEGER(n). {
+ res = '['. n .']';
+}
+
+
+indexdef(res) ::= DOT LDEL expr(e) RDEL. {
+ res = '['. e .']';
+}
+
+ // section tag index
+indexdef(res) ::= OPENB ID(i)CLOSEB. {
+ res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\'index\']').']';
+}
+
+indexdef(res) ::= OPENB ID(i) DOT ID(i2) CLOSEB. {
+ res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\''.i2.'\']').']';
+}
+indexdef(res) ::= OPENB SINGLEQUOTESTRING(s) CLOSEB. {
+ res = '['.s.']';
+}
+indexdef(res) ::= OPENB INTEGER(n) CLOSEB. {
+ res = '['.n.']';
+}
+indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. {
+ res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
+}
+indexdef(res) ::= OPENB variable(v) CLOSEB. {
+ res = '['.v.']';
+}
+indexdef(res) ::= OPENB value(v) CLOSEB. {
+ res = '['.v.']';
+}
+
+ // PHP style index
+indexdef(res) ::= OPENB expr(e) CLOSEB. {
+ res = '['. e .']';
+}
+
+ // for assign append array
+indexdef(res) ::= OPENB CLOSEB. {
+ res = '[]';
+}
+
+
+//
+// variable variable names
+//
+
+ // singel identifier element
+varvar(res) ::= DOLLARID(i). {
+ res = '\''.substr(i,1).'\'';
+}
+ // single $
+varvar(res) ::= DOLLAR. {
+ res = '\'\'';
+}
+
+ // sequence of identifier elements
+varvar(res) ::= varvar(v1) varvarele(v2). {
+ res = v1.'.'.v2;
+}
+
+ // fix sections of element
+varvarele(res) ::= ID(s). {
+ res = '\''.s.'\'';
+}
+varvarele(res) ::= SIMPELOUTPUT(i). {
+ $var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
+ res = $this->compiler->compileVariable('\''.$var.'\'');
+}
+
+ // variable sections of element
+varvarele(res) ::= LDEL expr(e) RDEL. {
+ res = '('.e.')';
+}
+
+//
+// objects
+//
+object(res) ::= varindexed(vi) objectchain(oc). {
+ 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;
+ }
+}
+
+ // single element
+objectchain(res) ::= objectelement(oe). {
+ res = oe;
+}
+
+ // chain of elements
+objectchain(res) ::= objectchain(oc) objectelement(oe). {
+ res = oc.oe;
+}
+
+ // variable
+objectelement(res)::= PTR ID(i) arrayindex(a). {
+ if ($this->security && substr(i,0,1) === '_') {
+ $this->compiler->trigger_template_error (self::ERR1);
+ }
+ res = '->'.i.a;
+}
+
+objectelement(res)::= PTR varvar(v) arrayindex(a). {
+ if ($this->security) {
+ $this->compiler->trigger_template_error (self::ERR2);
+ }
+ res = '->{'.$this->compiler->compileVariable(v).a.'}';
+}
+
+objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
+ if ($this->security) {
+ $this->compiler->trigger_template_error (self::ERR2);
+ }
+ res = '->{'.e.a.'}';
+}
+
+objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
+ if ($this->security) {
+ $this->compiler->trigger_template_error (self::ERR2);
+ }
+ res = '->{\''.ii.'\'.'.e.a.'}';
+}
+
+ // method
+objectelement(res)::= PTR method(f). {
+ res = '->'.f;
+}
+
+
+//
+// function
+//
+function(res) ::= ns1(f) OPENP params(p) CLOSEP. {
+ res = $this->compiler->compilePHPFunctionCall(f, p);
+}
+
+
+//
+// method
+//
+method(res) ::= ID(f) OPENP params(p) CLOSEP. {
+ if ($this->security && substr(f,0,1) === '_') {
+ $this->compiler->trigger_template_error (self::ERR1);
+ }
+ res = f . '('. implode(',',p) .')';
+}
+
+method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
+ if ($this->security) {
+ $this->compiler->trigger_template_error (self::ERR2);
+ }
+ $prefixVar = $this->compiler->getNewPrefixVariable();
+ $this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
+ res = $prefixVar .'('. implode(',',p) .')';
+}
+
+// function/method parameter
+ // multiple parameters
+params(res) ::= params(p) COMMA expr(e). {
+ res = array_merge(p,array(e));
+}
+
+ // single parameter
+params(res) ::= expr(e). {
+ res = array(e);
+}
+
+ // kein parameter
+params(res) ::= . {
+ res = array();
+}
+
+//
+// modifier
+//
+modifierlist(res) ::= modifierlist(l) modifier(m) modparameters(p). {
+ res = array_merge(l,array(array_merge(m,p)));
+}
+
+modifierlist(res) ::= modifier(m) modparameters(p). {
+ res = array(array_merge(m,p));
+}
+
+modifier(res) ::= VERT AT ID(m). {
+ res = array(m);
+}
+
+modifier(res) ::= VERT ID(m). {
+ res = array(m);
+}
+
+//
+// modifier parameter
+//
+ // multiple parameter
+modparameters(res) ::= modparameters(mps) modparameter(mp). {
+ res = array_merge(mps,mp);
+}
+
+ // no parameter
+modparameters(res) ::= . {
+ res = array();
+}
+
+ // parameter expression
+modparameter(res) ::= COLON value(mp). {
+ res = array(mp);
+}
+modparameter(res) ::= COLON UNIMATH(m) value(mp). {
+ res = array(trim(m).mp);
+}
+
+modparameter(res) ::= COLON array(mp). {
+ res = array(mp);
+}
+
+ // static class methode call
+static_class_access(res) ::= method(m). {
+ res = array(m, '', 'method');
+}
+
+ // static class methode call with object chainig
+static_class_access(res) ::= method(m) objectchain(oc). {
+ res = array(m, oc, 'method');
+}
+
+ // static class constant
+static_class_access(res) ::= ID(v). {
+ res = array(v, '');
+}
+
+ // static class variables
+static_class_access(res) ::= DOLLARID(v) arrayindex(a). {
+ res = array(v, a, 'property');
+}
+
+ // static class variables with object chain
+static_class_access(res) ::= DOLLARID(v) arrayindex(a) objectchain(oc). {
+ res = array(v, a.oc, 'property');
+}
+
+
+// if conditions and operators
+lop(res) ::= LOGOP(o). {
+ res = ' '. trim(o) . ' ';
+}
+
+lop(res) ::= SLOGOP(o). {
+ static $lops = array(
+ 'eq' => ' == ',
+ 'ne' => ' != ',
+ 'neq' => ' != ',
+ 'gt' => ' > ',
+ 'ge' => ' >= ',
+ 'gte' => ' >= ',
+ 'lt' => ' < ',
+ 'le' => ' <= ',
+ 'lte' => ' <= ',
+ 'mod' => ' % ',
+ 'and' => ' && ',
+ 'or' => ' || ',
+ 'xor' => ' xor ',
+ );
+ $op = strtolower(preg_replace('/\s*/', '', o));
+ res = $lops[$op];
+}
+tlop(res) ::= TLOGOP(o). {
+ static $tlops = array(
+ 'isdivby' => array('op' => ' % ', 'pre' => '!('),
+ 'isnotdivby' => array('op' => ' % ', 'pre' => '('),
+ 'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '),
+ 'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '),
+ 'isoddby' => array('op' => ' / ', 'pre' => '(1 & '),
+ 'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '),
+ );
+ $op = strtolower(preg_replace('/\s*/', '', o));
+ res = $tlops[$op];
+ }
+
+scond(res) ::= SINGLECOND(o). {
+ static $scond = array (
+ 'iseven' => '!(1 & ',
+ 'isnoteven' => '(1 & ',
+ 'isodd' => '(1 & ',
+ 'isnotodd' => '!(1 & ',
+ );
+ $op = strtolower(str_replace(' ', '', o));
+ res = $scond[$op];
+}
+
+//
+// ARRAY element assignment
+//
+arraydef(res) ::= OPENB arrayelements(a) CLOSEB. {
+ res = 'array('.a.')';
+}
+arraydef(res) ::= ARRAYOPEN arrayelements(a) CLOSEP. {
+ res = 'array('.a.')';
+}
+
+arrayelements(res) ::= arrayelement(a). {
+ res = a;
+}
+
+arrayelements(res) ::= arrayelements(a1) COMMA arrayelement(a). {
+ res = a1.','.a;
+}
+
+arrayelements ::= . {
+ return;
+}
+
+arrayelement(res) ::= value(e1) APTR expr(e2). {
+ res = e1.'=>'.e2;
+}
+
+arrayelement(res) ::= ID(i) APTR expr(e2). {
+ res = '\''.i.'\'=>'.e2;
+}
+
+arrayelement(res) ::= expr(e). {
+ res = e;
+}
+
+
+//
+// double quoted strings
+//
+doublequoted_with_quotes(res) ::= QUOTE QUOTE. {
+ res = '\'\'';
+}
+
+doublequoted_with_quotes(res) ::= QUOTE doublequoted(s) QUOTE. {
+ $this->compiler->leaveDoubleQuote();
+ res = s->to_smarty_php($this);
+}
+
+
+doublequoted(res) ::= doublequoted(o1) doublequotedcontent(o2). {
+ o1->append_subtree($this, o2);
+ res = o1;
+}
+
+doublequoted(res) ::= doublequotedcontent(o). {
+ res = new Smarty_Internal_ParseTree_Dq($this, o);
+}
+
+doublequotedcontent(res) ::= BACKTICK variable(v) BACKTICK. {
+ res = new Smarty_Internal_ParseTree_Code('(string)'.v);
+}
+
+doublequotedcontent(res) ::= BACKTICK expr(e) BACKTICK. {
+ res = new Smarty_Internal_ParseTree_Code('(string)('.e.')');
+}
+
+doublequotedcontent(res) ::= DOLLARID(i). {
+ res = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\''. substr(i,1) .'\']->value');
+}
+
+doublequotedcontent(res) ::= LDEL variable(v) RDEL. {
+ res = new Smarty_Internal_ParseTree_Code('(string)'.v);
+}
+
+doublequotedcontent(res) ::= LDEL expr(e) RDEL. {
+ res = new Smarty_Internal_ParseTree_Code('(string)('.e.')');
+}
+
+doublequotedcontent(res) ::= smartytag(st). {
+ res = new Smarty_Internal_ParseTree_Tag($this, st);
+}
+
+doublequotedcontent(res) ::= TEXT(o). {
+ res = new Smarty_Internal_ParseTree_DqContent(o);
+}
+
diff --git a/vendor/smarty/smarty/libs/Smarty.class.php b/vendor/smarty/smarty/libs/Smarty.class.php
index 44b77a856..9e0ca7670 100644
--- a/vendor/smarty/smarty/libs/Smarty.class.php
+++ b/vendor/smarty/smarty/libs/Smarty.class.php
@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
- const SMARTY_VERSION = '3.1.34-dev-7';
+ const SMARTY_VERSION = '3.1.36';
/**
* define variable scopes
*/
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php
index 4b9984888..1f0ab9b7d 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php
@@ -83,7 +83,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
if (isset($parameter[ 'smarty_internal_index' ])) {
$output =
"<?php \$_tmp_array = isset(\$_smarty_tpl->tpl_vars[{$_var}]) ? \$_smarty_tpl->tpl_vars[{$_var}]->value : array();\n";
- $output .= "if (!is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess) {\n";
+ $output .= "if (!(is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess)) {\n";
$output .= "settype(\$_tmp_array, 'array');\n";
$output .= "}\n";
$output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php
index 78b45ea7e..a68da5409 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php
@@ -219,8 +219,9 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
if (isset($itemAttr[ 'index' ])) {
$output .= "{$itemVar}->index = -1;\n";
}
- $output .= "if (\$_from !== null) {\n";
- $output .= "foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
+ $output .= "{$itemVar}->do_else = true;\n";
+ $output .= "if (\$_from !== null) foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
+ $output .= "{$itemVar}->do_else = false;\n";
if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) {
$output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n";
}
@@ -296,7 +297,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
if ($restore === 2) {
$output .= "{$itemVar} = {$local}saved;\n";
}
- $output .= "}\n} else {\n?>";
+ $output .= "}\nif ({$itemVar}->do_else) {\n?>";
return $output;
}
}
@@ -332,9 +333,6 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
if ($restore === 2) {
$output .= "{$itemVar} = {$local}saved;\n";
}
- if ($restore > 0) {
- $output .= "}\n";
- }
$output .= "}\n";
/* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
$foreachCompiler = $compiler->getTagCompiler('foreach');
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
index f987f6da5..ed18d84bb 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
@@ -48,6 +48,8 @@ class Smarty_Internal_Method_RegisterPlugin
throw new SmartyException("Plugin tag '{$name}' already registered");
} elseif (!is_callable($callback)) {
throw new SmartyException("Plugin '{$name}' not callable");
+ } elseif ($cacheable && $cache_attr) {
+ throw new SmartyException("Cannot set caching attributes for plugin '{$name}' when it is cacheable.");
} else {
$smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool)$cacheable, (array)$cache_attr);
}
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php
index 8e716bd5d..477232ef8 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php
@@ -85,45 +85,85 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
public function to_smarty_php(Smarty_Internal_Templateparser $parser)
{
$code = '';
- for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
- if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
- $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
- while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
- $this->subtrees[ $key + 1 ]->data === '')) {
- $key++;
- if ($this->subtrees[ $key ]->data === '') {
- continue;
- }
- $subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
- }
- if ($subtree === '') {
- continue;
- }
- $code .= preg_replace(
- '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
- "<?php echo '\$1'; ?>\n",
- $subtree
- );
- continue;
- }
- if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
- $subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
- while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
- $this->subtrees[ $key + 1 ]->data === '')) {
- $key++;
- if ($this->subtrees[ $key ]->data === '') {
- continue;
- }
- $subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
- }
- if ($subtree === '') {
- continue;
- }
- $code .= $subtree;
- continue;
- }
- $code .= $this->subtrees[ $key ]->to_smarty_php($parser);
+
+ foreach ($this->getChunkedSubtrees() as $chunk) {
+ $text = '';
+ switch ($chunk['mode']) {
+ case 'textstripped':
+ foreach ($chunk['subtrees'] as $subtree) {
+ $text .= $subtree->to_smarty_php($parser);
+ }
+ $code .= preg_replace(
+ '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
+ "<?php echo '\$1'; ?>\n",
+ $parser->compiler->processText($text)
+ );
+ break;
+ case 'text':
+ foreach ($chunk['subtrees'] as $subtree) {
+ $text .= $subtree->to_smarty_php($parser);
+ }
+ $code .= preg_replace(
+ '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
+ "<?php echo '\$1'; ?>\n",
+ $text
+ );
+ break;
+ case 'tag':
+ foreach ($chunk['subtrees'] as $subtree) {
+ $text = $parser->compiler->appendCode($text, $subtree->to_smarty_php($parser));
+ }
+ $code .= $text;
+ break;
+ default:
+ foreach ($chunk['subtrees'] as $subtree) {
+ $text = $subtree->to_smarty_php($parser);
+ }
+ $code .= $text;
+
+ }
}
return $code;
}
+
+ private function getChunkedSubtrees() {
+ $chunks = [];
+ $currentMode = null;
+ $currentChunk = [];
+ for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
+
+ if ($this->subtrees[ $key ]->data === '' && in_array($currentMode, ['textstripped', 'text', 'tag'])) {
+ continue;
+ }
+
+ if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text
+ && $this->subtrees[ $key ]->isToBeStripped()) {
+ $newMode = 'textstripped';
+ } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
+ $newMode = 'text';
+ } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
+ $newMode = 'tag';
+ } else {
+ $newMode = 'other';
+ }
+
+ if ($newMode == $currentMode) {
+ $currentChunk[] = $this->subtrees[ $key ];
+ } else {
+ $chunks[] = [
+ 'mode' => $currentMode,
+ 'subtrees' => $currentChunk
+ ];
+ $currentMode = $newMode;
+ $currentChunk = [$this->subtrees[ $key ]];
+ }
+ }
+ if ($currentMode && $currentChunk) {
+ $chunks[] = [
+ 'mode' => $currentMode,
+ 'subtrees' => $currentChunk
+ ];
+ }
+ return $chunks;
+ }
}
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php
index b3100fa09..399e84941 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php
@@ -16,14 +16,31 @@
*/
class Smarty_Internal_ParseTree_Text extends Smarty_Internal_ParseTree
{
- /**
- * Create template text buffer
- *
- * @param string $data text
- */
- public function __construct($data)
+
+ /**
+ * Wether this section should be stripped on output to smarty php
+ * @var bool
+ */
+ private $toBeStripped = false;
+
+ /**
+ * Create template text buffer
+ *
+ * @param string $data text
+ * @param bool $toBeStripped wether this section should be stripped on output to smarty php
+ */
+ public function __construct($data, $toBeStripped = false)
{
$this->data = $data;
+ $this->toBeStripped = $toBeStripped;
+ }
+
+ /**
+ * Wether this section should be stripped on output to smarty php
+ * @return bool
+ */
+ public function isToBeStripped() {
+ return $this->toBeStripped;
}
/**
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php
index 4476f120f..200c11bb5 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php
@@ -265,7 +265,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
*
* @param string $type plugin type
* @param string $name name of template tag
- * @param callback $callback PHP callback to register
+ * @param callable $callback PHP callback to register
* @param bool $cacheable if true (default) this function is cache able
* @param mixed $cache_attr caching attributes if any
*
@@ -301,7 +301,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* @link http://www.smarty.net/docs/en/api.register.filter.tpl
*
* @param string $type filter type
- * @param callback $callback
+ * @param callable $callback
* @param string|null $name optional filter name
*
* @return \Smarty|\Smarty_Internal_Template
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
index a72f3a4ab..3cc957dec 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
@@ -621,22 +621,18 @@ abstract class Smarty_Internal_TemplateCompilerBase
|| strcasecmp($name, 'array') === 0 || is_callable($name)
) {
$func_name = strtolower($name);
- $par = implode(',', $parameter);
- $parHasFuction = strpos($par, '(') !== false;
+
if ($func_name === 'isset') {
if (count($parameter) === 0) {
$this->trigger_template_error('Illegal number of parameter in "isset()"');
}
- if ($parHasFuction) {
- $pa = array();
- foreach ($parameter as $p) {
- $pa[] = (strpos($p, '(') === false) ? ('isset(' . $p . ')') : ('(' . $p . ' !== null )');
- }
- return '(' . implode(' && ', $pa) . ')';
- } else {
- $isset_par = str_replace("')->value", "',null,true,false)->value", $par);
- }
- return $name . '(' . $isset_par . ')';
+
+ $pa = array();
+ foreach ($parameter as $p) {
+ $pa[] = $this->syntaxMatchesVariable($p) ? 'isset(' . $p . ')' : '(' . $p . ' !== null )';
+ }
+ return '(' . implode(' && ', $pa) . ')';
+
} elseif (in_array(
$func_name,
array(
@@ -653,7 +649,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
$this->trigger_template_error("Illegal number of parameter in '{$func_name()}'");
}
if ($func_name === 'empty') {
- if ($parHasFuction && version_compare(PHP_VERSION, '5.5.0', '<')) {
+ if (!$this->syntaxMatchesVariable($parameter[0]) && version_compare(PHP_VERSION, '5.5.0', '<')) {
return '(' . $parameter[ 0 ] . ' === false )';
} else {
return $func_name . '(' .
@@ -671,74 +667,82 @@ abstract class Smarty_Internal_TemplateCompilerBase
}
}
+ /**
+ * Determines whether the passed string represents a valid (PHP) variable.
+ * This is important, because `isset()` only works on variables and `empty()` can only be passed
+ * a variable prior to php5.5
+ * @param $string
+ * @return bool
+ */
+ private function syntaxMatchesVariable($string) {
+ static $regex_pattern = '/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*((->)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\[.*]*\])*$/';
+ return 1 === preg_match($regex_pattern, trim($string));
+ }
+
/**
- * This method is called from parser to process a text content section
+ * This method is called from parser to process a text content section if strip is enabled
* - remove text from inheritance child templates as they may generate output
- * - strip text if strip is enabled
*
* @param string $text
*
- * @return null|\Smarty_Internal_ParseTree_Text
+ * @return string
*/
public function processText($text)
{
- if ((string)$text != '') {
- $store = array();
- $_store = 0;
- if ($this->parser->strip) {
- if (strpos($text, '<') !== false) {
- // capture html elements not to be messed with
- $_offset = 0;
- if (preg_match_all(
- '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
- $text,
- $matches,
- PREG_OFFSET_CAPTURE | PREG_SET_ORDER
- )
- ) {
- foreach ($matches as $match) {
- $store[] = $match[ 0 ][ 0 ];
- $_length = strlen($match[ 0 ][ 0 ]);
- $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
- $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
- $_offset += $_length - strlen($replace);
- $_store++;
- }
- }
- $expressions = array(// replace multiple spaces between tags by a single space
- '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2',
- // remove newline between tags
- '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2',
- // remove multiple spaces between attributes (but not in attribute values!)
- '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
- '#>[\040\011]+$#Ss' => '> ',
- '#>[\040\011]*[\n]\s*$#Ss' => '>',
- $this->stripRegEx => '',
- );
- $text = preg_replace(array_keys($expressions), array_values($expressions), $text);
- $_offset = 0;
- if (preg_match_all(
- '#@!@SMARTY:([0-9]+):SMARTY@!@#is',
- $text,
- $matches,
- PREG_OFFSET_CAPTURE | PREG_SET_ORDER
- )
- ) {
- foreach ($matches as $match) {
- $_length = strlen($match[ 0 ][ 0 ]);
- $replace = $store[ $match[ 1 ][ 0 ] ];
- $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
- $_offset += strlen($replace) - $_length;
- $_store++;
- }
- }
- } else {
- $text = preg_replace($this->stripRegEx, '', $text);
- }
+
+ if (strpos($text, '<') === false) {
+ return preg_replace($this->stripRegEx, '', $text);
+ }
+
+ $store = array();
+ $_store = 0;
+
+ // capture html elements not to be messed with
+ $_offset = 0;
+ if (preg_match_all(
+ '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
+ $text,
+ $matches,
+ PREG_OFFSET_CAPTURE | PREG_SET_ORDER
+ )
+ ) {
+ foreach ($matches as $match) {
+ $store[] = $match[ 0 ][ 0 ];
+ $_length = strlen($match[ 0 ][ 0 ]);
+ $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
+ $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
+ $_offset += $_length - strlen($replace);
+ $_store++;
+ }
+ }
+ $expressions = array(// replace multiple spaces between tags by a single space
+ '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2',
+ // remove newline between tags
+ '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2',
+ // remove multiple spaces between attributes (but not in attribute values!)
+ '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
+ '#>[\040\011]+$#Ss' => '> ',
+ '#>[\040\011]*[\n]\s*$#Ss' => '>',
+ $this->stripRegEx => '',
+ );
+ $text = preg_replace(array_keys($expressions), array_values($expressions), $text);
+ $_offset = 0;
+ if (preg_match_all(
+ '#@!@SMARTY:([0-9]+):SMARTY@!@#is',
+ $text,
+ $matches,
+ PREG_OFFSET_CAPTURE | PREG_SET_ORDER
+ )
+ ) {
+ foreach ($matches as $match) {
+ $_length = strlen($match[ 0 ][ 0 ]);
+ $replace = $store[ $match[ 1 ][ 0 ] ];
+ $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
+ $_offset += strlen($replace) - $_length;
+ $_store++;
}
- return new Smarty_Internal_ParseTree_Text($text);
}
- return null;
+ return $text;
}
/**
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php
index d29c39b56..867a31d26 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php
@@ -376,7 +376,7 @@ class Smarty_Internal_Templatelexer
continue;
}
} else {
- throw new Exception('Unexpected input at line' . $this->line .
+ throw new Exception('Unexpected input at line ' . $this->line .
': ' . $this->data[ $this->counter ]);
}
break;
@@ -497,7 +497,7 @@ class Smarty_Internal_Templatelexer
continue;
}
} else {
- throw new Exception('Unexpected input at line' . $this->line .
+ throw new Exception('Unexpected input at line ' . $this->line .
': ' . $this->data[ $this->counter ]);
}
break;
@@ -635,7 +635,7 @@ class Smarty_Internal_Templatelexer
continue;
}
} else {
- throw new Exception('Unexpected input at line' . $this->line .
+ throw new Exception('Unexpected input at line ' . $this->line .
': ' . $this->data[ $this->counter ]);
}
break;
@@ -927,7 +927,7 @@ class Smarty_Internal_Templatelexer
continue;
}
} else {
- throw new Exception('Unexpected input at line' . $this->line .
+ throw new Exception('Unexpected input at line ' . $this->line .
': ' . $this->data[ $this->counter ]);
}
break;
@@ -1014,7 +1014,7 @@ class Smarty_Internal_Templatelexer
continue;
}
} else {
- throw new Exception('Unexpected input at line' . $this->line .
+ throw new Exception('Unexpected input at line ' . $this->line .
': ' . $this->data[ $this->counter ]);
}
break;
@@ -1092,4 +1092,4 @@ class Smarty_Internal_Templatelexer
}
}
- \ No newline at end of file
+
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php
index a26e7a147..aaeae63b7 100644
--- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php
+++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php
@@ -2169,8 +2169,13 @@ class Smarty_Internal_Templateparser
// line 255 "../smarty/lexer/smarty_internal_templateparser.y"
public function yy_r2()
{
- $this->current_buffer->append_subtree($this,
- $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor));
+ $text = $this->yystack[ $this->yyidx + 0 ]->minor;
+
+ if ((string)$text == '') {
+ $this->current_buffer->append_subtree($this, null);
+ }
+
+ $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text($text, $this->strip));
}
// line 259 "../smarty/lexer/smarty_internal_templateparser.y"
@@ -2252,7 +2257,7 @@ class Smarty_Internal_Templateparser
-$this->compiler->getRdelLength()));
if ($tag == 'strip') {
$this->strip = true;
- $this->_retvalue = null;;
+ $this->_retvalue = null;
} else {
if (defined($tag)) {
if ($this->security) {