r32737 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32736‎ | r32737 | r32738 >
Date:12:53, 3 April 2008
Author:catrope
Status:old
Tags:
Comment:
Adding Woopra extension by Shane Froebel
Modified paths:
  • /trunk/extensions/Woopra (added) (history)
  • /trunk/extensions/Woopra/Woopra.php (added) (history)

Diff [purge]

Index: trunk/extensions/Woopra/Woopra.php
@@ -0,0 +1,46 @@
 2+<?php
 3+
 4+/**
 5+ * Used to add Woopra Live Stat Tracking to your MediaWiki Instllation
 6+ *
 7+ * @addtogroup Extensions
 8+ * @author Shane Froebel
 9+ * @copyright � 2008-2009 FrakMedia! Productions, http://www.frakmedia.net/main/woopra
 10+ * @license GNU General Public Licence 2.0 or later
 11+ */
 12+
 13+if( !defined( 'MEDIAWIKI' ) ) {
 14+ echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
 15+ die( 1 );
 16+}
 17+
 18+$wgExtensionCredits['specialpage'][] = array(
 19+ 'name' => 'Woopra Live Stats Tracking',
 20+ 'author' => array( 'Shane Froebel'),
 21+ 'version' => '1.0.0',
 22+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Woopra',
 23+ 'description' => 'Allows for the [http://www.woopra.com/ Woopra Live Tracking Software] to work for your MediaWiki installation',
 24+);
 25+
 26+$wgHooks['BeforePageDisplay'][] = 'fnWoopraJavascript';
 27+
 28+function fnWoopraJavascript($out)
 29+{
 30+ global $wgUser, $wgWoopraSitekey;
 31+
 32+ $html .= "<script type=\"text/javascript\">\r\n";
 33+ $html .= "woopra_id = '" . $wgWoopraSitekey . "';\r\n";
 34+
 35+ if (!$wgUser->isAnon())
 36+ {
 37+ $html .= "var woopra_array = new Array();\r\n";
 38+ $html .= "woopra_array['name'] = '" . $wgUser->getRealName() . "';\r\n";
 39+ $html .= "woopra_array['Email'] = '" . $wgUser->getEmail() . "';\r\n";
 40+ // Add custom tracking code here!
 41+ }
 42+ $html .= "</script>\r\n";
 43+ $html .= "<script type=\"text/javascript\" src=\"http://static.woopra.com/js/woopra.js\"></script>";
 44+
 45+ $out->addScript($html);
 46+ return true;
 47+}

Status & tagging log