r98130 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98129‎ | r98130 | r98131 >
Date:13:19, 26 September 2011
Author:demon
Status:ok
Tags:
Comment:
stylize
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.i18n.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/tests/MobileFrontendTest.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/information/disable.html.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/layout/application.html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/tests/MobileFrontendTest.php
@@ -1,9 +1,9 @@
22 <?php
33
44 class ExtMobileFrontendTest extends MediaWikiTestCase {
5 -
 5+
66 /**
7 - * PHP 5.3.2 introduces the ReflectionMethod::setAccessible() method to allow the invocation of
 7+ * PHP 5.3.2 introduces the ReflectionMethod::setAccessible() method to allow the invocation of
88 * protected and private methods directly through the Reflection API
99 */
1010 protected static function getMethod( $name ) {
@@ -12,7 +12,7 @@
1313 $method->setAccessible( true );
1414 return $method;
1515 }
16 -
 16+
1717 protected function setUp() {
1818 parent::setUp();
1919 $this->wgExtMobileFrontend = new ExtMobileFrontend();
@@ -22,21 +22,21 @@
2323 unset( $this->wgExtMobileFrontend );
2424 parent::tearDown();
2525 }
26 -
 26+
2727 public function testGetBaseDomain() {
2828 $getBaseDomain = self::getMethod( 'getBaseDomain' );
2929 $wgExtMobileFrontend = new ExtMobileFrontend();
3030 $_SERVER['HTTP_HOST'] = 'en.wikipedia.org';
3131 $this->assertEquals( '.wikipedia.org', $getBaseDomain->invokeArgs( $wgExtMobileFrontend, array() ) );
3232 }
33 -
 33+
3434 public function testGetRelativeURL() {
3535 $getRelativeURL = self::getMethod( 'getRelativeURL' );
3636 $wgExtMobileFrontend = new ExtMobileFrontend();
3737 $url = 'http://en.wikipedia.org/wiki/Positional_astronomy';
3838 $this->assertEquals( '/wiki/Positional_astronomy', $getRelativeURL->invokeArgs( $wgExtMobileFrontend, array( $url ) ) );
3939 }
40 -
 40+
4141 public function testDisableCaching() {
4242 global $wgRequest;
4343 $disableCaching = self::getMethod( 'disableCaching' );
@@ -47,7 +47,7 @@
4848 $this->assertEquals( 'Sat, 26 Jul 1997 05:00:00 GMT', $wgRequest->response()->getheader( 'Expires' ) );
4949 $this->assertEquals( 'no-cache', $wgRequest->response()->getheader( 'Pragma' ) );
5050 }
51 -
 51+
5252 public function testSendXDeviceVaryHeader() {
5353 global $wgRequest;
5454 $sendXDeviceVaryHeader = self::getMethod( 'sendXDeviceVaryHeader' );
Index: trunk/extensions/MobileFrontend/MobileFrontend.i18n.php
@@ -11,7 +11,7 @@
1212
1313 $messages = array();
1414
15 -//en translation
 15+// en translation
1616 $messages['en'] = array (
1717 'mobile-frontend-desc' => 'Mobile Frontend',
1818 'mobile-frontend-search-submit' => 'Go',
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -18,11 +18,11 @@
1919 // Define the extension; allows us make sure the extension is used correctly
2020 define( 'MOBILEFRONTEND', 'MobileFrontend' );
2121 // WURFL installation dir
22 -define( 'WURFL_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' .
 22+define( 'WURFL_DIR', dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'library' .
2323 DIRECTORY_SEPARATOR . 'WURFL' . DIRECTORY_SEPARATOR );
2424 // WURFL configuration files directory
25 -define( 'RESOURCES_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' .
26 - DIRECTORY_SEPARATOR. 'resources' . DIRECTORY_SEPARATOR );
 25+define( 'RESOURCES_DIR', dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'library' .
 26+ DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR );
2727
2828 require_once( WURFL_DIR . 'Application.php' );
2929
@@ -36,9 +36,9 @@
3737 'url' => 'http://www.mediawiki.org/wiki/Extension:MobileFrontend',
3838 );
3939
40 -$cwd = dirname(__FILE__) . DIRECTORY_SEPARATOR;
 40+$cwd = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
4141 $wgExtensionMessagesFiles['MobileFrontend'] = $cwd . 'MobileFrontend.i18n.php';
42 -//autoload extension classes
 42+// autoload extension classes
4343 $wgAutoloadClasses['DeviceDetection'] = $cwd . 'DeviceDetection.php';
4444 $wgAutoloadClasses['CssDetection'] = $cwd . 'CssDetection.php';
4545
@@ -125,8 +125,8 @@
126126 public static $displayNoticeId;
127127 public static $leaveFeedbackURL;
128128 public static $mobileRedirectFormAction;
129 -
130 - public static $messageKeys = array(
 129+
 130+ public static $messageKeys = array(
131131 'mobile-frontend-show-button',
132132 'mobile-frontend-hide-button',
133133 'mobile-frontend-back-to-top-of-section',
@@ -198,7 +198,7 @@
199199 '#ogg_player_1',
200200 '.nomobile',
201201 );
202 -
 202+
203203 public function testCanonicalRedirect( $request, $title, $output ) {
204204 $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : '';
205205 if ( empty( $xDevice ) ) {
@@ -214,14 +214,14 @@
215215
216216 $title = $obj->getTitle();
217217 $isSpecial = $title->isSpecialPage();
218 -
 218+
219219 if ( ! $isSpecial ) {
220220 $footerlinks = $tpl->data['footerlinks'];
221221 $mobileViewUrl = $wgRequest->escapeAppendQuery( 'useformat=mobile' );
222222
223 - $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>" . wfMsg( 'mobile-frontend-view' ) . "</a>");
 223+ $tpl->set( 'mobileview', "<a href='{$mobileViewUrl}'>" . wfMsg( 'mobile-frontend-view' ) . "</a>" );
224224 $footerlinks['places'][] = 'mobileview';
225 - $tpl->set('footerlinks', $footerlinks);
 225+ $tpl->set( 'footerlinks', $footerlinks );
226226 }
227227 wfProfileOut( __METHOD__ );
228228 return true;
@@ -230,23 +230,23 @@
231231 public function getMsg() {
232232 global $wgUser, $wgContLang, $wgRequest, $wgServer, $wgMobileRedirectFormAction, $wgMobileDomain;
233233 wfProfileIn( __METHOD__ );
234 -
 234+
235235 self::$disableImagesURL = $wgRequest->escapeAppendQuery( 'disableImages=1' );
236236 self::$enableImagesURL = $wgRequest->escapeAppendQuery( 'enableImages=1' );
237237 self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=disable_mobile_site' );
238238 self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=view_normal_site' );
239239 self::$currentURL = $wgRequest->getFullRequestURL();
240240 self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 'mobileaction=leave_feedback' );
241 -
 241+
242242 $skin = $wgUser->getSkin();
243243 $copyright = $skin->getCopyright();
244244 // Need to stash the results of the "wfMsg" call before the Output Buffering handler
245245 // because at this point the database connection is shut down, etc.
246 -
 246+
247247 self::$messages['mobile-frontend-copyright'] = $copyright;
248 -
 248+
249249 foreach ( self::$messageKeys as $messageKey ) {
250 -
 250+
251251 if ( $messageKey == 'mobile-frontend-leave-feedback-notice' ) {
252252 $linkText = wfMsg( 'mobile-frontend-leave-feedback-link-text' );
253253 $linkTarget = wfMsgNoTrans( 'mobile-frontend-feedback-page' );
@@ -260,7 +260,7 @@
261261
262262 self::$dir = $wgContLang->getDir();
263263 self::$code = $wgContLang->getCode();
264 -
 264+
265265 $nonMobileServerBaseURL = str_replace( $wgMobileDomain, '.', $wgServer );
266266 self::$mobileRedirectFormAction = ( $wgMobileRedirectFormAction !== false ) ? $wgMobileRedirectFormAction : "{$nonMobileServerBaseURL}/w/mobileRedirect.php";
267267
@@ -279,15 +279,15 @@
280280 wfProfileIn( __METHOD__ );
281281 // The title
282282 self::$title = $out->getTitle();
283 -
 283+
284284 if ( Title::newMainPage()->equals( self::$title ) ) {
285285 self::$isMainPage = true;
286286 }
287 -
 287+
288288 self::$htmlTitle = $out->getHTMLTitle();
289289
290290 $userAgent = $_SERVER['HTTP_USER_AGENT'];
291 - $uAmd5 = md5($userAgent);
 291+ $uAmd5 = md5( $userAgent );
292292
293293 $key = wfMemcKey( 'mobile', 'ua', $uAmd5 );
294294
@@ -308,8 +308,8 @@
309309 $props = "generic";
310310 }
311311 }
312 - } catch (Exception $e) {
313 - //echo $e->getMessage();
 312+ } catch ( Exception $e ) {
 313+ // echo $e->getMessage();
314314 }
315315
316316 // Note: The WebRequest Class calls are made in this block because
@@ -331,7 +331,7 @@
332332 $location = $this->getRelativeURL( $location );
333333 $wgRequest->response()->header( 'Location: ' . $location . '&mfi=0' );
334334 }
335 -
 335+
336336 if ( self::$disableImages == 0 ) {
337337 $disableImages = $wgRequest->getCookie( 'disableImages' );
338338 if ( $disableImages ) {
@@ -356,18 +356,18 @@
357357 self::$search = $wgRequest->getText( 'search' );
358358 self::$callback = $wgRequest->getText( 'callback' );
359359 self::$searchField = $wgRequest->getText( 'search', '' );
360 -
 360+
361361 $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : '';
362362
363363 $acceptHeader = $_SERVER["HTTP_ACCEPT"];
364364 $device = new DeviceDetection();
365 -
 365+
366366 if ( !empty( $xDevice ) ) {
367367 $formatName = $xDevice;
368368 } else {
369369 $formatName = $device->formatName( $userAgent, $acceptHeader );
370370 }
371 -
 371+
372372 self::$device = $device->format( $formatName );
373373
374374 if ( self::$device['view_format'] === 'wml' ) {
@@ -379,7 +379,7 @@
380380 if ( self::$useFormat === 'mobile-wap' ) {
381381 $this->contentFormat = 'WML';
382382 }
383 -
 383+
384384 if ( $mobileAction == 'leave_feedback' ) {
385385 echo $this->renderLeaveFeedbackXHTML();
386386 wfProfileOut( __METHOD__ );
@@ -387,15 +387,15 @@
388388 }
389389
390390 if ( $mobileAction == 'leave_feedback_post' ) {
391 -
 391+
392392 $this->getMsg();
393 -
 393+
394394 $subject = $wgRequest->getText( 'subject', '' );
395395 $message = $wgRequest->getText( 'message', '' );
396396 $token = $wgRequest->getText( 'edittoken', '' );
397 -
 397+
398398 $title = Title::newFromText( self::$messages['mobile-frontend-feedback-page'] );
399 -
 399+
400400 if ( $title->userCan( 'edit' ) &&
401401 !$wgUser->isBlockedFrom( $title ) &&
402402 $wgUser->matchEditToken( $token ) ) {
@@ -404,7 +404,7 @@
405405 $rawtext .= "\n== {$subject} == \n {$message} ~~~~ \n <small>User agent: {$userAgent}</small> ";
406406 $article->doEdit( $rawtext, '' );
407407 }
408 -
 408+
409409 $location = str_replace( '&mobileaction=leave_feedback_post', '', $wgRequest->getFullRequestURL() . '&noticeid=1' );
410410 $location = $this->getRelativeURL( $location );
411411 $wgRequest->response()->header( 'Location: ' . $location );
@@ -449,8 +449,8 @@
450450
451451 // WURFL documentation: http://wurfl.sourceforge.net/help_doc.php
452452 // Determine the kind of markup
453 - if( is_array( $props ) && $props['preferred_markup'] ) {
454 - //wfDebug( __METHOD__ . ": preferred markup for this device: " . $props['preferred_markup'] );
 453+ if ( is_array( $props ) && $props['preferred_markup'] ) {
 454+ // wfDebug( __METHOD__ . ": preferred markup for this device: " . $props['preferred_markup'] );
455455 // xhtml/html: html_web_3_2, html_web_4_0
456456 // xthml basic/xhtmlmp (wap 2.0): html_wi_w3_xhtmlbasic html_wi_oma_xhtmlmp_1_0
457457 // chtml (imode): html_wi_imode_*
@@ -470,10 +470,10 @@
471471
472472 // Determine
473473
474 - if (self::$useFormat === 'mobile' ||
 474+ if ( self::$useFormat === 'mobile' ||
475475 self::$useFormat === 'mobile-wap' ||
476476 !empty( $xDevice ) ) {
477 - if ( $action !== 'edit' &&
 477+ if ( $action !== 'edit' &&
478478 $mobileAction !== 'view_normal_site' ) {
479479 $this->getMsg();
480480 $this->disableCaching();
@@ -498,11 +498,11 @@
499499
500500 private function getBaseDomain() {
501501 wfProfileIn( __METHOD__ );
502 - //Validates value as IP address
503 - if( !IP::isValid( $_SERVER['HTTP_HOST'] ) ) {
 502+ // Validates value as IP address
 503+ if ( !IP::isValid( $_SERVER['HTTP_HOST'] ) ) {
504504 $domainParts = explode( '.', $_SERVER['HTTP_HOST'] );
505505 $domainParts = array_reverse( $domainParts );
506 - //Although some browsers will accept cookies without the initial ., » RFC 2109 requires it to be included.
 506+ // Although some browsers will accept cookies without the initial ., » RFC 2109 requires it to be included.
507507 wfProfileOut( __METHOD__ );
508508 return '.' . $domainParts[1] . '.' . $domainParts[0];
509509 } else {
@@ -514,8 +514,8 @@
515515 private function getRelativeURL( $url ) {
516516 wfProfileIn( __METHOD__ );
517517 $parsedUrl = parse_url( $url );
518 - //Validates value as IP address
519 - if( !IP::isValid( $parsedUrl['host'] ) ) {
 518+ // Validates value as IP address
 519+ if ( !IP::isValid( $parsedUrl['host'] ) ) {
520520 wfProfileOut( __METHOD__ );
521521 $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
522522 $baseUrl = str_replace( $baseUrl, '', $url );
@@ -537,7 +537,7 @@
538538 }
539539 wfProfileOut( __METHOD__ );
540540 }
541 -
 541+
542542 private function sendXDeviceVaryHeader() {
543543 global $wgOut, $wgRequest;
544544 wfProfileIn( __METHOD__ );
@@ -547,14 +547,14 @@
548548 }
549549 wfProfileOut( __METHOD__ );
550550 }
551 -
 551+
552552 private function renderLeaveFeedbackXHTML() {
553553 global $wgRequest, $wgUser;
554554 wfProfileIn( __METHOD__ );
555555 if ( $this->contentFormat == 'XHTML' ) {
556556 $this->getMsg();
557557 $editToken = $wgUser->editToken();
558 -
 558+
559559 $htmlTitle = self::$messages['mobile-frontend-leave-feedback'];
560560 $title = self::$messages['mobile-frontend-leave-feedback-title'];
561561 $notice = self::$messages['mobile-frontend-leave-feedback-notice'];
@@ -562,7 +562,7 @@
563563 $message = self::$messages['mobile-frontend-leave-feedback-message'];
564564 $cancel = self::$messages['mobile-frontend-leave-feedback-cancel'];
565565 $submit = self::$messages['mobile-frontend-leave-feedback-submit'];
566 -
 566+
567567 $feedbackPostURL = str_replace( '&mobileaction=leave_feedback', '', $wgRequest->getFullRequestURL() ) . '&mobileaction=leave_feedback_post';
568568 require( 'views/layout/_search_webkit.html.php' );
569569 require( 'views/layout/_footmenu_default.html.php' );
@@ -656,7 +656,7 @@
657657 private function headingTransformCallbackXHTML( $matches ) {
658658 wfProfileIn( __METHOD__ );
659659 if ( isset( $matches[0] ) ) {
660 - preg_match('/id="([^"]*)"/', $matches[0], $headlineMatches);
 660+ preg_match( '/id="([^"]*)"/', $matches[0], $headlineMatches );
661661 }
662662
663663 $headlineId = ( isset( $headlineMatches[1] ) ) ? $headlineMatches[1] : '';
@@ -667,35 +667,35 @@
668668 $backToTop = self::$messages['mobile-frontend-back-to-top-of-section'];
669669 ++$headings;
670670 // Back to top link
671 - $base = Html::openElement( 'div',
672 - array( 'id' => 'anchor_' . intval( $headings - 1 ),
673 - 'class' => 'section_anchors', )
 671+ $base = Html::openElement( 'div',
 672+ array( 'id' => 'anchor_' . intval( $headings - 1 ),
 673+ 'class' => 'section_anchors', )
674674 ) .
675675 Html::rawElement( 'a',
676 - array( 'href' => '#section_' . intval( $headings - 1 ),
677 - 'class' => 'back_to_top' ),
678 - '&#8593;' . $backToTop ) .
 676+ array( 'href' => '#section_' . intval( $headings - 1 ),
 677+ 'class' => 'back_to_top' ),
 678+ '&#8593;' . $backToTop ) .
679679 Html::closeElement( 'div' );
680680 // generate the HTML we are going to inject
681681 $buttons = Html::element( 'button',
682 - array('class' => 'section_heading show',
683 - 'section_id' => $headings ),
 682+ array( 'class' => 'section_heading show',
 683+ 'section_id' => $headings ),
684684 $show ) .
685 - Html::element( 'button',
686 - array('class' => 'section_heading hide',
 685+ Html::element( 'button',
 686+ array( 'class' => 'section_heading hide',
687687 'section_id' => $headings ),
688 - $hide );
 688+ $hide );
689689 $base .= Html::openElement( 'h2',
690 - array('class' => 'section_heading',
691 - 'id' => 'section_' . $headings) ) .
 690+ array( 'class' => 'section_heading',
 691+ 'id' => 'section_' . $headings ) ) .
692692 $buttons .
693693 Html::rawElement( 'span',
694 - array( 'id' => $headlineId),
 694+ array( 'id' => $headlineId ),
695695 $matches[2] ) .
696 - Html::closeElement( 'h2' ) .
697 - Html::openElement( 'div',
698 - array('class' => 'content_block',
699 - 'id' => 'content_' . $headings) );
 696+ Html::closeElement( 'h2' ) .
 697+ Html::openElement( 'div',
 698+ array( 'class' => 'content_block',
 699+ 'id' => 'content_' . $headings ) );
700700
701701 if ( $headings > 1 ) {
702702 // Close it up here
@@ -748,11 +748,11 @@
749749
750750 $card .= "<card id='s{$idx}' title='{$title}'><p>{$segments[$requestedSegment]}</p>";
751751 $idx = $requestedSegment + 1;
752 - $segmentsCount = count($segments);
 752+ $segmentsCount = count( $segments );
753753 $card .= "<p>" . $idx . "/" . $segmentsCount . "</p>";
754754
755755 $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 'useformat=' . self::$useFormat : '';
756 -
 756+
757757 // Title::getLocalUrl doesn't work at this point since PHP 5.1.x, all objects have their destructors called
758758 // before the output buffer callback function executes.
759759 // Thus, globalized objects will not be available as expected in the function.
@@ -760,13 +760,13 @@
761761 $mDefaultQuery = $_GET;
762762 unset( $mDefaultQuery['seg'] );
763763 unset( $mDefaultQuery['useformat'] );
764 -
 764+
765765 $qs = wfArrayToCGI( $mDefaultQuery );
766766 $delimiter = ( !empty( $qs ) ) ? '?' : '';
767767 $basePageParts = wfParseUrl( self::$currentURL );
768768 $basePage = $basePageParts['scheme'] . $basePageParts['delimiter'] . $basePageParts['host'] . $basePageParts['path'] . $delimiter . $qs;
769769 $appendDelimiter = ( $delimiter === '?' ) ? '&' : '?';
770 -
 770+
771771 if ( $idx < $segmentsCount ) {
772772 $card .= "<p><a href=\"{$basePage}{$appendDelimiter}seg={$idx}{$useFormatParam}\">" . self::$messages['mobile-frontend-wml-continue'] . "</a></p>";
773773 }
@@ -794,47 +794,47 @@
795795 CssDetection::detectIdCssOrTag( $itemToRemove, $type, $rawName );
796796 $itemToRemoveRecords[$type][] = $rawName;
797797 }
798 -
 798+
799799 wfProfileOut( __METHOD__ );
800800 return $itemToRemoveRecords;
801801 }
802 -
 802+
803803 public function DOMParseMainPage( $html ) {
804804 wfProfileIn( __METHOD__ );
805 - $html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8");
 805+ $html = mb_convert_encoding( $html, 'HTML-ENTITIES', "UTF-8" );
806806 libxml_use_internal_errors( true );
807807 $this->mainPage = new DOMDocument();
808 - //It seems that loadhtml() does not "attach" the html dtd that defines id as an id-attribute to the DOM.
 808+ // It seems that loadhtml() does not "attach" the html dtd that defines id as an id-attribute to the DOM.
809809 $this->mainPage->loadHTML( '<?xml encoding="UTF-8"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
810810 <html><head><title></title></head><body>' . $html . '</body></html>' );
811811 libxml_use_internal_errors( false );
812812 $this->mainPage->preserveWhiteSpace = false;
813813 $this->mainPage->strictErrorChecking = false;
814814 $this->mainPage->encoding = 'UTF-8';
815 -
 815+
816816 $featuredArticle = $this->mainPage->getElementById( 'mp-tfa' );
817817 $newsItems = $this->mainPage->getElementById( 'mp-itn' );
818 -
 818+
819819 $xpath = new DOMXpath( $this->mainPage );
820820 $elements = $xpath->query( '//*[starts-with(@id, "mf-")]' );
821 -
822 - $commonAttributes = array('mp-tfa', 'mp-itn');
823821
 822+ $commonAttributes = array( 'mp-tfa', 'mp-itn' );
 823+
824824 $content = $this->mainPage->createElement( 'div' );
825825 $content->setAttribute( 'id', 'main_box' );
826 -
 826+
827827 if ( $featuredArticle ) {
828828 $h2FeaturedArticle = $this->mainPage->createElement( 'h2', self::$messages['mobile-frontend-featured-article'] );
829829 $content->appendChild( $h2FeaturedArticle );
830830 $content->appendChild( $featuredArticle );
831831 }
832 -
 832+
833833 if ( $newsItems ) {
834834 $h2NewsItems = $this->mainPage->createElement( 'h2', self::$messages['mobile-frontend-news-items'] );
835835 $content->appendChild( $h2NewsItems );
836836 $content->appendChild( $newsItems );
837837 }
838 -
 838+
839839 foreach ( $elements as $element ) {
840840 if ( $element->hasAttribute( 'id' ) ) {
841841 $id = $element->getAttribute( 'id' );
@@ -849,16 +849,16 @@
850850 }
851851 }
852852 }
853 -
 853+
854854 $contentHtml = $this->mainPage->saveXML( $content, LIBXML_NOEMPTYTAG );
855855 wfProfileOut( __METHOD__ );
856856 return $contentHtml;
857857 }
858858
859 - public function DOMParse( $html ) {
 859+ public function DOMParse( $html ) {
860860 global $wgSitename;
861861 wfProfileIn( __METHOD__ );
862 - $html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8");
 862+ $html = mb_convert_encoding( $html, 'HTML-ENTITIES', "UTF-8" );
863863 libxml_use_internal_errors( true );
864864 $this->doc = new DOMDocument();
865865 $this->doc->loadHTML( '<?xml encoding="UTF-8">' . $html );
@@ -891,14 +891,14 @@
892892 foreach ( $itemToRemoveRecords['TAG'] as $tagToRemove ) {
893893 $tagToRemoveNodes = $this->doc->getElementsByTagName( $tagToRemove );
894894
895 - foreach( $tagToRemoveNodes as $tagToRemoveNode ) {
 895+ foreach ( $tagToRemoveNodes as $tagToRemoveNode ) {
896896 if ( $tagToRemoveNode ) {
897897 $domElemsToRemove[] = $tagToRemoveNode;
898898 }
899899 }
900900 }
901901
902 - foreach( $domElemsToRemove as $domElement ) {
 902+ foreach ( $domElemsToRemove as $domElement ) {
903903 $domElement->parentNode->removeChild( $domElement );
904904 }
905905
@@ -915,7 +915,7 @@
916916 foreach ( $itemToRemoveRecords['CLASS'] as $classToRemove ) {
917917 $elements = $xpath->query( '//*[@class="' . $classToRemove . '"]' );
918918
919 - foreach( $elements as $element ) {
 919+ foreach ( $elements as $element ) {
920920 $removedElement = $element->parentNode->removeChild( $element );
921921 }
922922 }
@@ -928,15 +928,15 @@
929929 '//' . $parts[0] . '[@class="' . $parts[1] . '"]'
930930 );
931931
932 - foreach( $elements as $element ) {
 932+ foreach ( $elements as $element ) {
933933 $removedElement = $element->parentNode->removeChild( $element );
934934 }
935935 }
936936
937937 // Handle red links with action equal to edit
938938 $redLinks = $xpath->query( '//a[@class="new"]' );
939 - foreach( $redLinks as $redLink ) {
940 - //PHP Bug #36795 — Inappropriate "unterminated entity reference"
 939+ foreach ( $redLinks as $redLink ) {
 940+ // PHP Bug #36795 — Inappropriate "unterminated entity reference"
941941 $spanNode = $this->doc->createElement( "span", str_replace( "&", "&amp;", $redLink->nodeValue ) );
942942
943943 if ( $redLink->hasAttributes() ) {
@@ -951,7 +951,7 @@
952952 $content = $this->doc->getElementById( 'content' );
953953
954954 $contentHtml = $this->doc->saveXML( $content, LIBXML_NOEMPTYTAG );
955 -
 955+
956956 if ( self::$isMainPage ) {
957957 $contentHtml = $this->DOMParseMainPage( $contentHtml );
958958 }
@@ -966,7 +966,7 @@
967967 } elseif ( $this->contentFormat == 'WML' ) {
968968 $homeButton = self::$messages['mobile-frontend-home-button'];
969969 $randomButton = self::$messages['mobile-frontend-random-button'];
970 - //header( 'Content-Type: text/vnd.wap.wml' );
 970+ // header( 'Content-Type: text/vnd.wap.wml' );
971971
972972 // TODO: Content transformations required
973973 // WML Validator:
@@ -988,12 +988,12 @@
989989 if ( $this->contentFormat == 'XHTML' && self::$format != 'json' ) {
990990 if ( !empty( self::$displayNoticeId ) ) {
991991 $noticePagePath = 'views/notices/notice_' . intval( self::$displayNoticeId ) . '.html.php';
992 - if ( file_exists( dirname(__FILE__) . '/' . $noticePagePath ) ) {
 992+ if ( file_exists( dirname( __FILE__ ) . '/' . $noticePagePath ) ) {
993993 require( $noticePagePath );
994994 }
995995 }
996 -
997 - //header( 'Content-Type: application/xhtml+xml; charset=utf-8' );
 996+
 997+ // header( 'Content-Type: application/xhtml+xml; charset=utf-8' );
998998 require( 'views/layout/_search_webkit.html.php' );
999999 require( 'views/layout/_footmenu_default.html.php' );
10001000 require( 'views/layout/application.html.php' );
@@ -1015,7 +1015,7 @@
10161016 wfProfileOut( __METHOD__ );
10171017 return $json;
10181018 }
1019 -
 1019+
10201020 wfProfileOut( __METHOD__ );
10211021 return $applicationHtml;
10221022 }
Index: trunk/extensions/MobileFrontend/views/information/disable.html.php
@@ -1,7 +1,7 @@
22 <?php
33
44 $currentURL = self::$currentURL;
5 -$currentURL = str_replace('&mobileaction=disable_mobile_site', '', $currentURL);
 5+$currentURL = str_replace( '&mobileaction=disable_mobile_site', '', $currentURL );
66 $mobileRedirectFormAction = self::$mobileRedirectFormAction;
77
88 $disableHtml = <<<EOT
Index: trunk/extensions/MobileFrontend/views/layout/application.html.php
@@ -4,7 +4,7 @@
55 $dir = self::$dir;
66 $code = self::$code;
77
8 -if( $wgAppleTouchIcon !== false ) {
 8+if ( $wgAppleTouchIcon !== false ) {
99 $appleTouchIconTag = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
1010 } else {
1111 $appleTouchIconTag = "";

Status & tagging log