http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97645

Revision: 97645
Author:   preilly
Date:     2011-09-20 17:21:17 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
fix for bug 31012 - mobile version replaced by desktop version in a webview on 
iPad apps

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/MobileFrontend.php

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-20 16:45:53 UTC 
(rev 97644)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-20 17:21:17 UTC 
(rev 97645)
@@ -49,6 +49,7 @@
  */
 $wgMobileFrontendLogo = false;
 
+$wgMobileDomain = '.m.';
 
 $wgExtMobileFrontend = new ExtMobileFrontend();
 
@@ -57,6 +58,8 @@
 $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 
'addMobileFooter' );
 $wgExtensionFunctions[] = array( &$wgExtMobileFrontend, 'setDefaultLogo' );
 
+$wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 
'testCanonicalRedirect' );
+
 /**
  * Make the classes stripped from page content configurable. Each item will
  * be stripped from the page. See $itemsToRemove for more info
@@ -73,7 +76,7 @@
 }
 
 class ExtMobileFrontend {
-       const VERSION = '0.5.64';
+       const VERSION = '0.5.65';
 
        /**
         * @var DOMDocument
@@ -186,6 +189,12 @@
                '#ogg_player_1',
                '.nomobile',
        );
+       
+       public function testCanonicalRedirect( $request, $title, $output ) {
+               global $wgMobileDomain;
+               $host = $request->getHeader( 'HOST' );
+               return ( stristr( $host, $wgMobileDomain ) !== false ) ? false 
: true;
+       }
 
        public function addMobileFooter( &$obj, &$tpl ) {
                global $wgRequest;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to