From ab5d8d4e07bb3c8230d0285ef8902ef1979fce51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:39:34 +0200 Subject: Updating Smarty --- .../sysplugins/smarty_internal_method_append.php | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/smarty/sysplugins/smarty_internal_method_append.php (limited to 'lib/smarty/sysplugins/smarty_internal_method_append.php') diff --git a/lib/smarty/sysplugins/smarty_internal_method_append.php b/lib/smarty/sysplugins/smarty_internal_method_append.php new file mode 100644 index 0000000..881375e --- /dev/null +++ b/lib/smarty/sysplugins/smarty_internal_method_append.php @@ -0,0 +1,74 @@ + $_val) { + if ($_key !== '') { + $this->append($data, $_key, $_val, $merge, $nocache); + } + } + } else { + if ($tpl_var !== '' && isset($value)) { + if (!isset($data->tpl_vars[ $tpl_var ])) { + $tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false); + if ($tpl_var_inst instanceof Smarty_Undefined_Variable) { + $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); + } else { + $data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst; + } + } + if (!(is_array($data->tpl_vars[ $tpl_var ]->value) + || $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess) + ) { + settype($data->tpl_vars[ $tpl_var ]->value, 'array'); + } + if ($merge && is_array($value)) { + foreach ($value as $_mkey => $_mval) { + $data->tpl_vars[ $tpl_var ]->value[ $_mkey ] = $_mval; + } + } else { + $data->tpl_vars[ $tpl_var ]->value[] = $value; + } + } + if ($data->_isTplObj() && $data->scope) { + $data->ext->_updateScope->_updateScope($data, $tpl_var); + } + } + return $data; + } +} -- cgit v1.2.3