当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Dispatcher_Interface::isValidModule方法代码示例

本文整理汇总了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;
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:40,代码来源:Module.php

示例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;
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:60,代码来源:Module.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:dkplusengine,代码行数:69,代码来源:Module.php

示例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;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:83,代码来源:Module.php


注:本文中的Zend_Controller_Dispatcher_Interface::isValidModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。