Index: branches/resourceloader/phase3/includes/ResourceLoader.php |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | 'script' => null, |
221 | 221 | 'locales' => null, |
222 | 222 | 'raw' => false, |
223 | | - // An empty array is used for needs to make json_encode output [] instead of null which is shorted and |
| 223 | + // An empty array is used for needs to make FormatJson::encode output [] instead of null which is shorted and |
224 | 224 | // results in easier to work with data on the client |
225 | 225 | 'needs' => array(), |
226 | 226 | 'loader' => null, |
— | — | @@ -272,12 +272,11 @@ |
273 | 273 | 'lang' => $request->getVal( 'lang', $wgLang->getCode() ), |
274 | 274 | 'skin' => $request->getVal( 'skin', $wgDefaultSkin ), |
275 | 275 | 'debug' => $request->getVal( 'debug' ), |
276 | | - 'server' => $server, |
277 | 276 | ); |
278 | 277 | // Mediawiki's WebRequest::getBool is a bit on the annoying side - we need to allow 'true' and 'false' values |
279 | 278 | // to be converted to boolean true and false |
280 | | - $parameters['user'] = $parameters['user'] === 'true'; |
281 | | - $parameters['debug'] = $parameters['debug'] === 'true'; |
| 279 | + $parameters['user'] = $parameters['user'] === 'true' || $parameters['user']; |
| 280 | + $parameters['debug'] = $parameters['debug'] === 'true' || $parameters['debug']; |
282 | 281 | // Get the direction from the requested language |
283 | 282 | if ( !isset( $parameters['dir'] ) ) { |
284 | 283 | $lang = $wgLang->factory( $parameters['lang'] ); |
— | — | @@ -309,7 +308,8 @@ |
310 | 309 | } |
311 | 310 | // Special meta-information for the 'mediawiki' module |
312 | 311 | if ( in_array( 'mediawiki', $modules ) ) { |
313 | | - echo "mediaWiki.config.set( 'debug', " . ( $parameters['debug'] ? 'true' : 'false' ) . " );\n"; |
| 312 | + $config = array( 'server' => $server, 'debug', 'debug' => $parameters['debug'] ); |
| 313 | + echo "mediaWiki.config.set( " . FormatJson::encode( $config ) . " );\n"; |
314 | 314 | // Generate list of registrations and collect all loader scripts |
315 | 315 | $loaders = array(); |
316 | 316 | $registrations = array(); |
— | — | @@ -332,7 +332,7 @@ |
333 | 333 | // Include loaders |
334 | 334 | self::read( $loaders, true ); |
335 | 335 | // Register modules without loaders |
336 | | - echo "mediaWiki.loader.register( " . json_encode( array_values( $registrations ) ) . " );\n"; |
| 336 | + echo "mediaWiki.loader.register( " . FormatJson::encode( array_values( $registrations ) ) . " );\n"; |
337 | 337 | } |
338 | 338 | // Output non-raw modules |
339 | 339 | $blobs = MessageBlobStore::get( $modules, $parameters['lang'] ); |