Perforce Chronicle 2012.2/486814
API Documentation
|
Extended version of the standard http request object with specialized knowledge of the convention for embedding a site branch name in path info (e.g. More...
Public Member Functions | |
getBranchBaseUrl () | |
Get the base url with the branch embedded (if one is present). | |
getBranchlessPath () | |
Get the request path info, but with the embedded branch name removed. | |
getBranchName () | |
Get the branch name in this request's path info (if one is present). | |
getPathInfo () | |
Extended to fix a problem where explicitly setting the path to an empty string always re-generated the path from server/environment variables. | |
Protected Attributes | |
$_branch = false | |
$_pathInfo = null |
Extended version of the standard http request object with specialized knowledge of the convention for embedding a site branch name in path info (e.g.
'/-dev-/module/controller/action').
See P4Cms_Site for additional information.
P4Cms_Controller_Request_Http::getBranchBaseUrl | ( | ) |
Get the base url with the branch embedded (if one is present).
{ $baseUrl = trim($this->getBaseUrl(), '/'); return $this->getBranchName() ? $baseUrl . '/-' . $this->getBranchName() . '-' : $baseUrl; }
P4Cms_Controller_Request_Http::getBranchlessPath | ( | ) |
Get the request path info, but with the embedded branch name removed.
{ $pattern = '#^/?-' . $this->getBranchName() . '-/?#'; return preg_replace($pattern, '', $this->getPathInfo()); }
P4Cms_Controller_Request_Http::getBranchName | ( | ) |
Get the branch name in this request's path info (if one is present).
For example: '/-dev-/path' would produce 'dev'.
{ if ($this->_branch === false) { $this->_branch = preg_match('#^/-([^/]+)-#', $this->getPathInfo(), $matches) ? $matches[1] : null; } return $this->_branch; }
P4Cms_Controller_Request_Http::getPathInfo | ( | ) |
Extended to fix a problem where explicitly setting the path to an empty string always re-generated the path from server/environment variables.
{ if ($this->_pathInfo === null) { $this->setPathInfo(); } return $this->_pathInfo; }
P4Cms_Controller_Request_Http::$_branch = false [protected] |
P4Cms_Controller_Request_Http::$_pathInfo = null [protected] |