Definition at line 57 of file URL2.php.
Net_URL2::__construct |
( |
|
$url, |
|
|
array |
$options = array() |
|
) |
| |
Constructor.
- Parameters
-
string | $url | an absolute or relative URL |
array | $options | an array of OPTION_xxx constants |
self::parseUrl()
Definition at line 148 of file URL2.php.
Magic Getter.
This is the magic get method to retrieve the private variable that was set by either __set() or it's setter...
- Parameters
-
string | $var | The property name to retrieve. |
- Returns
- mixed $this->$var Either a boolean false if the property is not set or the value of the private property.
Definition at line 190 of file URL2.php.
Net_URL2::__set |
( |
|
$var, |
|
|
|
$arg |
|
) |
| |
Magic Setter.
This method will magically set the value of a private variable ($var) with the value passed as the args
- Parameters
-
string | $var | The private variable to set. |
mixed | $arg | An argument of any type. |
- Returns
- void
Definition at line 170 of file URL2.php.
Net_URL2::buildQuery |
( |
array |
$data, |
|
|
|
$separator, |
|
|
|
$key = null |
|
) |
| |
|
protected |
A simple version of http_build_query in userland. The encoded string is percentage encoded according to RFC 3986.
- Parameters
-
array | $data | An array, which has to be converted into QUERY_STRING. Anything is possible. |
string | $separator | Separator self::OPTION_SEPARATOR_OUTPUT |
string | $key | For stacked values (arrays in an array). |
- Returns
- string
Definition at line 1128 of file URL2.php.
Net_URL2::getAuthority |
( |
| ) |
|
Returns the authority part, i.e. [ userinfo "@" ] host [ ":" port ], or false if there is no authority.
- Returns
- string|bool
Definition at line 346 of file URL2.php.
static Net_URL2::getCanonical |
( |
| ) |
|
|
static |
Returns a Net_URL2 instance representing the canonical URL of the currently executing PHP script.
- Exceptions
-
- Returns
- string
Definition at line 1052 of file URL2.php.
Net_URL2::getFragment |
( |
| ) |
|
Returns the fragment name, or false if "#" is not present in the URL.
- Returns
- string|bool
Definition at line 459 of file URL2.php.
Returns the host part, or false if there is no authority part, e.g. relative URLs.
- Returns
- string|bool a hostname, an IP address, or false
Definition at line 296 of file URL2.php.
Net_URL2::getNormalizedURL |
( |
| ) |
|
Returns a normalized string representation of this URL. This is useful for comparison of URLs.
- Returns
- string
Definition at line 763 of file URL2.php.
Net_URL2::getOption |
( |
|
$optionName | ) |
|
Returns the value of the specified option.
- Parameters
-
string | $optionName | The name of the option to retrieve |
- Returns
- mixed
Definition at line 1111 of file URL2.php.
Net_URL2::getPassword |
( |
| ) |
|
Returns the password part of the userinfo part (the part after the first ":"), or false if there is no userinfo part (i.e. the URL does not contain "@" in front of the hostname) or the userinfo part does not contain ":".
- Returns
- string|bool
Definition at line 249 of file URL2.php.
Returns the path part (possibly an empty string).
- Returns
- string
Definition at line 409 of file URL2.php.
Returns the port number, or false if there is no port number specified, i.e. if the default port is to be used.
- Returns
- string|bool
Definition at line 321 of file URL2.php.
Returns the query string (excluding the leading "?"), or false if "?" is not present in the URL.
- Returns
- string|bool
- See Also
- getQueryVariables
Definition at line 434 of file URL2.php.
Net_URL2::getQueryVariables |
( |
| ) |
|
Returns the query string like an array as the variables would appear in $_GET in a PHP script. If the URL does not contain a "?", an empty array is returned.
- Returns
- array
Definition at line 485 of file URL2.php.
static Net_URL2::getRequested |
( |
| ) |
|
|
static |
Returns a Net_URL2 instance representing the URL used to retrieve the current request.
- Exceptions
-
- Returns
- $this
Definition at line 1089 of file URL2.php.
static Net_URL2::getRequestedURL |
( |
| ) |
|
|
static |
Returns the URL used to retrieve the current request.
- Returns
- string
Definition at line 1077 of file URL2.php.
Returns the scheme, e.g. "http" or "urn", or false if there is no scheme specified, i.e. if this is a relative URL.
- Returns
- string|bool
Definition at line 206 of file URL2.php.
Returns a string representation of this URL.
- Returns
- string
Definition at line 699 of file URL2.php.
Returns the user part of the userinfo part (the part preceding the first ":"), or false if there is no userinfo part.
- Returns
- string|bool
Definition at line 234 of file URL2.php.
Net_URL2::getUserinfo |
( |
| ) |
|
Returns the userinfo part, or false if there is none, i.e. if the authority part does not contain "@".
- Returns
- string|bool
Definition at line 262 of file URL2.php.
Returns whether this instance represents an absolute URL.
- Returns
- bool
Definition at line 868 of file URL2.php.
Normalizes the URL
See RFC 3986, Section 6. Normalization and Comparison
void
Definition at line 779 of file URL2.php.
Net_URL2::parseUrl |
( |
|
$url | ) |
|
|
protected |
This method uses a regex to parse the url into the designated parts.
- Parameters
-
- Returns
- void self::$_scheme, self::setAuthority(), self::$_path, self::$_query, self::$_fragment
- See Also
- __construct
Definition at line 1166 of file URL2.php.
static Net_URL2::removeDotSegments |
( |
|
$path | ) |
|
|
static |
Removes dots as described in RFC 3986, section 5.2.4, e.g. "/foo/../bar/baz" => "/bar/baz"
- Parameters
-
- Returns
- string a path
Definition at line 976 of file URL2.php.
Net_URL2::resolve |
( |
|
$reference | ) |
|
Returns an Net_URL2 instance representing an absolute URL relative to this URL.
- Parameters
-
- Exceptions
-
- Returns
- $this
Definition at line 882 of file URL2.php.
Net_URL2::setAuthority |
( |
|
$authority | ) |
|
Sets the authority part, i.e. [ userinfo "@" ] host [ ":" port ]. Specify false if there is no authority.
- Parameters
-
string | bool | $authority | a hostname or an IP address, possibly with userinfo prefixed and port number appended, e.g. "foo:bar@example.org:81". |
- Returns
- $this
Definition at line 377 of file URL2.php.
Net_URL2::setFragment |
( |
|
$fragment | ) |
|
Sets the fragment name. Specify false if "#" is not present in the URL.
- Parameters
-
string | bool | $fragment | a fragment excluding the leading "#", or false |
- Returns
- $this
Definition at line 472 of file URL2.php.
Net_URL2::setHost |
( |
|
$host | ) |
|
Sets the host part. Specify false if there is no authority part, e.g. relative URLs.
- Parameters
-
string | bool | $host | a hostname, an IP address, or false |
- Returns
- $this
Definition at line 309 of file URL2.php.
Net_URL2::setPath |
( |
|
$path | ) |
|
Sets the path part (possibly an empty string).
- Parameters
-
- Returns
- $this
Definition at line 421 of file URL2.php.
Net_URL2::setPort |
( |
|
$port | ) |
|
Sets the port number. Specify false if there is no port number specified, i.e. if the default port is to be used.
- Parameters
-
string | bool | $port | a port number, or false |
- Returns
- $this
Definition at line 334 of file URL2.php.
Net_URL2::setQuery |
( |
|
$query | ) |
|
Sets the query string (excluding the leading "?"). Specify false if "?" is not present in the URL.
- Parameters
-
string | bool | $query | a query string, e.g. "foo=1&bar=2" |
- Returns
- $this
- See Also
- setQueryVariables
Definition at line 448 of file URL2.php.
Net_URL2::setQueryVariable |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Sets the specified variable in the query string.
- Parameters
-
string | $name | variable name |
mixed | $value | variable value |
- Returns
- $this
Definition at line 672 of file URL2.php.
Net_URL2::setQueryVariables |
( |
array |
$array | ) |
|
Sets the query string to the specified variable in the query string.
- Parameters
-
array | $array | (name => value) array |
- Returns
- $this
Definition at line 651 of file URL2.php.
Net_URL2::setScheme |
( |
|
$scheme | ) |
|
Sets the scheme, e.g. "http" or "urn". Specify false if there is no scheme specified, i.e. if this is a relative URL.
- Parameters
-
string | bool | $scheme | e.g. "http" or "urn", or false if there is no scheme specified, i.e. if this is a relative URL |
- Returns
- $this
- See Also
- getScheme
Definition at line 222 of file URL2.php.
Net_URL2::setUserinfo |
( |
|
$userinfo, |
|
|
|
$password = false |
|
) |
| |
Sets the userinfo part. If two arguments are passed, they are combined in the userinfo part as username ":" password.
- Parameters
-
string | bool | $userinfo | userinfo or username |
string | bool | $password | optional password, or false |
- Returns
- $this
Definition at line 276 of file URL2.php.
Net_URL2::unsetQueryVariable |
( |
|
$name | ) |
|
Removes the specified variable from the query string.
- Parameters
-
string | $name | a query string variable, e.g. "foo" in "?foo=1" |
- Returns
- void
Definition at line 687 of file URL2.php.
static Net_URL2::urlencode |
( |
|
$string | ) |
|
|
static |
Percent-encodes all non-alphanumeric characters except these: _ . - ~ Similar to PHP's rawurlencode(), except that it also encodes ~ in PHP 5.2.x and earlier.
- Parameters
-
string | $string | string to encode |
- Returns
- string
Definition at line 1036 of file URL2.php.
const Net_URL2::OPTION_DROP_SEQUENCE = 'drop_sequence' |
Drop zero-based integer sequences in query using PHP's [] notation. Default is true.
Definition at line 74 of file URL2.php.
const Net_URL2::OPTION_ENCODE_KEYS = 'encode_keys' |
URL-encode query variable keys. Default is true.
Definition at line 79 of file URL2.php.
const Net_URL2::OPTION_SEPARATOR_INPUT = 'input_separator' |
Query variable separators when parsing the query string. Every character is considered a separator. Default is "&".
Definition at line 85 of file URL2.php.
const Net_URL2::OPTION_SEPARATOR_OUTPUT = 'output_separator' |
Query variable separator used when generating the query string. Default is "&".
Definition at line 91 of file URL2.php.
const Net_URL2::OPTION_STRICT = 'strict' |
Do strict parsing in resolve() (see RFC 3986, section 5.2.2). Default is true.
Definition at line 63 of file URL2.php.
const Net_URL2::OPTION_USE_BRACKETS = 'use_brackets' |
Represent arrays in query using PHP's [] notation. Default is true.
Definition at line 68 of file URL2.php.
The documentation for this class was generated from the following file: