From db2f09d46ce2f3a46be1b6f6e031492966242025 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 18 Aug 2014 23:54:32 +0200 Subject: oauth dance works --- lib/urlhelper.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/urlhelper.php (limited to 'lib/urlhelper.php') diff --git a/lib/urlhelper.php b/lib/urlhelper.php new file mode 100644 index 0000000..e0de8f9 --- /dev/null +++ b/lib/urlhelper.php @@ -0,0 +1,41 @@ + + * @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 + * @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); + } +} +?> -- cgit v1.2.3