A route that matches/assembles url paths using custom url records.
More...
List of all members.
Public Member Functions |
| assemble ($data=array(), $reset=true, $encode=false) |
| Attempt to return a path for the given route parameters.
|
| getCurrentUrl () |
| Get the last matched url record.
|
| getVersion () |
| Get the version of the route.
|
| match ($match) |
| Look for a custom url.
|
| setMatchDeleted ($matchDeleted) |
| Control whether or not route will match on deleted custom urls.
|
Static Public Member Functions |
static | getInstance (Zend_Config $config) |
| Implemented out of obligation as required by the interface.
|
Protected Attributes |
| $_currentUrl = null |
| $_matchDeleted = true |
Detailed Description
A route that matches/assembles url paths using custom url records.
- Copyright:
- 2011-2012 Perforce Software. All rights reserved
- License:
- Please see LICENSE.txt in top-level folder of this distribution.
- Version:
- 2012.2/486814
Member Function Documentation
Url_Route::assemble |
( |
$ |
data = array() , |
|
|
$ |
reset = true , |
|
|
$ |
encode = false |
|
) |
| |
Attempt to return a path for the given route parameters.
If no custom url is defined for the given params ('data') throws an exception.
- Parameters:
-
array | $data | the route parameters to assemble path for. |
bool | $reset | this parameter has no effect - we always reset |
bool | $encode | this parameter has no effect - paths are always encoded |
- Returns:
- string the assembled/matching url path.
- Exceptions:
-
Url_Route::getCurrentUrl |
( |
| ) |
|
Get the last matched url record.
- Returns:
- Url_Model_Url|null the last matched url or null if none matched.
{
return $this->_currentUrl;
}
static Url_Route::getInstance |
( |
Zend_Config $ |
config | ) |
[static] |
Implemented out of obligation as required by the interface.
Always returns a new instance of this route class.
- Parameters:
-
Zend_Config | $config | route configuration information (we ignore) |
- Returns:
- Url_Route a new instance of this route class.
Url_Route::getVersion |
( |
| ) |
|
Get the version of the route.
We do this to make the rewrite router passing the whole request to our match() method.
- Returns:
- integer route version
Url_Route::match |
( |
$ |
match | ) |
|
Look for a custom url.
- Parameters:
-
string | Zend_Controller_Request_Abstract | $match | either http request or the url path to lookup params for |
- Returns:
- array|false params for the given path or false if no matching record found.
{
$request = $match instanceof Zend_Controller_Request_Abstract ? $match : null;
$path = $request ? $request->getPathInfo() : $match;
try {
$this->_currentUrl = Url_Model_Url::fetch(
$path, array('includeDeleted' => $this->_matchDeleted)
);
$params = $this->_currentUrl->getParams();
if ($request && $request->getParam('action')) {
$params['action'] = $request->getParam('action');
}
return $params;
} catch (P4Cms_Record_NotFoundException $e) {
return false;
}
}
Url_Route::setMatchDeleted |
( |
$ |
matchDeleted | ) |
|
Control whether or not route will match on deleted custom urls.
Default behavior is to match on deleted urls (to avoid breaking links).
- Parameters:
-
bool | $matchDeleted | true to match deleted; false to ignore. |
- Returns:
- Url_Route provides fluent interface.
{
$this->_matchDeleted = (bool) $matchDeleted;
return $this;
}
Member Data Documentation
Url_Route::$_currentUrl = null [protected] |
Url_Route::$_matchDeleted = true [protected] |
The documentation for this class was generated from the following file: