Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | } |
86 | 86 | |
87 | 87 | class ExtMobileFrontend { |
88 | | - const VERSION = '0.5.68'; |
| 88 | + const VERSION = '0.5.70'; |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @var DOMDocument |
— | — | @@ -200,9 +200,12 @@ |
201 | 201 | ); |
202 | 202 | |
203 | 203 | public function testCanonicalRedirect( $request, $title, $output ) { |
204 | | - global $wgMobileDomain; |
205 | | - $host = $request->getHeader( 'HOST' ); |
206 | | - return !( stristr( $host, $wgMobileDomain ) !== false ); |
| 204 | + $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : ''; |
| 205 | + if ( empty( $xDevice ) ) { |
| 206 | + return true; // Let the redirect happen |
| 207 | + } else { |
| 208 | + return false; // Prevent the redirect from occuring |
| 209 | + } |
207 | 210 | } |
208 | 211 | |
209 | 212 | public function addMobileFooter( &$obj, &$tpl ) { |
— | — | @@ -216,7 +219,7 @@ |
217 | 220 | $footerlinks = $tpl->data['footerlinks']; |
218 | 221 | $mobileViewUrl = $wgRequest->escapeAppendQuery( 'useformat=mobile' ); |
219 | 222 | |
220 | | - $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>".wfMsg( 'mobile-frontend-view')."</a>"); |
| 223 | + $tpl->set('mobileview', "<a href='{$mobileViewUrl}'>" . wfMsg( 'mobile-frontend-view' ) . "</a>"); |
221 | 224 | $footerlinks['places'][] = 'mobileview'; |
222 | 225 | $tpl->set('footerlinks', $footerlinks); |
223 | 226 | } |