本文整理汇总了PHP中Fox::getAdminKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getAdminKey方法的具体用法?PHP Fox::getAdminKey怎么用?PHP Fox::getAdminKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fox
的用法示例。
在下文中一共展示了Fox::getAdminKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: match
/**
* Matches a user submitted path. Assigns and returns an array of variables
* on a successful match.
*
* If a request object is registered, it uses its setModuleName(),
* setControllerName(), and setActionName() accessors to set those values.
* Always returns the values as an array.
*
* @param string $path Path used to match against this routing map
* @return array An array of assigned values or a false on a mismatch
*/
public function match($path, $partial = false)
{
$this->_setRequestKeys();
$values = array();
$params = array();
if (!$partial) {
$path = trim($path, self::URI_DELIMITER);
} else {
$matchedPath = $path;
}
if ($path != '') {
$path = explode(self::URI_DELIMITER, $path);
$adminKey = Fox::getAdminKey();
$adminModule = 'admin';
if ($path[0] == $adminKey) {
$path[0] = $adminModule;
} else {
if ('admin' == $path[0]) {
$path[0] = FALSE;
}
}
if ($this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) {
$values[$this->_moduleKey] = array_shift($path);
$this->_moduleValid = true;
}
if (count($path) && !empty($path[0])) {
$values[$this->_controllerKey] = array_shift($path);
}
if (count($path) && !empty($path[0])) {
$values[$this->_actionKey] = array_shift($path);
}
if ($numSegs = count($path)) {
for ($i = 0; $i < $numSegs; $i = $i + 2) {
$key = urldecode($path[$i]);
$val = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null;
$params[$key] = isset($params[$key]) ? array_merge((array) $params[$key], array($val)) : $val;
}
}
}
if ($partial) {
$this->setMatchedPath($matchedPath);
}
$this->_values = $values + $params;
return $this->_values + $this->_defaults;
}
示例2: sendForward
/**
* Forward to another controller/action.
*
* It is important to supply the unformatted names, i.e. "article"
* rather than "ArticleController". The dispatcher will do the
* appropriate formatting when the request is received.
*
* @param string $rout routing path in format of "module/controller/action"
* if "*" provided in place of module, controller or action
* then current module, controller or action will used to forward
* @param array $params
* @return void
*/
protected function sendForward($rout = '*/*/*', array $params = array())
{
$request = $this->getRequest();
$routInfo['admin'] = Fox::getAdminKey();
$urlParts = explode('/', $rout);
$module = isset($urlParts[0]) && $urlParts[0] != '*' ? $urlParts[0] : NULL;
$controller = isset($urlParts[1]) && $urlParts[1] != '*' ? $urlParts[1] : NULL;
$action = isset($urlParts[2]) && $urlParts[2] != '*' ? $urlParts[2] : NULL;
if ($module == 'admin') {
$module = $routInfo['admin'];
}
if (!empty($params)) {
$request->setParams($params);
}
if (null !== $controller) {
$request->setControllerName($controller);
// Module should only be reset if controller has been specified
if (null !== $module) {
$request->setModuleName($module);
}
}
$request->setActionName($action)->setDispatched(false);
}