r98806 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98805‎ | r98806 | r98807 >
Date:20:55, 3 October 2011
Author:preilly
Status:ok
Tags:
Comment:
mft r98804
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/application.wml.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -206,7 +206,7 @@
207207 return true; // Let the redirect happen
208208 } else {
209209 if ( $title->getNamespace() == NS_SPECIAL ) {
210 - list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
 210+ list( $name, $subpage ) = SpecialPage::resolveAlias( $title->getDBkey() );
211211 if ( $name ) {
212212 $title = SpecialPage::getTitleFor( $name, $subpage );
213213 }
@@ -803,7 +803,7 @@
804804 $segmentsCount = count( $segments );
805805 $card .= "<p>" . $idx . "/" . $segmentsCount . "</p>";
806806
807 - $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 'useformat=' . self::$useFormat : '';
 807+ $useFormatParam = ( isset( self::$useFormat ) ) ? '&amp;' . 'useformat=' . self::$useFormat : '';
808808
809809 // Title::getLocalUrl doesn't work at this point since PHP 5.1.x, all objects have their destructors called
810810 // before the output buffer callback function executes.
@@ -817,7 +817,7 @@
818818 $delimiter = ( !empty( $qs ) ) ? '?' : '';
819819 $basePageParts = wfParseUrl( self::$currentURL );
820820 $basePage = $basePageParts['scheme'] . $basePageParts['delimiter'] . $basePageParts['host'] . $basePageParts['path'] . $delimiter . $qs;
821 - $appendDelimiter = ( $delimiter === '?' ) ? '&' : '?';
 821+ $appendDelimiter = ( $delimiter === '?' ) ? '&amp;' : '?';
822822
823823 if ( $idx < $segmentsCount ) {
824824 $card .= "<p><a href=\"{$basePage}{$appendDelimiter}seg={$idx}{$useFormatParam}\">" . self::$messages['mobile-frontend-wml-continue'] . "</a></p>";
@@ -1032,6 +1032,12 @@
10331033 // Add segmentation markers
10341034 $contentHtml = $this->headingTransform( $contentHtml );
10351035
 1036+ // Content removal for WML rendering
 1037+ $elements = array( 'span', 'div', 'sup', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'sup', 'sub' );
 1038+ foreach ( $elements as $element ) {
 1039+ $contentHtml = preg_replace( '#</?' . $element . '[^>]*>#is', '', $contentHtml );
 1040+ }
 1041+
10361042 // Content wrapping
10371043 $contentHtml = $this->createWMLCard( $contentHtml );
10381044 require( 'views/layout/application.wml.php' );
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/application.wml.php
@@ -6,13 +6,9 @@
77
88 $applicationHtml = <<<EOT
99 <?xml version='1.0' encoding='utf-8' ?>
10 - <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
 10+ <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
 11+ "http://www.wapforum.org/DTD/wml13.dtd">
1112 <wml xml:lang="{$code}" dir="{$dir}">
12 - <head>
13 - <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
14 - <meta name="character-set=utf-8" content="charset"/>
15 - <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
16 - </head>
1713 <template>
1814 <do name="home" type="options" label="{$homeButton}" >
1915 <go href="{$mainPageUrl}"/>

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98804fix for bug 31310 - Mobile can deliver malformed WML contentpreilly20:51, 3 October 2011

Status & tagging log