Index: trunk/extensions/Piwik/Piwik_specialpage.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | } |
11 | 11 | |
12 | 12 | function execute( $par ) { |
13 | | - global $wgRequest, $wgOut, $wgPiwikURL, $wgScriptPath, $wgPiwikIDSite; |
| 13 | + global $wgRequest, $wgOut, $wgPiwikURL, $wgScriptPath, $wgPiwikIDSite, $wgPiwikSpecialPageDate; |
14 | 14 | |
15 | 15 | wfLoadExtensionMessages( 'Piwik' ); |
16 | 16 | |
— | — | @@ -18,24 +18,26 @@ |
19 | 19 | $wgOut->setPagetitle( 'Piwik' ); |
20 | 20 | |
21 | 21 | $selfTitle = $this->getTitle(); |
22 | | - $badCharsInURL = array( ":", "/" ); |
23 | | - $goodCharsInURL = array( "%3A", "%2F" ); |
24 | | - $specialcharsURL = str_replace( $badCharsInURL, $goodCharsInURL, $wgPiwikURL ); |
25 | 22 | |
26 | 23 | $lastvisits = wfMsg( 'piwik-lastvisits' ); |
27 | 24 | $countries = wfMsg( 'piwik-countries' ); |
28 | 25 | $browsers = wfMsg( 'piwik-browsers' ); |
29 | 26 | |
| 27 | + if ( $wgPiwikSpecialPageDate != 'today' && $wgPiwikSpecialPageDate != 'yesterday' ) { |
| 28 | + $wgPiwikSpecialPageDate = 'yesterday'; |
| 29 | + } |
| 30 | + |
| 31 | + |
30 | 32 | // checking |
31 | 33 | $piwikpage = <<<PIWIK |
32 | 34 | <h2>{$lastvisits}</h2> |
33 | | - <iframe src="http://{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&columns[]=nb_visits&moduleToWidgetize=VisitsSummary&actionToWidgetize=getEvolutionGraph&idSite={$wgPiwikIDSite}&period=day&date=last30&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" height="250" scrolling="no" width="100%"></iframe> |
| 35 | + <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&columns[]=nb_visits&moduleToWidgetize=VisitsSummary&actionToWidgetize=getEvolutionGraph&idSite={$wgPiwikIDSite}&period=day&date=last30&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" height="250" scrolling="no" width="100%"></iframe> |
34 | 36 | |
35 | 37 | <h2>{$countries}</h2> |
36 | | - <iframe src="http://{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite={$wgPiwikIDSite}&period=day&date=yesterday&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> |
| 38 | + <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite={$wgPiwikIDSite}&period=day&date={$wgPiwikSpecialPageDate}&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> |
37 | 39 | |
38 | 40 | <h2>{$browsers}</h2> |
39 | | - <iframe src="http://{$wgPiwikURL}/index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite={$wgPiwikIDSite}&period=day&date=yesterday&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> |
| 41 | + <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite={$wgPiwikIDSite}&period=day&date={$wgPiwikSpecialPageDate}&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> |
40 | 42 | |
41 | 43 | PIWIK; |
42 | 44 | |
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-2010 Isb1009 |
9 | 9 | * @licence GNU General Public Licence 2.0 |
10 | 10 | */ |
11 | 11 | |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | $wgExtensionCredits['specialpage'][] = array( |
17 | 17 | 'path' => __FILE__, |
18 | 18 | 'name' => 'Piwik Integration', |
19 | | - 'version' => '1.5.1-piwik0.4.3', |
| 19 | + 'version' => '1.5.2-piwik0.5.5', |
20 | 20 | 'author' => 'Isb1009', |
21 | 21 | 'descriptionmsg' => 'piwik-desc', |
22 | 22 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Piwik_Integration', |
— | — | @@ -30,6 +30,7 @@ |
31 | 31 | $wgPiwikCustomJS = ""; |
32 | 32 | $wgPiwikUsePageTitle = false; |
33 | 33 | $wgPiwikActionName = ""; |
| 34 | +$wgPiwikSpecialPageDate = 'yesterday'; |
34 | 35 | |
35 | 36 | function efPiwikHookText( $skin, &$text = '' ) { |
36 | 37 | $text .= efAddPiwik(); |
Index: trunk/extensions/Piwik/README |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | MediaWiki Piwik Integration extension |
3 | 3 | |
4 | | -version 1.5-piwik0.4.2 |
5 | | -9 August 2009 |
| 4 | +version 1.5.2-piwik0.5.5 |
| 5 | +24 April 2010 |
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 |
— | — | @@ -26,24 +26,25 @@ |
27 | 27 | * Edit your LocalSettings.php and, at the end of the file, add the |
28 | 28 | following: |
29 | 29 | |
30 | | - require_once($IP.'/extensions/piwik/Piwik.php'); |
| 30 | + require_once('/extensions/piwik/Piwik.php'); |
31 | 31 | |
32 | 32 | |
33 | 33 | * Then, you need to define where Piwik is installed and the "idsite". |
34 | 34 | To do it, just add after the require_once: |
35 | 35 | |
36 | | - $wgPiwikURL = "piwik/url/"; //Don't include the protocol |
| 36 | + $wgPiwikURL = "piwik-host.tld/dir/"; //Don't include the protocol |
37 | 37 | $wgPiwikIDSite = "piwik_idsite"; |
38 | 38 | |
39 | | - Note: Change the value of $wgPiwikURL with the URL, without the protocol, |
40 | | - where you installed Piwik. Remember to add the trailing slash! |
| 39 | + Note: Change the value of $wgPiwikURL with the URL, without the protocol |
| 40 | + but including the domain name, where you installed Piwik. |
| 41 | + Remember to add the trailing slash! |
41 | 42 | |
42 | 43 | Change the value of $wgPiwikIDSite with your site ID. |
43 | 44 | For example, in: |
44 | 45 | |
45 | 46 | <!-- Piwik --> |
46 | 47 | <script type="text/javascript"> |
47 | | - var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik/url/" : "http://piwik/url/"); |
| 48 | + var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik-host.tld/dir/" : "http://piwik-host.tld/dir/"); |
48 | 49 | document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); |
49 | 50 | </script><script type="text/javascript"> |
50 | 51 | try { |
— | — | @@ -51,7 +52,7 @@ |
52 | 53 | piwikTracker.trackPageView(); |
53 | 54 | piwikTracker.enableLinkTracking(); |
54 | 55 | } catch( err ) {} |
55 | | - </script><noscript><p><img src="http://piwik/url/piwik.php?idsite=3" style="border:0" alt=""/></p></noscript> |
| 56 | + </script><noscript><p><img src="http://piwik-host.tld/dir/piwik.php?idsite=3" style="border:0" alt=""/></p></noscript> |
56 | 57 | <!-- End Piwik Tag --> |
57 | 58 | |
58 | 59 | the $wgPiwikIDSite is 3 |
— | — | @@ -83,3 +84,6 @@ |
84 | 85 | add that line with 'bureaucrat' where 'usergroup' is. The same is for |
85 | 86 | normal users ('user') and anonymous users ('*'). |
86 | 87 | |
| 88 | +* Since 1.5.2, you can set the date for the countries and browsers information in |
| 89 | + the special page, setting $wgPiwikSpecialPageDate to either today or yesterday. |
| 90 | + |