r75668 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75667‎ | r75668 | r75669 >
Date:19:35, 29 October 2010
Author:kaldari
Status:deferred (Comments)
Tags:
Comment:
some working code
Modified paths:
  • /trunk/extensions/LandingCheck/LandingCheck.i18n.php (added) (history)
  • /trunk/extensions/LandingCheck/SpecialLandingCheck.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LandingCheck/SpecialLandingCheck.php
@@ -4,14 +4,33 @@
55 exit( 1 );
66 }
77
8 -class LandingCheck extends SpecialPage {
 8+class SpecialLandingCheck extends SpecialPage {
99
1010 function __construct() {
1111 // Register special page
1212 parent::__construct( 'LandingCheck' );
1313 }
 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+ }
1437 }
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+);

Comments

#Comment by Raymond (talk | contribs)   19:41, 29 October 2010

+ 'referrer' => $wgRequest->getHeader( 'referer' )

referer with 1 r?

#Comment by Catrope (talk | contribs)   20:00, 29 October 2010

That's what the spec says ^^ see en:HTTP referrer

Status & tagging log