Index: trunk/phase3/includes/ResourceLoaderContext.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $this->direction = $request->getVal( 'dir' ); |
51 | 51 | $this->skin = $request->getVal( 'skin' ); |
52 | 52 | $this->user = $request->getVal( 'user' ); |
53 | | - $this->debug = $request->getBool( 'debug' ) && $request->getVal( 'debug' ) === 'true'; |
| 53 | + $this->debug = $request->getFuzzyBool( 'debug' ); |
54 | 54 | $this->only = $request->getVal( 'only' ); |
55 | 55 | $this->version = $request->getVal( 'version' ); |
56 | 56 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2286,7 +2286,7 @@ |
2287 | 2287 | // TODO: Divide off modules starting with "user", and add the user parameter to them |
2288 | 2288 | $query = array( |
2289 | 2289 | 'lang' => $wgLang->getCode(), |
2290 | | - 'debug' => ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) == 'true' ) ? 'true' : 'false', |
| 2290 | + 'debug' => $wgRequest->getFuzzyBool( 'debug' ) ? 'true' : 'false', |
2291 | 2291 | 'skin' => $wgUser->getSkin()->getSkinName(), |
2292 | 2292 | 'only' => $only, |
2293 | 2293 | ); |
— | — | @@ -2357,7 +2357,7 @@ |
2358 | 2358 | $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n"; |
2359 | 2359 | |
2360 | 2360 | // Script and Messages "only" |
2361 | | - if ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) !== 'false' ) { |
| 2361 | + if ( $wgRequest->getFuzzyBool( 'debug' ) ) { |
2362 | 2362 | // Scripts |
2363 | 2363 | foreach ( $this->getModuleScripts() as $name ) { |
2364 | 2364 | $scripts .= self::makeResourceLoaderLink( $sk, $name, 'scripts' ); |
— | — | @@ -2526,7 +2526,7 @@ |
2527 | 2527 | } |
2528 | 2528 | |
2529 | 2529 | // Support individual script requests in debug mode |
2530 | | - if ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) !== 'false' ) { |
| 2530 | + if ( $wgRequest->getFuzzyBool( 'debug' ) ) { |
2531 | 2531 | foreach ( $this->getModuleStyles() as $name ) { |
2532 | 2532 | $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles' ); |
2533 | 2533 | } |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -347,6 +347,19 @@ |
348 | 348 | public function getBool( $name, $default = false ) { |
349 | 349 | return $this->getVal( $name, $default ) ? true : false; |
350 | 350 | } |
| 351 | + |
| 352 | + /** |
| 353 | + * Fetch a boolean value from the input or return $default if not set. |
| 354 | + * Unlike getBool, the string "false" will result in boolean false, which is |
| 355 | + * useful when interpreting information sent from JavaScript. |
| 356 | + * |
| 357 | + * @param $name String |
| 358 | + * @param $default Boolean |
| 359 | + * @return Boolean |
| 360 | + */ |
| 361 | + public function getFuzzyBool( $name, $default = false ) { |
| 362 | + return $this->getBool( $name, $default ) && $this->getVal( $name ) !== 'false'; |
| 363 | + } |
351 | 364 | |
352 | 365 | /** |
353 | 366 | * Return true if the named value is set in the input, whatever that |