add __get() to templateCreate class

This commit is contained in:
monte.ohrt
2010-03-08 16:20:19 +00:00
parent 374d801d51
commit 54a8dcd343

View File

@@ -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