blob: e0de8f9cb557bbfe3daa9e8fae1a3f05140dc159 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
/**
* Part of grauphel
*
* PHP version 5
*
* @category Tools
* @package Grauphel
* @author Christian Weiske <cweiske@cweiske.de>
* @copyright 2014 Christian Weiske
* @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
* @link http://cweiske.de/grauphel.htm
*/
namespace OCA\Grauphel\Lib;
/**
* URL helper methods
*
* @category Tools
* @package Grauphel
* @author Christian Weiske <cweiske@cweiske.de>
* @copyright 2014 Christian Weiske
* @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
* @version Release: @package_version@
* @link http://cweiske.de/grauphel.htm
*/
class UrlHelper
{
public static function addParams($url, $arParams)
{
$parts = array();
foreach($arParams as $key => $val) {
if ($val != '') {
$parts[] = urlencode($key) . '=' . urlencode($val);
}
}
$sep = (strpos($url, '?') !== false) ? '&' : '?';
return $url . $sep . implode('&', $parts);
}
}
?>
|