This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SiteMeter.php
61 lines (53 loc) · 2.22 KB
/
SiteMeter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Site Meter for MediaWiki
*
* @file
* @ingroup Extensions
* @author Lewis Cawte (http://mediawiki.org/wiki/User:Lcawte) <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 1 );
}
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'Site Meter',
'version' => '1.1',
'author' => 'Lewis Cawte',
'descriptionmsg' => 'sitemeter-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:Site_Meter',
);
$wgSiteMeterServer = 's8'; // Server part (s<Number>.sitemeter.com)
$wgSiteMeterCodename = 'sm4mw'; // Codename part (server<CodenameHere>)
# Internationalization files
$wgMessagesDirs['SiteMeter'] = __DIR__ . '/i18n';
$wgHooks['SkinBuildSidebar'][] = "wfSiteMeterMW";
function wfSiteMeterMW( $skin, &$bar ) {
global $wgSiteMeterServer, $wgSiteMeterCodename;
$siteMeterCodename = $wgSiteMeterServer . $wgSiteMeterCodename;
$siteMeterCode = '<!-- Site Meter -->' .
'<script type="text/javascript" src="http://' . $wgSiteMeterServer . '.sitemeter.com/js/counter.js?site=' . $siteMeterCodename . '">' .
'</script>' .
'<noscript>' .
'<a href="http://' . $wgSiteMeterServer . '.sitemeter.com/stats.asp?site=' . $siteMeterCodename . '" target="_top">' .
'<img src="http://' . $wgSiteMeterServer . '.sitemeter.com/meter.asp?site=' . $siteMeterCodename . '" alt="Site Meter" border="0"/></a>' .
'</noscript>' .
'<!-- Copyright (c)2009 Site Meter -->';
$bar['sitemeter'] = $siteMeterCode;
return true;
}