revealMethods (); $this->init (); } function __call ($method_name, $arguments) { foreach ($this->getExtensions() as $extension) { if (in_array($method_name, $extension->getThemeMethods ())) { return call_user_func_array (array ($extension, $method_name), $arguments); } } throw new Exception ("Method $method_name does not exist."); } function isAllowed ($name) { return in_array ($name, $this->allowed); } protected final function allowMethod () { $arguments = func_get_args (); foreach (new RecursiveIteratorIterator (new RecursiveArrayIterator ($arguments)) as $method) { $this->allowed[] = $method; } } function revealMethods () { $this->allowMethod ('getId'); } function init () { } function restrict () { return new Theme_Restrictor ($this); } function setId ($id) { $this->id = $id; } function getId () { return $this->id; } protected function getRecord () { return $this->page_record; } function setRecord ($page_record) { $this->page_record = $page_record; $this->onAssignRecord (); } function onAssignRecord () { $this->setId ($this->getRecord ()->id); } function setMacrophage ($macrophage) { if ($macrophage instanceof Theme_API) { $macrophage = $macrophage->getMacrophage (); } if (! ($macrophage instanceof Macrophage)) { throw new Exception ("Invalid object type. Macrophage is expected."); } $this->macrophage = $macrophage; } function getMacrophage () { if (!isset ($this->macrophage)) { } return $this->macrophage; } function dump () { echo '
Object of type ', get_class ($this), '
';; } function addExtension ($_extension) { $_extension->setRecord ($this->getRecord()); $this->allowMethod ($_extension->getThemeMethods ()); $this->_extensions [] = $_extension; } function getExtensions () { return $this->_extensions; } }