From 3282ddbe2ea305edbb0b3ae84b6860c0d90ab072 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 15 Dec 2015 15:24:01 +0100 Subject: update Smarty to official version 3.1.28 --- include/smarty/INHERITANCE_RELEASE_NOTES.txt | 10 +++++----- include/smarty/NEW_FEATURES.txt | 15 ++++++++++----- include/smarty/change_log.txt | 7 ++++++- include/smarty/libs/Smarty.class.php | 10 +++++++--- .../libs/plugins/modifiercompiler.strip_tags.php | 2 +- .../smarty_internal_compile_private_foreachsection.php | 13 ++++++------- .../sysplugins/smarty_internal_compile_private_php.php | 2 +- .../smarty/libs/sysplugins/smarty_internal_debug.php | 18 +++++++++--------- .../libs/sysplugins/smarty_internal_template.php | 6 +----- 9 files changed, 46 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/include/smarty/INHERITANCE_RELEASE_NOTES.txt b/include/smarty/INHERITANCE_RELEASE_NOTES.txt index 8568a35c8..8b2c64a1b 100644 --- a/include/smarty/INHERITANCE_RELEASE_NOTES.txt +++ b/include/smarty/INHERITANCE_RELEASE_NOTES.txt @@ -9,23 +9,23 @@ This does enable some new features: Any code outside root {block} tags in child templates is now executed but any output will be ignored. - {extends 'foo.tpl} + {extends 'foo.tpl'} {$bar = 'on'} // assigns variable $bar seen in parent templates {block 'buh'}{/block} - {extends 'foo.tpl} + {extends 'foo.tpl'} {$bar} // the output of variable bar is ignored {block 'buh'}{/block} {block} tags can be dynamically en/disabled by conditions. - {block 'root} + {block 'root'} {if $foo} - {block 'v1} + {block 'v1'} .... {/block} {else} - {block 'v1} + {block 'v1'} .... {/block} {/if} diff --git a/include/smarty/NEW_FEATURES.txt b/include/smarty/NEW_FEATURES.txt index 67d391a52..595dc4d3c 100644 --- a/include/smarty/NEW_FEATURES.txt +++ b/include/smarty/NEW_FEATURES.txt @@ -21,13 +21,18 @@ Smarty 3.1.28 fetch() and display() ===================== The fetch() and display() methods of the template object accept now optionally the same parameter - as the corresponding Smarty methods the get tne content of another template. + as the corresponding Smarty methods to get tne content of another template. + Example: + $template->display(); Does display template of template object + $template->dispaly('foo.tpl'); Does display template 'foo.bar' File: resource ============== Multiple template_dir entries can now be selected by a comma separated list of indices. - The template_dir array is searched in the order of the indices. (could be used to change the default search order) - + The template_dir array is searched in the order of the indices. (Could be used to change the default search order) + Example: + $smarty->display([1],[0]foo.bar'); + Filter support ============== Optional filter names @@ -40,8 +45,8 @@ Smarty 3.1.28 - $smarty->registerFilter('pre', function($source) {return $source;}); If no optional filter name was specified it gets the default name 'closure'. If you register multiple closures register each with a unique filter name. - - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_1'); - - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_2'); + - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_1'); + - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_2'); Smarty 3.1.22 diff --git a/include/smarty/change_log.txt b/include/smarty/change_log.txt index e9472f45b..cecda63d1 100644 --- a/include/smarty/change_log.txt +++ b/include/smarty/change_log.txt @@ -1,4 +1,9 @@ - ===== 3.1.28-dev===== (xx.xx.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) + - bugfix Debug Console could display incorrect data when using subtemplates + 09.12.2015 - bugix Smarty did fail under PHP 7.0.0 with use_include_path = true; diff --git a/include/smarty/libs/Smarty.class.php b/include/smarty/libs/Smarty.class.php index e4fc94733..17457131c 100644 --- a/include/smarty/libs/Smarty.class.php +++ b/include/smarty/libs/Smarty.class.php @@ -27,7 +27,7 @@ * @author Uwe Tews * @author Rodney Rehm * @package Smarty - * @version 3.1.28-dev + * @version 3.1.28 */ /** @@ -118,7 +118,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.28-dev/79'; + const SMARTY_VERSION = '3.1.28'; /** * define variable scopes @@ -1094,8 +1094,12 @@ class Smarty extends Smarty_Internal_TemplateBase $tpl->tpl_vars[$_key] = new Smarty_Variable($_val); } } - if ($this->debugging) { + if ($this->debugging || $this->debugging_ctrl == 'URL') { $tpl->smarty->_debug = new Smarty_Internal_Debug(); + // check URL debugging control + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + $tpl->smarty->_debug->debugUrl($tpl->smarty); + } } return $tpl; } diff --git a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php index 3e6e13048..da5d364cb 100644 --- a/include/smarty/libs/plugins/modifiercompiler.strip_tags.php +++ b/include/smarty/libs/plugins/modifiercompiler.strip_tags.php @@ -12,7 +12,7 @@ * Name: strip_tags
* Purpose: strip html tags from text * - * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual) + * @link http://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual) * @author Uwe Tews * * @param array $params parameters diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/include/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php index 25b35e861..50c25bdb6 100644 --- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php +++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php @@ -206,16 +206,15 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com */ public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { - // make all lower case - $parameter = array_map('strtolower', $parameter); - $tag = trim($parameter[0], '"\''); - if (!isset($parameter[1]) || false === $name = $compiler->getId($parameter[1])) { + $tag = strtolower(trim($parameter[ 0 ], '"\'')); + $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; + if (!$name) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); } + /* @var Smarty_Internal_Compile_Foreach|Smarty_Internal_Compile_Section $className */ $className = 'Smarty_Internal_Compile_' . ucfirst($tag); - if ((!isset($parameter[2]) || false === $property = $compiler->getId($parameter[2])) || - !in_array($property, $className::$nameProperties) - ) { + $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false; + if (!$property || !in_array($property, $className::$nameProperties)) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true); } $tagVar = "'__smarty_{$tag}_{$name}'"; diff --git a/include/smarty/libs/sysplugins/smarty_internal_compile_private_php.php b/include/smarty/libs/sysplugins/smarty_internal_compile_private_php.php index 584f70b0e..3ca63a548 100644 --- a/include/smarty/libs/sysplugins/smarty_internal_compile_private_php.php +++ b/include/smarty/libs/sysplugins/smarty_internal_compile_private_php.php @@ -79,7 +79,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase } else { $compiler->has_code = true; if (!($compiler->smarty instanceof SmartyBC)) { - $compiler->trigger_template_error('{php}[/php} tags not allowed. Use SmartyBC to enable them', null, true); + $compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, true); } $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); diff --git a/include/smarty/libs/sysplugins/smarty_internal_debug.php b/include/smarty/libs/sysplugins/smarty_internal_debug.php index e330a35c1..0cbd54955 100644 --- a/include/smarty/libs/sysplugins/smarty_internal_debug.php +++ b/include/smarty/libs/sysplugins/smarty_internal_debug.php @@ -399,31 +399,31 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data /** * handle 'URL' debugging mode * - * @param Smarty_Internal_Template $_template + * @param Smarty $smarty */ - public function debugUrl(Smarty_Internal_Template $_template) + public function debugUrl(Smarty $smarty) { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } - if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id)) { - if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=on')) { + if (false !== strpos($_query_string, $smarty->smarty_debug_id)) { + if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) { // enable debugging for this browser session setcookie('SMARTY_DEBUG', true); - $_template->smarty->debugging = true; - } elseif (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=off')) { + $smarty->debugging = true; + } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) { // disable debugging for this browser session setcookie('SMARTY_DEBUG', false); - $_template->smarty->debugging = false; + $smarty->debugging = false; } else { // enable debugging for this page - $_template->smarty->debugging = true; + $smarty->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { - $_template->smarty->debugging = true; + $smarty->debugging = true; } } } diff --git a/include/smarty/libs/sysplugins/smarty_internal_template.php b/include/smarty/libs/sysplugins/smarty_internal_template.php index 52c7391b1..7c16a53db 100644 --- a/include/smarty/libs/sysplugins/smarty_internal_template.php +++ b/include/smarty/libs/sysplugins/smarty_internal_template.php @@ -138,10 +138,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}"); } - // check URL debugging control - if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { - $this->smarty->_debug->debugUrl($this); - } // disable caching for evaluated code if ($this->source->handler->recompiled) { $this->caching = false; @@ -188,7 +184,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } else { if ($this->smarty->debugging) { $this->smarty->_debug->end_template($this); - if ($this->smarty->debugging == 2 and !$display) { + if ($this->smarty->debugging === 2 && $display === false) { $this->smarty->_debug->display_debug($this, true); } } -- cgit v1.2.3