From 26babe73b3f66651b8018be2cf0dcfa388830361 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 30 Oct 2009 06:44:13 +0000 Subject: [PATCH] Replacement for PHP < 5 added, credits and thanks to Marco K. (Germany) --- inc/functions.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 6bf29c4d55..2d4fcf45df 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -3576,5 +3576,29 @@ if (!function_exists('html_entity_decode')) { } } // END - if +if (!function_exists('http_build_query')) { + // Taken from documentation on www.php.net, credits to Marco K. (Germany) + function http_build_query($data, $prefix='', $sep='', $key='') { + $ret = array(); + foreach ((array)$data as $k => $v) { + if (is_int($k) && $prefix != null) { + $k = urlencode($prefix . $k); + } // END - if + + if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']'; + + if (is_array($v) || is_object($v)) { + array_push($ret, http_build_query($v, '', $sep, $k)); + } else { + array_push($ret, $k.'='.urlencode($v)); + } + } // END - foreach + + if (empty($sep)) $sep = ini_get('arg_separator.output'); + + return implode($sep, $ret); + } +}// // END - if + // [EOF] ?> -- 2.39.2