| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * Smarty Internal Plugin Data | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * This file contains the basic classes and methodes for template and variable creation | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * @package Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * @author Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * Base class with template and variable methodes | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-12-27 15:06:49 +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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +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 | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param boolean $scope the scope the variable will have  (local,parent or root) | 
					
						
							| 
									
										
										
										
											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 != '') { | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00: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 != '') { | 
					
						
							| 
									
										
										
										
											2011-10-04 16:18:24 +00: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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $varname the global variable name | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param mixed  $value   the value to assign | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @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 != '') { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             Smarty::$global_tpl_vars[$varname] = 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
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $tpl_var the template variable name | 
					
						
							|  |  |  |      * @param mixed $ &$value the referenced 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 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 != '') { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache); | 
					
						
							| 
									
										
										
										
											2009-10-11 20:23:00 +00: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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +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 | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @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); | 
					
						
							|  |  |  |                         if ($tpl_var_inst instanceof Undefined_Smarty_Variable) { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00: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)) { | 
					
						
							|  |  |  |                         foreach($_val as $_mkey => $_mval) { | 
					
						
							|  |  |  |                             $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); | 
					
						
							|  |  |  |                     if ($tpl_var_inst instanceof Undefined_Smarty_Variable) { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00: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)) { | 
					
						
							|  |  |  |                     foreach($value as $_mkey => $_mval) { | 
					
						
							|  |  |  |                         $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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $tpl_var the template variable name | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @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])) { | 
					
						
							|  |  |  |                 $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)) { | 
					
						
							|  |  |  |                 foreach($value as $_key => $_val) { | 
					
						
							|  |  |  |                     $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 { | 
					
						
							|  |  |  |                 $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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param string  $varname        variable name or null | 
					
						
							|  |  |  |      * @param string  $_ptr           optional pointer to data object | 
					
						
							|  |  |  |      * @param boolean $search_parents include parent templates? | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @return string variable value or or array of variables | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  |             } while ($_ptr !== null) { | 
					
						
							|  |  |  |                 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
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +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. | 
					
						
							| 
									
										
										
										
											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(); | 
					
						
							| 
									
										
										
										
											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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $config_file filename | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @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
 | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         $config = new Smarty_Internal_Config($config_file, $this->smarty, $this); | 
					
						
							|  |  |  |         $config->loadConfigVars($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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param string  $variable the name of the Smarty variable | 
					
						
							|  |  |  |      * @param object  $_ptr     optional pointer to data object | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param boolean $search_parents search also in parent data | 
					
						
							|  |  |  |      * @return object the object of the variable | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							| 
									
										
										
										
											2009-04-12 22:26:02 +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
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-10-31 00:44:58 +00:00
										 |  |  |         if ($this->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
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         return new Undefined_Smarty_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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $variable the name of the config variable | 
					
						
							|  |  |  |      * @return mixed the value of the config variable | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getConfigVariable($variable, $error_enable = true) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         $_ptr = $this; | 
					
						
							|  |  |  |         while ($_ptr !== null) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             if (isset($_ptr->config_vars[$variable])) { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |                 // found it, return it
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 return $_ptr->config_vars[$variable]; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |             // not found, try at parent
 | 
					
						
							|  |  |  |             $_ptr = $_ptr->parent; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if ($this->smarty->error_unassigned && $error_enable) { | 
					
						
							|  |  |  |             // force a notice
 | 
					
						
							|  |  |  |             $x = $$variable; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         return null; | 
					
						
							| 
									
										
										
										
											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
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $variable the stream of the variable | 
					
						
							|  |  |  |      * @return mixed the value of the stream variable | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             while (!feof($fp) && ($current_line = fgets($fp)) !== false ) { | 
					
						
							|  |  |  |                 $_result .= $current_line; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-04-18 14:46:29 +00:00
										 |  |  |             fclose($fp); | 
					
						
							|  |  |  |             return $_result; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-04-18 14:46:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-23 14:40:10 +00:00
										 |  |  |         if ($this->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
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * Returns a single or all config variables | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $varname variable name or null | 
					
						
							|  |  |  |      * @return string variable value or or array of variables | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getConfigVars($varname = null, $search_parents = true) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |         $_ptr = $this; | 
					
						
							|  |  |  |         $var_array = array(); | 
					
						
							|  |  |  |         while ($_ptr !== null) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             if (isset($varname)) { | 
					
						
							|  |  |  |                 if (isset($_ptr->config_vars[$varname])) { | 
					
						
							|  |  |  |                     return $_ptr->config_vars[$varname]; | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 $var_array = array_merge($_ptr->config_vars, $var_array); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |              // not found, try at parent
 | 
					
						
							|  |  |  |             if ($search_parents) { | 
					
						
							|  |  |  |                 $_ptr = $_ptr->parent; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |                 $_ptr = null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |         if (isset($varname)) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             return ''; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2010-11-15 19:17:18 +00:00
										 |  |  |             return $var_array; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * Deassigns a single or all config variables | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param string $varname variable name 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
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function clearConfig($varname = null) | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (isset($varname)) { | 
					
						
							|  |  |  |             unset($this->config_vars[$varname]); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $this->config_vars = array(); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * class for the Smarty data object | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * The Smarty data object will hold Smarty variables in the current scope | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-12-27 15:06:49 +00:00
										 |  |  | class Smarty_Data extends Smarty_Internal_Data { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Smarty object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  |     public $smarty = null; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * create Smarty data object | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty|array $_parent  parent template | 
					
						
							|  |  |  |      * @param Smarty       $smarty   global smarty instance | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  |     public function __construct ($_parent = null, $smarty = null) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  |         $this->smarty = $smarty; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         if (is_object($_parent)) { | 
					
						
							|  |  |  |             // when object set up back pointer
 | 
					
						
							|  |  |  |             $this->parent = $_parent; | 
					
						
							|  |  |  |         } elseif (is_array($_parent)) { | 
					
						
							|  |  |  |             // set up variable values
 | 
					
						
							|  |  |  |             foreach ($_parent as $_key => $_val) { | 
					
						
							|  |  |  |                 $this->tpl_vars[$_key] = new Smarty_variable($_val); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-01-22 16:39:30 +00:00
										 |  |  |         } elseif ($_parent != null) { | 
					
						
							| 
									
										
										
										
											2010-08-13 10:39:51 +00:00
										 |  |  |             throw new SmartyException("Wrong type for template variables"); | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  * class for the Smarty variable object | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * This class defines the Smarty variable object | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | class Smarty_Variable { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * template variable | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var mixed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $value = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * if true any output of this variable will be not cached | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var boolean | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $nocache = false; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * the scope the variable will have  (local,parent or root) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $scope = Smarty::SCOPE_LOCAL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * create Smarty variable object | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param mixed   $value   the value to assign | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      * @param boolean $nocache if true any output of this variable will be not cached | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param int     $scope   the scope the variable will have  (local,parent or root) | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function __construct($value = null, $nocache = false, $scope = Smarty::SCOPE_LOCAL) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->value = $value; | 
					
						
							|  |  |  |         $this->nocache = $nocache; | 
					
						
							| 
									
										
										
										
											2009-04-07 16:22:31 +00:00
										 |  |  |         $this->scope = $scope; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * <<magic>> String conversion | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __toString() | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         return (string) $this->value; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * class for undefined variable object | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  * This class defines an object for undefined variable handling | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | class Undefined_Smarty_Variable { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Returns FALSE for 'nocache' and NULL otherwise. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @return bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __get($name) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-03-26 14:08:43 +00:00
										 |  |  |         if ($name == 'nocache') { | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             return null; | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Always returns an empty string. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __toString() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return ""; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-14 11:11:52 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-18 15:10:35 +00:00
										 |  |  | ?>
 |