ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
Slim_Http_Uri Class Reference
+ Collaboration diagram for Slim_Http_Uri:

Static Public Member Functions

static getBaseUri ($reload=false)
 Get Base URI without trailing slash.
static getUri ($reload=false)
 Get URI with leading slash.
static getScheme ($reload=false)
 Get URI Scheme.
static getQueryString ($reload=false)
 Get URI Query String.

Static Protected Attributes

static $scheme
static $baseUri
static $uri
static $queryString

Detailed Description

Definition at line 42 of file Uri.php.

Member Function Documentation

static Slim_Http_Uri::getBaseUri (   $reload = false)
static

Get Base URI without trailing slash.

Parameters
bool$reloadForce reparse the base URI?
Returns
string

Definition at line 69 of file Uri.php.

References $baseUri.

Referenced by Slim_Http_Request\__construct().

{
if ( $reload || is_null(self::$baseUri) ) {
$requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; //Full Request URI
$scriptName = $_SERVER['SCRIPT_NAME']; //Script path from docroot
$baseUri = strpos($requestUri, $scriptName) === 0 ? $scriptName : str_replace('\\', '/', dirname($scriptName));
self::$baseUri = rtrim($baseUri, '/');
}
}

+ Here is the caller graph for this function:

static Slim_Http_Uri::getQueryString (   $reload = false)
static

Get URI Query String.

Parameters
bool$reloadFor reparse the URL query string?
Returns
string

Definition at line 124 of file Uri.php.

References $queryString.

{
if ( $reload || is_null(self::$queryString) ) {
self::$queryString = $_SERVER['QUERY_STRING'];
}
}
static Slim_Http_Uri::getScheme (   $reload = false)
static

Get URI Scheme.

Parameters
bool$reloadFor reparse the URL scheme?
Returns
string "https" or "http"

Definition at line 112 of file Uri.php.

References $scheme.

{
if ( $reload || is_null(self::$scheme) ) {
self::$scheme = ( empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ) ? 'http' : 'https';
}
return self::$scheme;
}
static Slim_Http_Uri::getUri (   $reload = false)
static

Get URI with leading slash.

Parameters
bool$reloadForce reparse the URI?
Returns
string
Exceptions
RuntimeExceptionIf unable if unable to determine URI

Definition at line 85 of file Uri.php.

References $uri.

Referenced by Slim_Http_Request\__construct().

{
if ( $reload || is_null(self::$uri) ) {
$uri = '';
if ( !empty($_SERVER['PATH_INFO']) ) {
$uri = $_SERVER['PATH_INFO'];
} else {
if ( isset($_SERVER['REQUEST_URI']) ) {
$uri = parse_url(self::getScheme() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
} else if ( isset($_SERVER['PHP_SELF']) ) {
$uri = $_SERVER['PHP_SELF'];
} else {
throw new RuntimeException('Unable to detect request URI');
}
}
if ( self::getBaseUri() !== '' && strpos($uri, self::getBaseUri()) === 0 ) {
$uri = substr($uri, strlen(self::getBaseUri()));
}
self::$uri = '/' . ltrim($uri, '/');
}
return self::$uri;
}

+ Here is the caller graph for this function:

Field Documentation

Slim_Http_Uri::$baseUri
staticprotected

Definition at line 52 of file Uri.php.

Referenced by getBaseUri().

Slim_Http_Uri::$queryString
staticprotected

Definition at line 62 of file Uri.php.

Referenced by getQueryString().

Slim_Http_Uri::$scheme
staticprotected

Definition at line 47 of file Uri.php.

Referenced by getScheme().

Slim_Http_Uri::$uri
staticprotected

Definition at line 57 of file Uri.php.

Referenced by getUri().


The documentation for this class was generated from the following file: