| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |  * Smarty Internal Plugin Config | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Config | 
					
						
							|  |  |  |  * @author Uwe Tews | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Config | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |  * Main class for config variables | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Config | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @property Smarty_Config_Source   $source | 
					
						
							|  |  |  |  * @property Smarty_Config_Compiled $compiled | 
					
						
							|  |  |  |  * @ignore | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | class Smarty_Internal_Config { | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Samrty instance | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty object | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public $smarty = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Object of config var storage | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var object | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $data = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Config resource | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $config_resource = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Compiled config file | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $compiled_config = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * filepath of compiled config file | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $compiled_filepath = null; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Filemtime of compiled config Filemtime | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $compiled_timestamp = null; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * flag if compiled config file is invalid and must be (re)compiled | 
					
						
							|  |  |  |      * @var bool | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public $mustCompile = null; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * Config file compiler object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty_Internal_Config_File_Compiler object | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public $compiler_object = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Constructor of config file object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $config_resource config file resource name | 
					
						
							|  |  |  |      * @param Smarty $smarty Smarty instance | 
					
						
							|  |  |  |      * @param object $data object for config vars storage | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __construct($config_resource, $smarty, $data = null) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $this->data = $data; | 
					
						
							|  |  |  |         $this->smarty = $smarty; | 
					
						
							|  |  |  |         $this->config_resource = $config_resource; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * Returns the compiled  filepath | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * @return string the compiled filepath | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getCompiledFilepath() | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         return $this->compiled_filepath === null ? | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 ($this->compiled_filepath = $this->buildCompiledFilepath()) : | 
					
						
							|  |  |  |                 $this->compiled_filepath; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get file path. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     public function buildCompiledFilepath() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-10 17:02:48 +00:00
										 |  |  |         $_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2 | 
					
						
							|  |  |  |                 + (int) $this->smarty->config_overwrite * 4; | 
					
						
							|  |  |  |         $_filepath = sha1($this->source->name . $_flag); | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // if use_sub_dirs, break file into directories
 | 
					
						
							|  |  |  |         if ($this->smarty->use_sub_dirs) { | 
					
						
							| 
									
										
										
										
											2009-10-31 00:44:58 +00:00
										 |  |  |             $_filepath = substr($_filepath, 0, 2) . DS | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                     . substr($_filepath, 2, 2) . DS | 
					
						
							|  |  |  |                     . substr($_filepath, 4, 2) . DS | 
					
						
							|  |  |  |                     . $_filepath; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-10 17:02:48 +00:00
										 |  |  |         $_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^'; | 
					
						
							| 
									
										
										
										
											2010-11-10 16:46:57 +00:00
										 |  |  |         if (isset($_compile_id)) { | 
					
						
							|  |  |  |             $_filepath = $_compile_id . $_compile_dir_sep . $_filepath; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |         $_compile_dir = $this->smarty->getCompileDir(); | 
					
						
							|  |  |  |         return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * Returns the timpestamp of the compiled file | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * @return integer the file timestamp | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getCompiledTimestamp() | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         return $this->compiled_timestamp === null | 
					
						
							|  |  |  |             ? ($this->compiled_timestamp = (file_exists($this->getCompiledFilepath())) ? filemtime($this->getCompiledFilepath()) : false) | 
					
						
							|  |  |  |             : $this->compiled_timestamp; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * Returns if the current config file must be compiled | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * It does compare the timestamps of config source and the compiled config and checks the force compile configuration | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-29 15:41:01 +00:00
										 |  |  |      * @return boolean true if the file must be compiled | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function mustCompile() | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         return $this->mustCompile === null ? | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp () === false || $this->smarty->compile_check && $this->getCompiledTimestamp () < $this->source->timestamp): | 
					
						
							|  |  |  |             $this->mustCompile; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * Returns the compiled config file | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      * It checks if the config file must be compiled or just read the compiled version | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      * @return string the compiled config file | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function getCompiledConfig() | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if ($this->compiled_config === null) { | 
					
						
							|  |  |  |             // see if template needs compiling.
 | 
					
						
							|  |  |  |             if ($this->mustCompile()) { | 
					
						
							|  |  |  |                 $this->compileConfigSource(); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $this->compiled_config = file_get_contents($this->getCompiledFilepath()); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         return $this->compiled_config; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Compiles the config files | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @throws Exception | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function compileConfigSource() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // compile template
 | 
					
						
							|  |  |  |         if (!is_object($this->compiler_object)) { | 
					
						
							|  |  |  |             // load compiler
 | 
					
						
							|  |  |  |             $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // compile locking
 | 
					
						
							|  |  |  |         if ($this->smarty->compile_locking) { | 
					
						
							|  |  |  |             if ($saved_timestamp = $this->getCompiledTimestamp()) { | 
					
						
							|  |  |  |                 touch($this->getCompiledFilepath()); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // call compiler
 | 
					
						
							|  |  |  |         try { | 
					
						
							|  |  |  |             $this->compiler_object->compileSource($this); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } catch (Exception $e) { | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |             // restore old timestamp in case of error
 | 
					
						
							|  |  |  |             if ($this->smarty->compile_locking && $saved_timestamp) { | 
					
						
							|  |  |  |                 touch($this->getCompiledFilepath(), $saved_timestamp); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |             throw $e; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // compiling succeded
 | 
					
						
							|  |  |  |         // write compiled template
 | 
					
						
							|  |  |  |         Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |      * load config variables | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param mixed $sections array of section names, single section or null | 
					
						
							|  |  |  |      * @param object $scope global,parent or local | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function loadConfigVars($sections = null, $scope = 'local') | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         if ($this->data instanceof Smarty_Internal_Template) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $this->data->properties['file_dependency'][sha1($this->source->filepath)] = array($this->source->filepath, $this->source->timestamp, 'file'); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-04-28 20:30:27 +00:00
										 |  |  |         if ($this->mustCompile()) { | 
					
						
							|  |  |  |             $this->compileConfigSource(); | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |         // pointer to scope
 | 
					
						
							|  |  |  |         if ($scope == 'local') { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $scope_ptr = $this->data; | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         } elseif ($scope == 'parent') { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             if (isset($this->data->parent)) { | 
					
						
							|  |  |  |                 $scope_ptr = $this->data->parent; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $scope_ptr = $this->data; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         } elseif ($scope == 'root' || $scope == 'global') { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $scope_ptr = $this->data; | 
					
						
							|  |  |  |             while (isset($scope_ptr->parent)) { | 
					
						
							|  |  |  |                 $scope_ptr = $scope_ptr->parent; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-23 14:40:10 +00:00
										 |  |  |         $_config_vars = array(); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         include($this->getCompiledFilepath()); | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // copy global config vars
 | 
					
						
							| 
									
										
										
										
											2010-04-28 20:30:27 +00:00
										 |  |  |         foreach ($_config_vars['vars'] as $variable => $value) { | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |             if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { | 
					
						
							|  |  |  |                 $scope_ptr->config_vars[$variable] = $value; | 
					
						
							| 
									
										
										
										
											2009-11-24 20:33:40 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |         // scan sections
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if (!empty($sections)) { | 
					
						
							|  |  |  |             foreach ($_config_vars['sections'] as $this_section => $dummy) { | 
					
						
							|  |  |  |                 if (in_array($this_section, (array) $sections)) { | 
					
						
							|  |  |  |                     foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) { | 
					
						
							|  |  |  |                         if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { | 
					
						
							|  |  |  |                             $scope_ptr->config_vars[$variable] = $value; | 
					
						
							|  |  |  |                         } else { | 
					
						
							|  |  |  |                             $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * set Smarty property in template context | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $property_name property name | 
					
						
							|  |  |  |      * @param mixed  $value         value | 
					
						
							|  |  |  |      * @throws SmartyException if $property_name is not valid | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __set($property_name, $value) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch ($property_name) { | 
					
						
							|  |  |  |             case 'source': | 
					
						
							|  |  |  |             case 'compiled': | 
					
						
							|  |  |  |                 $this->$property_name = $value; | 
					
						
							|  |  |  |                 return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         throw new SmartyException("invalid config property '$property_name'."); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * get Smarty property in template context | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $property_name property name | 
					
						
							|  |  |  |      * @throws SmartyException if $property_name is not valid | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __get($property_name) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch ($property_name) { | 
					
						
							|  |  |  |             case 'source': | 
					
						
							|  |  |  |                 if (empty($this->config_resource)) { | 
					
						
							|  |  |  |                     throw new SmartyException("Unable to parse resource name \"{$this->config_resource}\""); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 $this->source = Smarty_Resource::config($this); | 
					
						
							|  |  |  |                 return $this->source; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             case 'compiled': | 
					
						
							|  |  |  |                 $this->compiled = $this->source->getCompiled($this); | 
					
						
							|  |  |  |                 return $this->compiled; | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         throw new SmartyException("config attribute '$property_name' does not exist."); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  | ?>
 |