3 * Smarty Internal Plugin
6 * @subpackage TemplateResources
10 * Smarty Resource Data Object
11 * Meta Data Container for Config Files
14 * @subpackage TemplateResources
16 * @property string $content
17 * @property int $timestamp
18 * @property bool $exists
20 class Smarty_Config_Source extends Smarty_Template_Source
23 * create Config Object container
25 * @param Smarty_Resource $handler Resource Handler this source object communicates with
26 * @param Smarty $smarty Smarty instance this source object belongs to
27 * @param string $resource full config_resource
28 * @param string $type type of resource
29 * @param string $name resource name
30 * @param string $unique_resource unqiue resource name
32 public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
34 $this->handler = $handler; // Note: prone to circular references
36 // Note: these may be ->config_compiler_class etc in the future
37 //$this->config_compiler_class = $handler->config_compiler_class;
38 //$this->config_lexer_class = $handler->config_lexer_class;
39 //$this->config_parser_class = $handler->config_parser_class;
41 $this->smarty = $smarty;
42 $this->resource = $resource;
45 $this->unique_resource = $unique_resource;
49 * <<magic>> Generic setter.
51 * @param string $property_name valid: content, timestamp, exists
52 * @param mixed $value newly assigned value (not check for correct type)
54 * @throws SmartyException when the given property name is not valid
56 public function __set($property_name, $value)
58 switch ($property_name) {
62 $this->$property_name = $value;
66 throw new SmartyException("invalid config property '$property_name'.");
71 * <<magic>> Generic getter.
73 * @param string $property_name valid: content, timestamp, exists
76 * @throws SmartyException when the given property name is not valid
78 public function __get($property_name)
80 switch ($property_name) {
83 $this->handler->populateTimestamp($this);
85 return $this->$property_name;
88 return $this->content = $this->handler->getContent($this);
91 throw new SmartyException("config property '$property_name' does not exist.");