3 * Smarty Internal Plugin
6 * @subpackage TemplateResources
10 * Smarty Resource Data Object
12 * Meta Data Container for Config Files
15 * @subpackage TemplateResources
18 * @property string $content
19 * @property int $timestamp
20 * @property bool $exists
22 class Smarty_Config_Source extends Smarty_Template_Source {
25 * create Config Object container
27 * @param Smarty_Resource $handler Resource Handler this source object communicates with
28 * @param Smarty $smarty Smarty instance this source object belongs to
29 * @param string $resource full config_resource
30 * @param string $type type of resource
31 * @param string $name resource name
32 * @param string $unique_resource unqiue resource name
34 public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
36 $this->handler = $handler; // Note: prone to circular references
38 // Note: these may be ->config_compiler_class etc in the future
39 //$this->config_compiler_class = $handler->config_compiler_class;
40 //$this->config_lexer_class = $handler->config_lexer_class;
41 //$this->config_parser_class = $handler->config_parser_class;
43 $this->smarty = $smarty;
44 $this->resource = $resource;
47 $this->unique_resource = $unique_resource;
51 * <<magic>> Generic setter.
53 * @param string $property_name valid: content, timestamp, exists
54 * @param mixed $value newly assigned value (not check for correct type)
55 * @throws SmartyException when the given property name is not valid
57 public function __set($property_name, $value)
59 switch ($property_name) {
63 $this->$property_name = $value;
67 throw new SmartyException("invalid config property '$property_name'.");
72 * <<magic>> Generic getter.
74 * @param string $property_name valid: content, timestamp, exists
75 * @throws SmartyException when the given property name is not valid
77 public function __get($property_name)
79 switch ($property_name) {
82 $this->handler->populateTimestamp($this);
83 return $this->$property_name;
86 return $this->content = $this->handler->getContent($this);
89 throw new SmartyException("config property '$property_name' does not exist.");