summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian Schneider2018-02-15 15:44:50 +0100
committerChristian Schneider2018-02-15 15:44:50 +0100
commit6af639103cff531d35b18741f444db6280a8bd61 (patch)
treef6500937ed62ddc627d0dd72f6d920a40b141306 /it_url.class
parent36572cde8de29b47f94f74b9812afa443bd02567 (diff)
downloaditools-6af639103cff531d35b18741f444db6280a8bd61.tar.gz
itools-6af639103cff531d35b18741f444db6280a8bd61.tar.bz2
itools-6af639103cff531d35b18741f444db6280a8bd61.zip
Encode [] in url parameters as new tidy validates URLs and complains about it
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class7
1 files changed, 5 insertions, 2 deletions
diff --git a/it_url.class b/it_url.class
index 3a8cc41..30a1e41 100644
--- a/it_url.class
+++ b/it_url.class
@@ -707,7 +707,7 @@ static function params($params, $keys = null)
return join("&", it_url::_params($params, $keys));
}
-static function _params($params, $keys = null)
+static function _params($params, $keys = null, $finalize = true)
{
$result = array();
@@ -718,7 +718,7 @@ static function _params($params, $keys = null)
{
if (is_array($params[$key]))
{
- foreach (it_url::_params($params[$key]) as $value)
+ foreach (it_url::_params($params[$key], null, false) as $value)
{
if (strlen($value))
$result[] = it::replace(array('^([^=\[]*)' => $key . '[$1]'), $value);
@@ -728,6 +728,9 @@ static function _params($params, $keys = null)
$result[] = urlencode($key) . "=" . it_url::encode($params[$key]);
}
+ if ($finalize)
+ $result = preg_replace(['#\[#', '#\]#'], ['%5B', '%5D'], $result);
+
return $result;
}