r97881 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97880‎ | r97881 | r97882 >
Date:01:08, 23 September 2011
Author:preilly
Status:ok
Tags:
Comment:
mft r97879
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -84,7 +84,7 @@
8585 }
8686
8787 class ExtMobileFrontend {
88 - const VERSION = '0.5.68';
 88+ const VERSION = '0.5.70';
8989
9090 /**
9191 * @var DOMDocument
@@ -200,9 +200,12 @@
201201 );
202202
203203 public function testCanonicalRedirect( $request, $title, $output ) {
204 - global $wgMobileDomain;
205 - $host = $request->getHeader( 'HOST' );
206 - return !( stristr( $host, $wgMobileDomain ) !== false );
 204+ $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : '';
 205+ if ( empty( $xDevice ) ) {
 206+ return true; // Let the redirect happen
 207+ } else {
 208+ return false; // Prevent the redirect from occuring
 209+ }
207210 }
208211
209212 public function addMobileFooter( &$obj, &$tpl ) {
@@ -216,7 +219,7 @@
217220 $footerlinks = $tpl->data['footerlinks'];
218221 $mobileViewUrl = $wgRequest->escapeAppendQuery( 'useformat=mobile' );
219222
220 - $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>".wfMsg( 'mobile-frontend-view')."</a>");
 223+ $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>" . wfMsg( 'mobile-frontend-view' ) . "</a>");
221224 $footerlinks['places'][] = 'mobileview';
222225 $tpl->set('footerlinks', $footerlinks);
223226 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97879fix for TestCanonicalRedirect hook — fix typopreilly01:07, 23 September 2011

Status & tagging log