mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
add __get() to templateCreate class
This commit is contained in:
@@ -803,6 +803,25 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
return $this->smarty->fetch($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy loads (valid) property objects
|
||||
*
|
||||
* @param string $name property name
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if (in_array($name, array('register', 'unregister', 'utility', 'cache'))) {
|
||||
$class = "Smarty_Internal_" . ucfirst($name);
|
||||
$this->$name = new $class($this);
|
||||
return $this->$name;
|
||||
} else if ($name == '_version') {
|
||||
// Smarty 2 BC
|
||||
$this->_version = self::SMARTY_VERSION;
|
||||
return $this->_version;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes unknown class methods and lazy loads sysplugin files for them
|
||||
* class name format: Smarty_Method_MethodName
|
||||
|
Reference in New Issue
Block a user