r78408 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78407‎ | r78408 | r78409 >
Date:23:09, 14 December 2010
Author:nimishg
Status:deferred (Comments)
Tags:
Comment:
Added OWALiteTracker file
Modified paths:
  • /trunk/extensions/OWALiteTracker/OWALiteTracker.php (added) (history)

Diff [purge]

Index: trunk/extensions/OWALiteTracker/OWALiteTracker.php
@@ -0,0 +1,18 @@
 2+
 3+
 4+//Must come after "CentralNotice", which creates the "Geo" object
 5+
 6+$wgHooks['SkinAfterBottomScripts'][] = 'efOWALiteTracker';
 7+
 8+$wgOWAGeoTrackSites = array(
 9+ array("country", "IN", "india-allproj.js"),
 10+);
 11+
 12+function efOWALiteTracker($skin, &$text){
 13+ if( count( $wgOWAGeoTrackSites ) <= 0 ){ return; }
 14+ $text .= "<script> var includeOWA = false; if(Geo){";
 15+ foreach($condition in $wgOWAGeoTrackSites){
 16+ $text .= "if (Geo.{$condition[0]} && Geo.{$condition[0]} == \"{$condition[1]}\"){ if(!includeOWA){includeOWA=true; importScriptURI( document.location.protocol +'//owa.wikimedia.org/owa/modules/base/js/owa.tracker-combined-min.js');} importScriptURI( document.location.protocol + '//owa.wikimedia.org/resources/{$condition[2]}');}";
 17+ }
 18+ $text .= "}</script>";
 19+}
\ No newline at end of file
Property changes on: trunk/extensions/OWALiteTracker/OWALiteTracker.php
___________________________________________________________________
Added: svn:eol-style
120 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r78416Followup r78408, add missing <?php, fix syntax errors from missing global and...reedy00:24, 15 December 2010
r78418Followup r78408, add basic $wgExtensionCreditsreedy00:27, 15 December 2010

Comments

#Comment by Reedy (talk | contribs)   00:26, 15 December 2010

Hmm. Why did it let you commit this with syntax errors..

$blah = array( 1 );

foreach ( $blah2 in $blah ) {

}
reedy@ubuntu64-esxi:~$ php -l test.php

Parse error: syntax error, unexpected T_STRING in test.php on line 5
Errors parsing test.php
#Comment by Brion VIBBER (talk | contribs)   00:34, 15 December 2010

There's no "<?php", so it's all just unstructured raw text to the PHP parser.

Status & tagging log