public static function current() { if (!is_null(self::$uri)) { return self::$uri; } $uri = trim(Request::pathInfo(), "/"); $uri = $uri ? $uri : "/"; self::$uri = $uri; $segments = array_diff(explode("/", trim($uri, "/")), array("")); if (array_get($segments, 0) == "manager") { self::$isManager = true; array_shift($segments); } self::$segments = $segments; return $uri; }
/** * Returns the full URL for the current request * @return string */ public static function full() { return trim(Request::rootURL(), "/") . Request::pathInfo(); }
$allowed = true; break; } } if (!$allowed || count($pieces) == 0) { return Response::code(403); } $path = implode(DS, $pieces); if (!File::exists(J_PATH . $path) || is_dir(J_PATH . $path)) { return Response::code(404); } $im = new Image(J_PATH . $path); $im->resize((int) Request::get("width"), (int) Request::get("height"), Request::get("method", "fit"), Request::get("background", 0xffffff)); $im->header(); }); Router::register("*", "(:all)", function () { Response::code(404); if (Request::isLocal()) { echo "URI: " . URI::full() . "<br>\n"; echo "Path Info: " . Request::pathInfo() . "\n"; } return; }); if (URI::isManager()) { Structure::routes(); } Request::$route = Router::route(Request::method(), URI::current()); Event::fire(J_EVENT_RESPONSE_START); echo Request::$route->call(); Event::fire(J_EVENT_RESPONSE_END); //echo "<br><br>" . round(elapsed_time() * 1000000) / 1000 . "ms";