Exemplo n.º 1
0
    Routing\Filter::register(require $filters);
}
// --------------------------------------------------------------
// Call the "before" filter for the application and module.
// --------------------------------------------------------------
foreach (array('before', ACTIVE_MODULE . '::before') as $filter) {
    $response = Routing\Filter::call($filter, array(Request::method(), Request::uri()), true);
    if (!is_null($response)) {
        break;
    }
}
// --------------------------------------------------------------
// Route the request and get the response from the route.
// --------------------------------------------------------------
if (is_null($response)) {
    $route = Routing\Router::make(Request::method(), Request::uri(), new Routing\Loader(ACTIVE_MODULE_PATH))->route();
    $response = is_null($route) ? Response::error('404') : $route->call();
}
$response = Response::prepare($response);
// --------------------------------------------------------------
// Call the "after" filter for the application and module.
// --------------------------------------------------------------
foreach (array(ACTIVE_MODULE . '::after', 'after') as $filter) {
    Routing\Filter::call($filter, array($response, Request::method(), Request::uri()));
}
// --------------------------------------------------------------
// Stringify the response.
// --------------------------------------------------------------
$response->content = (string) $response->content;
// --------------------------------------------------------------
// Close the session.