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(). | |
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.
| 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.
| $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.
| $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. |
spunQ.html.uriPrefix). The array contains the keyslocale: 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.| 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.
| $entrypoint | The entry point to create url manager for. | |
| $name | Name of the url manager factory to use. |
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.
| 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.
| 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.
| $factory | The factory to register. |
Definition at line 22 of file UrlManager.class.php.
spunQ_UrlManager::$factories = array() [static, private] |
Registered factories, indexed by spunQ_IUrlManagerFactory::getName().
Definition at line 15 of file UrlManager.class.php.
1.5.9