r93524 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93523‎ | r93524 | r93525 >
Date:14:27, 30 July 2011
Author:hartman
Status:ok
Tags:
Comment:
* Fix content-type response header for wml
* Fix content-type in wml <head>
* Fix an issue where the card index for wml was not wrapped in <p>
* Make some notes about things we should and could do in the future.
Modified paths:
  • /trunk/extensions/MobileFrontend/DeviceDetection.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/layout/application.wml.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/DeviceDetection.php
@@ -364,6 +364,7 @@
365365
366366 if ( $formatName === '' ) {
367367 if ( strpos( $acceptHeader, 'application/vnd.wap.xhtml+xml' ) !== false ) {
 368+ // Should be wap2 or in WURFL xhtmlmp
368369 $formatName = 'html';
369370 } elseif ( strpos( $acceptHeader, 'vnd.wap.wml' ) !== false ) {
370371 $formatName = 'wml';
@@ -373,4 +374,4 @@
374375 }
375376 return $formatName;
376377 }
377 -}
\ No newline at end of file
 378+}
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -218,6 +218,29 @@
219219 // ob_start( array( $this, 'DOMParse' ) );
220220 // }
221221
 222+ // WURFL documentation: http://wurfl.sourceforge.net/help_doc.php
 223+ // Determine the kind of markup
 224+ if( is_array($props) && $props['preferred_markup'] ) {
 225+ wfDebug( __METHOD__ . ": preferred markup for this device: " . $props['preferred_markup'] );
 226+ // xhtml/html: html_web_3_2, html_web_4_0
 227+ // xthml basic/xhtmlmp (wap 2.0): html_wi_w3_xhtmlbasic html_wi_oma_xhtmlmp_1_0
 228+ // chtml (imode): html_wi_imode_*
 229+ // wml (wap 1): wml_1_1, wml_1_2, wml_1_3
 230+ }
 231+ // WML options that might influence our 'style' of output
 232+ // $props['access_key_support'] (for creating easy keypad navigation)
 233+ // $props['softkey_support'] ( for creating your own menu)
 234+
 235+ // WAP2/XHTML MP
 236+ // xhtmlmp_preferred_mime_type ( the mime type with which you should serve your xhtml to this device
 237+
 238+ // HTML
 239+ // $props['pointing_method'] == touchscreen
 240+ // ajax_support_javascript
 241+ // html_preferred_dtd
 242+
 243+ // Determine
 244+
222245 if (self::$useFormat === 'mobile' ||
223246 self::$useFormat === 'mobile-wap' ) {
224247 $this->disableCaching();
@@ -340,7 +363,7 @@
341364 $card .= "<card id='{$idx}' title='{$title}'><p>{$segments[$requestedSegment]}</p>";
342365 $idx = $requestedSegment + 1;
343366 $segmentsCount = count($segments);
344 - $card .= $idx . "/" . $segmentsCount;
 367+ $card .= "<p>" . $idx . "/" . $segmentsCount . "</p>";
345368
346369 $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 'useFormat=' . self::$useFormat : '';
347370
@@ -489,7 +512,18 @@
490513 && empty( self::$search ) ) {
491514 $contentHtml = $this->javascriptize( $contentHtml );
492515 } elseif ( $this->contentFormat == 'WML' ) {
493 - $contentHtml = $this->javascriptize( $contentHtml );
 516+ header( 'Content-Type: text/vnd.wap.wml' );
 517+
 518+ // TODO: Content transformations required
 519+ // WML Validator:
 520+ // http://validator.w3.org
 521+ //
 522+ // div -> p
 523+ // no style, no class, no h1-h6, sup, sub, ol, ul, li etc.
 524+ // table requires "columns" property
 525+ // lang and dir officially unsupported (but often work on rtl phones)
 526+
 527+ // Content wrapping
494528 $contentHtml = $this->createWMLCard( $contentHtml, $title );
495529 require( 'views/layout/application.wml.php' );
496530 }
Index: trunk/extensions/MobileFrontend/views/layout/application.wml.php
@@ -7,7 +7,6 @@
88 <title>{$title}</title>
99 <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
1010 <meta name="character-set=utf-8" content="charset"/>
11 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
1211 <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
1312 </head>
1413 {$contentHtml}

Status & tagging log