From: Michael Dale Date: Thu, 1 Oct 2009 18:35:14 +0000 (+0000) Subject: * fixed json mapping issue for no-mediawiki instance X-Git-Tag: 1.31.0-rc.0~39427 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=52679fa6c344f76b2b5dbb416c3fe55b7165a771;p=lhc%2Fweb%2Fwiklou.git * fixed json mapping issue for no-mediawiki instance --- diff --git a/js2/mwEmbed/php/noMediaWikiConfig.php b/js2/mwEmbed/php/noMediaWikiConfig.php index e6b3f7d800..cf1024b928 100644 --- a/js2/mwEmbed/php/noMediaWikiConfig.php +++ b/js2/mwEmbed/php/noMediaWikiConfig.php @@ -18,8 +18,6 @@ $wgFileCacheDirectory = realpath( dirname( __FILE__ ) ) . '/script-cache'; $wgUseFileCache = true; -$wgEnableScriptLoaderJsFile = false; - // Init our wg Globals $wgJSAutoloadClasses = array(); $wgJSAutoloadLocalClasses = array(); @@ -105,28 +103,14 @@ function wfMsgNoTrans( $msgKey ) { return '<' . $msgKey . '>'; } } +/* mediaWiki abstracts the json functions with fallbacks +* here we just map directly to the call */ class FormatJson{ public static function encode($value, $isHtml=false){ - // Some versions of PHP have a broken json_encode, see PHP bug - // 46944. Test encoding an affected character (U+20000) to - // avoid this. - if (!function_exists('json_encode') || $isHtml || strtolower(json_encode("\xf0\xa0\x80\x80")) != '\ud840\udc00') { - $json = new Services_JSON(); - return $json->encode($value, $isHtml) ; - } else { - return json_encode($value); - } + return json_encode($value); } public static function decode( $value, $assoc=false ){ - if (!function_exists('json_decode') ) { - $json = new Services_JSON(); - $jsonDec = $json->decode( $value ); - if( $assoc ) - $jsonDec = wfObjectToArray( $jsonDec ); - return $jsonDec; - } else { - return json_decode( $value, $assoc ); - } + return json_decode( $value, $assoc ); } }