function on_exception($message, $e = null) { if ($this->_exception) { return; } // triggered twice? $this->_exception = true; if (!$e) { $e = new Exception($message); } $this->renderer->set_data('exception', $e); if (loader::in_ajax()) { $this->renderer->set_ajax_message($e->getMessage())->set_ajax_result(false)->ajax_flush(); } else { $this->renderer->set_template('error'); // @todo вникуда: output_editor override this } }
/** run action (entry pooint) */ function run($action = null) { if (preg_match('/[^\\w_-]/', $this->params->op)) { throw new controller_exception(__METHOD__ . ': Bad action'); } $action = $action ?: $this->params->op; $action = $action ?: 'index'; $this->run_before(); $this->render_controller(); $this->action($action); if (!$this->_disable_render) { $this->render(); } $this->renderer->set_page_title($this->title); $this->run_after(); // visible in templates as {$controller.key} $this->renderer->set_data('controller', $this->response->as_array()); }