Index: trunk/extensions/PatchOutputMobile/views/layout/_footmenu_default.html.php |
— | — | @@ -4,9 +4,9 @@ |
5 | 5 | <div id='footer'> |
6 | 6 | <div class='nav' id='footmenu'> |
7 | 7 | <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> |
9 | 9 | <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> |
11 | 11 | </div> |
12 | 12 | </div> |
13 | 13 | </div> |
Index: trunk/extensions/PatchOutputMobile/PatchOutputMobile.php |
— | — | @@ -27,11 +27,11 @@ |
28 | 28 | 'url' => 'http://www.mediawiki.org/wiki/Extension:PatchOutputMobile', |
29 | 29 | ); |
30 | 30 | |
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'; |
33 | 33 | //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'; |
36 | 36 | |
37 | 37 | $wgExtPatchOutputMobile = new ExtPatchOutputMobile(); |
38 | 38 | |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | 'onOutputPageBeforeHTML' ); |
41 | 41 | |
42 | 42 | class ExtPatchOutputMobile { |
43 | | - const VERSION = '0.3.6'; |
| 43 | + const VERSION = '0.3.7'; |
44 | 44 | |
45 | 45 | private $doc; |
46 | 46 | |
— | — | @@ -99,6 +99,10 @@ |
100 | 100 | self::$messages['patch-output-mobile-copyright'] = wfMsg( 'patch-output-mobile-copyright' ); |
101 | 101 | self::$messages['patch-output-mobile-home-button'] = wfMsg( 'patch-output-mobile-home-button' ); |
102 | 102 | 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' ); |
103 | 107 | |
104 | 108 | self::$dir = $wgContLang->getDir(); |
105 | 109 | self::$code = $wgContLang->getCode(); |
— | — | @@ -115,10 +119,45 @@ |
116 | 120 | $this->contentFormat = 'XHTML'; |
117 | 121 | } |
118 | 122 | |
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 | + } |
120 | 135 | return true; |
121 | 136 | } |
122 | 137 | |
| 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 | + |
123 | 162 | private function showHideCallbackWML( $matches ) { |
124 | 163 | static $headings = 0; |
125 | 164 | ++$headings; |