public function run_controller($in_action = false) { // Инициализируем класс контроллера $class = 'controller_' . $this->request->controller; if (!class_exists($class) && $this->config->fallback_controller) { $class = 'controller_' . $this->config->fallback_controller; } if (!class_exists($class)) { if ($in_action) { $class = 'controller_error'; } else { error::call('Not Found', 404); } } $this->controller = new $class($this->request, $this->response); ob_start(); $this->plugin_action('controller_before'); // Хук, до выполнения экшена контроллера $this->controller->before(); // Запускаем основной экшн $action = $this->request->action . '_action'; $this->controller->{$action}($this->request->param); $this->plugin_action('controller_after'); // Хук, после выполнения экшена контроллера $this->controller->after(); // Запускаем ренедер контента $this->controller->render(); $this->plugin_action('controller_render'); }