/** * Method to load and execute app * * @param string $handler Handler config * @param array $matches Matches array from url * @param boolean $print_output Whenever to print or return output * * return void */ public static function load_app($handler, $matches, $print_output) { if (!isset($handler['controller'])) { return self::error_page(500, null, true); } $controller = EE::controller($handler['controller']); if (isset($handler['action'])) { $action = $handler['action']; } else { if (isset($matches[0]) && !empty($matches[0])) { $action = strtolower(array_shift($matches)); } else { $action = 'index'; } } $action .= '_action'; if (!method_exists($controller, $action)) { return self::error_page(404, null, true); } $controller->{$action}($matches); }