From 7085a0c2f7104a56a7e946c43ba0b5736be5f4e7 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 27 Dec 2016 14:47:01 +0100 Subject: * smarty bundled --- .../sysplugins/smarty_internal_method_append.php | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/smarty3/sysplugins/smarty_internal_method_append.php (limited to 'lib/smarty3/sysplugins/smarty_internal_method_append.php') diff --git a/lib/smarty3/sysplugins/smarty_internal_method_append.php b/lib/smarty3/sysplugins/smarty_internal_method_append.php new file mode 100644 index 0000000..b89aacf --- /dev/null +++ b/lib/smarty3/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->_objType == 2 && $data->scope) { + $data->ext->_updateScope->_updateScope($data, $tpl_var); + } + } + return $data; + } +} \ No newline at end of file -- cgit v1.2.3