Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | } |
86 | 86 | |
87 | 87 | class ExtMobileFrontend { |
88 | | - const VERSION = '0.5.70'; |
| 88 | + const VERSION = '0.5.71'; |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @var DOMDocument |
— | — | @@ -226,6 +226,12 @@ |
227 | 227 | wfProfileOut( __METHOD__ ); |
228 | 228 | return true; |
229 | 229 | } |
| 230 | + |
| 231 | + private function removeQueryStringParameter( $url, $field ) { |
| 232 | + $url = preg_replace( '/(.*)(\?|&)' . $field . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&' ); |
| 233 | + $url = substr( $url, 0, -1 ); |
| 234 | + return $url; |
| 235 | + } |
230 | 236 | |
231 | 237 | public function getMsg() { |
232 | 238 | global $wgUser, $wgContLang, $wgRequest, $wgServer, $wgMobileRedirectFormAction, $wgMobileDomain; |
— | — | @@ -234,7 +240,8 @@ |
235 | 241 | self::$disableImagesURL = $wgRequest->escapeAppendQuery( 'disableImages=1' ); |
236 | 242 | self::$enableImagesURL = $wgRequest->escapeAppendQuery( 'enableImages=1' ); |
237 | 243 | self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=disable_mobile_site' ); |
238 | | - self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery( 'mobileaction=view_normal_site' ); |
| 244 | + self::$viewNormalSiteURL = str_replace( $wgMobileDomain, '.', $wgRequest->getFullRequestURL() ); |
| 245 | + self::$viewNormalSiteURL = $this->removeQueryStringParameter( self::$viewNormalSiteURL, 'useformat' ); |
239 | 246 | self::$currentURL = $wgRequest->getFullRequestURL(); |
240 | 247 | self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery( 'mobileaction=leave_feedback' ); |
241 | 248 | |