mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
parent
50ca1aec1a
commit
5c3eb1d796
@ -39,8 +39,6 @@ class Zend_View_Helper_QUrl extends Zend_View_Helper_Abstract
|
|||||||
$params = array();
|
$params = array();
|
||||||
}
|
}
|
||||||
return Url::fromPath($url, $params);
|
return Url::fromPath($url, $params);
|
||||||
$params = array_map('rawurlencode', $params);
|
|
||||||
return $this->view->baseUrl(vsprintf($url, $params));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Zend_View_Helper_Qlink extends Zend_View_Helper_Abstract
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($key === 'target') {
|
if ($key === 'target') {
|
||||||
$attibutes[] = 'target="'.$val.'"';
|
$attributes[] = 'target="'.$val.'"';
|
||||||
}
|
}
|
||||||
if ($key === 'style' && is_array($val)) {
|
if ($key === 'style' && is_array($val)) {
|
||||||
if (empty($val)) {
|
if (empty($val)) {
|
||||||
|
@ -94,6 +94,7 @@ class Url
|
|||||||
$urlObject->setPath($urlParts["path"]);
|
$urlObject->setPath($urlParts["path"]);
|
||||||
}
|
}
|
||||||
if (isset($urlParts["query"])) {
|
if (isset($urlParts["query"])) {
|
||||||
|
$urlParams = array();
|
||||||
parse_str($urlParts["query"], $urlParams);
|
parse_str($urlParts["query"], $urlParams);
|
||||||
$params = array_merge($urlParams, $params);
|
$params = array_merge($urlParams, $params);
|
||||||
}
|
}
|
||||||
@ -149,9 +150,10 @@ class Url
|
|||||||
*/
|
*/
|
||||||
public function getRelativeUrl()
|
public function getRelativeUrl()
|
||||||
{
|
{
|
||||||
if (empty($this->params))
|
if (empty($this->params)) {
|
||||||
return ltrim($this->path,'/');
|
return ltrim($this->path, '/');
|
||||||
return ltrim($this->path,'/').'?'.http_build_query($this->params);
|
}
|
||||||
|
return ltrim($this->path, '/').'?'.http_build_query($this->params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +169,7 @@ class Url
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a set of parameters to the query part
|
* Add a set of parameters to the query part if the keys don't exist yet
|
||||||
*
|
*
|
||||||
* @param array $params The parameters to add
|
* @param array $params The parameters to add
|
||||||
* @return $this
|
* @return $this
|
||||||
|
@ -352,6 +352,25 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testAddParamAfterCreation()
|
||||||
|
{
|
||||||
|
$url = Url::fromPath('/my/test/url.html?param=val¶m2=val2¶m3=val3', array(), new RequestMock());
|
||||||
|
$url->addParams(array(
|
||||||
|
"param4" => "val4",
|
||||||
|
"param3" => "newval3"
|
||||||
|
));
|
||||||
|
$this->assertEquals(
|
||||||
|
"val4",
|
||||||
|
$url->getParam("param4", "wrongval"),
|
||||||
|
"Asserting that a parameter can be added with addParam"
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
"val3",
|
||||||
|
$url->getParam("param3", "wrongval"),
|
||||||
|
"Asserting that addParam doesn't overwrite existing parameters"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether toString is the same as getAbsoluteUrl
|
* Test whether toString is the same as getAbsoluteUrl
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user