| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: |  | 
| 6: |  | 
| 7: |  | 
| 8: |  | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: | class Smarty_Internal_Method_AppendByRef | 
| 13: | { | 
| 14: |  | 
| 15: |  | 
| 16: |  | 
| 17: |  | 
| 18: |  | 
| 19: |  | 
| 20: |  | 
| 21: |  | 
| 22: |  | 
| 23: |  | 
| 24: |  | 
| 25: |  | 
| 26: |  | 
| 27: | public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false) | 
| 28: | { | 
| 29: | if ($tpl_var !== '' && isset($value)) { | 
| 30: | if (!isset($data->tpl_vars[ $tpl_var ])) { | 
| 31: | $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); | 
| 32: | } | 
| 33: | if (!is_array($data->tpl_vars[ $tpl_var ]->value)) { | 
| 34: | settype($data->tpl_vars[ $tpl_var ]->value, 'array'); | 
| 35: | } | 
| 36: | if ($merge && is_array($value)) { | 
| 37: | foreach ($value as $_key => $_val) { | 
| 38: | $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ]; | 
| 39: | } | 
| 40: | } else { | 
| 41: | $data->tpl_vars[ $tpl_var ]->value[] = &$value; | 
| 42: | } | 
| 43: | if ($data->_isTplObj() && $data->scope) { | 
| 44: | $data->ext->_updateScope->_updateScope($data, $tpl_var); | 
| 45: | } | 
| 46: | } | 
| 47: | return $data; | 
| 48: | } | 
| 49: | } | 
| 50: |  |