Index: trunk/extensions/piwik/piwik-mw.js |
— | — | @@ -0,0 +1,220 @@ |
| 2 | +// Web analytics by Piwik - http://piwik.org |
| 3 | +// Copyleft 2007, All rights reversed. |
| 4 | +var _pk_use_title_as_name = 0; |
| 5 | +var _pk_install_tracker = 1; |
| 6 | +var _pk_tracker_pause = 500; |
| 7 | +var _pk_download_extensions = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip"; |
| 8 | + |
| 9 | +// Beginning script |
| 10 | +function _pk_plug_normal(_pk_pl) { |
| 11 | + if (_pk_tm.indexOf(_pk_pl) != -1 && (navigator.mimeTypes[_pk_pl].enabledPlugin != null)) |
| 12 | + return '1'; |
| 13 | + return '0'; |
| 14 | +} |
| 15 | + |
| 16 | +function _pk_plug_ie(_pk_pl) |
| 17 | +{ |
| 18 | + pk_found = false; |
| 19 | + document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n on error resume next \n pk_found = IsObject(CreateObject("' + _pk_pl + '")) </SCR' + 'IPT>\n'); |
| 20 | + if (pk_found) return '1'; |
| 21 | + return '0'; |
| 22 | +} |
| 23 | + |
| 24 | +var _pk_jav = '0'; if(navigator.javaEnabled()) _pk_jav='1'; |
| 25 | +var _pk_agent = navigator.userAgent.toLowerCase(); |
| 26 | +var _pk_moz = (navigator.appName.indexOf("Netscape") != -1); |
| 27 | +var _pk_ie = (_pk_agent.indexOf("msie") != -1); |
| 28 | +var _pk_win = ((_pk_agent.indexOf("win") != -1) || (_pk_agent.indexOf("32bit") != -1)); |
| 29 | +var _pk_cookie = (navigator.cookieEnabled)? '1' : '0'; |
| 30 | +if((typeof (navigator.cookieEnabled) == "undefined") && (_pk_cookie == '0')) { |
| 31 | + document.cookie="_pk_testcookie" |
| 32 | + _pk_cookie=(document.cookie.indexOf("_pk_testcookie")!=-1)? '1' : '0'; |
| 33 | +} |
| 34 | + |
| 35 | +var _pk_dir='0',_pk_fla='0',_pk_pdf='0',_pk_qt = '0',_pk_rea = '0',_pk_wma='0'; |
| 36 | +if (_pk_win && _pk_ie){ |
| 37 | + _pk_dir = _pk_plug_ie("SWCtl.SWCtl.1"); |
| 38 | + _pk_fla = _pk_plug_ie("ShockwaveFlash.ShockwaveFlash.1"); |
| 39 | + if (_pk_plug_ie("PDF.PdfCtrl.1") == '1' || _pk_plug_ie('PDF.PdfCtrl.5') == '1' || _pk_plug_ie('PDF.PdfCtrl.6') == '1') _pk_pdf = '1'; |
| 40 | + _pk_qt = _pk_plug_ie("Quicktime.Quicktime"); // Old : "QuickTimeCheckObject.QuickTimeCheck.1" |
| 41 | + _pk_rea = _pk_plug_ie("rmocx.RealPlayer G2 Control.1"); |
| 42 | + _pk_wma = _pk_plug_ie("wmplayer.ocx"); // Old : "MediaPlayer.MediaPlayer.1" |
| 43 | +} else { |
| 44 | + var _pk_tm = ''; |
| 45 | + for (var i=0; i < navigator.mimeTypes.length; i++) |
| 46 | + _pk_tm += navigator.mimeTypes[i].type.toLowerCase(); |
| 47 | + _pk_dir = _pk_plug_normal("application/x-director"); |
| 48 | + _pk_fla = _pk_plug_normal("application/x-shockwave-flash"); |
| 49 | + _pk_pdf = _pk_plug_normal("application/pdf"); |
| 50 | + _pk_qt = _pk_plug_normal("video/quicktime"); |
| 51 | + _pk_rea = _pk_plug_normal("audio/x-pn-realaudio-plugin"); |
| 52 | + _pk_wma = _pk_plug_normal("application/x-mplayer2"); |
| 53 | +} |
| 54 | + |
| 55 | +var _pk_rtu = ''; |
| 56 | +try { |
| 57 | + _pk_rtu = top.document.referrer; |
| 58 | +} catch(e1) { |
| 59 | + if(parent){ |
| 60 | + try{ _pk_rtu = parent.document.referrer; } catch(e2) { _pk_rtu=''; } |
| 61 | + } |
| 62 | +} |
| 63 | +if(_pk_rtu == '') { |
| 64 | + _pk_rtu = document.referrer; |
| 65 | +} |
| 66 | + |
| 67 | +function _pk_escape(_pk_str){ |
| 68 | + if(typeof(encodeURIComponent) == 'function') { |
| 69 | + return encodeURIComponent(_pk_str); |
| 70 | + } else { |
| 71 | + return escape(_pk_str); |
| 72 | + } |
| 73 | +} |
| 74 | +var _pk_title = ''; |
| 75 | +if (document.title && document.title!="") _pk_title = _pk_escape(document.title); |
| 76 | + |
| 77 | +var _pk_called; |
| 78 | + |
| 79 | +function _pk_getUrlLog( _pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ) |
| 80 | +{ |
| 81 | + var _pk_custom_vars_str = ''; |
| 82 | + if(typeof _pk_custom_vars == "undefined"){ |
| 83 | + _pk_custom_vars = false; |
| 84 | + } |
| 85 | + if (_pk_custom_vars) { |
| 86 | + for (var i in _pk_custom_vars){ |
| 87 | + if (!Array.prototype[i]){ |
| 88 | + _pk_custom_vars_str = _pk_custom_vars_str + '&vars['+ escape(i) + ']' + "=" + escape(_pk_custom_vars[i]); |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + var _pk_url = document.location.href; |
| 94 | + var _pk_da = new Date(); |
| 95 | + var _pk_src = _pk_pkurl |
| 96 | + +'?url='+_pk_escape(document.location.href) |
| 97 | + +'&action_name='+_pk_escape(_pk_action_name) |
| 98 | + +'&idsite='+_pk_site |
| 99 | + +'&res='+screen.width+'x'+screen.height +'&col='+screen.colorDepth |
| 100 | + +'&h='+_pk_da.getHours()+'&m='+_pk_da.getMinutes()+'&s='+_pk_da.getSeconds() |
| 101 | + +'&fla='+_pk_fla+'&dir='+_pk_dir+'&qt='+_pk_qt+'&realp='+_pk_rea+'&pdf='+_pk_pdf |
| 102 | + +'&wma='+_pk_wma+'&java='+_pk_jav+'&cookie='+_pk_cookie |
| 103 | + +'&title='+_pk_title |
| 104 | + +'&urlref='+_pk_escape(_pk_rtu) |
| 105 | + +_pk_custom_vars_str; |
| 106 | + return _pk_src; |
| 107 | +} |
| 108 | + |
| 109 | +function piwik_log( _pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ) |
| 110 | +{ |
| 111 | + if(_pk_called && (!_pk_action_name || _pk_action_name=="")) return; |
| 112 | + var _pk_src = _pk_getUrlLog(_pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ); |
| 113 | + document.writeln('<img src="'+_pk_src+'" alt="Piwik" style="border:0" />'); |
| 114 | + if(!_pk_action_name || _pk_action_name=="") _pk_called=1; |
| 115 | + |
| 116 | + _pk_init_tracker(_pk_site, _pk_pkurl); |
| 117 | +} |
| 118 | + |
| 119 | +function _pk_add_event(elm, evType, fn, useCapture) |
| 120 | +{ |
| 121 | + if (elm.addEventListener) { |
| 122 | + elm.addEventListener(evType, fn, useCapture); |
| 123 | + return true; |
| 124 | + } else if (elm.attachEvent) { |
| 125 | + var r = elm.attachEvent('on' + evType, fn); |
| 126 | + return r; |
| 127 | + } else { |
| 128 | + elm['on' + evType] = fn; |
| 129 | + } |
| 130 | +} |
| 131 | + |
| 132 | +var _pk_tracker_site, _pk_tracker_url; |
| 133 | + |
| 134 | +function _pk_init_tracker(_pk_site, _pk_pkurl) |
| 135 | +{ |
| 136 | + if( typeof(piwik_install_tracker) != "undefined" ) |
| 137 | + _pk_install_tracker = piwik_install_tracker; |
| 138 | + if( typeof(piwik_tracker_pause) != "undefined" ) |
| 139 | + _pk_tracker_pause = piwik_tracker_pause; |
| 140 | + if( typeof(piwik_download_extensions) != "undefined" ) |
| 141 | + _pk_download_extensions = piwik_download_extensions; |
| 142 | + |
| 143 | + _pk_hosts_alias = ( typeof(piwik_hosts_alias) != "undefined" ? piwik_hosts_alias : new Array()) |
| 144 | + _pk_hosts_alias.push(window.location.hostname); |
| 145 | + |
| 146 | + if( !_pk_install_tracker ) |
| 147 | + return; |
| 148 | + |
| 149 | + _pk_tracker_site = _pk_site; |
| 150 | + _pk_tracker_url = _pk_pkurl; |
| 151 | + |
| 152 | + if (document.getElementsByTagName) { |
| 153 | + linksElements = document.getElementsByTagName('a') |
| 154 | + for (var i = 0; i < linksElements.length; i++) { |
| 155 | + if( linksElements[i].className != 'piwik_ignore' ) |
| 156 | + _pk_add_event(linksElements[i], 'mousedown', _pk_click, false); |
| 157 | + } |
| 158 | + } |
| 159 | +} |
| 160 | + |
| 161 | +function _pk_dummy() { return true; } |
| 162 | + |
| 163 | +function _pk_pause(_pk_time_msec) { |
| 164 | + var _pk_now = new Date(); |
| 165 | + var _pk_expire = _pk_now.getTime() + _pk_time_msec; |
| 166 | + while(_pk_now.getTime() < _pk_expire) |
| 167 | + _pk_now = new Date(); |
| 168 | +} |
| 169 | + |
| 170 | +// _pk_type only 'download' and 'link' types supported |
| 171 | +function piwik_track(url, _pk_site, _pk_url, _pk_type) |
| 172 | +{ |
| 173 | + var _pk_image = new Image(); |
| 174 | + _pk_image.onLoad = function() { _pk_dummy(); }; |
| 175 | + _pk_image.src = _pk_url + '?idsite=' + _pk_site + '&' + _pk_type + '=' + escape(url) + '&rand=' + Math.random() + '&redirect=0'; |
| 176 | + _pk_pause(_pk_tracker_pause); |
| 177 | +} |
| 178 | + |
| 179 | +function _pk_is_site_hostname(_pk_hostname) { |
| 180 | + for(i = 0; i < _pk_hosts_alias.length; i++) |
| 181 | + if( _pk_hostname == _pk_hosts_alias[i] ) |
| 182 | + return true; |
| 183 | + return false; |
| 184 | +} |
| 185 | + |
| 186 | +function _pk_click(e) |
| 187 | +{ |
| 188 | + var source; |
| 189 | + |
| 190 | + if (typeof e == 'undefined') |
| 191 | + var e = window.event; |
| 192 | + |
| 193 | + if (typeof e.target != 'undefined') |
| 194 | + source = e.target; |
| 195 | + else if (typeof e.srcElement != 'undefined') |
| 196 | + source = e.srcElement; |
| 197 | + else return true; |
| 198 | + |
| 199 | + while( source.tagName != "A" ) |
| 200 | + source = source.parentNode; |
| 201 | + |
| 202 | + if( typeof source.href == 'undefined' ) |
| 203 | + return true; |
| 204 | + |
| 205 | + var _pk_download = new RegExp('\\.(' + _pk_download_extensions + ')$', 'i'); |
| 206 | + var _pk_link_type; |
| 207 | + var _pk_not_site_hostname = !_pk_is_site_hostname(source.hostname); |
| 208 | + |
| 209 | + if( source.className == "piwik_download" ) |
| 210 | + _pk_link_type = 'download'; |
| 211 | + else if( source.className == "image" ) { |
| 212 | + _pk_link_type = 'link'; |
| 213 | + _pk_not_site_hostname = 0; |
| 214 | + } |
| 215 | + else _pk_link_type = (_pk_download.test(source.href) ? 'download' : 'link'); |
| 216 | + |
| 217 | + if( _pk_not_site_hostname || _pk_link_type == 'download' ) |
| 218 | + piwik_track(source.href, _pk_tracker_site, _pk_tracker_url, _pk_link_type); |
| 219 | + |
| 220 | + return true; |
| 221 | +} |
Property changes on: trunk/extensions/piwik/piwik-mw.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 222 | + native |
Index: trunk/extensions/piwik/Piwik_specialpage.php |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Implements Special:Piwik |
| 5 | + */ |
| 6 | +class Piwik extends SpecialPage { |
| 7 | + function __construct() { |
| 8 | + parent::__construct( 'Piwik' ); |
| 9 | + } |
| 10 | + |
| 11 | + function execute( $par ) { |
| 12 | + global $wgRequest, $wgOut, $wgPiwikURL, $wgScriptPath, $wgPiwikIDSite; |
| 13 | + $this->setHeaders(); |
| 14 | + $wgOut->setPagetitle('Piwik'); |
| 15 | + $selfTitle = $this->getTitle(); |
| 16 | + $badCharsInURL = array(":", "/"); |
| 17 | + $goodCharsInURL = array("%3A", "%2F"); |
| 18 | + $specialcharsURL = str_replace($badCharsInURL, $goodCharsInURL, $wgPiwikURL); |
| 19 | + |
| 20 | + $lastvisits = wfMsg('lastvisits'); |
| 21 | + $countries = wfMsg('countries'); |
| 22 | + $browsers = wfMsg('browsers'); |
| 23 | + |
| 24 | + // checking |
| 25 | + $piwikpage = <<<PIWIK |
| 26 | + <h2>{$lastvisits}</h2> |
| 27 | + <iframe src="{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&moduleToWidgetize=VisitsSummary&actionToWidgetize=getLastVisitsGraph&idSite={$wgPiwikIDSite}&period=day&date=previous30" marginheight="0" marginwidth="0" frameborder="0" height="150" scrolling="no" width="100%"></iframe> |
| 28 | + <h2>{$countries}</h2> |
| 29 | + <iframe src="{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite={$wgPiwikIDSite}&period=day&date=yesterday" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="320" width="100%"></iframe> |
| 30 | + <h2>{$browsers}</h2> |
| 31 | + <iframe src="{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite={$wgPiwikIDSite}&period=day&date=yesterday" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="320" width="100%"></iframe> |
| 32 | + |
| 33 | + |
| 34 | +PIWIK; |
| 35 | + |
| 36 | + $wgOut->addHTML($piwikpage); |
| 37 | + } |
| 38 | + } |
\ No newline at end of file |
Property changes on: trunk/extensions/piwik/Piwik_specialpage.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 39 | + native |
Index: trunk/extensions/piwik/Piwik.i18n.php |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for extension Piwik Integration. |
| 5 | + * |
| 6 | + * @addtogroup Extensions |
| 7 | + */ |
| 8 | + |
| 9 | +$messages = array(); |
| 10 | + |
| 11 | +/** English |
| 12 | + * @author Isb1009 |
| 13 | + */ |
| 14 | +$messages['en'] = array( |
| 15 | + 'piwik-desc' => 'Inserts Piwik script into MediaWiki pages for tracking', |
| 16 | + 'piwik' => 'Piwik', |
| 17 | + 'lastvisits' => 'Last Visits', |
| 18 | + 'countries' => 'Countries', |
| 19 | + 'browsers' => 'Browsers', |
| 20 | +); |
| 21 | + |
| 22 | +/** Spanish (Castellano) |
| 23 | + * @author Isb1009 |
| 24 | + */ |
| 25 | +$messages['es'] = array( |
| 26 | + 'piwik-desc' => 'Inseta el código de Piwik en las páginas de la wiki MediaWiki para hacer las estadísticas', |
| 27 | + 'piwik' => 'Piwik', |
| 28 | + 'lastvisits' => 'Últimas visitas', |
| 29 | + 'countries' => 'Países', |
| 30 | + 'browsers' => 'Navegadores', |
| 31 | +); |
| 32 | + |
| 33 | +/** Catalan (Catal� ) |
| 34 | + * @author Isb1009 |
| 35 | + */ |
| 36 | +$messages['ca'] = array( |
| 37 | + 'piwik-desc' => 'Insereix el codi de Piwik dins les p� gines del MediaWiki per a fer les estadístiques', |
| 38 | + 'piwik' => 'Piwik', |
| 39 | + 'lastvisits' => 'Darreres visites', |
| 40 | + 'countries' => 'Països', |
| 41 | + 'browsers' => 'Navegadors', |
| 42 | +); |
Property changes on: trunk/extensions/piwik/Piwik.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 43 | + native |
Index: trunk/extensions/piwik/Piwik.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * |
6 | 6 | * @addtogroup Extensions |
7 | 7 | * @author isb1009 <isb1009 at gmail dot com> |
8 | | - * @copyright © 2008 isb1009 |
| 8 | + * @copyright � 2008 isb1009 |
9 | 9 | * @licence GNU General Public Licence 2.0 |
10 | 10 | */ |
11 | 11 | |
— | — | @@ -15,11 +15,11 @@ |
16 | 16 | die( 'This file is a MediaWiki extension, it is not a valid entry point' ); |
17 | 17 | } |
18 | 18 | |
19 | | -$wgExtensionCredits['other'][] = array( |
| 19 | +$wgExtensionCredits['specialpage'][] = array( |
20 | 20 | 'name' => 'Piwik Integration', |
21 | | - 'version' => '0.2 Alpha', |
| 21 | + 'version' => '0.2.2rev0.5 Beta', |
22 | 22 | 'author' => 'isb1009', |
23 | | - 'description' => 'Inserts Piwik script into MediaWiki pages for tracking. Based on Google Analytics Integration by Tim Laqua.', |
| 23 | + 'description' => 'Inserts Piwik script into MediaWiki pages for tracking and adds a [[Special:Piwik|special page]] with some stats. Based on Google Analytics Integration by Tim Laqua.', |
24 | 24 | 'descriptionurl' => 'piwik-desc', |
25 | 25 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Piwik_Integration', |
26 | 26 | ); |
— | — | @@ -29,39 +29,35 @@ |
30 | 30 | $wgHooks['SkinAfterBottomScripts'][] = 'efPiwikHookText'; |
31 | 31 | |
32 | 32 | $wgPiwikIDSite = ""; |
33 | | -$wgPiwikURLpiwikjs = ""; |
34 | | -$wgPiwikURLpiwikphp = ""; |
| 33 | +$wgPiwikURL = ""; |
35 | 34 | $wgPiwikIgnoreSysops = true; |
36 | 35 | $wgPiwikIgnoreBots = true; |
| 36 | +$wgPiwikCustomJS = ""; |
37 | 37 | |
38 | | - |
39 | 38 | function efPiwikHookText(&$skin, &$text='') { |
40 | 39 | $text .= efAddPiwik(); |
41 | 40 | return true; |
42 | 41 | } |
43 | 42 | |
44 | 43 | function efAddPiwik() { |
45 | | - global $wgPiwikIDSite, $wgPiwikURLpiwikjs, $wgPiwikURLpiwikphp, $wgPiwikIgnoreSysops, $wgPiwikIgnoreBots, $wgUser; |
| 44 | + global $wgPiwikIDSite, $wgPiwikURL, $wgPiwikIgnoreSysops, $wgPiwikIgnoreBots, $wgUser, $wgScriptPath, $wgPiwikCustomJS; |
46 | 45 | if (!$wgUser->isAllowed('bot') || !$wgPiwikIgnoreBots) { |
47 | 46 | if (!$wgUser->isAllowed('protect') || !$wgPiwikIgnoreSysops) { |
48 | 47 | if ( !empty($wgPiwikIDSite) AND !empty($wgPiwikURLpiwikjs) AND !empty($wgPiwikURLpiwikphp)) { |
49 | 48 | $funcOutput = <<<PIWIK |
50 | 49 | <!-- Piwik --> |
51 | 50 | <a href="http://piwik.org" title="Web analytics" onclick="window.open(this.href);return(false);"> |
52 | | -<script language="javascript" src="{$wgPiwikURLpiwikjs}" type="text/javascript"></script> |
| 51 | +<script language="javascript" src="{$wgScriptPath}/extensions/piwik/piwik-mw.js" type="text/javascript"></script> |
53 | 52 | <script type="text/javascript"> |
54 | 53 | <!-- |
55 | 54 | piwik_action_name = ''; |
56 | 55 | piwik_idsite = {$wgPiwikIDSite}; |
57 | | -piwik_url = '{$wgPiwikURLpiwikphp}'; |
| 56 | +piwik_url = '{$wgPiwikURL}piwik.php'; |
58 | 57 | piwik_log(piwik_action_name, piwik_idsite, piwik_url); |
59 | | - if( source.className == "image" ) { |
60 | | - _pk_link_type = 'link'; |
61 | | - _pk_not_site_hostname = 0; |
62 | | - } |
| 58 | +{$wgPiwikCustomJS} |
63 | 59 | //--> |
64 | 60 | </script><object> |
65 | | -<noscript><p>Web analytics <img src="{$wgPiwikURLpiwikphp}" style="border:0" alt="piwik"/></p> |
| 61 | +<noscript><p>Web analytics <img src="{$wgPiwikURL}/piwik.php" style="border:0" alt="piwik"/></p> |
66 | 62 | </noscript></object></a> |
67 | 63 | <!-- /Piwik --> |
68 | 64 | PIWIK; |
— | — | @@ -77,9 +73,25 @@ |
78 | 74 | |
79 | 75 | return $funcOutput; |
80 | 76 | } |
| 77 | +$dir = dirname(__FILE__) . '/'; |
| 78 | +$wgAutoloadClasses['Piwik'] = $dir . 'Piwik_specialpage.php'; # Tell MediaWiki to load the extension body. |
| 79 | +$wgExtensionMessagesFiles['Piwik'] = $dir . 'Piwik.i18n.php'; |
| 80 | +$wgSpecialPages['Piwik'] = 'Piwik'; # Let MediaWiki know about your new special page. |
| 81 | +$wgHooks['LanguageGetSpecialPageAliases'][] = 'Piwik'; # Add any aliases for the special page. |
81 | 82 | |
82 | | -// Alias for efAddPiwik - backwards compatibility. |
83 | | -function addPiwik() { |
84 | | - return efAddPiwik(); |
| 83 | + |
| 84 | +function Piwik(&$specialPageArray, $code) { |
| 85 | + # The localized title of the special page is among the messages of the extension: |
| 86 | + |
| 87 | + wfLoadExtensionMessages('Piwik'); |
| 88 | + $text = wfMsg('piwik'); |
| 89 | + |
| 90 | + # Convert from title in text form to DBKey and put it into the alias array: |
| 91 | + $title = Title::newFromText($text); |
| 92 | + $specialPageArray['Piwik'][] = $title->getDBKey(); |
| 93 | + |
| 94 | + return true; |
85 | 95 | } |
86 | | -?> |
| 96 | + |
| 97 | +///Alias for efAddPiwik - backwards compatibility. |
| 98 | +function addPiwik() { return efAddPiwik(); } |
\ No newline at end of file |
Index: trunk/extensions/piwik/README |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | MediaWiki Piwik Integration extension |
3 | 3 | |
4 | | -version 0.2 Alpha |
5 | | -25 May 2008 |
| 4 | +version 0.2.2rev0.5 Beta |
| 5 | +31 May 2008 |
6 | 6 | |
7 | 7 | This is the README file for the Piwik Integration extension for MediaWiki |
8 | 8 | software. The extension is only useful if you've got a MediaWiki |
— | — | @@ -28,24 +28,39 @@ |
29 | 29 | require_once($IP.'/extensions/piwik/Piwik.php'); |
30 | 30 | |
31 | 31 | |
32 | | -* Then, you need to define where are piwik.php and piwik.js files in your |
33 | | - Piwik installation and the "idsite". To do it, just add after the |
34 | | - require_once: |
| 32 | +* Then, you need to define where Piwik is installed and the "idsite". |
| 33 | + To do it, just add after the require_once: |
35 | 34 | |
36 | | - $wgPiwikURLpiwikjs = "url/of/piwik.js"; |
37 | | - $wgPiwikURLpiwikphp = "piwik.php_location"; |
| 35 | + $wgPiwikURL = "http://piwik/url/"; |
38 | 36 | $wgPiwikIDSite = "piwik_idsite"; |
39 | 37 | |
40 | | - Note: Change the value of $wgPiwikURLpiwikjs with the URL inside |
41 | | - "src". For example, in: |
| 38 | + Note: Change the value of $wgPiwikURL with the URL where you installed |
| 39 | + Piwik. Remember to add the trailing slash! |
| 40 | + |
| 41 | + Change the value of $wgPiwikIDSite with the number inside |
| 42 | + "piwik_idsite" in your Piwik code. For example, in: |
| 43 | + |
| 44 | + <!-- Piwik --> |
| 45 | + <a href="http://piwik.org" title="Web analytics" onclick="window.open(this.href);return(false);"> |
| 46 | + <script language="javascript" src="http://piwik/url/piwik.js" type="text/javascript"></script> |
| 47 | + <script type="text/javascript"> |
| 48 | + <!-- |
| 49 | + piwik_action_name = ''; |
| 50 | + piwik_idsite = 1; |
| 51 | + piwik_url = 'http://piwik/url/piwik.php'; |
| 52 | + piwik_log(piwik_action_name, piwik_idsite, piwik_url); |
| 53 | + //--> |
| 54 | + </script><object> |
| 55 | + <noscript><p>Web analytics <img src="http://stats.astronomipedia.es/piwik.php" style="border:0" alt="piwik"/></p> |
| 56 | + </noscript></object></a> |
| 57 | + <!-- /Piwik --> |
| 58 | + |
| 59 | + the $wgPiwikIDSite is 1 |
42 | 60 | |
43 | | - <script language="javascript" src="http://domain/path/piwik.js" |
44 | | - type="text/javascript"></script> |
45 | | - <script type="text/javascript"> |
46 | | - |
47 | | - the $wgPiwikURLpiwikjs is http://domain/path/piwik.js |
48 | | - |
49 | | - |
50 | | - Change the value of $wgPiwikURLpiwikphp with the URL inside |
51 | | - "piwik_url" and the value of $wgPiwikIDSite with the number inside |
52 | | - "piwik_idsite" in your Piwik code. |
| 61 | + |
| 62 | +* You can also set $wgPiwikCustomJS if you want to add custom javascript |
| 63 | + tags (see http://piwik.org/javascript-tag-documentation/ for further |
| 64 | + information). For example: |
| 65 | + |
| 66 | + $wgPiwikCustomJS = "piwik_hosts_alias = ["hostname1.com", "hostname2.com"]; // the current tracked website is added to this array anyway |
| 67 | + piwik_install_tracker = 0;" |
\ No newline at end of file |