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.
|
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 | $reload | Force 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'];
$scriptName = $_SERVER['SCRIPT_NAME'];
$baseUri = strpos($requestUri, $scriptName) === 0 ? $scriptName : str_replace(
'\\',
'/', dirname($scriptName));
}
}
static Slim_Http_Uri::getQueryString |
( |
|
$reload = false | ) |
|
|
static |
Get URI Query String.
- Parameters
-
bool | $reload | For 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 | $reload | For 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';
}
}
static Slim_Http_Uri::getUri |
( |
|
$reload = false | ) |
|
|
static |
Get URI with leading slash.
- Parameters
-
bool | $reload | Force reparse the URI? |
- Returns
- string
- Exceptions
-
RuntimeException | If 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) ) {
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,
'/');
}
}
Field Documentation
Slim_Http_Uri::$queryString |
|
staticprotected |
The documentation for this class was generated from the following file:
- Services/WebServices/Rest/lib/Slim/Http/Uri.php