diff --git a/src/Url.php b/src/Url.php index f886989..eff949a 100644 --- a/src/Url.php +++ b/src/Url.php @@ -538,17 +538,21 @@ class Url { * * @param string $url The URL * @param string $parameter The parameter name - * @param string $value The parameter value + * @param string|null $value The parameter value (optional) * @param boolean $encode Set if parameter value must be URL encoded (optional, default: true) * * @return string The completed URL */ - public static function add_url_parameter($url, $parameter, $value, $encode=true) { + public static function add_url_parameter($url, $parameter, $value=null, $encode=true) { if (strpos($url, '?') === false) $url .= '?'; else $url .= '&'; - $url .= "$parameter=".($encode?urlencode($value):$value); + $url .= ( + is_null($value)? + $parameter: + "$parameter=".($encode?urlencode($value):$value) + ); return $url; }