Dotclear 2.24
Loading...
Searching...
No Matches
http Class Reference

HTTP utilities. More...

Static Public Member Functions

static getHost ()
 
static getHostFromURL (string $url)
 
static getSelfURI ()
 
static redirect (string $relative_url)
 
static concatURL (string $url, string $path)
 
static realIP ()
 
static browserUID (string $key)
 
static getAcceptLanguage ()
 
static getAcceptLanguages ()
 
static cache (array $mod_files, array $mod_timestamps=[])
 
static etag (... $args)
 
static head (int $code, $msg=null)
 
static trimRequest ()
 

Static Public Attributes

static $https_scheme_on_443 = false
 
static $cache_max_age = 0
 
static $reverse_proxy = false
 

Static Protected Member Functions

static prepareRedirect (string $relative_url)
 

Detailed Description

HTTP utilities.

Member Function Documentation

◆ getHost()

static getHost ( )
static

Self root URI

Returns current scheme, host and port.

Returns
string

Referenced by getSelfURI(), adminAuth\init(), prepareRedirect(), and testGetHost().

◆ getHostFromURL()

static getHostFromURL ( string  $url)
static

Self root URI

Returns current scheme and host from a static URL.

Parameters
string$urlURL to retrieve the host from.
Returns
string

Referenced by dcBlog\__construct(), and testGetHostFromURL().

◆ getSelfURI()

static getSelfURI ( )
static

Self URI

Returns current URI with full hostname.

Returns
string

References getHost().

Referenced by testGetSelfURI().

◆ prepareRedirect()

static prepareRedirect ( string  $relative_url)
staticprotected

Prepare a full redirect URI from a relative or absolute URL

Parameters
string$relative_urlRelative URL
Returns
string full URI

References getHost().

◆ redirect()

◆ concatURL()

static concatURL ( string  $url,
string  $path 
)
static

Concat URL and path

Appends a path to a given URL. If path begins with "/" it will replace the original URL path.

Parameters
string$urlURL
string$pathPath to append
Returns
string

Referenced by dcStore\check(), adminConfigThemeDuctile\init(), adminBlowupConfig\render(), and testConcatURL().

◆ realIP()

static realIP ( )
static

Real IP

Returns the real client IP (or tries to do its best).

Returns
string

Referenced by dcBlog\addComment(), akismet\callFunc(), urlPages\pages(), and testRealIP().

◆ browserUID()

static browserUID ( string  $key)
static

Client unique ID

Returns a "almost" safe client unique ID.

Parameters
string$keyHMAC key
Returns
string

References crypt\hmac().

Referenced by dcAuth\checkSession(), dcAuth\checkUser(), adminAuth\process(), adminPost\render(), adminPage\render(), and testBrowserUID().

◆ getAcceptLanguage()

static getAcceptLanguage ( )
static

Client language

Returns a two letters language code take from HTTP_ACCEPT_LANGUAGE.

Returns
string

Referenced by adminAuth\init(), and testGetAcceptLanguage().

◆ getAcceptLanguages()

static getAcceptLanguages ( )
static

Client languages

Returns an array of accepted langages ordered by priority. can be a two letters language code or a xx-xx variant.

Returns
array

Referenced by testGetAcceptLanguages().

◆ cache()

static cache ( array  $mod_files,
array  $mod_timestamps = [] 
)
static

HTTP Cache

Sends HTTP cache headers (304) according to a list of files and an optionnal. list of timestamps.

Parameters
array$mod_filesFiles on which check mtime
array$mod_timestampsList of timestamps

References exit, and head().

Referenced by adminBlogTheme\process(), testCache(), and urlBlogroll\xbel().

◆ etag()

static etag (   $args)
static

HTTP Etag

Sends HTTP cache headers (304) according to a list of etags in client request.

References exit, and head().

Referenced by testEtag().

◆ head()

static head ( int  $code,
  $msg = null 
)
static

HTTP Header

Sends an HTTP code and message to client.

Parameters
int$codeHTTP code
string$msgMessage

References $code.

Referenced by cache(), etag(), adminXMLRPCpage\init(), dcAdmin\init(), urlPages\pages(), dcTrackback\receiveTrackback(), dcTrackback\receiveWebmention(), and testHead().

◆ trimRequest()

static trimRequest ( )
static

Trim request

Trims every value in GET, POST, REQUEST and COOKIE vars. Removes magic quotes if magic_quote_gpc is on.

Field Documentation

◆ $https_scheme_on_443

$https_scheme_on_443 = false
static

Referenced by testGetHost().

◆ $cache_max_age

$cache_max_age = 0
static

◆ $reverse_proxy

$reverse_proxy = false
static

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