diff options
Diffstat (limited to 'modules/Url.php')
-rw-r--r-- | modules/Url.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/Url.php b/modules/Url.php index de672847d9..72df3763c3 100644 --- a/modules/Url.php +++ b/modules/Url.php @@ -1,6 +1,21 @@ <?php class Piwik_Url { + + static function getCurrentQueryStringWithParametersModified( $params ) + { + $queryString = Piwik_Url::getCurrentQueryString(); + $queryString = htmlspecialchars($queryString); + $urlValues = Piwik_Common::getArrayFromQueryString($queryString); + // var_dump($urlValues); + foreach($params as $key => $value) + { + $urlValues[$key] = $value; + } + + return '?' . http_build_query($urlValues); + } + static public function redirectToUrl( $url ) { header("Location: $url"); @@ -30,6 +45,21 @@ class Piwik_Url . self::getCurrentScriptName() ; } + /** + * Ending with / + */ + static public function getCurrentUrlWithoutFileName() + { + + $host = self::getCurrentHost(); + $queryString = self::getCurrentScriptName() ; + + //add a fake letter case /test/test2/ returns /test which is not expected + $urlDir = dirname ($queryString . 'x'); + return $host.$urlDir.'/'; + + } + static public function getCurrentScriptName() { $url = ''; |