spunQ_UrlManager Class Reference

Manages url managers. More...

List of all members.

Static Public Member Functions

static register (spunQ_IUrlManagerFactory $factory)
 Registers a spunQ_IUrlManagerFactory.
static create (spunQ_HttpEntryPoint $entryPoint, $name)
 Will create a spunQ_IUrlManager using a registerd factory.
static extractLocale (spunQ_IHttpRequest $request)
 Extracts the locale requested by the client.
static getSanitizedUri (spunQ_IHttpRequest $request)
 Sanitizes a url.
static addGlobalPrefix ($url, $locale)
 Adds the global prefix and optionally a locale definition to a url.

Static Private Member Functions

static analyzeUrl ($url, $throwException=true)
 Analyzes a url and returns various information in an associative array.

Static Private Attributes

static $factories = array()
 Registered factories, indexed by spunQ_IUrlManagerFactory::getName().


Detailed Description

Manages url managers.

spunQ_IUrlManagerFactory objects are registered at this class using register() to be later used to generate url manager objects. The entrypoint gets its url manager by passing its @urlManager annotation to create().

Definition at line 9 of file UrlManager.class.php.


Member Function Documentation

static spunQ_UrlManager::addGlobalPrefix ( url,
locale 
) [static]

Adds the global prefix and optionally a locale definition to a url.

The global prefix is a string to be prepended to all urls. If the global prefix is 'blog', for example, the string '/blog' will be prepended to the url. This value is defined as spunQ.html.uriPrefix in the spunQ configuration and might be empty, indicating the url starts at the server root.

Parameters:
$url The url string to prepend the definitions to.
$locale Locale to add to the url. The locale will be omitted if the configuration value spunQ.html.localeInUrl evaluates to false.

Definition at line 77 of file UrlManager.class.php.

static spunQ_UrlManager::analyzeUrl ( url,
throwException = true 
) [static, private]

Analyzes a url and returns various information in an associative array.

Parameters:
$url The string url to analyze
$throwException Whether the function should throw an exception if the url does not start with the global url prefix.
Returns:
array Or NULL if the url didn't match the global prefix (as the defined configuration value spunQ.html.uriPrefix). The array contains the keys
  • locale: Locale of the url. Will be NULL if the url does not contain a locale part.
  • sanitized: Url deprived of the defined global prefix and locale, with a leading slash. I.e. /myProject/en-us/page becomes /page.
Exceptions:
spunQ_HtmlException 

Definition at line 107 of file UrlManager.class.php.

static spunQ_UrlManager::create ( spunQ_HttpEntryPoint entryPoint,
name 
) [static]

Will create a spunQ_IUrlManager using a registerd factory.

Parameters:
$entrypoint The entry point to create url manager for.
$name Name of the url manager factory to use.
Returns:
spunQ_IUrlManager

Definition at line 33 of file UrlManager.class.php.

static spunQ_UrlManager::extractLocale ( spunQ_IHttpRequest request  )  [static]

Extracts the locale requested by the client.

Will use the URL to extract the url definition.

Returns:
spunQ_Locale
Exceptions:
spunQ_HtmlException If the url does not start with a declared global url prefix.

Definition at line 47 of file UrlManager.class.php.

static spunQ_UrlManager::getSanitizedUri ( spunQ_IHttpRequest request  )  [static]

Sanitizes a url.

Removes the global prefix, any locale definition and the request string. I.e. /myProject/en-us/page?foo=bar becomes /page.

Returns:
string
Exceptions:
spunQ_HtmlException If the url does not start with a declared global url prefix.

Definition at line 60 of file UrlManager.class.php.

static spunQ_UrlManager::register ( spunQ_IUrlManagerFactory factory  )  [static]

Registers a spunQ_IUrlManagerFactory.

Parameters:
$factory The factory to register.
Returns:
void

Definition at line 22 of file UrlManager.class.php.


Member Data Documentation

spunQ_UrlManager::$factories = array() [static, private]

Registered factories, indexed by spunQ_IUrlManagerFactory::getName().

Type:
array

Definition at line 15 of file UrlManager.class.php.


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

Generated on Fri Jul 1 11:12:44 2011 for spunQ3 by  doxygen 1.5.9