| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * Smarty Internal Plugin Data | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * This file contains the basic classes and methods for template and variable creation | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * Base class with template and variable methods | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Data | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * name of class used for templates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2009-09-29 22:58:54 +00:00
										 |  |  |     public $template_class = 'Smarty_Internal_Template'; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * template variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $tpl_vars = array(); | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * parent template (if any) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty_Internal_Template | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $parent = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * configuration settings | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $config_vars = array(); | 
					
						
							| 
									
										
										
										
											2009-08-18 16:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * assigns a Smarty variable | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @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 | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public function assign($tpl_var, $value = null, $nocache = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (is_array($tpl_var)) { | 
					
						
							|  |  |  |             foreach ($tpl_var as $_key => $_val) { | 
					
						
							|  |  |  |                 if ($_key != '') { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                     $this->tpl_vars[$_key] = new Smarty_Variable($_val, $nocache); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             if ($tpl_var != '') { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                 $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * assigns a global Smarty variable | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @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 | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-02-06 22:11:10 +00:00
										 |  |  |     public function assignGlobal($varname, $value = null, $nocache = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if ($varname != '') { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |             Smarty::$global_tpl_vars[$varname] = new Smarty_Variable($value, $nocache); | 
					
						
							| 
									
										
										
										
											2012-11-20 02:06:20 +00:00
										 |  |  |             $ptr = $this; | 
					
						
							|  |  |  |             while ($ptr instanceof Smarty_Internal_Template) { | 
					
						
							|  |  |  |                 $ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname]; | 
					
						
							|  |  |  |                 $ptr = $ptr->parent; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * assigns values to template variables by reference | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param string   $tpl_var the template variable name | 
					
						
							|  |  |  |      * @param          $value | 
					
						
							|  |  |  |      * @param  boolean $nocache if true any output of this variable will be not cached | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public function assignByRef($tpl_var, &$value, $nocache = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00:00
										 |  |  |         if ($tpl_var != '') { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |             $this->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache); | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |             $this->tpl_vars[$tpl_var]->value = &$value; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 20:45:18 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * appends values to template variables | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  array|string $tpl_var the template variable name(s) | 
					
						
							|  |  |  |      * @param  mixed        $value   the value to append | 
					
						
							|  |  |  |      * @param  boolean      $merge   flag if array elements shall be merged | 
					
						
							|  |  |  |      * @param  boolean      $nocache if true any output of this variable will be not cached | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public function append($tpl_var, $value = null, $merge = false, $nocache = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (is_array($tpl_var)) { | 
					
						
							|  |  |  |             // $tpl_var is an array, ignore $value
 | 
					
						
							|  |  |  |             foreach ($tpl_var as $_key => $_val) { | 
					
						
							|  |  |  |                 if ($_key != '') { | 
					
						
							|  |  |  |                     if (!isset($this->tpl_vars[$_key])) { | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                         $tpl_var_inst = $this->getVariable($_key, null, true, false); | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |                         if ($tpl_var_inst instanceof Smarty_Undefined_Variable) { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                             $this->tpl_vars[$_key] = new Smarty_Variable(null, $nocache); | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                         } else { | 
					
						
							|  |  |  |                             $this->tpl_vars[$_key] = clone $tpl_var_inst; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                     if (!(is_array($this->tpl_vars[$_key]->value) || $this->tpl_vars[$_key]->value instanceof ArrayAccess)) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                         settype($this->tpl_vars[$_key]->value, 'array'); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                     if ($merge && is_array($_val)) { | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |                         foreach ($_val as $_mkey => $_mval) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                             $this->tpl_vars[$_key]->value[$_mkey] = $_mval; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                         } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                     } else { | 
					
						
							|  |  |  |                         $this->tpl_vars[$_key]->value[] = $_val; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             if ($tpl_var != '' && isset($value)) { | 
					
						
							|  |  |  |                 if (!isset($this->tpl_vars[$tpl_var])) { | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                     $tpl_var_inst = $this->getVariable($tpl_var, null, true, false); | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |                     if ($tpl_var_inst instanceof Smarty_Undefined_Variable) { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                         $this->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache); | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                     } else { | 
					
						
							|  |  |  |                         $this->tpl_vars[$tpl_var] = clone $tpl_var_inst; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  |                 if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                     settype($this->tpl_vars[$tpl_var]->value, 'array'); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                 if ($merge && is_array($value)) { | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |                     foreach ($value as $_mkey => $_mval) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                         $this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                 } else { | 
					
						
							|  |  |  |                     $this->tpl_vars[$tpl_var]->value[] = $value; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * appends values to template variables by reference | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @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 | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-02-06 22:11:10 +00:00
										 |  |  |     public function appendByRef($tpl_var, &$value, $merge = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00:00
										 |  |  |         if ($tpl_var != '' && isset($value)) { | 
					
						
							|  |  |  |             if (!isset($this->tpl_vars[$tpl_var])) { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                 $this->tpl_vars[$tpl_var] = new Smarty_Variable(); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-21 22:54:08 +00:00
										 |  |  |             if (!is_array($this->tpl_vars[$tpl_var]->value)) { | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00:00
										 |  |  |                 settype($this->tpl_vars[$tpl_var]->value, 'array'); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00:00
										 |  |  |             if ($merge && is_array($value)) { | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |                 foreach ($value as $_key => $_val) { | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |                     $this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key]; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |                 $this->tpl_vars[$tpl_var]->value[] = &$value; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * Returns a single or all template variables | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  string  $varname        variable name or null | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |      * @param  object  $_ptr           optional pointer to data object | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  boolean $search_parents include parent templates? | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return string  variable value or or array of variables | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true) | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (isset($varname)) { | 
					
						
							| 
									
										
										
										
											2010-12-06 19:00:50 +00:00
										 |  |  |             $_var = $this->getVariable($varname, $_ptr, $search_parents, false); | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |             if (is_object($_var)) { | 
					
						
							|  |  |  |                 return $_var->value; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 return null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_result = array(); | 
					
						
							|  |  |  |             if ($_ptr === null) { | 
					
						
							|  |  |  |                 $_ptr = $this; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             while ($_ptr !== null) { | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |                 foreach ($_ptr->tpl_vars AS $key => $var) { | 
					
						
							| 
									
										
										
										
											2010-12-31 13:47:12 +00:00
										 |  |  |                     if (!array_key_exists($key, $_result)) { | 
					
						
							|  |  |  |                         $_result[$key] = $var->value; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |                 // not found, try at parent
 | 
					
						
							|  |  |  |                 if ($search_parents) { | 
					
						
							|  |  |  |                     $_ptr = $_ptr->parent; | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     $_ptr = null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             if ($search_parents && isset(Smarty::$global_tpl_vars)) { | 
					
						
							|  |  |  |                 foreach (Smarty::$global_tpl_vars AS $key => $var) { | 
					
						
							| 
									
										
										
										
											2010-12-31 13:47:12 +00:00
										 |  |  |                     if (!array_key_exists($key, $_result)) { | 
					
						
							|  |  |  |                         $_result[$key] = $var->value; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 17:31:15 +00:00
										 |  |  |             return $_result; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * clear the given assigned template variable. | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  string|array $tpl_var the template variable(s) to clear | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-02-06 22:11:10 +00:00
										 |  |  |     public function clearAssign($tpl_var) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (is_array($tpl_var)) { | 
					
						
							|  |  |  |             foreach ($tpl_var as $curr_var) { | 
					
						
							|  |  |  |                 unset($this->tpl_vars[$curr_var]); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             unset($this->tpl_vars[$tpl_var]); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * clear all the assigned template variables. | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-02-06 22:11:10 +00:00
										 |  |  |     public function clearAllAssign() | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->tpl_vars = array(); | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-05 18:22:40 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * load a config file, optionally load just selected sections | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  string $config_file filename | 
					
						
							|  |  |  |      * @param  mixed  $sections    array of section names, single section or null | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-02-06 22:11:10 +00:00
										 |  |  |     public function configLoad($config_file, $sections = null) | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-11-05 18:22:40 +00:00
										 |  |  |         // load Config class
 | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |         Smarty_Internal_Extension_Config::configLoad($this, $config_file, $sections); | 
					
						
							| 
									
										
										
										
											2011-09-27 12:36:50 +00:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-05 18:22:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * gets the object of a Smarty variable | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  string  $variable       the name of the Smarty variable | 
					
						
							|  |  |  |      * @param  object  $_ptr           optional pointer to data object | 
					
						
							|  |  |  |      * @param  boolean $search_parents search also in parent data | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param bool     $error_enable | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return object  the object of the variable | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if ($_ptr === null) { | 
					
						
							|  |  |  |             $_ptr = $this; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |         while ($_ptr !== null) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             if (isset($_ptr->tpl_vars[$variable])) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                 // found it, return it
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 return $_ptr->tpl_vars[$variable]; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |             // not found, try at parent
 | 
					
						
							|  |  |  |             if ($search_parents) { | 
					
						
							|  |  |  |                 $_ptr = $_ptr->parent; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_ptr = null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if (isset(Smarty::$global_tpl_vars[$variable])) { | 
					
						
							| 
									
										
										
										
											2009-04-10 12:33:51 +00:00
										 |  |  |             // found it, return it
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             return Smarty::$global_tpl_vars[$variable]; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-02-15 01:45:37 +01:00
										 |  |  |         $smarty = isset($this->smarty) ? $this->smarty : $this; | 
					
						
							|  |  |  |         if ($smarty->error_unassigned && $error_enable) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             // force a notice
 | 
					
						
							|  |  |  |             $x = $$variable; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |         return new Smarty_Undefined_Variable; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * gets  a config variable | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  string $variable the name of the config variable | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param bool    $error_enable | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return mixed  the value of the config variable | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getConfigVariable($variable, $error_enable = true) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |         return Smarty_Internal_Extension_Config::getConfigVariable($this, $variable, $error_enable = true); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Returns a single or all config variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param  string $varname variable name or null | 
					
						
							|  |  |  |      * @param bool    $search_parents | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string variable value or or array of variables | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getConfigVars($varname = null, $search_parents = true) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return Smarty_Internal_Extension_Config::getConfigVars($this, $varname, $search_parents); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-02 12:11:21 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Deassigns a single or all config variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param  string $varname variable name or null | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function clearConfig($varname = null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return Smarty_Internal_Extension_Config::clearConfig($this, $varname); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-18 18:58:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * gets  a stream variable | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  string $variable the stream of the variable | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @throws SmartyException | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return mixed  the value of the stream variable | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2009-04-18 14:46:29 +00:00
										 |  |  |     public function getStreamVariable($variable) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $_result = ''; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $fp = fopen($variable, 'r+'); | 
					
						
							|  |  |  |         if ($fp) { | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |             while (!feof($fp) && ($current_line = fgets($fp)) !== false) { | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |                 $_result .= $current_line; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-04-18 14:46:29 +00:00
										 |  |  |             fclose($fp); | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-18 14:46:29 +00:00
										 |  |  |             return $_result; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-02-15 01:45:37 +01:00
										 |  |  |         $smarty = isset($this->smarty) ? $this->smarty : $this; | 
					
						
							|  |  |  |         if ($smarty->error_unassigned) { | 
					
						
							| 
									
										
										
										
											2010-08-13 10:39:51 +00:00
										 |  |  |             throw new SmartyException('Undefined stream variable "' . $variable . '"'); | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2010-10-20 18:28:04 +00:00
										 |  |  |             return null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |