ext = new Smarty_Internal_Extension_Handler(); $this->ext->objType = $this->_objType; } /** * assigns a Smarty variable * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for * chaining */ public function assign($tpl_var, $value = null, $nocache = false) { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { if ($_key != '') { $this->tpl_vars[$_key] = new Smarty_Variable($_val, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $_key); } } } } else { if ($tpl_var != '') { $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $tpl_var); } } } return $this; } /** * appends values to template variables * * @api Smarty::append() * @link http://www.smarty.net/docs/en/api.append.tpl * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to append * @param bool $merge flag if array elements shall be merged * @param bool $nocache if true any output of this variable will * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function append($tpl_var, $value = null, $merge = false, $nocache = false) { return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache); } /** * assigns a global Smarty variable * * @param string $varName the global variable name * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignGlobal($varName, $value = null, $nocache = false) { return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache); } /** * appends values to template variables by reference * * @param string $tpl_var the template variable name * @param mixed &$value the referenced value to append * @param boolean $merge flag if array elements shall be merged * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function appendByRef($tpl_var, &$value, $merge = false) { return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge); } /** * assigns values to template variables by reference * * @param string $tpl_var the template variable name * @param $value * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignByRef($tpl_var, &$value, $nocache = false) { return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache); } /** * Returns a single or all template variables * * @api Smarty::getTemplateVars() * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * * @param string $varName variable name or null * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); } /** * Follow the parent chain an merge template and config variables * * @param \Smarty_Internal_Data|null $data */ public function _mergeVars(Smarty_Internal_Data $data = null) { if (isset($data)) { if (!empty($this->tpl_vars)) { $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); } if (!empty($this->config_vars)) { $data->config_vars = array_merge($this->config_vars, $data->config_vars); } } else { $data = $this; } if (isset($this->parent)) { $this->parent->_mergeVars($data); } } /** * Handle unknown class methods * * @param string $name unknown method-name * @param array $args argument array * * @return mixed * @throws SmartyException */ public function __call($name, $args) { return $this->ext->_callExternalMethod($this, $name, $args); } }