Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | } |
89 | 89 | |
90 | 90 | class ExtMobileFrontend { |
91 | | - const VERSION = '0.5.80'; |
| 91 | + const VERSION = '0.5.81'; |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @var DOMDocument |
— | — | @@ -404,22 +404,7 @@ |
405 | 405 | public function beforePageDisplayHTML( &$out, &$text ) { |
406 | 406 | global $wgContLang, $wgRequest, $wgMemc, $wgUser; |
407 | 407 | wfProfileIn( __METHOD__ ); |
408 | | - // The title |
409 | | - self::$title = $out->getTitle(); |
410 | 408 | |
411 | | - if ( Title::newMainPage()->equals( self::$title ) ) { |
412 | | - self::$isMainPage = true; |
413 | | - } |
414 | | - |
415 | | - if ( self::$title == 'Special:UserLogin' ) { |
416 | | - self::$wsLoginToken = $wgRequest->getSessionData( 'wsLoginToken' ); |
417 | | - $returnToVal = $wgRequest->getVal( 'returnto' ); |
418 | | - $returnto = ( !empty ( $returnToVal ) ) ? '&returnto=' . wfUrlencode( $returnToVal ) : ''; |
419 | | - self::$wsLoginFormAction = self::$title->getLocalURL( 'action=submitlogin&type=login' . $returnto ); |
420 | | - } |
421 | | - |
422 | | - self::$htmlTitle = $out->getHTMLTitle(); |
423 | | - |
424 | 409 | $userAgent = $_SERVER['HTTP_USER_AGENT']; |
425 | 410 | $uAmd5 = md5( $userAgent ); |
426 | 411 | |
— | — | @@ -439,14 +424,30 @@ |
440 | 425 | $props = $device->getAllCapabilities(); |
441 | 426 | $wgMemc->set( $key, $props, 86400 ); |
442 | 427 | } else { |
443 | | - $wgMemc->set( $key, "generic", 86400 ); |
444 | | - $props = "generic"; |
| 428 | + $wgMemc->set( $key, 'generic', 86400 ); |
| 429 | + $props = 'generic'; |
445 | 430 | } |
446 | 431 | } |
447 | 432 | } catch ( Exception $e ) { |
448 | 433 | // echo $e->getMessage(); |
449 | 434 | } |
| 435 | + |
| 436 | + // The title |
| 437 | + self::$title = $out->getTitle(); |
450 | 438 | |
| 439 | + if ( Title::newMainPage()->equals( self::$title ) ) { |
| 440 | + self::$isMainPage = true; |
| 441 | + } |
| 442 | + |
| 443 | + if ( self::$title == 'Special:UserLogin' ) { |
| 444 | + self::$wsLoginToken = $wgRequest->getSessionData( 'wsLoginToken' ); |
| 445 | + $returnToVal = $wgRequest->getVal( 'returnto' ); |
| 446 | + $returnto = ( !empty ( $returnToVal ) ) ? '&returnto=' . wfUrlencode( $returnToVal ) : ''; |
| 447 | + self::$wsLoginFormAction = self::$title->getLocalURL( 'action=submitlogin&type=login' . $returnto ); |
| 448 | + } |
| 449 | + |
| 450 | + self::$htmlTitle = $out->getHTMLTitle(); |
| 451 | + |
451 | 452 | // Note: The WebRequest Class calls are made in this block because |
452 | 453 | // since PHP 5.1.x, all objects have their destructors called |
453 | 454 | // before the output buffer callback function executes. |
— | — | @@ -492,9 +493,9 @@ |
493 | 494 | self::$callback = $wgRequest->getText( 'callback' ); |
494 | 495 | self::$searchField = $wgRequest->getText( 'search', '' ); |
495 | 496 | |
496 | | - $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : ''; |
| 497 | + $xDevice = !empty( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : ''; |
497 | 498 | |
498 | | - $acceptHeader = isset( $_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : ''; |
| 499 | + $acceptHeader = !empty( $_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : ''; |
499 | 500 | $device = new DeviceDetection(); |
500 | 501 | |
501 | 502 | if ( !empty( $xDevice ) ) { |
— | — | @@ -576,29 +577,6 @@ |
577 | 578 | $this->setOptInOutCookie( '' ); |
578 | 579 | } |
579 | 580 | |
580 | | - // WURFL documentation: http://wurfl.sourceforge.net/help_doc.php |
581 | | - // Determine the kind of markup |
582 | | - //if ( is_array( $props ) && isset( $props['preferred_markup'] ) && $props['preferred_markup'] ) { |
583 | | - // wfDebug( __METHOD__ . ": preferred markup for this device: " . $props['preferred_markup'] ); |
584 | | - // xhtml/html: html_web_3_2, html_web_4_0 |
585 | | - // xthml basic/xhtmlmp (wap 2.0): html_wi_w3_xhtmlbasic html_wi_oma_xhtmlmp_1_0 |
586 | | - // chtml (imode): html_wi_imode_* |
587 | | - // wml (wap 1): wml_1_1, wml_1_2, wml_1_3 |
588 | | - //} |
589 | | - // WML options that might influence our 'style' of output |
590 | | - // $props['access_key_support'] (for creating easy keypad navigation) |
591 | | - // $props['softkey_support'] ( for creating your own menu) |
592 | | - |
593 | | - // WAP2/XHTML MP |
594 | | - // xhtmlmp_preferred_mime_type ( the mime type with which you should serve your xhtml to this device |
595 | | - |
596 | | - // HTML |
597 | | - // $props['pointing_method'] == touchscreen |
598 | | - // ajax_support_javascript |
599 | | - // html_preferred_dtd |
600 | | - |
601 | | - // Determine |
602 | | - |
603 | 581 | if ( self::$useFormat === 'mobile' || |
604 | 582 | self::$useFormat === 'mobile-wap' || |
605 | 583 | !empty( $xDevice ) ) { |