From 3c971e8f36463850f4e8e3b2324ff1c12dbf2682 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Jul 2011 18:11:05 -0500 Subject: [PATCH] Zend\Uri: Updated Sitemap view helper to use new URI API --- .../Zend/View/Helper/Navigation/Sitemap.php | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index 7a1a8a48d8e..91b60c86c21 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -24,8 +24,11 @@ */ namespace Zend\View\Helper\Navigation; -use Zend\Navigation\AbstractPage, +use DOMDocument, + RecursiveIteratorIterator, + Zend\Navigation\AbstractPage, Zend\Navigation\Container, + Zend\Uri, Zend\View; /** @@ -33,16 +36,6 @@ * * @link http://www.sitemaps.org/protocol.php * - * @uses DOMDocument - * @uses RecursiveIteratorIterator - * @uses \Zend\Uri\Url - * @uses \Zend\Uri\Exception - * @uses \Zend\Validator\Sitemap\Changefreq - * @uses \Zend\Validator\Sitemap\Lastmod - * @uses \Zend\Validator\Sitemap\Loc - * @uses \Zend\Validator\Sitemap\Priority - * @uses \Zend\View\Exception - * @uses \Zend\View\Helper\Navigation\AbstractHelper * @category Zend * @package Zend_View * @subpackage Helper @@ -224,21 +217,21 @@ public function getUseSchemaValidation() * * @param string $serverUrl server URL to set (only * scheme and host) - * @throws \Zend\Uri\Exception if invalid server URL - * @return \Zend\View\Helper\Navigation\Sitemap fluent interface, returns + * @throws Uri\Exception if invalid server URL + * @return Sitemap fluent interface, returns * self */ public function setServerUrl($serverUrl) { - $uri = new \Zend\Uri\Url($serverUrl); + $uri = Uri\UriFactory::factory($serverUrl); $uri->setFragment(''); $uri->setPath(''); $uri->setQuery(''); if ($uri->isValid()) { - $this->_serverUrl = $uri->generate(); + $this->_serverUrl = $uri->toString(); } else { - $e = new \Zend\Uri\Exception(sprintf( + $e = new Uri\Exception\InvalidUriException(sprintf( 'Invalid server URL: "%s"', $serverUrl)); $e->setView($this->view); @@ -347,7 +340,7 @@ public function getDomSitemap(Container $container = null) } // create document - $dom = new \DOMDocument('1.0', 'UTF-8'); + $dom = new DOMDocument('1.0', 'UTF-8'); $dom->formatOutput = $this->getFormatOutput(); // ...and urlset (root) element @@ -355,8 +348,8 @@ public function getDomSitemap(Container $container = null) $dom->appendChild($urlSet); // create iterator - $iterator = new \RecursiveIteratorIterator($container, - \RecursiveIteratorIterator::SELF_FIRST); + $iterator = new RecursiveIteratorIterator($container, + RecursiveIteratorIterator::SELF_FIRST); $maxDepth = $this->getMaxDepth(); if (is_int($maxDepth)) {