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