| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Plugin Data | 
					
						
							|  |  |  |  * This file contains the data object | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							|  |  |  |  * @author     Uwe Tews | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * class for the Smarty data object | 
					
						
							|  |  |  |  * The Smarty data object will hold Smarty variables in the current scope | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Template | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class Smarty_Data extends Smarty_Internal_Data | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Counter | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     static $count = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Data block name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $dataObjectName = ''; | 
					
						
							| 
									
										
										
										
											2015-08-17 21:52:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Smarty object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $smarty = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * create Smarty data object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty|array                    $_parent parent template | 
					
						
							|  |  |  |      * @param Smarty|Smarty_Internal_Template $smarty  global smarty instance | 
					
						
							|  |  |  |      * @param string                          $name    optional data block name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @throws SmartyException | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __construct($_parent = null, $smarty = null, $name = null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-10-24 05:02:24 +02:00
										 |  |  |         parent::__construct(); | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |         self::$count ++; | 
					
						
							|  |  |  |         $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); | 
					
						
							|  |  |  |         $this->smarty = $smarty; | 
					
						
							|  |  |  |         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) { | 
					
						
							| 
									
										
										
										
											2015-01-06 01:18:58 +01:00
										 |  |  |                 $this->tpl_vars[$_key] = new Smarty_Variable($_val); | 
					
						
							| 
									
										
										
										
											2015-01-04 05:51:52 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } elseif ($_parent != null) { | 
					
						
							|  |  |  |             throw new SmartyException("Wrong type for template variables"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |