public static function load($group, $save = true) { $paths = array(); $paths[] = J_PATH . "config" . DS . $group . EXT; $paths[] = J_PATH . "config" . DS . strtolower(Request::env()) . DS . $group . EXT; if (URI::isManager()) { $paths[] = J_MANAGERPATH . DS . "config" . DS . $group . EXT; $paths[] = J_MANAGERPATH . DS . "config" . DS . strtolower(Request::env()) . DS . $group . EXT; } else { $paths[] = J_APPPATH . "config" . DS . $group . EXT; $paths[] = J_APPPATH . "config" . DS . strtolower(Request::env()) . DS . $group . EXT; } $items = array(); foreach ($paths as $path) { if (file_exists($path)) { $result = (require $path); if (is_array($result)) { $items = array_merge($items, $result); } } } if (count($items) > 0) { if ($save) { static::$items[$group] = $items; } return $items; } }
/** * Returns the root URL of the project. If addManager = false, don't append 'manager/' if we are calling this function from a manager route. * @param boolean $addManager * @return string */ public static function root($addManager = true) { $root = Request::rootURL(); if ($addManager && URI::isManager()) { $root .= "manager/"; } return $root; }
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; }
$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";