From 0cc792d7243f1e3135a5fd7c64297cbca67aaf24 Mon Sep 17 00:00:00 2001 From: Git Date: Tue, 27 May 2014 08:00:28 +0000 Subject: [PATCH] Empty commit --- classes/format.class.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/classes/format.class.php b/classes/format.class.php index b7885e39..3a530d0b 100644 --- a/classes/format.class.php +++ b/classes/format.class.php @@ -141,24 +141,20 @@ public static function get_ratio($Dividend, $Divisor, $Decimal = 2) { * Gets the query string of the current page, minus the parameters in $Exclude * * @param array $Exclude Query string parameters to leave out, or blank to include all parameters. - * @return An HTML sanatized query string + * @param bool $Escape Whether to return a string prepared for HTML output + * @return An optionally HTML sanatized query string */ - public static function get_url($Exclude = false) { + public static function get_url($Exclude = false, $Escape = true) { if ($Exclude !== false) { - $QueryItems = array(); + $Separator = $Escape ? '&' : '&'; + $QueryItems = NULL; parse_str($_SERVER['QUERY_STRING'], $QueryItems); - - foreach ($QueryItems AS $Key => $Val) { - if (!in_array(strtolower($Key), $Exclude)) { - $Query[$Key] = $Val; - } + foreach ($Exclude as $Key) { + unset($QueryItems[$Key]); } - if (empty($Query)) { - return; - } - return display_str(http_build_query($Query)); + return http_build_query($QueryItems, '', $Separator); } else { - return display_str($_SERVER['QUERY_STRING']); + return $Escape ? display_str($_SERVER['QUERY_STRING']) : $_SERVER['QUERY_STRING']; } }