summaryrefslogtreecommitdiff
path: root/html.class
diff options
context:
space:
mode:
authorChristian Schneider2007-02-13 16:28:13 +0000
committerChristian Schneider2007-02-13 16:28:13 +0000
commitcc4ddb57a83e2c5c922f03e1151680b3e59b1263 (patch)
treec4b246616acfef66bf44935077bd64d5a31beea4 /html.class
parent40c23e8e6ae2579fa279416b9f2fda5874b360a7 (diff)
downloaditools-cc4ddb57a83e2c5c922f03e1151680b3e59b1263.tar.gz
itools-cc4ddb57a83e2c5c922f03e1151680b3e59b1263.tar.bz2
itools-cc4ddb57a83e2c5c922f03e1151680b3e59b1263.zip
Added it_url::params (handles nested arrays) and use it in U() and search_url
Diffstat (limited to 'html.class')
-rw-r--r--html.class18
1 files changed, 2 insertions, 16 deletions
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" : "");
}