Add QUrl.php view helper

refs #4301
This commit is contained in:
Eric Lippmann 2013-06-27 13:32:50 +02:00
parent 9de6e4f950
commit 771cfbf4eb
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?php
use Icinga\Web\Url;
class Zend_View_Helper_QUrl extends Zend_View_Helper_Abstract
{
public function qUrl()
{
$params = func_get_args();
$url = array_shift($params);
if (isset($params[0])) {
$params = $params[0];
} else {
$params = array();
}
return Url::create($url, $params);
$params = array_map('rawurlencode', $params);
return $this->view->baseUrl(vsprintf($url, $params));
}
}