From cc4ddb57a83e2c5c922f03e1151680b3e59b1263 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 13 Feb 2007 16:28:13 +0000 Subject: Added it_url::params (handles nested arrays) and use it in U() and search_url --- html.class | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'html.class') diff --git a/html.class b/html.class index ccacfea..d1fb5d2 100644 --- a/html.class +++ b/html.class @@ -315,23 +315,9 @@ function u(/* ... */) $base = preg_replace('|\0|', '', $base); $base = preg_replace('|[^\w.+!*(),:@&=/~$-]|e', 'urlencode("$0")', $base); $base = preg_replace('|^(\w+:)?//[^/]*$|', '$0/', $base); # Add slash if absolute url without a path, e.g. http://gna.ch - $queryparams = array(); + $queryparams = it_url::params($params); - foreach ($params as $key => $value) - { - if (is_array($value)) - { - foreach ($value as $arrkey => $arrvalue) - { - if (strlen($arrvalue)) - $queryparams[] = urlencode($key) . "[" . urlencode($arrkey) . "]=" . it_url::encode($arrvalue); - } - } - else if (strlen($value)) - $queryparams[] = urlencode($key) . "=" . it_url::encode($value); - } - - return $base . ($queryparams ? ("?" . join("&", $queryparams)) : ""); + return $base . ($queryparams ? "?$queryparams" : ""); } -- cgit v1.2.3