From: Roland Häder Date: Fri, 30 Oct 2009 06:44:13 +0000 (+0000) Subject: Replacement for PHP < 5 added, credits and thanks to Marco K. (Germany) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=26babe73b3f66651b8018be2cf0dcfa388830361;p=mailer.git Replacement for PHP < 5 added, credits and thanks to Marco K. (Germany) --- 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] ?>