本文整理汇总了PHP中Zend_Controller_Dispatcher_Interface::isValidModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Dispatcher_Interface::isValidModule方法的具体用法?PHP Zend_Controller_Dispatcher_Interface::isValidModule怎么用?PHP Zend_Controller_Dispatcher_Interface::isValidModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Dispatcher_Interface
的用法示例。
在下文中一共展示了Zend_Controller_Dispatcher_Interface::isValidModule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
$this->_setRequestKeys();
$values = array();
$params = array();
$path = trim($path, self::URI_DELIMITER);
if ($path != '') {
$path = explode(self::URI_DELIMITER, $path);
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;
}
}
}
$this->_values = $values + $params;
return $this->_values + $this->_defaults;
}
示例2: 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)
{
$this->_setRequestKeys();
$values = array();
$params = array();
$path = trim($path, self::URI_DELIMITER);
if ($path != '') {
$path = explode(self::URI_DELIMITER, $path);
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;
/*
* check if key is meant as array as in index/index/key[]/one/key[]/two/key[]/three
*/
if (substr($key, -2) === '[]') {
//key is an array index
$index = substr($key, 0, strlen($key) - 2);
if (array_key_exists($index, $params)) {
if (is_array($params[$index])) {
//is already an array, ad value
$params[$index][] = $val;
} else {
//the key is already registered, it will not be overwritten
}
} else {
//create array at $index and place first value
$params[$index] = array($val);
}
} else {
//regular key
$params[$key] = $val;
}
}
}
}
$this->_values = $values + $params;
return $this->_values + $this->_defaults;
}
示例3: 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)
{
$this->_setRequestKeys();
if ($this->hasTranslator()) {
$translateMessages = $this->getTranslator()->getMessages();
}
$values = array();
$params = array();
if (!$this->isPartial()) {
$path = trim($path, self::URI_DELIMITER);
}
if ($path != '') {
$path = explode(self::URI_DELIMITER, $path);
if ($this->_dispatcher && ($this->_dispatcher->isValidModule($path[0]) || $this->hasTranslator() && !empty($translateMessages) && false !== ($moduleTranslated = array_search($path[0], $translateMessages)) && $this->_dispatcher->isValidModule($moduleTranslated))) {
$module = array_shift($path);
if ($this->hasTranslator() && !empty($translateMessages)) {
$moduleTranslated = array_search($module, $translateMessages);
if (!empty($moduleTranslated)) {
$module = $moduleTranslated;
}
}
$values[$this->_moduleKey] = $module;
$this->_moduleValid = true;
}
if (count($path) && !empty($path[0])) {
$controller = array_shift($path);
if ($this->hasTranslator() && !empty($translateMessages)) {
$controllerTranslated = array_search($controller, $translateMessages);
if (!empty($controllerTranslated)) {
$controller = $controllerTranslated;
}
}
$values[$this->_controllerKey] = $controller;
}
if (count($path) && !empty($path[0])) {
$action = array_shift($path);
if ($this->hasTranslator() && !empty($translateMessages)) {
$actionTranslated = array_search($action, $translateMessages);
if (!empty($actionTranslated)) {
$action = $actionTranslated;
}
}
$values[$this->_actionKey] = $action;
}
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 ($this->isPartial()) {
$this->setMatchedPath($path);
}
$this->_values = $values + $params;
return $this->_values + $this->_defaults;
}
示例4: 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)
{
$numbers = new Ml_Model_Numbers();
if (HOST_MODULE == "api") {
return array("controller" => "notstatic", "action" => "error", "module" => "api");
} else {
if (HOST_MODULE == "default") {
//@todo this is a workaround for another resource: the tag system
//the Zend_Controller_Router_Route_Regex don't work with utf-8
//despite trying the hack http://framework.zend.com/issues/browse/ZF-6661
//it didn't work
//clear this part of the code when everything is ok
//and only let the static=>docs
$path = explode("/", $path, 5);
if (isset($path[2]) && $path[2] == "tags" && isset($path[3])) {
//could be using regex...
$username = $path[1];
if ($username) {
$tag = urldecode($path[3]);
if (!isset($path[4])) {
$page = "1";
} else {
if (mb_substr($path[4], 0, 4) == "page") {
$tryPage = mb_substr($path[4], 4);
if ($numbers->isNaturalDbId($tryPage)) {
$page = $tryPage;
}
}
}
if (isset($page)) {
return array("username" => $username, "tag" => $tag, "page" => $page, "controller" => "tagspages", "action" => "tagpage", "module" => "default");
}
}
}
//end of workaround
return array("controller" => "static", "action" => "docs", "module" => "default");
}
}
$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);
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;
}