public function __construct($request_uri, $params = array(), $view_params = array()) { $this->request_uri = $request_uri; $this->params = $params; $this->view_params = $view_params; $this->template = $params["controller"] . "/" . $params["action"]; if (Import::helper($params["controller"])) { $this->helper = $params['controller'] . "Helper"; } else { $this->helper = false; } }
public function handle_request($params) { if (array_key_exists("format", $params) === false) { $params["format"] = "html"; } $this->params = $params; $controller_name = Inflector::camelize($params["controller"], "first"); Logger::process_controller($controller_name, $params["action"], env("REQUEST_METHOD"), $params); if (Import::controller($params["controller"])) { Import::helper($params["controller"]); $helper_name = "{$controller_name}Helper"; $this->controller = new $controller_name($this->request_uri, $params); if (class_exists($helper_name)) { $this->controller->helper = new $helper_name(); } $action = $params["action"]; } else { $this->controller = new self($this->request_uri, $params); $action = "not_found"; $this->controller->{$action}(); } $this->controller->format = $this->params["format"]; $this->controller->handle_action($action); }