Version Description
- Bugfix: Error messages won't by cached anymore
- Bugfix: Custom vars will now be added properly
- Bugfix: Missing slash in proxy mode added
- Feature: Track users on admin pages
Download this release
Release Info
Developer | Braekling |
Plugin | WP-Matomo (WP-Piwik) |
Version | 0.9.9.7 |
Comparing to | |
See all releases |
Code changes from version 0.9.9.6 to 0.9.9.7
- classes/WP_Piwik_Settings.php +3 -1
- readme.txt +13 -4
- settings/piwik.php +8 -3
- settings/tracking.php +5 -5
- settings/views.php +4 -0
- shortcodes/overview.php +1 -1
- update/90001.php +1 -1
- update/90971.php +3 -0
- wp-piwik.php +36 -16
classes/WP_Piwik_Settings.php
CHANGED
@@ -30,6 +30,7 @@
|
|
30 |
'track_mode' => 0,
|
31 |
'track_post' => false,
|
32 |
'track_proxy' => false,
|
|
|
33 |
'track_cdnurlssl' => '',
|
34 |
'track_noscript' => false,
|
35 |
'track_nojavascript' => false,
|
@@ -38,7 +39,8 @@
|
|
38 |
'disable_cookies' => false,
|
39 |
'toolbar' => false,
|
40 |
'shortcodes' => false,
|
41 |
-
'cache' => true
|
|
|
42 |
),
|
43 |
$settings = array(
|
44 |
'name' => '',
|
30 |
'track_mode' => 0,
|
31 |
'track_post' => false,
|
32 |
'track_proxy' => false,
|
33 |
+
'track_admin' => false,
|
34 |
'track_cdnurlssl' => '',
|
35 |
'track_noscript' => false,
|
36 |
'track_nojavascript' => false,
|
39 |
'disable_cookies' => false,
|
40 |
'toolbar' => false,
|
41 |
'shortcodes' => false,
|
42 |
+
'cache' => true,
|
43 |
+
'perpost_stats' => false
|
44 |
),
|
45 |
$settings = array(
|
46 |
'name' => '',
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WP-Piwik ===
|
2 |
|
3 |
Contributors: Braekling
|
4 |
-
Requires at least: 3.
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 0.9.9.
|
7 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
|
8 |
Tags: statistics, stats, analytics, piwik, wpmu
|
9 |
|
@@ -13,7 +13,7 @@ This plugin adds a Piwik stats site to your WordPress or WordPress multisite das
|
|
13 |
|
14 |
This plugin adds a Piwik stats site to your WordPress dashboard. It's also able to add the Piwik tracking code to your blog using wp_footer.
|
15 |
|
16 |
-
**You need a running Piwik (at least
|
17 |
|
18 |
Look at the [Piwik website](http://piwik.org/) to get further information about Piwik.
|
19 |
|
@@ -71,6 +71,9 @@ Try to enable the "avoid mod_security" option (WP-Piwik settings, Tracking tab)
|
|
71 |
|
72 |
See [this support thread](http://wordpress.org/support/topic/plugin-wp-piwik-https-ssl-support?replies=3).
|
73 |
|
|
|
|
|
|
|
74 |
== Installation ==
|
75 |
|
76 |
= Install WP-Piwik on a simple WordPress blog =
|
@@ -114,6 +117,12 @@ Please update Piwik if not done yet (Piwik 1.11 or higher is recommended)!
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
= 0.9.9.6 =
|
118 |
* Bugfix: Proxy script will work again
|
119 |
* Option: Enable/disable one week caching
|
1 |
=== WP-Piwik ===
|
2 |
|
3 |
Contributors: Braekling
|
4 |
+
Requires at least: 3.8
|
5 |
+
Tested up to: 3.8
|
6 |
+
Stable tag: 0.9.9.7
|
7 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
|
8 |
Tags: statistics, stats, analytics, piwik, wpmu
|
9 |
|
13 |
|
14 |
This plugin adds a Piwik stats site to your WordPress dashboard. It's also able to add the Piwik tracking code to your blog using wp_footer.
|
15 |
|
16 |
+
**You need a running Piwik (at least 2.0.2) installation** and at least view access to your stats. Also PHP 5 or higher is strictly required.
|
17 |
|
18 |
Look at the [Piwik website](http://piwik.org/) to get further information about Piwik.
|
19 |
|
71 |
|
72 |
See [this support thread](http://wordpress.org/support/topic/plugin-wp-piwik-https-ssl-support?replies=3).
|
73 |
|
74 |
+
= Overview shortcode shows no unique visitors using a yearly range. =
|
75 |
+
See [Piwik FAQ](http://piwik.org/faq/how-to/#faq_113).
|
76 |
+
|
77 |
== Installation ==
|
78 |
|
79 |
= Install WP-Piwik on a simple WordPress blog =
|
117 |
|
118 |
== Changelog ==
|
119 |
|
120 |
+
= 0.9.9.7 =
|
121 |
+
* Bugfix: Error messages won't by cached anymore
|
122 |
+
* Bugfix: Custom vars will now be added properly
|
123 |
+
* Bugfix: Missing slash in proxy mode added
|
124 |
+
* Feature: Track users on admin pages
|
125 |
+
|
126 |
= 0.9.9.6 =
|
127 |
* Bugfix: Proxy script will work again
|
128 |
* Option: Enable/disable one week caching
|
settings/piwik.php
CHANGED
@@ -7,7 +7,7 @@ if (!$bolFOpen && !$bolCURL) {
|
|
7 |
<strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong>
|
8 |
</td>
|
9 |
</tr><?php } else { ?><tr>
|
10 |
-
<
|
11 |
<?php _e('To enable Piwik statistics, please enter', 'wp-piwik'); ?>:
|
12 |
<ol>
|
13 |
<li><?php _e('your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server path (like /var/www/mydomain.com/httpdocs/piwik/)', 'wp-piwik'); ?></li>
|
@@ -17,7 +17,7 @@ if (!$bolFOpen && !$bolCURL) {
|
|
17 |
<?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?>
|
18 |
<p><?php _e('<strong>Important note:</strong> If you do not host this blog on your own, your site admin is able to get your auth token from the database.', 'wp-piwik'); ?></p>
|
19 |
<?php } ?>
|
20 |
-
</
|
21 |
</tr><tr>
|
22 |
<th><?php _e('Piwik URL', 'wp-piwik'); ?> (REST API):</th>
|
23 |
<td>
|
@@ -42,7 +42,12 @@ if (!$bolFOpen && !$bolCURL) {
|
|
42 |
<input name="wp-piwik_token" id="wp-piwik_token" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_token'); ?>" />
|
43 |
<label for="wp-piwik_token"></label>
|
44 |
</td>
|
45 |
-
</tr><?php
|
|
|
|
|
|
|
|
|
|
|
46 |
<th><?php _e('Auto config', 'wp-piwik'); ?>:</th>
|
47 |
<td>
|
48 |
<input name="wp-piwik_auto_site_config" id="wp-piwik_auto_site_config" value="1" type="checkbox"<?php echo (self::$settings->getGlobalOption('auto_site_config')?' checked="checked"':'') ?>/>
|
7 |
<strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong>
|
8 |
</td>
|
9 |
</tr><?php } else { ?><tr>
|
10 |
+
<td colspan="2">
|
11 |
<?php _e('To enable Piwik statistics, please enter', 'wp-piwik'); ?>:
|
12 |
<ol>
|
13 |
<li><?php _e('your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server path (like /var/www/mydomain.com/httpdocs/piwik/)', 'wp-piwik'); ?></li>
|
17 |
<?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?>
|
18 |
<p><?php _e('<strong>Important note:</strong> If you do not host this blog on your own, your site admin is able to get your auth token from the database.', 'wp-piwik'); ?></p>
|
19 |
<?php } ?>
|
20 |
+
</td>
|
21 |
</tr><tr>
|
22 |
<th><?php _e('Piwik URL', 'wp-piwik'); ?> (REST API):</th>
|
23 |
<td>
|
42 |
<input name="wp-piwik_token" id="wp-piwik_token" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_token'); ?>" />
|
43 |
<label for="wp-piwik_token"></label>
|
44 |
</td>
|
45 |
+
</tr><tr><th><?php _e('Enable cache', 'wp-piwik'); ?>:</th><td>
|
46 |
+
<input type="checkbox" value="1" id="wp-piwik_cache" name="wp-piwik_cache"<?php echo (self::$settings->getGlobalOption('cache')?' checked="checked"':''); ?> />
|
47 |
+
<label for="wp-piwik_cache"><?php _e('Cache API calls, which not contain today\'s values, for a week', 'wp-piwik'); ?>.</label>
|
48 |
+
</td></tr>
|
49 |
+
|
50 |
+
<?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?><tr>
|
51 |
<th><?php _e('Auto config', 'wp-piwik'); ?>:</th>
|
52 |
<td>
|
53 |
<input name="wp-piwik_auto_site_config" id="wp-piwik_auto_site_config" value="1" type="checkbox"<?php echo (self::$settings->getGlobalOption('auto_site_config')?' checked="checked"':'') ?>/>
|
settings/tracking.php
CHANGED
@@ -86,16 +86,16 @@ if (self::$settings->getGlobalOption('add_tracking_code')) {
|
|
86 |
<label for="wp-piwik_reqpost"><?php _e('WP-Piwik can automatically force the Tracking Code to sent data in POST. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/troubleshooting/#faq_100">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label>
|
87 |
</td></tr>
|
88 |
|
89 |
-
<tr><th><?php _e('Enable cache', 'wp-piwik'); ?>:</th><td>
|
90 |
-
<input type="checkbox" value="1" id="wp-piwik_cache" name="wp-piwik_cache"<?php echo (self::$settings->getGlobalOption('cache')?' checked="checked"':''); ?> />
|
91 |
-
<label for="wp-piwik_cache"><?php _e('Cache API calls, which not contain today\'s values, for a week', 'wp-piwik'); ?>.</label>
|
92 |
-
</td></tr>
|
93 |
-
|
94 |
<tr><th><?php _e('CDN URL', 'wp-piwik'); ?>:</th><td>
|
95 |
http://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurl'); ?>" id="wp-piwik_cdnurl" name="wp-piwik_cdnurl" /> https://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurlssl'); ?>" id="wp-piwik_cdnurlssl" name="wp-piwik_cdnurlssl" /><br />
|
96 |
<label for="wp-piwik_reqpost"><?php _e('Leave blank if you do not want to define a CDN URL or you do not know what this is.', 'wp-piwik'); ?></label>
|
97 |
</td></tr>
|
98 |
|
|
|
|
|
|
|
|
|
|
|
99 |
<tr><th><?php _e('Tracking filter', 'wp-piwik'); ?>:</th><td>
|
100 |
<?php
|
101 |
global $wp_roles;
|
86 |
<label for="wp-piwik_reqpost"><?php _e('WP-Piwik can automatically force the Tracking Code to sent data in POST. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/troubleshooting/#faq_100">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label>
|
87 |
</td></tr>
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
<tr><th><?php _e('CDN URL', 'wp-piwik'); ?>:</th><td>
|
90 |
http://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurl'); ?>" id="wp-piwik_cdnurl" name="wp-piwik_cdnurl" /> https://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurlssl'); ?>" id="wp-piwik_cdnurlssl" name="wp-piwik_cdnurlssl" /><br />
|
91 |
<label for="wp-piwik_reqpost"><?php _e('Leave blank if you do not want to define a CDN URL or you do not know what this is.', 'wp-piwik'); ?></label>
|
92 |
</td></tr>
|
93 |
|
94 |
+
<tr><th><?php _e('Track admin pages', 'wp-piwik'); ?>:</th><td>
|
95 |
+
<input type="checkbox" value="1" id="wp-piwik_trackadmin" name="wp-piwik_trackadmin"<?php echo (self::$settings->getGlobalOption('track_admin')?' checked="checked"':''); ?> />
|
96 |
+
<label for="wp-piwik_trackadmin"><?php _e('Enable to track users on admin pages (remember to configure the tracking filter appropriately).'); ?></label>
|
97 |
+
</td></tr>
|
98 |
+
|
99 |
<tr><th><?php _e('Tracking filter', 'wp-piwik'); ?>:</th><td>
|
100 |
<?php
|
101 |
global $wp_roles;
|
settings/views.php
CHANGED
@@ -54,6 +54,10 @@ if (!$bolFOpen && !$bolCURL) {
|
|
54 |
<input type="checkbox" value="1" id="wp-piwik_disabletimelimit" name="wp-piwik_disabletimelimit"<?php echo (self::$settings->getGlobalOption('disable_timelimit')?' checked="checked"':''); ?> />
|
55 |
<label for="wp-piwik_disabletimelimit"><?php echo _e('Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik'); ?></label>
|
56 |
</td></tr>
|
|
|
|
|
|
|
|
|
57 |
<tr><th><?php _e('Enable shortcodes', 'wp-piwik'); ?>:</th><td>
|
58 |
<input type="checkbox" value="1" id="wp-piwik_shortcodes" name="wp-piwik_shortcodes"<?php echo (self::$settings->getGlobalOption('shortcodes')?' checked="checked"':''); ?> />
|
59 |
<label for="wp-piwik_shortcodes"><?php echo _e('Enable shortcodes in post or page content.', 'wp-piwik'); ?></label>
|
54 |
<input type="checkbox" value="1" id="wp-piwik_disabletimelimit" name="wp-piwik_disabletimelimit"<?php echo (self::$settings->getGlobalOption('disable_timelimit')?' checked="checked"':''); ?> />
|
55 |
<label for="wp-piwik_disabletimelimit"><?php echo _e('Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik'); ?></label>
|
56 |
</td></tr>
|
57 |
+
<tr><th><?php _e('Show per post stats', 'wp-piwik'); ?>:</th><td>
|
58 |
+
<input type="checkbox" value="1" id="wp-piwik_perpost" name="wp-piwik_perpost"<?php echo (self::$settings->getGlobalOption('perpost_stats')?' checked="checked"':''); ?> />
|
59 |
+
<label for="wp-piwik_shortcodes"><?php echo _e('Show stats about single posts at the post edit admin page.', 'wp-piwik'); ?></label>
|
60 |
+
</td></tr>
|
61 |
<tr><th><?php _e('Enable shortcodes', 'wp-piwik'); ?>:</th><td>
|
62 |
<input type="checkbox" value="1" id="wp-piwik_shortcodes" name="wp-piwik_shortcodes"<?php echo (self::$settings->getGlobalOption('shortcodes')?' checked="checked"':''); ?> />
|
63 |
<label for="wp-piwik_shortcodes"><?php echo _e('Enable shortcodes in post or page content.', 'wp-piwik'); ?></label>
|
shortcodes/overview.php
CHANGED
@@ -8,7 +8,7 @@ $aryData = $this->callPiwikAPI('VisitsSummary.get',
|
|
8 |
$this->aryAttributes['limit']
|
9 |
);
|
10 |
|
11 |
-
$this->strResult = '<table><tr><th>'.__('Overview', 'wp-piwik').($this->aryAttributes['title']?' '.$this->aryAttributes['title']:'').'</th></tr>';
|
12 |
|
13 |
function summize($aryData) {
|
14 |
$aryTmp = array();
|
8 |
$this->aryAttributes['limit']
|
9 |
);
|
10 |
|
11 |
+
$this->strResult = '<table><tr><th colspan="2">'.__('Overview', 'wp-piwik').($this->aryAttributes['title']?' '.$this->aryAttributes['title']:'').'</th></tr>';
|
12 |
|
13 |
function summize($aryData) {
|
14 |
$aryTmp = array();
|
update/90001.php
CHANGED
@@ -6,7 +6,7 @@ if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && $aryWPMUConfig) {
|
|
6 |
delete_site_option('wpmu-piwik_global-settings');
|
7 |
self::$settings->setGlobalOption('auto_site_config', true);
|
8 |
} else self::$settings->setGlobalOption('auto_site_config', false);
|
9 |
-
self::$settings->setGlobalOption('dashboard_seo'
|
10 |
self::$settings->setGlobalOption('stats_seo', false);
|
11 |
self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404'));
|
12 |
self::$settings->setGlobalOption('track_compress', false);
|
6 |
delete_site_option('wpmu-piwik_global-settings');
|
7 |
self::$settings->setGlobalOption('auto_site_config', true);
|
8 |
} else self::$settings->setGlobalOption('auto_site_config', false);
|
9 |
+
self::$settings->setGlobalOption('dashboard_seo', false);
|
10 |
self::$settings->setGlobalOption('stats_seo', false);
|
11 |
self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404'));
|
12 |
self::$settings->setGlobalOption('track_compress', false);
|
update/90971.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
self::$settings->setGlobalOption('track_admin', false);
|
3 |
+
self::$settings->setGlobalOption('perpost_stats', false);
|
wp-piwik.php
CHANGED
@@ -6,12 +6,12 @@ Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
|
|
6 |
|
7 |
Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
|
8 |
|
9 |
-
Version: 0.9.9.
|
10 |
Author: André Bräkling
|
11 |
Author URI: http://www.braekling.de
|
12 |
|
13 |
******************************************************************************************
|
14 |
-
Copyright (C) 2009-
|
15 |
|
16 |
This program is free software: you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
@@ -42,8 +42,8 @@ if (!class_exists('wp_piwik')) {
|
|
42 |
class wp_piwik {
|
43 |
|
44 |
private static
|
45 |
-
$intRevisionId =
|
46 |
-
$strVersion = '0.9.9.
|
47 |
$blog_id,
|
48 |
$intDashboardID = 30,
|
49 |
$strPluginBasename = NULL,
|
@@ -108,6 +108,9 @@ class wp_piwik {
|
|
108 |
add_action('wp_head', array($this, 'site_header'));
|
109 |
// Add <noscript> code if enabled
|
110 |
if (self::$settings->getGlobalOption('track_noscript')) add_action('wp_footer', array($this, 'site_footer'));
|
|
|
|
|
|
|
111 |
}
|
112 |
self::$settings->save();
|
113 |
}
|
@@ -172,7 +175,9 @@ class wp_piwik {
|
|
172 |
self::includeFile('update/90940');
|
173 |
if (self::$settings->getGlobalOption('revision') < 90961)
|
174 |
self::includeFile('update/90961');
|
175 |
-
|
|
|
|
|
176 |
// Install new version
|
177 |
$this->installPlugin();
|
178 |
}
|
@@ -257,7 +262,7 @@ class wp_piwik {
|
|
257 |
if (!empty($strMetaKey) && !empty($strMetaVal))
|
258 |
$strCustomVars .= "_paq.push(['setCustomVariable',".$i.", '".$strMetaKey."', '".$strMetaVal."', 'page']);\n";
|
259 |
}
|
260 |
-
if (!empty($
|
261 |
}
|
262 |
echo $strTrackingCode;
|
263 |
echo '<!-- *** /WP-Piwik *********************************************************** -->'."\n";
|
@@ -639,6 +644,13 @@ class wp_piwik {
|
|
639 |
wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik.css',array(),self::$strVersion);
|
640 |
}
|
641 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
/**
|
643 |
* Add required header tags to stats page
|
644 |
*/
|
@@ -688,11 +700,12 @@ class wp_piwik {
|
|
688 |
curl_setopt($c, CURLOPT_HEADER, 0);
|
689 |
// Set cURL timeout
|
690 |
curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout'));
|
691 |
-
|
692 |
-
|
693 |
-
curl_setopt($c,
|
694 |
-
|
695 |
-
|
|
|
696 |
}
|
697 |
// Get result
|
698 |
$strResult = curl_exec($c);
|
@@ -830,6 +843,7 @@ class wp_piwik {
|
|
830 |
$strURL = str_replace('http://', '://', $strURL);
|
831 |
$strProxy = str_replace('https://', '://', plugins_url('wp-piwik'));
|
832 |
$strProxy = str_replace('http://', '://', $strProxy);
|
|
|
833 |
$strCode = str_replace($strURL, $strProxy, $strCode);
|
834 |
}
|
835 |
$strCode = str_replace('//";','/"',$strCode);
|
@@ -883,10 +897,13 @@ class wp_piwik {
|
|
883 |
*/
|
884 |
function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP', $strPageURL = '') {
|
885 |
// Create unique cache key
|
886 |
-
$strKey = 'wp-
|
887 |
// Call API if data not cached
|
888 |
-
|
889 |
-
|
|
|
|
|
|
|
890 |
$strToken = self::$settings->getGlobalOption('piwik_token');
|
891 |
// If multisite stats are shown, maybe the super admin wants to show other blog's stats.
|
892 |
if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && function_exists('wp_get_current_user') && is_super_admin() && isset($_GET['wpmu_show_stats'])) {
|
@@ -933,7 +950,8 @@ class wp_piwik {
|
|
933 |
$strMethod != 'SitesManager.getJavascriptTag' &&
|
934 |
$strDate != 'today' && $strDate != date('Ymd') && substr($strDate, 0, 4) != 'last' &&
|
935 |
self::$settings->getGlobalOption('cache') &&
|
936 |
-
!(isset($result['result']) && $result['result'] == 'error')
|
|
|
937 |
) set_transient($strKey, $result, WEEK_IN_SECONDS);
|
938 |
}
|
939 |
return $result;
|
@@ -1160,6 +1178,7 @@ class wp_piwik {
|
|
1160 |
self::$settings->setGlobalOption('disable_timelimit', (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false));
|
1161 |
self::$settings->setGlobalOption('toolbar', (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false));
|
1162 |
self::$settings->setGlobalOption('shortcodes', (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false));
|
|
|
1163 |
break;
|
1164 |
case 'tracking':
|
1165 |
self::$settings->setGlobalOption('add_tracking_code', (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false));
|
@@ -1172,8 +1191,8 @@ class wp_piwik {
|
|
1172 |
self::$settings->setGlobalOption('track_cdnurlssl', trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$settings->getGlobalOption('track_cdnurl')));
|
1173 |
self::$settings->setGlobalOption('track_noscript', (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false));
|
1174 |
self::$settings->setGlobalOption('track_nojavascript', (isset($_POST['wp-piwik_nojavascript'])?$_POST['wp-piwik_nojavascript']:false));
|
|
|
1175 |
self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()));
|
1176 |
-
self::$settings->setGlobalOption('cache', (isset($_POST['wp-piwik_cache'])?$_POST['wp-piwik_cache']:false));
|
1177 |
self::$settings->setGlobalOption('disable_cookies', (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false));
|
1178 |
self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
|
1179 |
break;
|
@@ -1181,6 +1200,7 @@ class wp_piwik {
|
|
1181 |
self::$settings->setGlobalOption('piwik_token', (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:''));
|
1182 |
self::$settings->setGlobalOption('piwik_url', self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:'')));
|
1183 |
self::$settings->setGlobalOption('piwik_path', (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):''));
|
|
|
1184 |
self::$settings->setGlobalOption('piwik_mode', (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http'));
|
1185 |
self::$settings->setGlobalOption('piwik_useragent', (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php'));
|
1186 |
self::$settings->setGlobalOption('connection_timeout', (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5));
|
6 |
|
7 |
Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
|
8 |
|
9 |
+
Version: 0.9.9.7
|
10 |
Author: André Bräkling
|
11 |
Author URI: http://www.braekling.de
|
12 |
|
13 |
******************************************************************************************
|
14 |
+
Copyright (C) 2009-2014 Andre Braekling (email: webmaster@braekling.de)
|
15 |
|
16 |
This program is free software: you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
42 |
class wp_piwik {
|
43 |
|
44 |
private static
|
45 |
+
$intRevisionId = 90971,
|
46 |
+
$strVersion = '0.9.9.7',
|
47 |
$blog_id,
|
48 |
$intDashboardID = 30,
|
49 |
$strPluginBasename = NULL,
|
108 |
add_action('wp_head', array($this, 'site_header'));
|
109 |
// Add <noscript> code if enabled
|
110 |
if (self::$settings->getGlobalOption('track_noscript')) add_action('wp_footer', array($this, 'site_footer'));
|
111 |
+
// Add tracking code to admin page header if enabled
|
112 |
+
if (self::$settings->getGlobalOption('track_admin'))
|
113 |
+
add_action('admin_head', array($this, 'addAdminHeaderTracking'));
|
114 |
}
|
115 |
self::$settings->save();
|
116 |
}
|
175 |
self::includeFile('update/90940');
|
176 |
if (self::$settings->getGlobalOption('revision') < 90961)
|
177 |
self::includeFile('update/90961');
|
178 |
+
if (self::$settings->getGlobalOption('revision') < 90971)
|
179 |
+
self::includeFile('update/90971');
|
180 |
+
|
181 |
// Install new version
|
182 |
$this->installPlugin();
|
183 |
}
|
262 |
if (!empty($strMetaKey) && !empty($strMetaVal))
|
263 |
$strCustomVars .= "_paq.push(['setCustomVariable',".$i.", '".$strMetaKey."', '".$strMetaVal."', 'page']);\n";
|
264 |
}
|
265 |
+
if (!empty($strCustomVars)) $strTrackingCode = str_replace("_paq.push(['trackPageView']);", $strCustomVars."_paq.push(['trackPageView']);", $strTrackingCode);
|
266 |
}
|
267 |
echo $strTrackingCode;
|
268 |
echo '<!-- *** /WP-Piwik *********************************************************** -->'."\n";
|
644 |
wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik.css',array(),self::$strVersion);
|
645 |
}
|
646 |
|
647 |
+
/**
|
648 |
+
* Add tracking code to admin header
|
649 |
+
*/
|
650 |
+
function addAdminHeaderTracking() {
|
651 |
+
$this->site_header();
|
652 |
+
}
|
653 |
+
|
654 |
/**
|
655 |
* Add required header tags to stats page
|
656 |
*/
|
700 |
curl_setopt($c, CURLOPT_HEADER, 0);
|
701 |
// Set cURL timeout
|
702 |
curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout'));
|
703 |
+
$httpProxyClass = new WP_HTTP_Proxy();
|
704 |
+
if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($strURL)) {
|
705 |
+
curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host());
|
706 |
+
curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port());
|
707 |
+
if ($httpProxyClass->use_authentication())
|
708 |
+
curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password());
|
709 |
}
|
710 |
// Get result
|
711 |
$strResult = curl_exec($c);
|
843 |
$strURL = str_replace('http://', '://', $strURL);
|
844 |
$strProxy = str_replace('https://', '://', plugins_url('wp-piwik'));
|
845 |
$strProxy = str_replace('http://', '://', $strProxy);
|
846 |
+
$strProxy .= '/';
|
847 |
$strCode = str_replace($strURL, $strProxy, $strCode);
|
848 |
}
|
849 |
$strCode = str_replace('//";','/"',$strCode);
|
897 |
*/
|
898 |
function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP', $strPageURL = '') {
|
899 |
// Create unique cache key
|
900 |
+
$strKey = 'wp-piwik_'.md5($strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit.'_'.self::$settings->getGlobalOption('piwik_token').'_'.self::$settings->getGlobalOption('piwik_url'));
|
901 |
// Call API if data not cached
|
902 |
+
if (self::$settings->getGlobalOption('cache')) {
|
903 |
+
$result = get_transient($strKey);
|
904 |
+
self::$logger->log('API method: '.$strMethod.' Fetch call from cache: '.$strKey);
|
905 |
+
} else $result = false;
|
906 |
+
if ($strMethod == "SitesManager.getSitesWithAtLeastViewAccess" || false === $result) {
|
907 |
$strToken = self::$settings->getGlobalOption('piwik_token');
|
908 |
// If multisite stats are shown, maybe the super admin wants to show other blog's stats.
|
909 |
if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && function_exists('wp_get_current_user') && is_super_admin() && isset($_GET['wpmu_show_stats'])) {
|
950 |
$strMethod != 'SitesManager.getJavascriptTag' &&
|
951 |
$strDate != 'today' && $strDate != date('Ymd') && substr($strDate, 0, 4) != 'last' &&
|
952 |
self::$settings->getGlobalOption('cache') &&
|
953 |
+
!(isset($result['result']) && $result['result'] == 'error')&&
|
954 |
+
!empty($result)
|
955 |
) set_transient($strKey, $result, WEEK_IN_SECONDS);
|
956 |
}
|
957 |
return $result;
|
1178 |
self::$settings->setGlobalOption('disable_timelimit', (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false));
|
1179 |
self::$settings->setGlobalOption('toolbar', (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false));
|
1180 |
self::$settings->setGlobalOption('shortcodes', (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false));
|
1181 |
+
self::$settings->setGlobalOption('perpost_stats', (isset($_POST['wp-piwik_perpost'])?$_POST['wp-piwik_perpost']:false));
|
1182 |
break;
|
1183 |
case 'tracking':
|
1184 |
self::$settings->setGlobalOption('add_tracking_code', (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false));
|
1191 |
self::$settings->setGlobalOption('track_cdnurlssl', trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$settings->getGlobalOption('track_cdnurl')));
|
1192 |
self::$settings->setGlobalOption('track_noscript', (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false));
|
1193 |
self::$settings->setGlobalOption('track_nojavascript', (isset($_POST['wp-piwik_nojavascript'])?$_POST['wp-piwik_nojavascript']:false));
|
1194 |
+
self::$settings->setGlobalOption('track_admin', (isset($_POST['wp-piwik_trackadmin'])?$_POST['wp-piwik_trackadmin']:false));
|
1195 |
self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()));
|
|
|
1196 |
self::$settings->setGlobalOption('disable_cookies', (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false));
|
1197 |
self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
|
1198 |
break;
|
1200 |
self::$settings->setGlobalOption('piwik_token', (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:''));
|
1201 |
self::$settings->setGlobalOption('piwik_url', self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:'')));
|
1202 |
self::$settings->setGlobalOption('piwik_path', (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):''));
|
1203 |
+
self::$settings->setGlobalOption('cache', (isset($_POST['wp-piwik_cache'])?$_POST['wp-piwik_cache']:false));
|
1204 |
self::$settings->setGlobalOption('piwik_mode', (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http'));
|
1205 |
self::$settings->setGlobalOption('piwik_useragent', (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php'));
|
1206 |
self::$settings->setGlobalOption('connection_timeout', (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5));
|