diff --git a/change_log.txt b/change_log.txt
index f214d270..5121a950 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,8 +1,9 @@
===== 3.1.32 - dev ===
-05.11.2017 3.1.32-dev-32
+05.11.2017
- lexer/parser optimization
+ - code cleanup and optimizations
-26.10.2017 3.1.32-dev-28
+26.10.2017
- bugfix Smarty version was not filled in header comment of compiled and cached files
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR
- deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors()
@@ -98,12 +99,11 @@
https://github.com/smarty-php/smarty/issues/347
14.4.2017
- - merge pull requests https://github.com/smarty-php/smarty/pull/349, https://github.com/smarty-php/smarty/pull/322 and
- https://github.com/smarty-php/smarty/pull/337 to fix spelling and annotation
+ - merge pull requests https://github.com/smarty-php/smarty/pull/349, https://github.com/smarty-php/smarty/pull/322 and https://github.com/smarty-php/smarty/pull/337 to fix spelling and annotation
13.4.2017
- bugfix array_merge() parameter should be checked https://github.com/smarty-php/smarty/issues/350
-
+
===== 3.1.31 ===== (14.12.2016)
23.11.2016
- move template object cache into static variables
@@ -142,7 +142,7 @@
19.10.2016
- bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305
- bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304
-
+
12.10.2016
- bugfix {include} with template names including variable or constants could fail after bugfix from
28.09.2016 https://github.com/smarty-php/smarty/issues/302
@@ -201,7 +201,7 @@
01.09.2016
- performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280
-
+
26.08.2016
- bugfix change of 23.08.2016 failed on linux when use_include_path = true
@@ -224,47 +224,47 @@
- bugfix update of 04.08.2016 was incomplete
05.08.2016
- - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264
+ - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264
- updated error checking at template and config default handler
-
+
04.08.2016
- improvement move template function source parameter into extension
-
+
26.07.2016
- optimization unneeded loading of compiled resource
-
+
24.07.2016
- regression this->addPluginsDir('/abs/path/to/dir') adding absolute path without trailing '/' did fail https://github.com/smarty-php/smarty/issues/260
-
+
23.07.2016
- bugfix setTemplateDir('/') and setTemplateDir('') did create wrong absolute filepath https://github.com/smarty-php/smarty/issues/245
- optimization of filepath normalization
- improvement remove double function declaration in plugin shared.escape_special_cars.php https://github.com/smarty-php/smarty/issues/229
-
+
19.07.2016
- bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246
- bugfix {math} shell injection vulnerability patch provided by Tim Weber
-
+
18.07.2016
- bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254
- bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228
- bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244
- bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246
-
+
14.07.2016
- bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231
-
+
13.07.2016
- bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241
- update testInstall() https://github.com/smarty-php/smarty/issues/248https://github.com/smarty-php/smarty/issues/248
- bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237
- bugfix template function data should be merged when loading subtemplate https://github.com/smarty-php/smarty/issues/240
- bugfix wrong parameter on compileAllTemplates() https://github.com/smarty-php/smarty/issues/231
-
+
12.07.2016
- bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239
- bugfix enableSecurity() must init cache flags https://github.com/smarty-php/smarty/issues/247
-
+
27.05.2016
- bugfix/improvement of compileAlltemplates() follow symlinks in template folder (PHP >= 5.3.1) https://github.com/smarty-php/smarty/issues/224
clear internal cache and expension handler for each template to avoid possible conflicts https://github.com/smarty-php/smarty/issues/231
@@ -307,26 +307,26 @@
11.03.2016
- optimization of capture and security handling
- improvement $smarty->clearCompiledTemplate() should return on recompiled or uncompiled resources
-
+
10.03.2016
- optimization of resource processing
-
+
09.03.2016
- improvement rework of 'scope' attribute handling see see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/194
https://github.com/smarty-php/smarty/issues/186 https://github.com/smarty-php/smarty/issues/179
- bugfix correct Autoloader update of 2.3.2014 https://github.com/smarty-php/smarty/issues/199
-
+
04.03.2016
- bugfix change from 01.03.2016 will cause $smarty->isCached(..) failure if called multiple time for same template
(forum topic 25935)
-
+
02.03.2016
- revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199
-
+
01.03.2016
- bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched
multiple times (forum topic 25909)
-
+
25.02.2016
- bugfix wrong _realpath with 4 or more parent-directories https://github.com/smarty-php/smarty/issues/190
- optimization of _realpath
@@ -335,10 +335,10 @@
20.02.2016
- bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184
- new feature/bugfix {foreach}{section} add 'properties' attribute to force compilation of loop properties
- see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189
-
+ see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189
+
19.02.2016
- - revert output buffer flushing on display, echo content again because possible problems when PHP files had
+ - revert output buffer flushing on display, echo content again because possible problems when PHP files had
characters (newline} after ?> at file end https://github.com/smarty-php/smarty/issues/187
14.02.2016
@@ -349,33 +349,33 @@
- optimization make compiler tag object cache static for higher compilation speed
11.02.2016
- - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82
+ - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82
https://github.com/smarty-php/smarty/pull/181
-
+
10.02.2016
- bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177
- bugfix wrong precedence on special if conditions like '$foo is ... by $bar' could cause wrong code https://github.com/smarty-php/smarty/issues/178
- improvement because of ambiguities the inline constant support has been removed from the $foo.bar syntax https://github.com/smarty-php/smarty/issues/149
- - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180
+ - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180
09.02.2016
- move some code from parser into compiler
- reformat all code for unique style
- update/bugfix scope attribute handling reworked. Read the newfeatures.txt file
-
+
05.02.2016
- improvement internal compiler changes
-
+
01.02.2016
- bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used.
29.01.2016
- bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151
-
+
28.01.2016
- bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170
- bugfix if fetch('foo.tpl') is called on a template object the $parent parameter should default to the calling template object https://github.com/smarty-php/smarty/issues/152
-
+
27.01.2016
- revert bugfix compiling {section} did create warning
- bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161
@@ -385,7 +385,7 @@
- bugfix {extends} with relative file path did not work https://github.com/smarty-php/smarty/issues/154
https://github.com/smarty-php/smarty/issues/158
- bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153
-
+
26.01.2016
- improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
- bugfix compiling {section} did create warning
@@ -395,28 +395,28 @@
- update scope handling
- optimize block plugin compiler
- improvement runtime checks if registered block plugins are callable
-
+
01.01.2016
- remove Smarty::$resource_cache_mode property
-
+
31.12.2015
- optimization of {assign}, {if} and {while} compiled code
-
+
30.12.2015
- bugfix plugin names starting with "php" did not compile https://github.com/smarty-php/smarty/issues/147
29.12.2015
- bugfix Smarty::error_reporting was not observed when display() or fetch() was called on template objects https://github.com/smarty-php/smarty/issues/145
-
+
28.12.2015
- optimization of {foreach} code size and processing
-
+
27.12.2015
- improve inheritance code
- update external methods
- code fixes
- PHPdoc updates
-
+
25.12.2015
- compile {block} tag code and its processing into classes
- optimization replace hhvm extension by inline code
@@ -430,45 +430,45 @@
- optimization move internal method decodeProperties back into template object
- optimization move subtemplate processing back into template object
- new feature Caching does now observe the template_dir setting and will create separate cache files if required
-
+
22.12.2015
- change $xxx_dir properties from private to protected in case Smarty class gets extended
- code optimizations
-
+
21.12.2015
- bugfix a filepath starting with '/' or '\' on windows should normalize to the root dir
of current working drive https://github.com/smarty-php/smarty/issues/134
- 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)
21.12.2015
- optimization improve speed of filetime checks on extends and extendsall resource
-
+
20.12.2015
- bugfix failure when the default resource type was set to 'extendsall' https://github.com/smarty-php/smarty/issues/123
- update compilation of Smarty special variables
- bugfix add addition check for OS type on normalization of file path https://github.com/smarty-php/smarty/issues/134
- bugfix the source uid of the extendsall resource must contain $template_dir settings https://github.com/smarty-php/smarty/issues/123
-
+
19.12.2015
- bugfix using $smarty.capture.foo in expressions could fail https://github.com/smarty-php/smarty/pull/138
- bugfix broken PHP 5.2 compatibility https://github.com/smarty-php/smarty/issues/139
- remove no longer used code
- improvement make sure that compiled and cache templates never can contain a trailing '?>?
-
+
18.12.2015
- bugfix regression when modifier parameter was followed by math https://github.com/smarty-php/smarty/issues/132
-
+
17.12.2015
- bugfix {$smarty.capture.nameFail} did lowercase capture name https://github.com/smarty-php/smarty/issues/135
- bugfix using {block append/prepend} on same block in multiple levels of inheritance templates could fail (forum topic 25827)
- bugfix text content consisting of just a single '0' like in {if true}0{/if} was suppressed (forum topic 25834)
-
+
16.12.2015
- bugfix {foreach} did fail if from atrribute is a Generator class https://github.com/smarty-php/smarty/issues/128
- bugfix direct access $smarty->template_dir = 'foo'; should call Smarty::setTemplateDir() https://github.com/smarty-php/smarty/issues/121
-
+
15.12.2015
- bugfix {$smarty.cookies.foo} did return the $_COOKIE array not the 'foo' value https://github.com/smarty-php/smarty/issues/122
- bugfix a call to clearAllCache() and other should clear all internal template object caches (forum topic 25828)
@@ -476,25 +476,25 @@
14.12.2015
- 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)
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)
- bugfix Debug Console could display incorrect data when using subtemplates
-
+
09.12.2015
- bugfix Smarty did fail under PHP 7.0.0 with use_include_path = true;
-
+
09.12.2015
- bugfix {strip} should exclude some html tags from stripping, related to fix for https://github.com/smarty-php/smarty/issues/111
-
+
08.12.2015
- bugfix internal template function data got stored in wrong compiled file https://github.com/smarty-php/smarty/issues/114
-
+
05.12.2015
-bugfix {strip} should insert a single space https://github.com/smarty-php/smarty/issues/111
-
+
25.11.2015
-bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798)
@@ -503,7 +503,7 @@
01.11.2015
- update config file processing
-
+
31.10.2015
- bugfix add missing $trusted_dir property to SmartyBC class (forum topic 25751)
@@ -527,7 +527,7 @@
18.09.2015
- bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92
-
+
17.09.2015
- bugfix {foreach} first attribute was not correctly reset since commit 05a8fa2 of 02.08.2015 https://github.com/smarty-php/smarty/issues/90
@@ -541,7 +541,7 @@
- move code of {call} processing back into Smarty_Internal_Template class
- improvement invalidate OPCACHE for cleared compiled and cached template files (forum topic 25557)
- bugfix unintended multiple debug windows (forum topic 25699)
-
+
30.08.2015
- size optimization move some runtime functions into extension
- optimize inline template processing
@@ -690,10 +690,10 @@
01.06.2015
- bugfix including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47
-
+
27.05.2015
- bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43
-
+
24.05.2015
- bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42
@@ -701,11 +701,11 @@
23.05.2015
- improvement on php_handling to allow very large PHP sections, better error handling
- improvement allow extreme large comment sections (forum 25538)
-
+
21.05.2015
- bugfix broken PHP 5.2 compatibility when compiling 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41
-
+
19.05.2015
- bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39
- bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220)
@@ -713,14 +713,14 @@
18.05.2015
- improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
- compilation speed
+ compilation speed
16.05.2015
- bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33
- improvement remove not needed ?> handling from parser to new compiler module
05.05.2015
- bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23
-
+
04.05.2015
- bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22)
- improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24)
@@ -770,13 +770,13 @@
28.04.2015
- bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508)
-
- 23.04.2015
+
+ 23.04.2015
- bugfix a nocache template variable used as parameter at {insert} was by mistake cached
-
+
20.04.2015
- bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name
-
+
27.03.2015
- bugfix Smarty_Security->allow_constants=false; did also disable true, false and null (change of 16.03.2015)
- improvement added a whitelist for trusted constants to security Smarty_Security::$trusted_constants (forum topic 25471)
@@ -784,39 +784,39 @@
20.03.2015
- bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}
- bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers)
-
+
16.03.2015
- bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452}
- bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457}
- bugfix {block}{/block} tags did not work inside double quoted strings https://github.com/smarty-php/smarty/issues/18
-
-
+
+
15.03.2015
- bugfix $smarty->compile_check must be restored before rendering of a just updated cache file {forum 25452}
-
+
14.03.2015
- bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable.
-
+
- bugfix template functions defined with {function} in an included subtemplate could not be called in nocache
mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452}
-
+
10.03.2015
- bugfix {include ... nocache} whith variable file or compile_id attribute was not executed in nocache mode.
-
+
12.02.2015
- bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function already defined error
-
+
11.02.2015
- bugfix recursive {includes} did create E_NOTICE message when $smarty->merge_compiled_includes = true; (github issue #16)
-
+
22.01.2015
- new feature security can now control access to static methods and properties
see also NEW_FEATURES.txt
21.01.2015
- bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397)
- - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class
-
+ - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class
+
04.01.2015
- push last weeks changes to github
@@ -827,10 +827,10 @@
- optimization restructure config file processing
31.12.2014
- - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING.
+ - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING.
Function mb_split could be overloaded depending on php.ini mbstring.func_overload
-
-
+
+
29.12.2014
- new feature security can now limit the template nesting level by property $max_template_nesting
see also NEW_FEATURES.txt (forum 25370)
@@ -844,14 +844,14 @@
13.12.2014
- improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed
-
+
11.12.2014
- bugfix resolve parser ambiguity between constant print tag {CONST} and other smarty tags after change of 09.12.2014
-
+
09.12.2014
- bugfix variables $null, $true and $false did not work after the change of 12.11.2014 (forum 25342)
- bugfix call of template function by a variable name did not work after latest changes (forum 25342)
-
+
23.11.2014
- bugfix a plugin with attached modifier could fail if the tag was immediately followed by another Smarty tag (since 3.1.21) (forum 25326)
@@ -869,12 +869,12 @@
04.11.2014
- new feature $smarty->debugging = true; => overwrite existing Debug Console window (old behaviour)
$smarty->debugging = 2; => individual Debug Console window by template name
-
+
03.11.2014
- bugfix Debug Console did not show included subtemplates since 3.1.17 (forum 25301)
- bugfix Modifier debug_print_var did not limit recursion or prevent recursive object display at Debug Console
(ATTENTION: parameter order has changed to be able to specify maximum recursion)
- - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true
+ - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true
- improvement The template variables are no longer displayed as objects on the Debug Console
- improvement $smarty->createData($parent = null, $name = null) new optional name parameter for display at Debug Console
- addition of some hooks for future extension of Debug Console
@@ -891,7 +891,7 @@
26.10.2014
- 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)
18.10.2014
- composer moved to github
@@ -918,143 +918,143 @@
===== 3.1.20 ===== (09.10.2014)
08.10.2014
- bugfix security mode of "';
- } elseif ($encode == 'javascript_charcode') {
+ } elseif ($encode === 'javascript_charcode') {
$string = '' . $text . '';
for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
@@ -123,7 +123,7 @@ function smarty_function_mailto($params)
implode(',', $ord) . "))" . "}\n" . "\n";
return $_ret;
- } elseif ($encode == 'hex') {
+ } elseif ($encode === 'hex') {
preg_match('!^(.*)(\?.*)$!', $address, $match);
if (!empty($match[ 2 ])) {
trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php
index fc5db335..18054cbf 100644
--- a/libs/plugins/function.math.php
+++ b/libs/plugins/function.math.php
@@ -38,7 +38,7 @@ function smarty_function_math($params, $template)
$equation = $params[ 'equation' ];
// make sure parenthesis are balanced
- if (substr_count($equation, "(") != substr_count($equation, ")")) {
+ if (substr_count($equation, '(') !== substr_count($equation, ')')) {
trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
return;
@@ -59,9 +59,9 @@ function smarty_function_math($params, $template)
}
foreach ($params as $key => $val) {
- if ($key != "equation" && $key != "format" && $key != "assign") {
+ if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
// make sure value is not empty
- if (strlen($val) == 0) {
+ if (strlen($val) === 0) {
trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
return;
@@ -86,7 +86,7 @@ function smarty_function_math($params, $template)
}
foreach ($params as $key => $val) {
- if ($key != "equation" && $key != "format" && $key != "assign") {
+ if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
}
}
diff --git a/libs/plugins/modifier.capitalize.php b/libs/plugins/modifier.capitalize.php
index 79c1a4fe..686f869a 100644
--- a/libs/plugins/modifier.capitalize.php
+++ b/libs/plugins/modifier.capitalize.php
@@ -72,7 +72,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
return $upper_string;
}
-/*
+/*
*
* Bug: create_function() use exhausts memory when used in long loops
* Fix: use declared functions for callbacks instead of using create_function()
diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php
index 37cf85f2..325d43b6 100644
--- a/libs/plugins/modifier.date_format.php
+++ b/libs/plugins/modifier.date_format.php
@@ -42,14 +42,14 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
}
$is_loaded = true;
}
- if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') {
+ if ($string !== '' && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') {
$timestamp = smarty_make_timestamp($string);
- } elseif ($default_date != '') {
+ } elseif ($default_date !== '') {
$timestamp = smarty_make_timestamp($default_date);
} else {
return;
}
- if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
+ if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) {
if (Smarty::$_IS_WINDOWS) {
$_win_from = array('%D',
'%h',
diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php
index 34f85dcd..2eb61dd8 100644
--- a/libs/plugins/modifier.debug_print_var.php
+++ b/libs/plugins/modifier.debug_print_var.php
@@ -28,7 +28,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
switch (gettype($var)) {
case 'array' :
$results = 'Array (' . count($var) . ')';
- if ($depth == $max) {
+ if ($depth === $max) {
break;
}
foreach ($var as $curr_key => $curr_val) {
@@ -46,7 +46,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
$results .= ' called recursive';
break;
}
- if ($depth == $max) {
+ if ($depth === $max) {
break;
}
$objects[] = $var;
diff --git a/libs/plugins/modifier.truncate.php b/libs/plugins/modifier.truncate.php
index 6fe84425..0f79dd26 100644
--- a/libs/plugins/modifier.truncate.php
+++ b/libs/plugins/modifier.truncate.php
@@ -27,7 +27,7 @@
*/
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
{
- if ($length == 0) {
+ if ($length === 0) {
return '';
}
diff --git a/libs/plugins/modifiercompiler.count_characters.php b/libs/plugins/modifiercompiler.count_characters.php
index f752d861..d2c9a4cf 100644
--- a/libs/plugins/modifiercompiler.count_characters.php
+++ b/libs/plugins/modifiercompiler.count_characters.php
@@ -21,7 +21,7 @@
*/
function smarty_modifiercompiler_count_characters($params)
{
- if (!isset($params[ 1 ]) || $params[ 1 ] != 'true') {
+ if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') {
return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
}
if (Smarty::$_MBSTRING) {
diff --git a/libs/plugins/modifiercompiler.strip_tags.php b/libs/plugins/modifiercompiler.strip_tags.php
index e56bf931..af2c3911 100644
--- a/libs/plugins/modifiercompiler.strip_tags.php
+++ b/libs/plugins/modifiercompiler.strip_tags.php
@@ -21,7 +21,7 @@
*/
function smarty_modifiercompiler_strip_tags($params)
{
- if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') == 'true') {
+ if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') === 'true') {
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
} else {
return 'strip_tags(' . $params[ 0 ] . ')';
diff --git a/libs/plugins/modifiercompiler.unescape.php b/libs/plugins/modifiercompiler.unescape.php
index a3409bc7..396ad7ea 100644
--- a/libs/plugins/modifiercompiler.unescape.php
+++ b/libs/plugins/modifiercompiler.unescape.php
@@ -26,7 +26,7 @@ function smarty_modifiercompiler_unescape($params)
if (!isset($params[ 2 ])) {
$params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
} else {
- $params[ 2 ] = "'" . $params[ 2 ] . "'";
+ $params[ 2 ] = "'{$params[ 2 ]}'";
}
switch (trim($params[ 1 ], '"\'')) {
diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php
index 1a67123a..70a66d3d 100644
--- a/libs/plugins/outputfilter.trimwhitespace.php
+++ b/libs/plugins/outputfilter.trimwhitespace.php
@@ -24,7 +24,7 @@ function smarty_outputfilter_trimwhitespace($source)
$_offset = 0;
// Unify Line-Breaks to \n
- $source = preg_replace("/\015\012|\015|\012/", "\n", $source);
+ $source = preg_replace('/\015\012|\015|\012/', "\n", $source);
// capture Internet Explorer and KnockoutJS Conditional Comments
if (preg_match_all('##is', $source, $matches,
diff --git a/libs/plugins/shared.make_timestamp.php b/libs/plugins/shared.make_timestamp.php
index 67f86244..02881166 100644
--- a/libs/plugins/shared.make_timestamp.php
+++ b/libs/plugins/shared.make_timestamp.php
@@ -25,7 +25,7 @@ function smarty_make_timestamp($string)
(interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
) {
return (int) $string->format('U'); // PHP 5.2 BC
- } elseif (strlen($string) == 14 && ctype_digit($string)) {
+ } elseif (strlen($string) === 14 && ctype_digit($string)) {
// it is mysql timestamp format of YYYYMMDDHHMMSS?
return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2),
substr($string, 6, 2), substr($string, 0, 4));
@@ -35,7 +35,7 @@ function smarty_make_timestamp($string)
} else {
// strtotime should handle it
$time = strtotime($string);
- if ($time == - 1 || $time === false) {
+ if ($time === - 1 || $time === false) {
// strtotime() was not able to parse $string, use "now":
return time();
}
diff --git a/libs/plugins/shared.mb_unicode.php b/libs/plugins/shared.mb_unicode.php
index 0f790b56..7450148a 100644
--- a/libs/plugins/shared.mb_unicode.php
+++ b/libs/plugins/shared.mb_unicode.php
@@ -20,12 +20,12 @@
function smarty_mb_to_unicode($string, $encoding = null)
{
if ($encoding) {
- $expanded = mb_convert_encoding($string, "UTF-32BE", $encoding);
+ $expanded = mb_convert_encoding($string, 'UTF-32BE', $encoding);
} else {
- $expanded = mb_convert_encoding($string, "UTF-32BE");
+ $expanded = mb_convert_encoding($string, 'UTF-32BE');
}
- return unpack("N*", $expanded);
+ return unpack('N*', $expanded);
}
/**
@@ -46,8 +46,8 @@ function smarty_mb_from_unicode($unicode, $encoding = null)
$encoding = mb_internal_encoding();
}
foreach ((array) $unicode as $utf32be) {
- $character = pack("N*", $utf32be);
- $t .= mb_convert_encoding($character, $encoding, "UTF-32BE");
+ $character = pack('N*', $utf32be);
+ $t .= mb_convert_encoding($character, $encoding, 'UTF-32BE');
}
return $t;
diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php
index b3f4c1b2..7a5920f4 100644
--- a/libs/sysplugins/smarty_cacheresource_custom.php
+++ b/libs/sysplugins/smarty_cacheresource_custom.php
@@ -138,7 +138,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
$_smarty_tpl->compile_id, $content, $timestamp);
}
if (isset($content)) {
- eval("?>" . $content);
+ eval('?>' . $content);
$cached->content = null;
return true;
}
diff --git a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
index 47e010a7..ff065a27 100644
--- a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
+++ b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
@@ -104,7 +104,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
}
}
if (isset($content)) {
- eval("?>" . $content);
+ eval('?>' . $content);
return true;
}
@@ -273,8 +273,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
*/
protected function addMetaTimestamp(&$content)
{
- $mt = explode(" ", microtime());
- $ts = pack("NN", $mt[ 1 ], (int) ($mt[ 0 ] * 100000000));
+ $mt = explode(' ', microtime());
+ $ts = pack('NN', $mt[ 1 ], (int) ($mt[ 0 ] * 100000000));
$content = $ts . $content;
}
@@ -371,7 +371,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
/**
* Translate a CacheID into the list of applicable InvalidationKeys.
- * Splits "some|chain|into|an|array" into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )
+ * Splits 'some|chain|into|an|array' into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )
*
* @param string $cid CacheID to translate
* @param string $resource_name template name
diff --git a/libs/sysplugins/smarty_data.php b/libs/sysplugins/smarty_data.php
index b9f5de9a..743b117b 100644
--- a/libs/sysplugins/smarty_data.php
+++ b/libs/sysplugins/smarty_data.php
@@ -61,8 +61,8 @@ class Smarty_Data extends Smarty_Internal_Data
foreach ($_parent as $_key => $_val) {
$this->tpl_vars[ $_key ] = new Smarty_Variable($_val);
}
- } elseif ($_parent != null) {
- throw new SmartyException("Wrong type for template variables");
+ } elseif ($_parent !== null) {
+ throw new SmartyException('Wrong type for template variables');
}
}
}
diff --git a/libs/sysplugins/smarty_internal_block.php b/libs/sysplugins/smarty_internal_block.php
index 596b6a30..780319f1 100644
--- a/libs/sysplugins/smarty_internal_block.php
+++ b/libs/sysplugins/smarty_internal_block.php
@@ -67,7 +67,7 @@ class Smarty_Internal_Block
/**
* Smarty_Internal_Block constructor.
- * - if outer level {block} of child template ($state == 1) save it as child root block
+ * - if outer level {block} of child template ($state === 1) save it as child root block
* - otherwise process inheritance and render
*
* @param string $name block name
diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php
index 942c003c..f6ef0930 100644
--- a/libs/sysplugins/smarty_internal_cacheresource_file.php
+++ b/libs/sysplugins/smarty_internal_cacheresource_file.php
@@ -93,7 +93,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
{
$_smarty_tpl->cached->valid = false;
if ($update && defined('HHVM_VERSION')) {
- eval("?>" . file_get_contents($_smarty_tpl->cached->filepath));
+ eval('?>' . file_get_contents($_smarty_tpl->cached->filepath));
return true;
} else {
return @include $_smarty_tpl->cached->filepath;
@@ -116,7 +116,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
$_template->smarty) === true
) {
if (function_exists('opcache_invalidate') &&
- (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api"))) < 1
+ (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1
) {
opcache_invalidate($_template->cached->filepath, true);
} else if (function_exists('apc_compile_file')) {
diff --git a/libs/sysplugins/smarty_internal_compile_assign.php b/libs/sysplugins/smarty_internal_compile_assign.php
index 3bd33847..5ec7a183 100644
--- a/libs/sysplugins/smarty_internal_compile_assign.php
+++ b/libs/sysplugins/smarty_internal_compile_assign.php
@@ -71,7 +71,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
$_scope = $compiler->convertScope($_attr, $this->valid_scopes);
}
// optional parameter
- $_params = "";
+ $_params = '';
if ($_nocache || $_scope) {
$_params .= ' ,' . var_export($_nocache, true);
}
diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php
index e3239031..753e6d8e 100644
--- a/libs/sysplugins/smarty_internal_compile_block.php
+++ b/libs/sysplugins/smarty_internal_compile_block.php
@@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
if (!isset($compiler->_cache['blockNesting'])) {
$compiler->_cache['blockNesting'] = 0;
}
- if ($compiler->_cache['blockNesting'] == 0) {
+ if ($compiler->_cache['blockNesting'] === 0) {
// make sure that inheritance gets initialized in template code
$this->registerInit($compiler);
$this->option_flags = array('hide', 'nocache', 'append', 'prepend');
@@ -115,12 +115,12 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
{
$name = isset($parameter[1]) ? $compiler->getId($parameter[1]) : false;
if (!$name) {
- $compiler->trigger_template_error("invalid \"\$smarty.block\" expected \"\$smarty.block.child\" or \"\$smarty.block.parent\"",
+ $compiler->trigger_template_error("invalid '\$smarty.block' expected '\$smarty.block.child' or '\$smarty.block.parent'",
null,
true);
}
if (!isset($compiler->_cache['blockNesting'])) {
- $compiler->trigger_template_error(" \"\$smarty.block.{$name}\" used outside {block} tags ",
+ $compiler->trigger_template_error(" '\$smarty.block.{$name}' used outside {block} tags ",
$compiler->parser->lex->taglineno);
}
$compiler->has_code = true;
@@ -134,7 +134,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
return '$_smarty_tpl->inheritance->callParent($_smarty_tpl, $this, null, true)';
break;
default:
- $compiler->trigger_template_error("invalid \"\$smarty.block.{$name}\" expected \"\$smarty.block.child\" or \"\$smarty.block.parent\"",
+ $compiler->trigger_template_error("invalid '\$smarty.block.{$name}' expected '\$smarty.block.child' or '\$smarty.block.parent'",
null,
true);
}
@@ -166,7 +166,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
$_assign = isset($_attr['assign']) ? $_attr['assign'] : null;
unset($_attr['assign'], $_attr['name']);
foreach ($_attr as $name => $stat) {
- if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) {
+ if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) {
$_block[ $name ] = 'true';
}
}
@@ -225,14 +225,14 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
$compiler->nocache = $_nocache;
$compiler->parser->current_buffer = $_buffer;
$output = "_cache['blockNesting'] == 1) {
+ if ($compiler->_cache['blockNesting'] === 1) {
$output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";
} else {
$output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
}
$output .= "?>\n";
$compiler->_cache['blockNesting']--;
- if ($compiler->_cache['blockNesting'] == 0) {
+ if ($compiler->_cache['blockNesting'] === 0) {
unset($compiler->_cache['blockNesting']);
}
$compiler->has_code = true;
diff --git a/libs/sysplugins/smarty_internal_compile_break.php b/libs/sysplugins/smarty_internal_compile_break.php
index ce162cb5..8879dff9 100644
--- a/libs/sysplugins/smarty_internal_compile_break.php
+++ b/libs/sysplugins/smarty_internal_compile_break.php
@@ -99,7 +99,7 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase
}
$stack_count --;
}
- if ($level_count != 0) {
+ if ($level_count !== 0) {
$compiler->trigger_template_error("cannot {$tag} {$levels} level(s)", null, true);
}
if ($lastTag === 'foreach' && $tag === 'break') {
diff --git a/libs/sysplugins/smarty_internal_compile_call.php b/libs/sysplugins/smarty_internal_compile_call.php
index 739df5ec..eb444d35 100644
--- a/libs/sysplugins/smarty_internal_compile_call.php
+++ b/libs/sysplugins/smarty_internal_compile_call.php
@@ -57,7 +57,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
// output will be stored in a smarty variable instead of being displayed
$_assign = $_attr[ 'assign' ];
}
- //$_name = trim($_attr['name'], "'\"");
+ //$_name = trim($_attr['name'], "''");
$_name = $_attr[ 'name' ];
unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'nocache' ]);
// set flag (compiled code of {function} must be included in cache file
@@ -74,7 +74,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
$_paramsArray[] = "'$_key'=>$_value";
}
}
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $_params = 'array(' . implode(',', $_paramsArray) . ')';
//$compiler->suppressNocacheProcessing = true;
// was there an assign attribute
if (isset($_assign)) {
diff --git a/libs/sysplugins/smarty_internal_compile_eval.php b/libs/sysplugins/smarty_internal_compile_eval.php
index 97a3c29c..550f194e 100644
--- a/libs/sysplugins/smarty_internal_compile_eval.php
+++ b/libs/sysplugins/smarty_internal_compile_eval.php
@@ -58,13 +58,12 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
}
// create template object
- $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] .
- ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
+ $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);";
//was there an assign attribute?
if (isset($_assign)) {
$_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
} else {
- $_output .= "echo \$_template->fetch();";
+ $_output .= 'echo $_template->fetch();';
}
return "";
diff --git a/libs/sysplugins/smarty_internal_compile_extends.php b/libs/sysplugins/smarty_internal_compile_extends.php
index 5e0b5899..7617f3af 100644
--- a/libs/sysplugins/smarty_internal_compile_extends.php
+++ b/libs/sysplugins/smarty_internal_compile_extends.php
@@ -64,18 +64,18 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
// add code to initialize inheritance
$this->registerInit($compiler, true);
$file = trim($_attr[ 'file' ], '\'"');
- if (strlen($file) > 8 && substr($file, 0, 8) == 'extends:') {
+ if (strlen($file) > 8 && substr($file, 0, 8) === 'extends:') {
// generate code for each template
$files = array_reverse(explode('|', substr($file, 8)));
$i = 0;
foreach ($files as $file) {
- if ($file[ 0 ] == '"') {
+ if ($file[ 0 ] === '"') {
$file = trim($file, '".');
} else {
$file = "'{$file}'";
}
$i ++;
- if ($i == count($files) && isset($_attr[ 'extends_resource' ])) {
+ if ($i === count($files) && isset($_attr[ 'extends_resource' ])) {
$this->compileEndChild($compiler);
}
$this->compileInclude($compiler, $file);
@@ -104,14 +104,14 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
$inlineUids = '';
if (isset($template) && $compiler->smarty->merge_compiled_includes) {
$code = $compiler->compileTag('include', array($template, array('scope' => 'parent')));
- if (preg_match("/([,][\s]*['][a-z0-9]+['][,][\s]*[']content.*['])[)]/", $code, $match)) {
+ if (preg_match('/([,][\s]*[\'][a-z0-9]+[\'][,][\s]*[\']content.*[\'])[)]/', $code, $match)) {
$inlineUids = $match[ 1 ];
}
}
$compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser,
- "inheritance->endChild(\$_smarty_tpl" .
+ 'inheritance->endChild($_smarty_tpl' .
(isset($template) ?
- ', ' . $template . $inlineUids :
+ ", {$template}{$inlineUids}" :
'') . ");\n?>\n");
}
diff --git a/libs/sysplugins/smarty_internal_compile_for.php b/libs/sysplugins/smarty_internal_compile_for.php
index e5e7c61c..f899769b 100644
--- a/libs/sysplugins/smarty_internal_compile_for.php
+++ b/libs/sysplugins/smarty_internal_compile_for.php
@@ -35,7 +35,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
public function compile($args, $compiler, $parameter)
{
$compiler->loopNesting ++;
- if ($parameter == 0) {
+ if ($parameter === 0) {
$this->required_attributes = array('start', 'to');
$this->optional_attributes = array('max', 'step');
} else {
@@ -47,7 +47,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
$_attr = $this->getAttributes($compiler, $args);
$output = "tpl_vars[$var]->total > 0) {\n";
$output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n";
- $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration == 1;";
- $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration == \$_smarty_tpl->tpl_vars[$var]->total;";
+ $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration === 1;";
+ $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration === \$_smarty_tpl->tpl_vars[$var]->total;";
}
- $output .= "?>";
+ $output .= '?>';
$this->openTag($compiler, 'for', array('for', $compiler->nocache));
// maybe nocache because of nocache variables
@@ -161,7 +161,7 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse'));
$output = "\n";
diff --git a/libs/sysplugins/smarty_internal_compile_foreach.php b/libs/sysplugins/smarty_internal_compile_foreach.php
index 932d1b03..b6971a19 100644
--- a/libs/sysplugins/smarty_internal_compile_foreach.php
+++ b/libs/sysplugins/smarty_internal_compile_foreach.php
@@ -118,7 +118,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
$fromName = $compiler->getVariableName($_attr[ 'from' ]);
if ($fromName) {
foreach (array('item', 'key') as $a) {
- if (isset($attributes[ $a ]) && $attributes[ $a ] == $fromName) {
+ if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) {
$compiler->trigger_template_error("'{$a}' and 'from' may not have same variable name '{$fromName}'",
null, true);
}
@@ -137,7 +137,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
if (!empty($this->matchResults[ 'named' ])) {
$namedAttr = $this->matchResults[ 'named' ];
}
- if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
+ if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) {
foreach ($match[ 1 ] as $prop) {
if (in_array($prop, $this->itemProperties)) {
$itemAttr[ $prop ] = true;
@@ -229,7 +229,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
$output .= "{$itemVar}->first = !{$itemVar}->index;\n";
}
if (isset($itemAttr[ 'last' ])) {
- $output .= "{$itemVar}->last = {$itemVar}->iteration == {$itemVar}->total;\n";
+ $output .= "{$itemVar}->last = {$itemVar}->iteration === {$itemVar}->total;\n";
}
if (isset($foreachVar)) {
if (isset($namedAttr[ 'iteration' ])) {
@@ -242,13 +242,13 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
$output .= "{$foreachVar}->value['first'] = !{$foreachVar}->value['index'];\n";
}
if (isset($namedAttr[ 'last' ])) {
- $output .= "{$foreachVar}->value['last'] = {$foreachVar}->value['iteration'] == {$foreachVar}->value['total'];\n";
+ $output .= "{$foreachVar}->value['last'] = {$foreachVar}->value['iteration'] === {$foreachVar}->value['total'];\n";
}
}
if (!empty($itemAttr)) {
$output .= "{$local}saved = {$itemVar};\n";
}
- $output .= "?>";
+ $output .= '?>';
return $output;
}
@@ -290,7 +290,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
list($openTag, $nocache, $local, $itemVar, $restore) = $this->closeTag($compiler, array('foreach'));
$this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $local, $itemVar, 0));
$output = "\n";
@@ -327,7 +327,7 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
$this->closeTag($compiler, array('foreach', 'foreachelse'));
$output = " 0) {
diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php
index 3badf8ce..bcb1f8aa 100644
--- a/libs/sysplugins/smarty_internal_compile_function.php
+++ b/libs/sysplugins/smarty_internal_compile_function.php
@@ -59,7 +59,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
$compiler->trigger_template_error('nocache option not allowed', null, true);
}
unset($_attr[ 'nocache' ]);
- $_name = trim($_attr[ 'name' ], "'\"");
+ $_name = trim($_attr[ 'name' ], '\'"');
$compiler->parent_compiler->tpl_function[ $_name ] = array();
$save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code,
$compiler->template->caching);
@@ -100,7 +100,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
$this->compiler = $compiler;
$saved_data = $this->closeTag($compiler, array('function'));
$_attr = $saved_data[ 0 ];
- $_name = trim($_attr[ 'name' ], "'\"");
+ $_name = trim($_attr[ 'name' ], '\'"');
$compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] =
$compiler->parent_compiler->template->compiled->filepath;
$compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid;
@@ -116,7 +116,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
}
}
if (!empty($_paramsArray)) {
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $_params = 'array(' . implode(',', $_paramsArray) . ')';
$_paramsCode = "\$params = array_merge($_params, \$params);\n";
} else {
$_paramsCode = '';
@@ -198,7 +198,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
/**
* Remove nocache code
- *
+ *
* @param $match
*
* @return string
diff --git a/libs/sysplugins/smarty_internal_compile_if.php b/libs/sysplugins/smarty_internal_compile_if.php
index bf4e04e3..82436c26 100644
--- a/libs/sysplugins/smarty_internal_compile_if.php
+++ b/libs/sysplugins/smarty_internal_compile_if.php
@@ -34,8 +34,8 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
// must whole block be nocache ?
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
- if (!array_key_exists("if condition", $parameter)) {
- $compiler->trigger_template_error("missing if condition", null, true);
+ if (!isset($parameter['if condition'])) {
+ $compiler->trigger_template_error('missing if condition', null, true);
}
if (is_array($parameter[ 'if condition' ])) {
@@ -49,9 +49,9 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
$compiler->setNocacheInVariable($var);
}
$prefixVar = $compiler->getNewPrefixVariable();
- $_output = "\n";
+ $_output = "\n";
$assignAttr = array();
- $assignAttr[][ 'value' ] = "{$prefixVar}";
+ $assignAttr[][ 'value' ] = $prefixVar;
$assignCompiler = new Smarty_Internal_Compile_Assign();
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
@@ -90,7 +90,7 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
$this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache));
- return "";
+ return '';
}
}
@@ -119,8 +119,8 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
- if (!array_key_exists("if condition", $parameter)) {
- $compiler->trigger_template_error("missing elseif condition", null, true);
+ if (!isset($parameter['if condition'])) {
+ $compiler->trigger_template_error('missing elseif condition', null, true);
}
$assignCode = '';
@@ -137,10 +137,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
$compiler->setNocacheInVariable($var);
}
$prefixVar = $compiler->getNewPrefixVariable();
- $assignCode = "\n";
+ $assignCode = "\n";
$assignCompiler = new Smarty_Internal_Compile_Assign();
$assignAttr = array();
- $assignAttr[][ 'value' ] = "{$prefixVar}";
+ $assignAttr[][ 'value' ] = $prefixVar;
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
$assignCode .= $assignCompiler->compile($assignAttr, $compiler,
diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php
index 02b09f7a..f6d456cb 100644
--- a/libs/sysplugins/smarty_internal_compile_include.php
+++ b/libs/sysplugins/smarty_internal_compile_include.php
@@ -312,7 +312,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
$compiled_code .= $tpl->compiler->postFilter($tpl->compiler->blockOrFunctionCode);
$compiled_code .= "";
+ $compiled_code .= '?>';
unset($tpl->compiler);
if ($tpl->compiled->has_nocache_code) {
// replace nocache_hash
diff --git a/libs/sysplugins/smarty_internal_compile_include_php.php b/libs/sysplugins/smarty_internal_compile_include_php.php
index ce96b7ec..e0aca93b 100644
--- a/libs/sysplugins/smarty_internal_compile_include_php.php
+++ b/libs/sysplugins/smarty_internal_compile_include_php.php
@@ -81,7 +81,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
}
}
}
- if ($_filepath == false) {
+ if ($_filepath === false) {
$compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true);
}
if (isset($compiler->smarty->security_policy)) {
@@ -93,7 +93,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
}
$_once = '_once';
if (isset($_attr[ 'once' ])) {
- if ($_attr[ 'once' ] == 'false') {
+ if ($_attr[ 'once' ] === 'false') {
$_once = '';
}
}
diff --git a/libs/sysplugins/smarty_internal_compile_insert.php b/libs/sysplugins/smarty_internal_compile_insert.php
index bcab8a81..bac0c801 100644
--- a/libs/sysplugins/smarty_internal_compile_insert.php
+++ b/libs/sysplugins/smarty_internal_compile_insert.php
@@ -70,7 +70,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
// output will be stored in a smarty variable instead of being displayed
$_assign = $_attr[ 'assign' ];
// create variable to make sure that the compiler knows about its nocache status
- $var = trim($_attr[ 'assign' ], "'");
+ $var = trim($_attr[ 'assign' ], '\'');
if (isset($compiler->template->tpl_vars[ $var ])) {
$compiler->template->tpl_vars[ $var ]->nocache = true;
} else {
@@ -101,7 +101,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
}
}
}
- if ($_filepath == false) {
+ if ($_filepath === false) {
$compiler->trigger_template_error("{insert} missing script file '{$_script}'", null, true);
}
// code for script file loading
diff --git a/libs/sysplugins/smarty_internal_compile_private_block_plugin.php b/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
index 49837e66..7f8a379c 100644
--- a/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
+++ b/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
@@ -46,14 +46,14 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function = null)
{
- if (!isset($tag[ 5 ]) || substr($tag, - 5) != 'close') {
+ if (!isset($tag[ 5 ]) || substr($tag, - 5) !== 'close') {
// opening tag of block plugin
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$this->nesting ++;
unset($_attr[ 'nocache' ]);
list($callback, $_paramsArray, $callable) = $this->setup($compiler, $_attr, $tag, $function);
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $_params = 'array(' . implode(',', $_paramsArray) . ')';
// compile code
$output = " $parameter[ 'modifier_list' ],
'value' => 'ob_get_clean()')) . ";\n";
}
- $output = "smarty->_cache['_tag_stack']);";
- $output .= "?>";
+ $output = "smarty->_cache[\'_tag_stack\']);?>';
}
return $output . "\n";
}
diff --git a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
index 2fcd8578..6a2ac07d 100644
--- a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
+++ b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
@@ -175,7 +175,7 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
if ($compiler !== $nextCompiler) {
// get template source
$_content = $nextCompiler->template->source->getContent();
- if ($_content != '') {
+ if ($_content !== '') {
// run pre filter if required
if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
diff --git a/libs/sysplugins/smarty_internal_compile_private_function_plugin.php b/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
index 7ecf61d2..a6b4b295 100644
--- a/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
+++ b/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
@@ -60,7 +60,7 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
$_paramsArray[] = "'$_key'=>$_value";
}
}
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $_params = 'array(' . implode(',', $_paramsArray) . ')';
// compile code
$output = "{$function}({$_params},\$_smarty_tpl)";
if (!empty($parameter[ 'modifierlist' ])) {
diff --git a/libs/sysplugins/smarty_internal_compile_private_modifier.php b/libs/sysplugins/smarty_internal_compile_private_modifier.php
index 3a39c2ba..ad442a3f 100644
--- a/libs/sysplugins/smarty_internal_compile_private_modifier.php
+++ b/libs/sysplugins/smarty_internal_compile_private_modifier.php
@@ -143,7 +143,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
}
}
if (!isset($compiler->known_modifier_type[ $modifier ])) {
- $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
+ $compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true);
}
}
diff --git a/libs/sysplugins/smarty_internal_compile_private_object_function.php b/libs/sysplugins/smarty_internal_compile_private_object_function.php
index 4ef108fb..c10d1222 100644
--- a/libs/sysplugins/smarty_internal_compile_private_object_function.php
+++ b/libs/sysplugins/smarty_internal_compile_private_object_function.php
@@ -62,10 +62,10 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
$_paramsArray[] = "'$_key'=>$_value";
}
}
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $_params = 'array(' . implode(',', $_paramsArray) . ')';
$output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
} else {
- $_params = implode(",", $_attr);
+ $_params = implode(',', $_attr);
$output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
}
} else {
diff --git a/libs/sysplugins/smarty_internal_compile_private_php.php b/libs/sysplugins/smarty_internal_compile_private_php.php
index 9080c487..1d100f0d 100644
--- a/libs/sysplugins/smarty_internal_compile_private_php.php
+++ b/libs/sysplugins/smarty_internal_compile_private_php.php
@@ -40,38 +40,34 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$compiler->has_code = false;
- if ($_attr[ 'type' ] == 'xml') {
+ if ($_attr[ 'type' ] === 'xml') {
$compiler->tag_nocache = true;
$output = addcslashes($_attr[ 'code' ], "'\\");
$compiler->parser->current_buffer->append_subtree($compiler->parser,
new Smarty_Internal_ParseTree_Tag($compiler->parser,
- $compiler->processNocacheCode("",
+ $compiler->processNocacheCode("",
true)));
return '';
}
- if ($_attr[ 'type' ] != 'tag') {
- if ($compiler->php_handling == Smarty::PHP_REMOVE) {
+ if ($_attr[ 'type' ] !== 'tag') {
+ if ($compiler->php_handling === Smarty::PHP_REMOVE) {
return '';
- } elseif ($compiler->php_handling == Smarty::PHP_QUOTE) {
+ } elseif ($compiler->php_handling === Smarty::PHP_QUOTE) {
$output =
preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(