diff --git a/src/Pluf/HTTP/URL.php b/src/Pluf/HTTP/URL.php index 6c6ae27..bed8138 100644 --- a/src/Pluf/HTTP/URL.php +++ b/src/Pluf/HTTP/URL.php @@ -43,19 +43,9 @@ class Pluf_HTTP_URL */ public static function generate($action, $params=array(), $encode=true) { - if ($encode) { - $amp = '&'; - } else { - $amp = '&'; - } $url = $action; - if (count($params) > 0) { - $url .= '?'; - $params_list = array(); - foreach ($params as $key=>$value) { - $params_list[] = urlencode($key).'='.urlencode($value); - } - $url .= implode($amp, $params_list); + if (count($params)) { + $url .= '?' . http_build_query($params, '', ($encode) ? '&' : '&'); } return $url; }