Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php |
— | — | @@ -304,6 +304,9 @@ |
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
| 308 | + * Invocation of BeforePageRedirect hook. |
| 309 | + * |
| 310 | + * Ensures URLs are handled properly for select special pages. |
308 | 311 | * @param $out OutputPage |
309 | 312 | * @param $redirect |
310 | 313 | * @param $code |
— | — | @@ -311,21 +314,21 @@ |
312 | 315 | */ |
313 | 316 | public function beforePageRedirect( $out, &$redirect, &$code ) { |
314 | 317 | wfProfileIn( __METHOD__ ); |
| 318 | + |
315 | 319 | $shouldDisplayMobileView = $this->shouldDisplayMobileView(); |
| 320 | + if ( !$shouldDisplayMobileView ) { |
| 321 | + wfProfileOut( __METHOD__ ); |
| 322 | + return true; |
| 323 | + } |
| 324 | + |
316 | 325 | if ( $out->getTitle()->isSpecial( 'Userlogin' ) ) { |
317 | | - if ( $shouldDisplayMobileView ) { |
318 | | - $forceHttps = true; |
319 | | - $redirect = $this->getMobileUrl( $redirect, $forceHttps ); |
320 | | - } |
321 | | - } else if ( $out->getTitle()->isSpecial( 'Randompage' ) ) { |
322 | | - if ( $shouldDisplayMobileView ) { |
323 | | - $redirect = $this->getMobileUrl( $redirect ); |
324 | | - } |
325 | | - } else if ( $out->getTitle()->isSpecial( 'Search' ) ) { |
326 | | - if ( $shouldDisplayMobileView ) { |
327 | | - $redirect = $this->getMobileUrl( $redirect ); |
328 | | - } |
| 326 | + $forceHttps = true; |
| 327 | + $redirect = $this->getMobileUrl( $redirect, $forceHttps ); |
| 328 | + } else if ( $out->getTitle()->isSpecial( 'Randompage' ) || |
| 329 | + $out->getTitle()->isSpecial( 'Search' ) ) { |
| 330 | + $redirect = $this->getMobileUrl( $redirect ); |
329 | 331 | } |
| 332 | + |
330 | 333 | wfProfileOut( __METHOD__ ); |
331 | 334 | return true; |
332 | 335 | } |