r22482 - htdocs/branches/beta/externals - Replace php5 only function with a custom function
Geert Janssens
gjanssens at code.gnucash.org
Thu Nov 1 11:35:31 EDT 2012
Author: gjanssens
Date: 2012-11-01 11:35:31 -0400 (Thu, 01 Nov 2012)
New Revision: 22482
Trac: http://svn.gnucash.org/trac/changeset/22482
Modified:
htdocs/branches/beta/externals/header.phtml
Log:
Replace php5 only function with a custom function
Modified: htdocs/branches/beta/externals/header.phtml
===================================================================
--- htdocs/branches/beta/externals/header.phtml 2012-11-01 14:27:16 UTC (rev 22481)
+++ htdocs/branches/beta/externals/header.phtml 2012-11-01 15:35:31 UTC (rev 22482)
@@ -6,6 +6,31 @@
$titleuservoice = T_("Request or vote enhancements for GnuCash");
$titlegplus = T_("GnuCash on Google +");
+function makeQueryString($params, $prefix = '', $removeFinalAmp = true) {
+ $queryString = '';
+ if (is_array($params)) {
+ foreach ($params as $key => $value) {
+ $correctKey = $prefix;
+ if ('' === $prefix) {
+ $correctKey .= $key;
+ } else {
+ $correctKey .= "[" . $key . "]";
+ }
+ if (!is_array($value)) {
+ $queryString .= urlencode($correctKey) . "="
+ . urlencode($value) . "&";
+ } else {
+ $queryString .= makeQueryString($value, $correctKey, false);
+ }
+ }
+ }
+ if ($removeFinalAmp === true) {
+ return substr($queryString, 0, strlen($queryString) - 1);
+ } else {
+ return $queryString;
+ }
+}
+
# This function will create a link to the given page
# reusing the get parameters that were specified
# with the option to override the language
@@ -15,7 +40,7 @@
{
$get_parms[lang] = $lang;
}
- $url_get_query = http_build_query ($get_parms);
+ $url_get_query = makeQueryString ($get_parms);
$lang_href = "$page"."?"."$url_get_query";
return $lang_href;
More information about the gnucash-changes
mailing list