diff options
author | robocoder <anthon.pang@gmail.com> | 2011-07-03 02:14:26 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-07-03 02:14:26 +0400 |
commit | 24eb9e31c64df784180ac32765e1e27b3f7b6cb7 (patch) | |
tree | fb727ea32318133d6725dcd00dd6c8a04d954754 /libs/upgradephp | |
parent | 3d44c9d429e884f6ce91b5d236dfc809f4fd55c1 (diff) |
fixes #2534 (I think)...output looked ok with de_DE.UTF-8
git-svn-id: http://dev.piwik.org/svn/trunk@4967 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/upgradephp')
-rw-r--r-- | libs/upgradephp/upgrade.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/upgradephp/upgrade.php b/libs/upgradephp/upgrade.php index c6dee9fe62..90677cf8c8 100644 --- a/libs/upgradephp/upgrade.php +++ b/libs/upgradephp/upgrade.php @@ -109,6 +109,9 @@ if(!defined('E_USER_DEPRECATED')) { define('E_USER_DEPRECATED', 16384); } if (!function_exists("json_encode")) { function json_encode($var, /*emu_args*/$obj=FALSE) { + #-- handle locale differences + $locale = localeconv(); + #-- prepare JSON string $json = ""; @@ -154,9 +157,16 @@ if (!function_exists("json_encode")) { elseif ($var === NULL) { $json = "null"; } - elseif (is_int($var) || is_float($var)) { + elseif (is_int($var)) { $json = "$var"; } + elseif (is_float($var)) { + $json = str_replace( + array($locale['mon_thousands_sep'], $locale['mon_decimal_point']), + array('', '.'), + $var + ); + } #-- something went wrong else { |