Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | 'onOutputPageBeforeHTML' ); |
50 | 50 | |
51 | 51 | class ExtMobileFrontend { |
52 | | - const VERSION = '0.5.1'; |
| 52 | + const VERSION = '0.5.2'; |
53 | 53 | |
54 | 54 | private $doc; |
55 | 55 | |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | public static $format; |
68 | 68 | public static $search; |
69 | 69 | public static $callback; |
| 70 | + public static $useFormat; |
70 | 71 | |
71 | 72 | public $itemsToRemove = array( |
72 | 73 | '#contentSub', # redirection notice |
— | — | @@ -143,7 +144,7 @@ |
144 | 145 | // This is stated to be intended behavior, as per the following: [http://bugs.php.net/bug.php?id=40104] |
145 | 146 | |
146 | 147 | $mAction = $wgRequest->getText( 'mAction' ); |
147 | | - $useFormat = $wgRequest->getText( 'useFormat' ); |
| 148 | + self::$useFormat = $wgRequest->getText( 'useFormat' ); |
148 | 149 | self::$format = $wgRequest->getText( 'format' ); |
149 | 150 | self::$requestedSegment = $wgRequest->getText( 'seg', 0 ); |
150 | 151 | self::$search = $wgRequest->getText( 'search' ); |
— | — | @@ -160,6 +161,10 @@ |
161 | 162 | } elseif ( self::$device['view_format'] === 'html' ) { |
162 | 163 | $this->contentFormat = 'XHTML'; |
163 | 164 | } |
| 165 | + |
| 166 | + if ( self::$useFormat === 'mobile-wap' ) { |
| 167 | + $this->contentFormat = 'WML'; |
| 168 | + } |
164 | 169 | |
165 | 170 | if ( $mAction == 'disable_mobile_site' ) { |
166 | 171 | if ( $this->contentFormat == 'XHTML' ) { |
— | — | @@ -172,7 +177,8 @@ |
173 | 178 | $props['is_wireless_device'] === 'true' && |
174 | 179 | $props['is_tablet'] === 'false' ) { |
175 | 180 | ob_start( array( $this, 'DOMParse' ) ); |
176 | | - } elseif ($useFormat === 'mobile') { |
| 181 | + } elseif (self::$useFormat === 'mobile' || |
| 182 | + self::$useFormat === 'mobile-wap') { |
177 | 183 | ob_start( array( $this, 'DOMParse' ) ); |
178 | 184 | } |
179 | 185 | |
— | — | @@ -284,14 +290,16 @@ |
285 | 291 | $idx = $requestedSegment + 1; |
286 | 292 | $segmentsCount = count($segments); |
287 | 293 | $card .= $idx . "/" . $segmentsCount; |
| 294 | + |
| 295 | + $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 'useFormat=' . self::$useFormat : ''; |
288 | 296 | |
289 | 297 | 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>"; |
291 | 299 | } |
292 | 300 | |
293 | 301 | if ( $idx > 1 ) { |
294 | 302 | $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>"; |
296 | 304 | } |
297 | 305 | |
298 | 306 | $card .= '</card>'; |