From 643f3aed7ead44ef22c9111826de34aae3eef566 Mon Sep 17 00:00:00 2001 From: Evan Coury Date: Tue, 8 Nov 2011 07:01:51 -0700 Subject: [PATCH] Updated ZF2 submodule and changed to segment route - Switch to segment route instead of regex route - Remove custom URL helper, using ZF-proivded one now --- library/ZendFramework | 2 +- modules/Application/configs/module.config.php | 28 +++++------------- .../src/Application/View/Helper/Url.php | 30 -------------------- 3 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 modules/Application/src/Application/View/Helper/Url.php diff --git a/library/ZendFramework b/library/ZendFramework index f4e41ab..2238faa 160000 --- a/library/ZendFramework +++ b/library/ZendFramework @@ -1 +1 @@ -Subproject commit f4e41abad2687dc32984fd93c2fc822763d5354b +Subproject commit 2238faaeb9116032814ddf87bd36d12da6f9ce61 diff --git a/modules/Application/configs/module.config.php b/modules/Application/configs/module.config.php index 1d13323..481fb13 100644 --- a/modules/Application/configs/module.config.php +++ b/modules/Application/configs/module.config.php @@ -9,21 +9,6 @@ return array( 'error' => 'Application\Controller\ErrorController', 'view' => 'Zend\View\PhpRenderer', ), - - 'Zend\View\HelperLoader' => array( - 'parameters' => array( - 'map' => array( - 'url' => 'Application\View\Helper\Url', - ), - ), - ), - - 'Zend\View\HelperBroker' => array( - 'parameters' => array( - 'loader' => 'Zend\View\HelperLoader', - ), - ), - 'Zend\View\PhpRenderer' => array( 'parameters' => array( 'resolver' => 'Zend\View\TemplatePathStack', @@ -32,20 +17,21 @@ return array( 'application' => __DIR__ . '/../views', ), ), - 'broker' => 'Zend\View\HelperBroker', ), ), ), ), - 'routes' => array( 'default' => array( - 'type' => 'Zend\Mvc\Router\Http\Regex', + 'type' => 'Zend\Mvc\Router\Http\Segment', 'options' => array( - 'regex' => '/(?P[^/]+)(/(?P[^/]+)?)?', - 'spec' => '/%controller%/%action%', + 'route' => '/[:controller[/:action]]', + 'constraints' => array( + 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + ), 'defaults' => array( - 'controller' => 'error', + 'controller' => 'index', 'action' => 'index', ), ), diff --git a/modules/Application/src/Application/View/Helper/Url.php b/modules/Application/src/Application/View/Helper/Url.php deleted file mode 100644 index 3785c47..0000000 --- a/modules/Application/src/Application/View/Helper/Url.php +++ /dev/null @@ -1,30 +0,0 @@ -router = $router; - } - - public function __invoke($params = array(), $options = array()) - { - if (null === $this->router) { - return ''; - } - - // Remove trailing '/index' from generated URLs. - $url = $this->router->assemble($params, $options); - if ((6 <= strlen($url)) && '/index' == substr($url, -6)) { - $url = substr($url, 0, strlen($url) - 6); - } - - return $url; - } -} -- 1.7.10.4