diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 6a4580b9..665eb33e 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.22-dev/13'; + const SMARTY_VERSION = '3.1.22-dev/14'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_compile_call.php b/libs/sysplugins/smarty_internal_compile_call.php index 0c517fb7..05420fa5 100644 --- a/libs/sysplugins/smarty_internal_compile_call.php +++ b/libs/sysplugins/smarty_internal_compile_call.php @@ -60,13 +60,6 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase unset($_attr['name'], $_attr['assign'], $_attr['nocache']); // set flag (compiled code of {function} must be included in cache file if (!$compiler->template->caching || $compiler->nocache || $compiler->tag_nocache) { - // variable template name ? - if (!($compiler->has_variable_string || !((substr_count($_name, '"') == 2 || substr_count($_name, "'") == 2)) - || substr_count($_name, '(') != 0 || substr_count($_name, '$_smarty_tpl->') != 0 - )) { - $n = trim($_name, "'\""); - $compiler->parent_compiler->templateProperties['tpl_function']['to_cache'][$n] = true; - } $_nocache = 'true'; } else { $_nocache = 'false'; diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 07bc0899..d9fe7ce5 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -104,9 +104,9 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $_name = trim($_attr['name'], "'\""); // reset flag that we are compiling a template function $compiler->compiles_template_function = false; - $compiler->parent_compiler->templateProperties['tpl_function']['param'][$_name]['called_functions'] = $compiler->called_functions; - $compiler->parent_compiler->templateProperties['tpl_function']['param'][$_name]['compiled_filepath'] = $compiler->parent_compiler->template->compiled->filepath; - $compiler->parent_compiler->templateProperties['tpl_function']['param'][$_name]['uid'] = $compiler->template->source->uid; + $compiler->parent_compiler->templateProperties['tpl_function'][$_name]['called_functions'] = $compiler->called_functions; + $compiler->parent_compiler->templateProperties['tpl_function'][$_name]['compiled_filepath'] = $compiler->parent_compiler->template->compiled->filepath; + $compiler->parent_compiler->templateProperties['tpl_function'][$_name]['uid'] = $compiler->template->source->uid; $compiler->called_functions = array(); $_parameter = $_attr; unset($_parameter['name']); @@ -132,7 +132,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $_funcName = "smarty_template_function_{$_name}_{$compiler->template->properties['nocache_hash']}"; $_funcNameCaching = $_funcName . '_nocache'; if ($compiler->template->has_nocache_code) { - $compiler->parent_compiler->templateProperties['tpl_function']['param'][$_name]['call_name_caching'] = $_funcNameCaching; + $compiler->parent_compiler->templateProperties['tpl_function'][$_name]['call_name_caching'] = $_funcNameCaching; $output = "parser->current_buffer->append_subtree(new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%\*\/';(\?>\n)?)/", array($this, 'removeNocache'), $_functionCode->to_smarty_php())); } - $compiler->parent_compiler->templateProperties['tpl_function']['param'][$_name]['call_name'] = $_funcName; + $compiler->parent_compiler->templateProperties['tpl_function'][$_name]['call_name'] = $_funcName; $output = "properties['tpl_function']['param'][$_name]; + $funcParam = $_smarty_tpl->properties['tpl_function'][$_name]; if (is_file($funcParam['compiled_filepath'])) { // read compiled file $code = file_get_contents($funcParam['compiled_filepath']); diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 5dfccf0b..f34fa1d8 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -58,7 +58,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase */ public $properties = array('file_dependency' => array(), 'nocache_hash' => '', - 'tpl_function' => array('param' => array()), + 'tpl_function' => array(), ); /** * required plugins @@ -229,7 +229,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $isCacheTpl = $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED; if (!($isCacheTpl) || !$this->cached->valid) { if ($isCacheTpl) { - $this->properties['tpl_function']['param'] = array(); + $this->properties['tpl_function'] = array(); } // render template (not loaded and not in cache) if ($this->smarty->debugging) { @@ -550,14 +550,14 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase */ public function callTemplateFunction($name, Smarty_Internal_Template $_smarty_tpl, $params, $nocache) { - if (isset($_smarty_tpl->properties['tpl_function']['param'][$name])) { + if (isset($_smarty_tpl->properties['tpl_function'][$name])) { if (!$_smarty_tpl->caching || ($_smarty_tpl->caching && $nocache)) { - $function = $_smarty_tpl->properties['tpl_function']['param'][$name]['call_name']; + $function = $_smarty_tpl->properties['tpl_function'][$name]['call_name']; } else { - if (isset($_smarty_tpl->properties['tpl_function']['param'][$name]['call_name_caching'])) { - $function = $_smarty_tpl->properties['tpl_function']['param'][$name]['call_name_caching']; + if (isset($_smarty_tpl->properties['tpl_function'][$name]['call_name_caching'])) { + $function = $_smarty_tpl->properties['tpl_function'][$name]['call_name_caching']; } else { - $function = $_smarty_tpl->properties['tpl_function']['param'][$name]['call_name']; + $function = $_smarty_tpl->properties['tpl_function'][$name]['call_name']; } } if (function_exists($function)) { @@ -636,9 +636,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase if (isset($properties['file_dependency'])) { $this->properties['file_dependency'] = array_merge($this->properties['file_dependency'], $properties['file_dependency']); } - //$this->properties['tpl_function']['param'] = isset($this->parent->properties['tpl_function']['param']) ? $this->parent->properties['tpl_function']['param'] : array(); - if (isset($properties['tpl_function']['param'])) { - $this->properties['tpl_function']['param'] = array_merge($this->properties['tpl_function']['param'], $properties['tpl_function']['param']); + if (isset($properties['tpl_function'])) { + $this->properties['tpl_function'] = array_merge($this->properties['tpl_function'], $properties['tpl_function']); } $this->properties['version'] = $properties['version']; $this->properties['unifunc'] = $properties['unifunc']; diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index fdb32017..bbc6365f 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -379,7 +379,7 @@ abstract class Smarty_Internal_TemplateCompilerBase } // compile the smarty tag (required compile classes to compile the tag are autoloaded) if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) { - if (isset($this->parent_compiler->templateProperties['tpl_function']['param'][$tag])) { + if (isset($this->parent_compiler->templateProperties['tpl_function'][$tag])) { // template defined by {template} tag $args['_attr']['name'] = "'" . $tag . "'"; $_output = $this->callTagCompiler('call', $args, $parameter);