URI

A library for handling URI generation and resolution.

Summary
URIA library for handling URI generation and resolution.
Functions
create_uri_objectGets the appropriate URI generator class for a given object and type.
URIRepresents a URI.
Functions
getGets a string containingthe URI in the canonical format.
getRelativeGets a root-relative URI, i.e.
getPrintableLike get, but returns a printable URI, i.e.
getRelativePrintableLike getPrintable, but uses a relative URI.
appendPathAppends a path componend to the URI path, adding or removing terminal/beginning slashes as appropriate.
clearQueryStringEmpties the query string;
addQueryAdds a parameter to the URI query string.
secureSet or get whether to use a secure, i.e.

Functions

create_uri_object

function create_uri_object(&$object,  
$type = false)

Gets the appropriate URI generator class for a given object and type.  Basically, this the lazy dynamic programmer’s version of a factory pattern.

Parameters

objectThe object for which to get a URI generator.  The class of the object determines the class returned.  Note that this function supports one level of inheritance, i.e. if the class doesn’t have a URI class of its own, the parent class’s is used.
typeOptional boolean that determines what kind of URI we’re using, e.g. querystring, htaccess, or wrapper scripts.  If not specified, then the value of the URI_TYPE configuration constant is used.

Returns

A URI generator object.  The exact object type is determined by the parameters to this function call.

URI

Represents a URI.  This auto-detects the URI settings from the environment, such as the host, current path, etc., and allows the caller to override them to create other URIs.  URI strings should be built using this class.

Summary
Functions
getGets a string containingthe URI in the canonical format.
getRelativeGets a root-relative URI, i.e.
getPrintableLike get, but returns a printable URI, i.e.
getRelativePrintableLike getPrintable, but uses a relative URI.
appendPathAppends a path componend to the URI path, adding or removing terminal/beginning slashes as appropriate.
clearQueryStringEmpties the query string;
addQueryAdds a parameter to the URI query string.
secureSet or get whether to use a secure, i.e.

Functions

get

function get()

Gets a string containingthe URI in the canonical format.

getRelative

function getRelative()

Gets a root-relative URI, i.e. no host, port, or protocol.

getPrintable

function getPrintable()

Like get, but returns a printable URI, i.e. with ampersands escaped.

getRelativePrintable

function getRelativePrintable()

Like getPrintable, but uses a relative URI.

appendPath

function appendPath($path)

Appends a path componend to the URI path, adding or removing terminal/beginning slashes as appropriate.

Parameters

pathThe path to append.

clearQueryString

function clearQueryString()

Empties the query string;

addQuery

function addQuery($key,
$val)

Adds a parameter to the URI query string.

Parameters

keyThe parameter name.
valThe value for that parameter.

secure

function secure($val = '')

Set or get whether to use a secure, i.e. https, URL.

function create_uri_object(&$object,  
$type = false)
Gets the appropriate URI generator class for a given object and type.
function get()
Gets a string containingthe URI in the canonical format.
function getRelative()
Gets a root-relative URI, i.e.
function getPrintable()
Like get, but returns a printable URI, i.e.
function getRelativePrintable()
Like getPrintable, but uses a relative URI.
function appendPath($path)
Appends a path componend to the URI path, adding or removing terminal/beginning slashes as appropriate.
function clearQueryString()
Empties the query string;
function addQuery($key,
$val)
Adds a parameter to the URI query string.
function secure($val = '')
Set or get whether to use a secure, i.e.
Close