r88940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88939‎ | r88940 | r88941 >
Date:22:04, 26 May 2011
Author:preilly
Status:deferred
Tags:
Comment:
add view on regular and disable mobile site options
Modified paths:
  • /trunk/extensions/PatchOutputMobile/PatchOutputMobile.php (modified) (history)
  • /trunk/extensions/PatchOutputMobile/views/layout/_footmenu_default.html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PatchOutputMobile/views/layout/_footmenu_default.html.php
@@ -4,9 +4,9 @@
55 <div id='footer'>
66 <div class='nav' id='footmenu'>
77 <div class='mwm-notice'>
8 - <a href="http://en.wikipedia.org/w/mobileRedirect.php?to=">{$regular_wikipedia}</a>
 8+ <a href="?m_action=view_normal_site">{$regular_wikipedia}</a>
99 <div id="perm">
10 - <a href="https://www.mediawiki.org/disable/?">{$perm_stop_redirect}</a>
 10+ <a href="?m_action=disable_mobile_site">{$perm_stop_redirect}</a>
1111 </div>
1212 </div>
1313 </div>
Index: trunk/extensions/PatchOutputMobile/PatchOutputMobile.php
@@ -27,11 +27,11 @@
2828 'url' => 'http://www.mediawiki.org/wiki/Extension:PatchOutputMobile',
2929 );
3030
31 -$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
32 -$wgExtensionMessagesFiles['PatchOutputMobile'] = $dir . 'PatchOutputMobile.i18n.php';
 31+$cwd = dirname(__FILE__) . DIRECTORY_SEPARATOR;
 32+$wgExtensionMessagesFiles['PatchOutputMobile'] = $cwd . 'PatchOutputMobile.i18n.php';
3333 //autoload extension classes
34 -$wgAutoloadClasses['DeviceDetection'] = $dir . 'DeviceDetection.php';
35 -$wgAutoloadClasses['CssDetection'] = $dir . 'CssDetection.php';
 34+$wgAutoloadClasses['DeviceDetection'] = $cwd . 'DeviceDetection.php';
 35+$wgAutoloadClasses['CssDetection'] = $cwd . 'CssDetection.php';
3636
3737 $wgExtPatchOutputMobile = new ExtPatchOutputMobile();
3838
@@ -39,7 +39,7 @@
4040 'onOutputPageBeforeHTML' );
4141
4242 class ExtPatchOutputMobile {
43 - const VERSION = '0.3.6';
 43+ const VERSION = '0.3.7';
4444
4545 private $doc;
4646
@@ -99,6 +99,10 @@
100100 self::$messages['patch-output-mobile-copyright'] = wfMsg( 'patch-output-mobile-copyright' );
101101 self::$messages['patch-output-mobile-home-button'] = wfMsg( 'patch-output-mobile-home-button' );
102102 self::$messages['patch-output-mobile-random-button'] = wfMsg( 'patch-output-mobile-random-button' );
 103+ self::$messages['patch-output-mobile-are-you-sure'] = wfMsg( 'patch-output-mobile-are-you-sure' );
 104+ self::$messages['patch-output-mobile-explain-disable'] = wfMsg( 'patch-output-mobile-explain-disable' );
 105+ self::$messages['patch-output-mobile-disable-button'] = wfMsg( 'patch-output-mobile-disable-button' );
 106+ self::$messages['patch-output-mobile-back-button'] = wfMsg( 'patch-output-mobile-back-button' );
103107
104108 self::$dir = $wgContLang->getDir();
105109 self::$code = $wgContLang->getCode();
@@ -115,10 +119,45 @@
116120 $this->contentFormat = 'XHTML';
117121 }
118122
119 - ob_start( array( $this, 'DOMParse' ) );
 123+ $m_action = isset( $_GET['m_action'] ) ? $_GET['m_action'] : '';
 124+
 125+ if ( $m_action == 'disable_mobile_site' ) {
 126+ if ( $this->contentFormat == 'XHTML' ) {
 127+ echo $this->renderDisableMobileSiteXHTML();
 128+ exit();
 129+ }
 130+ }
 131+
 132+ if ( $m_action != 'view_normal_site' ) {
 133+ ob_start( array( $this, 'DOMParse' ) );
 134+ }
120135 return true;
121136 }
122137
 138+ private function renderDisableMobileSiteXHTML() {
 139+ if ( $this->contentFormat == 'XHTML' ) {
 140+ $dir = self::$dir;
 141+ $code = self::$code;
 142+ $regular_wikipedia = self::$messages['patch-output-mobile-regular-wikipedia'];
 143+ $perm_stop_redirect = self::$messages['patch-output-mobile-perm-stop-redirect'];
 144+ $copyright = self::$messages['patch-output-mobile-copyright'];
 145+ $home_button = self::$messages['patch-output-mobile-home-button'];
 146+ $random_button = self::$messages['patch-output-mobile-random-button'];
 147+ $are_you_sure = self::$messages['patch-output-mobile-are-you-sure'];
 148+ $explain_disable = self::$messages['patch-output-mobile-explain-disable'];
 149+ $disable_button = self::$messages['patch-output-mobile-disable-button'];
 150+ $back_button = self::$messages['patch-output-mobile-back-button'];
 151+ $title = $are_you_sure;
 152+ require( 'views/notices/_donate.html.php' );
 153+ require( 'views/layout/_search_webkit.html.php' );
 154+ require( 'views/layout/_footmenu_default.html.php' );
 155+ require( 'views/information/disable.html.php' );
 156+ $contentHtml = $disableHtml;
 157+ require( 'views/layout/application.html.php' );
 158+ return $applicationHtml;
 159+ }
 160+ }
 161+
123162 private function showHideCallbackWML( $matches ) {
124163 static $headings = 0;
125164 ++$headings;

Status & tagging log