r90505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90504‎ | r90505 | r90506 >
Date:00:44, 21 June 2011
Author:preilly
Status:deferred
Tags:
Comment:
Add override to force the wap mobile rendering of layout
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -48,7 +48,7 @@
4949 'onOutputPageBeforeHTML' );
5050
5151 class ExtMobileFrontend {
52 - const VERSION = '0.5.1';
 52+ const VERSION = '0.5.2';
5353
5454 private $doc;
5555
@@ -66,6 +66,7 @@
6767 public static $format;
6868 public static $search;
6969 public static $callback;
 70+ public static $useFormat;
7071
7172 public $itemsToRemove = array(
7273 '#contentSub', # redirection notice
@@ -143,7 +144,7 @@
144145 // This is stated to be intended behavior, as per the following: [http://bugs.php.net/bug.php?id=40104]
145146
146147 $mAction = $wgRequest->getText( 'mAction' );
147 - $useFormat = $wgRequest->getText( 'useFormat' );
 148+ self::$useFormat = $wgRequest->getText( 'useFormat' );
148149 self::$format = $wgRequest->getText( 'format' );
149150 self::$requestedSegment = $wgRequest->getText( 'seg', 0 );
150151 self::$search = $wgRequest->getText( 'search' );
@@ -160,6 +161,10 @@
161162 } elseif ( self::$device['view_format'] === 'html' ) {
162163 $this->contentFormat = 'XHTML';
163164 }
 165+
 166+ if ( self::$useFormat === 'mobile-wap' ) {
 167+ $this->contentFormat = 'WML';
 168+ }
164169
165170 if ( $mAction == 'disable_mobile_site' ) {
166171 if ( $this->contentFormat == 'XHTML' ) {
@@ -172,7 +177,8 @@
173178 $props['is_wireless_device'] === 'true' &&
174179 $props['is_tablet'] === 'false' ) {
175180 ob_start( array( $this, 'DOMParse' ) );
176 - } elseif ($useFormat === 'mobile') {
 181+ } elseif (self::$useFormat === 'mobile' ||
 182+ self::$useFormat === 'mobile-wap') {
177183 ob_start( array( $this, 'DOMParse' ) );
178184 }
179185
@@ -284,14 +290,16 @@
285291 $idx = $requestedSegment + 1;
286292 $segmentsCount = count($segments);
287293 $card .= $idx . "/" . $segmentsCount;
 294+
 295+ $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 'useFormat=' . self::$useFormat : '';
288296
289297 if ( $idx < $segmentsCount ) {
290 - $card .= "<p><a href='{$_SERVER['PHP_SELF']}?seg={$idx}'>Continue ...</a></p>";
 298+ $card .= "<p><a href='{$_SERVER['PHP_SELF']}?seg={$idx}{$useFormatParam}'>Continue ...</a></p>";
291299 }
292300
293301 if ( $idx > 1 ) {
294302 $back_idx = $requestedSegment - 1;
295 - $card .= "<p><a href='{$_SERVER['PHP_SELF']}?seg={$back_idx}'>Back ...</a></p>";
 303+ $card .= "<p><a href='{$_SERVER['PHP_SELF']}?seg={$back_idx}{$useFormatParam}'>Back ...</a></p>";
296304 }
297305
298306 $card .= '</card>';

Status & tagging log