r98427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98426‎ | r98427 | r98428 >
Date:18:38, 29 September 2011
Author:preilly
Status:resolved
Tags:
Comment:
fix for bug 31240 - android browsers render content poorly when viewing desktop view with .m
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -84,7 +84,7 @@
8585 }
8686
8787 class ExtMobileFrontend {
88 - const VERSION = '0.5.70';
 88+ const VERSION = '0.5.71';
8989
9090 /**
9191 * @var DOMDocument
@@ -226,6 +226,12 @@
227227 wfProfileOut( __METHOD__ );
228228 return true;
229229 }
 230+
 231+ private function removeQueryStringParameter( $url, $field ) {
 232+ $url = preg_replace( '/(.*)(\?|&)' . $field . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&' );
 233+ $url = substr( $url, 0, -1 );
 234+ return $url;
 235+ }
230236
231237 public function getMsg() {
232238 global $wgUser, $wgContLang, $wgRequest, $wgServer, $wgMobileRedirectFormAction, $wgMobileDomain;
@@ -234,7 +240,8 @@
235241 self::$disableImagesURL = $wgRequest->escapeAppendQuery( 'disableImages=1' );
236242 self::$enableImagesURL = $wgRequest->escapeAppendQuery( 'enableImages=1' );
237243 self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=disable_mobile_site' );
238 - self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=view_normal_site' );
 244+ self::$viewNormalSiteURL = str_replace( $wgMobileDomain, '.', $wgRequest->getFullRequestURL() );
 245+ self::$viewNormalSiteURL = $this->removeQueryStringParameter( self::$viewNormalSiteURL, 'useformat' );
239246 self::$currentURL = $wgRequest->getFullRequestURL();
240247 self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 'mobileaction=leave_feedback' );
241248

Follow-up revisions

RevisionCommit summaryAuthorDate
r98442fix for r98427 to avoid false positives on mobile domain removalpreilly20:28, 29 September 2011
r98448mft r98427 r98442 r98445preilly21:02, 29 September 2011
r98449mft r98427 r98442 r98445preilly21:02, 29 September 2011

Status & tagging log