PHP Class Horde_Url, horde

Author: Jan Schneider ([email protected])
Author: Michael Slusarz ([email protected])
Datei anzeigen Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$anchor string The anchor string (a/k/a fragment).
$parameters array The keys are paramter names, the values parameter values. Array values will be added to the URL using name[]=value notation.
$pathInfo string Any PATH_INFO to be added to the URL.
$raw boolean Whether to output the URL in the raw URL format or HTML-encoded.
$toStringCallback callback A callback function to use when converting to a string.
$url string The basic URL, without query parameters.

Protected Properties

Property Type Description
$_cache array Cached parameter list for use in toString().

Public Methods

Method Description
__construct ( string | Horde_Url $url = '', boolean $raw = null ) Constructor.
__toString ( ) : string Creates the full URL string.
add ( mixed $parameters, string $value = null ) : Horde_Url Adds one or more query parameters.
copy ( ) : Horde_Url Returns a clone of this object. Useful for chaining.
link ( array $attributes = [] ) : string Generates a HTML link tag out of this URL.
redirect ( ) Sends a redirect request to the browser to the URL in this object.
remove ( $parameters ) : Horde_Url Removes one ore more parameters.
setAnchor ( string $anchor ) : Horde_Url Sets the URL anchor.
setRaw ( boolean $raw ) : Horde_Url Sets the $raw value. This call can be chained.
setScheme ( string $scheme = 'http', boolean $replace = false ) : Horde_Url Sets the URL scheme.
toString ( boolean $raw = false, boolean $full = true ) : string Creates the full URL string.
unique ( ) : Horde_Url Add a unique parameter to the URL to aid in cache-busting.
uriB64Decode ( string $string ) : string Decode URL-safe base64 data, dealing with missing '='.
uriB64Encode ( string $string ) : string URL-safe base64 encoding, with trimmed '='.

Protected Methods

Method Description
_getParameters ( ) : array Return a formatted list of URL parameters.

Method Details

__construct() public method

Constructor.
public __construct ( string | Horde_Url $url = '', boolean $raw = null )
$url string | Horde_Url The basic URL, with or without query parameters.
$raw boolean Whether to output the URL in the raw URL format or HTML-encoded.

__toString() public method

Creates the full URL string.
public __toString ( ) : string
return string The string representation of this object.

_getParameters() protected method

Return a formatted list of URL parameters.
protected _getParameters ( ) : array
return array Parameter list.

add() public method

Adds one or more query parameters.
public add ( mixed $parameters, string $value = null ) : Horde_Url
$parameters mixed Either the name value or an array of name/value pairs.
$value string If specified, the value part ($parameters is then assumed to just be the parameter name).
return Horde_Url This (modified) object, to allow chaining.

copy() public method

Returns a clone of this object. Useful for chaining.
public copy ( ) : Horde_Url
return Horde_Url A clone of this object.

redirect() public method

Sends a redirect request to the browser to the URL in this object.
public redirect ( )

remove() public method

Removes one ore more parameters.
public remove ( $parameters ) : Horde_Url
return Horde_Url This (modified) object, to allow chaining.

setAnchor() public method

Sets the URL anchor.
public setAnchor ( string $anchor ) : Horde_Url
$anchor string An anchor to add.
return Horde_Url This (modified) object, to allow chaining.

setRaw() public method

Sets the $raw value. This call can be chained.
public setRaw ( boolean $raw ) : Horde_Url
$raw boolean Whether to output the URL in the raw URL format or HTML-encoded.
return Horde_Url This object, to allow chaining.

setScheme() public method

Sets the URL scheme.
public setScheme ( string $scheme = 'http', boolean $replace = false ) : Horde_Url
$scheme string The URL scheme.
$replace boolean Force using $scheme, even if it already exists?
return Horde_Url This object, to allow chaining.

toString() public method

Creates the full URL string.
public toString ( boolean $raw = false, boolean $full = true ) : string
$raw boolean Whether to output the URL in the raw URL format or HTML-encoded.
$full boolean Output the full URL?
return string The string representation of this object.

unique() public method

Add a unique parameter to the URL to aid in cache-busting.
public unique ( ) : Horde_Url
return Horde_Url This (modified) object, to allow chaining.

uriB64Decode() public static method

Decode URL-safe base64 data, dealing with missing '='.
public static uriB64Decode ( string $string ) : string
$string string Encoded data.
return string Decoded data.

uriB64Encode() public static method

URL-safe base64 encoding, with trimmed '='.
public static uriB64Encode ( string $string ) : string
$string string String to encode.
return string URL-safe, base64 encoded data.

Property Details

$_cache protected_oe property

Cached parameter list for use in toString().
protected array $_cache
return array

$anchor public_oe property

The anchor string (a/k/a fragment).
public string $anchor
return string

$parameters public_oe property

The keys are paramter names, the values parameter values. Array values will be added to the URL using name[]=value notation.
public array $parameters
return array

$pathInfo public_oe property

Any PATH_INFO to be added to the URL.
public string $pathInfo
return string

$raw public_oe property

Whether to output the URL in the raw URL format or HTML-encoded.
public bool $raw
return boolean

$toStringCallback public_oe property

A callback function to use when converting to a string.
public callback $toStringCallback
return callback

$url public_oe property

The basic URL, without query parameters.
public string $url
return string