import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -50,7 +50,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
* @var string
|
||||
*/
|
||||
protected $_matchedPath = null;
|
||||
|
||||
|
||||
/**
|
||||
* Get the version of the route
|
||||
*
|
||||
@ -60,7 +60,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set partially matched path
|
||||
*
|
||||
@ -71,7 +71,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
$this->_matchedPath = $path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get partially matched path
|
||||
*
|
||||
@ -81,10 +81,10 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
return $this->_matchedPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check or set wether this is an abstract route or not
|
||||
*
|
||||
*
|
||||
* @param boolean $flag
|
||||
* @return boolean
|
||||
*/
|
||||
@ -93,17 +93,17 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
if ($flag !== null) {
|
||||
$this->_isAbstract = $flag;
|
||||
}
|
||||
|
||||
|
||||
return $this->_isAbstract;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new chain
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Router_Route_Abstract $route
|
||||
* @param string $separator
|
||||
* @return Zend_Controller_Router_Route_Chain
|
||||
*/
|
||||
*/
|
||||
public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
|
||||
{
|
||||
require_once 'Zend/Controller/Router/Route/Chain.php';
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Chain.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Chain.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -46,10 +46,10 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
$defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
|
||||
return new self($config->route, $defs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a route to this chain
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Router_Route_Abstract $route
|
||||
* @param string $separator
|
||||
* @return Zend_Controller_Router_Route_Chain
|
||||
@ -79,29 +79,29 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
foreach ($this->_routes as $key => $route) {
|
||||
if ($key > 0 && $matchedPath !== null) {
|
||||
$separator = substr($subPath, 0, strlen($this->_separators[$key]));
|
||||
|
||||
|
||||
if ($separator !== $this->_separators[$key]) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$subPath = substr($subPath, strlen($separator));
|
||||
}
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
|
||||
$match = $subPath;
|
||||
} else {
|
||||
$request->setPathInfo($subPath);
|
||||
$match = $request;
|
||||
$match = $request;
|
||||
}
|
||||
|
||||
|
||||
$res = $route->match($match, true);
|
||||
if ($res === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$matchedPath = $route->getMatchedPath();
|
||||
|
||||
|
||||
if ($matchedPath !== null) {
|
||||
$subPath = substr($subPath, strlen($matchedPath));
|
||||
$separator = substr($subPath, 0, strlen($this->_separators[$key]));
|
||||
@ -109,9 +109,9 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
|
||||
$values = $res + $values;
|
||||
}
|
||||
|
||||
|
||||
$request->setPathInfo($path);
|
||||
|
||||
|
||||
if ($subPath !== '' && $subPath !== false) {
|
||||
return false;
|
||||
}
|
||||
@ -129,17 +129,17 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
{
|
||||
$value = '';
|
||||
$numRoutes = count($this->_routes);
|
||||
|
||||
|
||||
foreach ($this->_routes as $key => $route) {
|
||||
if ($key > 0) {
|
||||
$value .= $this->_separators[$key];
|
||||
}
|
||||
|
||||
|
||||
$value .= $route->assemble($data, $reset, $encode, (($numRoutes - 1) > $key));
|
||||
|
||||
|
||||
if (method_exists($route, 'getVariables')) {
|
||||
$variables = $route->getVariables();
|
||||
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
$data[$variable] = null;
|
||||
}
|
||||
@ -151,7 +151,7 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
|
||||
/**
|
||||
* Set the request object for this and the child routes
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract|null $request
|
||||
* @return void
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Module.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Module.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -80,11 +80,11 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
public static function getInstance(Zend_Config $config)
|
||||
{
|
||||
$frontController = Zend_Controller_Front::getInstance();
|
||||
|
||||
|
||||
$defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
|
||||
$dispatcher = $frontController->getDispatcher();
|
||||
$request = $frontController->getRequest();
|
||||
|
||||
|
||||
return new self($defs, $dispatcher, $request);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
|
||||
$values = array();
|
||||
$params = array();
|
||||
|
||||
|
||||
if (!$partial) {
|
||||
$path = trim($path, self::URI_DELIMITER);
|
||||
} else {
|
||||
@ -182,7 +182,7 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($partial) {
|
||||
$this->setMatchedPath($matchedPath);
|
||||
}
|
||||
@ -233,9 +233,10 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
unset($params[$this->_actionKey]);
|
||||
|
||||
foreach ($params as $key => $value) {
|
||||
$key = ($encode) ? urlencode($key) : $key;
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $arrayValue) {
|
||||
if ($encode) $arrayValue = urlencode($arrayValue);
|
||||
$arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue;
|
||||
$url .= '/' . $key;
|
||||
$url .= '/' . $arrayValue;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Regex.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Regex.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -63,7 +63,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Matches a user submitted path with a previously defined route.
|
||||
* Assigns and returns an array of defaults on a successful match.
|
||||
@ -79,13 +79,13 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
} else {
|
||||
$regex = '#^' . $this->_regex . '#i';
|
||||
}
|
||||
|
||||
|
||||
$res = preg_match($regex, $path, $values);
|
||||
|
||||
|
||||
if ($res === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($partial) {
|
||||
$this->setMatchedPath($values[0]);
|
||||
}
|
||||
@ -185,7 +185,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
foreach ($mergedData as $key => &$value) {
|
||||
$value = urlencode($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($mergedData);
|
||||
|
||||
@ -220,7 +220,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getDefaults() {
|
||||
return $this->_defaults;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all variables which are used by the route
|
||||
*
|
||||
@ -229,7 +229,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getVariables()
|
||||
{
|
||||
$variables = array();
|
||||
|
||||
|
||||
foreach ($this->_map as $key => $value) {
|
||||
if (is_numeric($key)) {
|
||||
$variables[] = $value;
|
||||
@ -237,7 +237,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
$variables[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Static.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Static.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -42,7 +42,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
|
||||
public function getVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates route based on passed Zend_Config structure
|
||||
*
|
||||
@ -85,7 +85,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
|
||||
return $this->_defaults;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user