view = new stdClass (); } function gate ($method_name = 'index') { try { $this->defineDatabasedConstants (); Zend_Registry::getInstance()->Environment = new Environment_Runtime(); $arguments = func_get_args (); array_shift ($arguments); Addon_Manifest::enumerate ('onBeforeFrontendMethod'); $this->view_name = $method_name; ob_start (); { $data = array ('controller' => $this, 'method' => $method_name); Event::run ('controller.action.before', $data); $this->onBeforeAction (); $this->executeMethod ($method_name, $arguments); Event::run ('controller.action.after', $data); } $text = ob_get_clean (); } catch (Exception_NotFound $e) { $this->not_found (); } catch (Exception_BadInstallation $e) { util::invalidInstallationMessage ($e); } $this->onBeforeRender (); if (! empty ($this->view_name)) { $view = new $this->view_class_name ($this->view_name); foreach ($this->view as $key => $value) { $view->$key = $value; } if (isset ($view->global_vars)) { foreach ($view->global_vars as $key => $value) { $view->addGlobalVar ($key, $value); } } echo $view->render (); } if (isset ($text)) { echo $text; } } protected function executeMethod ($method_name, $arguments) { if (method_exists ($this, $method_name)) { $reflection = new ReflectionMethod ($this, $method_name); if ($reflection->isPublic ()) { return call_user_func_array (array ($this, $method_name), $arguments); } } throw new Exception_NotFound (); } protected function onBeforeAction () {} protected function onBeforeRender () {} }