Index: trunk/extensions/LandingCheck/SpecialLandingCheck.php |
— | — | @@ -4,14 +4,33 @@ |
5 | 5 | exit( 1 ); |
6 | 6 | } |
7 | 7 | |
8 | | -class LandingCheck extends SpecialPage { |
| 8 | +class SpecialLandingCheck extends SpecialPage { |
9 | 9 | |
10 | 10 | function __construct() { |
11 | 11 | // Register special page |
12 | 12 | parent::__construct( 'LandingCheck' ); |
13 | 13 | } |
| 14 | + |
| 15 | + function execute( $sub ) { |
| 16 | + global $wgOut, $wgUser, $wgRequest, $wgLandingPageBase; |
| 17 | + |
| 18 | + if ( $wgRequest->getVal( 'language' ) ) { |
| 19 | + $language = ( preg_match( '/^[A-Za-z-]+$/', $wgRequest->getVal( 'language' ) ) ); |
| 20 | + } else { |
| 21 | + $language = 'en'; |
| 22 | + } |
| 23 | + $country = $wgRequest->getVal( 'country' ); |
| 24 | + $landingPage = $wgRequest->getVal( 'landing_page' ); |
| 25 | + |
| 26 | + $tracking = '?' . wfArrayToCGI( array( |
| 27 | + 'utm_source' => $wgRequest->getVal( 'utm_source' ), |
| 28 | + 'utm_medium' => $wgRequest->getVal( 'utm_medium' ), |
| 29 | + 'utm_campaign' => $wgRequest->getVal( 'utm_campaign' ), |
| 30 | + 'referrer' => $wgRequest->getHeader( 'referer' ) |
| 31 | + ) ); |
| 32 | + |
| 33 | + if ( 1 ) { |
| 34 | + $wgOut->redirect( $wgLandingPageBase . '/' . $language . '/' . $country . $tracking ); |
| 35 | + } |
| 36 | + } |
14 | 37 | } |
15 | | - |
16 | | -//$wgOut->redirect( $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) ); |
17 | | - |
18 | | -?> |
Index: trunk/extensions/LandingCheck/LandingCheck.i18n.php |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation for GeoLite extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Ryan Kaldari |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'landingcheck-desc' => 'This extension facilitates the use of geotargeted localized landing pages. It is a replacement for GeoLite.', |
| 17 | + 'landingcheck' => 'LandingCheck', |
| 18 | +); |