AnewtURL Class Reference

This class provides static methods for easy URL manipulation. More...

List of all members.

Static Public Member Functions

static build ($path, $parameters=null)
 Build a URL from the passed parameters.
static parse ($url)
 Parse a URL into a path and an array of query parameters.


Detailed Description

This class provides static methods for easy URL manipulation.

Definition at line 14 of file url.lib.php.


Member Function Documentation

static AnewtURL::build ( path,
parameters = null 
) [static]

Build a URL from the passed parameters.

You can provide a single path string, or an array of strings, in which case each of the items in $path is a path component. The path components will be concatenated, separated by slashes.

All slashes are normalized. If the first path component has a leading slash, the resulting string will also have a leading slash and if it doesn't, the resulting string won't have one either. The same goes for the trailing slash: if the last path component ends with a slash, the resulting string will have one as well.

If $parameters is passed, a HTTP query string will be appended to the url using the this associatve array.

Example:

$url = AnewtURL::join(array('/path/to', $file), array('foo' => 'bar'));

Parameters:
$path Single string or array of strings (each item is a path component of the url)
$parameters Associative array used to build a query string (optional)
Returns:
The resulting URL path
See also:
AnewtURL::parse

Definition at line 48 of file url.lib.php.

static AnewtURL::parse ( url  )  [static]

Parse a URL into a path and an array of query parameters.

This is (partly) the inverse operation of inverse AnewtURL::build() and can be used to parse an url into a path and query parameters (the GET string).

Parameters:
$url string The url to parse.
Returns:
A (path, parameters) code containing a string and an associative array.
See also:
AnewtURL::build

Definition at line 189 of file url.lib.php.


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

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9