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

Revision: 97876
Author:   preilly
Date:     2011-09-23 01:00:29 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
fix for TestCanonicalRedirect hook

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

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-23 01:00:11 UTC 
(rev 97875)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2011-09-23 01:00:29 UTC 
(rev 97876)
@@ -84,7 +84,7 @@
 }
 
 class ExtMobileFrontend {
-       const VERSION = '0.5.68';
+       const VERSION = '0.5.69';
 
        /**
         * @var DOMDocument
@@ -200,9 +200,8 @@
        );
        
        public function testCanonicalRedirect( $request, $title, $output ) {
-               global $wgMobileDomain;
-               $host = $request->getHeader( 'HOST' );
-               return !( stristr( $host, $wgMobileDomain ) !== false );
+               $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? 
$_SERVER['HTTP_X_DEVICE'] : '';
+               return ( !empty( $xDevice ) );
        }
 
        public function addMobileFooter( &$obj, &$tpl ) {
@@ -216,7 +215,7 @@
                        $footerlinks = $tpl->data['footerlinks'];
                        $mobileViewUrl = $wgRequest->escapeAppendQuery( 
'useformat=mobile' );
 
-                       $tpl->set('mobileview', "<a 
href='{$mobileViewUrl}'>".wfMsg( 'mobile-frontend-view')."</a>");
+                       $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>" . 
wfMsg( 'mobile-frontend-view' ) . "</a>");
                        $footerlinks['places'][] = 'mobileview';
                        $tpl->set('footerlinks', $footerlinks);
                }


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

Reply via email to