File indexing completed on 2024-12-22 05:37:14

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_View
0017  * @subpackage Helper
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @version    $Id$
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  */
0022 
0023 /** Zend_View_Helper_Abstract.php */
0024 // require_once 'Zend/View/Helper/Abstract.php';
0025 
0026 /**
0027  * Helper for making easy links and getting urls that depend on the routes and router
0028  *
0029  * @package    Zend_View
0030  * @subpackage Helper
0031  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0032  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0033  */
0034 class Zend_View_Helper_Url extends Zend_View_Helper_Abstract
0035 {
0036     /**
0037      * Generates an url given the name of a route.
0038      *
0039      * @access public
0040      *
0041      * @param  array $urlOptions Options passed to the assemble method of the Route object.
0042      * @param  mixed $name The name of a Route to use. If null it will use the current Route
0043      * @param  bool $reset Whether or not to reset the route defaults with those provided
0044      * @return string Url for the link href attribute.
0045      */
0046     public function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true)
0047     {
0048         $router = Zend_Controller_Front::getInstance()->getRouter();
0049         return $router->assemble($urlOptions, $name, $reset, $encode);
0050     }
0051 }