ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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. More...
 
static getUri ( $reload=false)
 Get URI with leading slash. More...
 
static getScheme ( $reload=false)
 Get URI Scheme. More...
 
static getQueryString ( $reload=false)
 Get URI Query String. More...
 

Static Protected Attributes

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

Detailed Description

Definition at line 42 of file Uri.php.

Member Function Documentation

◆ getBaseUri()

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.

69 {
70 if ( $reload || is_null(self::$baseUri) ) {
71 $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; //Full Request URI
72 $scriptName = $_SERVER['SCRIPT_NAME']; //Script path from docroot
73 $baseUri = strpos($requestUri, $scriptName) === 0 ? $scriptName : str_replace('\\', '/', dirname($scriptName));
74 self::$baseUri = rtrim($baseUri, '/');
75 }
76 return self::$baseUri;
77 }
static $baseUri
Definition: Uri.php:52
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, and $baseUri.

Referenced by Slim_Http_Request\__construct().

+ Here is the caller graph for this function:

◆ getQueryString()

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.

124 {
125 if ( $reload || is_null(self::$queryString) ) {
126 self::$queryString = $_SERVER['QUERY_STRING'];
127 }
128 return self::$queryString;
129 }
static $queryString
Definition: Uri.php:62

References $_SERVER, and $queryString.

◆ getScheme()

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.

112 {
113 if ( $reload || is_null(self::$scheme) ) {
114 self::$scheme = ( empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ) ? 'http' : 'https';
115 }
116 return self::$scheme;
117 }
static $scheme
Definition: Uri.php:47

References $_SERVER, and $scheme.

◆ getUri()

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.

85 {
86 if ( $reload || is_null(self::$uri) ) {
87 $uri = '';
88 if ( !empty($_SERVER['PATH_INFO']) ) {
89 $uri = $_SERVER['PATH_INFO'];
90 } else {
91 if ( isset($_SERVER['REQUEST_URI']) ) {
92 $uri = parse_url(self::getScheme() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
93 } else if ( isset($_SERVER['PHP_SELF']) ) {
94 $uri = $_SERVER['PHP_SELF'];
95 } else {
96 throw new RuntimeException('Unable to detect request URI');
97 }
98 }
99 if ( self::getBaseUri() !== '' && strpos($uri, self::getBaseUri()) === 0 ) {
100 $uri = substr($uri, strlen(self::getBaseUri()));
101 }
102 self::$uri = '/' . ltrim($uri, '/');
103 }
104 return self::$uri;
105 }
static $uri
Definition: Uri.php:57

References $_SERVER, and $uri.

Referenced by Slim_Http_Request\__construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $baseUri

Slim_Http_Uri::$baseUri
staticprotected

Definition at line 52 of file Uri.php.

Referenced by getBaseUri().

◆ $queryString

Slim_Http_Uri::$queryString
staticprotected

Definition at line 62 of file Uri.php.

Referenced by getQueryString().

◆ $scheme

Slim_Http_Uri::$scheme
staticprotected

Definition at line 47 of file Uri.php.

Referenced by getScheme().

◆ $uri

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: