Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -49,6 +49,7 @@ |
50 | 50 | */ |
51 | 51 | $wgMobileFrontendLogo = false; |
52 | 52 | |
| 53 | +$wgMobileDomain = '.m.'; |
53 | 54 | |
54 | 55 | $wgExtMobileFrontend = new ExtMobileFrontend(); |
55 | 56 | |
— | — | @@ -57,6 +58,8 @@ |
58 | 59 | $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 'addMobileFooter' ); |
59 | 60 | $wgExtensionFunctions[] = array( &$wgExtMobileFrontend, 'setDefaultLogo' ); |
60 | 61 | |
| 62 | +$wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 'testCanonicalRedirect' ); |
| 63 | + |
61 | 64 | /** |
62 | 65 | * Make the classes stripped from page content configurable. Each item will |
63 | 66 | * be stripped from the page. See $itemsToRemove for more info |
— | — | @@ -73,7 +76,7 @@ |
74 | 77 | } |
75 | 78 | |
76 | 79 | class ExtMobileFrontend { |
77 | | - const VERSION = '0.5.64'; |
| 80 | + const VERSION = '0.5.65'; |
78 | 81 | |
79 | 82 | /** |
80 | 83 | * @var DOMDocument |
— | — | @@ -186,6 +189,12 @@ |
187 | 190 | '#ogg_player_1', |
188 | 191 | '.nomobile', |
189 | 192 | ); |
| 193 | + |
| 194 | + public function testCanonicalRedirect( $request, $title, $output ) { |
| 195 | + global $wgMobileDomain; |
| 196 | + $host = $request->getHeader( 'HOST' ); |
| 197 | + return ( stristr( $host, $wgMobileDomain ) !== false ) ? false : true; |
| 198 | + } |
190 | 199 | |
191 | 200 | public function addMobileFooter( &$obj, &$tpl ) { |
192 | 201 | global $wgRequest; |