class UriHelper (View source)

Uri Helper

This class provides an UTF-8 safe version of parse_url().

This class is a fork from Joomla Uri.

Constants

CHAR_SUB_DELIMS

Sub-delimiters used in query strings and fragments.

CHAR_UNRESERVED

Unreserved characters used in paths, query strings, and fragments.

Methods

static string
buildQuery(array $params)

Build a query from a array (reverse of the PHP parse_str()).

static mixed
parseUrl(string $url)

Does a UTF-8 safe version of PHP parse_url function

static mixed
parseQuery(string $query)

parseQuery

static string
filterScheme(string $scheme)

filterScheme

static string
filterQuery(string $query)

Filter a query string to ensure it is propertly encoded.

static array
splitQueryValue(string $value)

Split a query value into a key/value tuple.

static string
filterQueryOrFragment(string $value)

Filter a query string key or value, or a fragment.

static string
filterFragment(string $fragment)

Filter a fragment value to ensure it is properly encoded.

static string
filterPath(string $path)

Filters the path of a URI to ensure it is properly encoded.

static string
cleanPath(string $path)

Resolves //, .

static array|string
decode(string $string)

decode

static array|string
encode(string $string)

encode

Details

at line line 46
static string buildQuery(array $params)

Build a query from a array (reverse of the PHP parse_str()).

Parameters

array $params The array of key => value pairs to return as a query string.

Return Value

string The resulting query string.

See also

parse_str()

at line line 61
static mixed parseUrl(string $url)

Does a UTF-8 safe version of PHP parse_url function

Parameters

string $url URL to parse

Return Value

mixed Associative array or false if badly formed URL.

See also

http://us3.php.net/manual/en/function.parse-url.php

at line line 95
static mixed parseQuery(string $query)

parseQuery

Parameters

string $query

Return Value

mixed

at line line 109
static string filterScheme(string $scheme)

filterScheme

Parameters

string $scheme

Return Value

string

at line line 131
static string filterQuery(string $query)

Filter a query string to ensure it is propertly encoded.

Ensures that the values in the query string are properly urlencoded.

Parameters

string $query

Return Value

string

at line line 167
static array splitQueryValue(string $value)

Split a query value into a key/value tuple.

Parameters

string $value

Return Value

array A value with exactly two elements, key and value

at line line 186
static string filterQueryOrFragment(string $value)

Filter a query string key or value, or a fragment.

Parameters

string $value

Return Value

string

at line line 205
static string filterFragment(string $fragment)

Filter a fragment value to ensure it is properly encoded.

Parameters

string $fragment

Return Value

string

at line line 227
static string filterPath(string $path)

Filters the path of a URI to ensure it is properly encoded.

Parameters

string $path

Return Value

string

at line line 253
static string cleanPath(string $path)

Resolves //, .

./ and ./ from a path and returns the result. Eg:

/foo/bar/../boo.php => /foo/boo.php /foo/bar/../../boo.php => /boo.php /foo/bar/.././/boo.php => /foo/boo.php

Parameters

string $path The URI path to clean.

Return Value

string Cleaned and resolved URI path.

at line line 289
static array|string decode(string $string)

decode

Parameters

string $string

Return Value

array|string

at line line 313
static array|string encode(string $string)

encode

Parameters

string $string

Return Value

array|string