/** * Removes some of the path in the uri. Used if the system is * not running on the top level of a domain. * @param string $path * @return void */ public static function reduceUri($path) { if (empty($path)) { return; } $split = explode($path, static::$request_uri); static::$request_uri = $split[1]; }
public function __construct() { // Because some hosts are complete // idiotic pieces of shit, let's // strip slashes from input. if (get_magic_quotes_gpc()) { $php_is_the_worst_language_ever_because_of_this = function (&$value) { $value = stripslashes($value); }; array_walk_recursive($_GET, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_POST, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_COOKIE, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_REQUEST, $php_is_the_worst_language_ever_because_of_this); } // Set query string static::$query = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null); // Set request scheme static::$scheme = static::isSecure() ? 'https' : 'http'; // Set host static::$host = strtolower(preg_replace('/:\d+$/', '', trim($_SERVER['SERVER_NAME']))); // Set base url static::$base = static::baseUrl(); // Set the request path static::$request_uri = static::requestPath(); // Set relative uri without query string $uri = explode('?', str_replace(static::$base, '', static::$request_uri)); static::$uri = $uri[0]; // Request segments static::$segments = explode('/', trim(static::$uri, '/')); // Set the request method static::$method = strtolower($_SERVER['REQUEST_METHOD']); // Requested with static::$requested_with = @$_SERVER['HTTP_X_REQUESTED_WITH']; // _REQUEST static::$request = $_REQUEST; // _POST static::$post = $_POST; }