WP-Matomo (WP-Piwik) - Version 0.6.3

Version Description

  • Click at a visitor stats day-row to load its details.
  • Add stats overview to your WordPress dashboard
Download this release

Release Info

Developer Braekling
Plugin Icon 128x128 WP-Matomo (WP-Piwik)
Version 0.6.3
Comparing to
See all releases

Code changes from version 0.6.0 to 0.6.3

dashboard/overview.php CHANGED
@@ -10,7 +10,8 @@
10
  $aryConf['params']['limit']
11
  );
12
  $aryConf['title'] = __('Overview', 'wp-piwik');
13
- include('header.php');
 
14
  /***************************************************************************/ ?>
15
  <div class="table">
16
  <table class="widefat">
@@ -31,6 +32,7 @@
31
  </table>
32
  </div>
33
  <?php /************************************************************************/
34
- include ('footer.php');
 
35
 
36
  /* EOF */
10
  $aryConf['params']['limit']
11
  );
12
  $aryConf['title'] = __('Overview', 'wp-piwik');
13
+ if (!isset($aryConf['inline']) || isset($aryConf['inline']) != true)
14
+ include('header.php');
15
  /***************************************************************************/ ?>
16
  <div class="table">
17
  <table class="widefat">
32
  </table>
33
  </div>
34
  <?php /************************************************************************/
35
+ if (!isset($aryConf['inline']) || isset($aryConf['inline']) != true)
36
+ include ('footer.php');
37
 
38
  /* EOF */
dashboard/visitors.php CHANGED
@@ -66,16 +66,16 @@
66
  <th class="n"><?php _e('Bounced', 'wp-piwik'); ?></th>
67
  </tr>
68
  </thead>
69
- <tbody>
70
  <?php /************************************************************************/
71
  $aryTmp = array_reverse($aryConf['data']['Visitors']);
72
  foreach ($aryTmp as $strDate => $intValue)
73
- echo '<tr><td>'.$strDate.'</td><td class="n">'.
74
  $intValue.'</td><td class="n">'.
75
  $aryConf['data']['Unique'][$strDate].
76
  '</td><td class="n">'.
77
  $aryConf['data']['Bounced'][$strDate].
78
- '</td></tr>';
79
  unset($aryTmp);
80
  /***************************************************************************/ ?>
81
  </tbody>
66
  <th class="n"><?php _e('Bounced', 'wp-piwik'); ?></th>
67
  </tr>
68
  </thead>
69
+ <tbody style="cursor:pointer;">
70
  <?php /************************************************************************/
71
  $aryTmp = array_reverse($aryConf['data']['Visitors']);
72
  foreach ($aryTmp as $strDate => $intValue)
73
+ echo '<tr onclick="javascript:datelink(\''.str_replace('-', '', $strDate).'\');"><td>'.$strDate.'</td><td class="n">'.
74
  $intValue.'</td><td class="n">'.
75
  $aryConf['data']['Unique'][$strDate].
76
  '</td><td class="n">'.
77
  $aryConf['data']['Bounced'][$strDate].
78
+ '</td></tr>'."\n";
79
  unset($aryTmp);
80
  /***************************************************************************/ ?>
81
  </tbody>
js/wp-piwik.js CHANGED
@@ -3,3 +3,7 @@ jQuery( function($) {
3
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
4
  postboxes.add_postbox_toggles('wppiwik');
5
  } );
 
 
 
 
3
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
4
  postboxes.add_postbox_toggles('wppiwik');
5
  } );
6
+
7
+ function datelink(strDate) {
8
+ window.location.href='index.php?page=wp-piwik/wp-piwik.php&date='+strDate;
9
+ }
languages/wp-piwik-be_BY.mo CHANGED
File without changes
languages/wp-piwik-be_BY.po CHANGED
File without changes
languages/wp-piwik-sq.mo CHANGED
File without changes
languages/wp-piwik-sq.po CHANGED
File without changes
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: braekling
4
 
5
  Requires at least: 2.7
6
 
7
- Tested up to: 2.9.0
8
 
9
- Stable tag: 0.6.0
10
 
11
  Donate link: http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=12&y=14
12
  Tags: statistics, stats, analytics, piwik, wpmu
@@ -71,6 +71,10 @@ Thank you, guys!
71
 
72
  == Changelog ==
73
 
 
 
 
 
74
  = 0.6.0 =
75
  * Added experimental WPMU support
76
  * Switch to disable Google Chart API
4
 
5
  Requires at least: 2.7
6
 
7
+ Tested up to: 2.9.1
8
 
9
+ Stable tag: 0.6.3
10
 
11
  Donate link: http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=12&y=14
12
  Tags: statistics, stats, analytics, piwik, wpmu
71
 
72
  == Changelog ==
73
 
74
+ = 0.6.3 =
75
+ * Click at a visitor stats day-row to load its details.
76
+ * Add stats overview to your WordPress dashboard
77
+
78
  = 0.6.0 =
79
  * Added experimental WPMU support
80
  * Switch to disable Google Chart API
wp-piwik.php CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/
6
 
7
  Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer.
8
 
9
- Version: 0.6.0
10
  Author: Andr&eacute; Br&auml;kling
11
  Author URI: http://www.braekling.de
12
 
@@ -53,10 +53,14 @@ class wp_piwik {
53
  if (!self::$bolWPMU)
54
  add_filter('plugin_row_meta', array($this, 'set_plugin_meta'), 10, 2);
55
 
56
- if (self::$bolWPMU || get_option('wp-piwik_addjs') == 1)
57
  add_action('wp_footer', array($this, 'footer'));
58
 
59
  add_action('admin_menu', array($this, 'build_menu'));
 
 
 
 
60
  }
61
 
62
  function install() {
@@ -71,13 +75,13 @@ class wp_piwik {
71
  get_currentuserinfo();
72
  $bolDisplay = true;
73
  if (!empty($current_user->roles)) {
 
74
  $aryFilter = (self::$bolWPMU?get_site_option('wpmu-piwik_filter'):get_option('wp-piwik_filter'));
75
  foreach ($current_user->roles as $strRole)
76
  if (isset($aryFilter[$strRole]) && $aryFilter[$strRole])
77
  $bolDisplay = false;
78
  }
79
  $strJSCode = get_option('wp-piwik_jscode', '');
80
-
81
  if (self::$bolWPMU && empty($strJSCode)) {
82
  $aryReturn = $this->create_wpmu_site();
83
  $strJSCode = $aryReturn['js'];
@@ -90,10 +94,12 @@ class wp_piwik {
90
  $intDisplayTo = get_option('wp-piwik_displayto', 8);
91
  $strToken = get_option('wp-piwik_token');
92
  $strPiwikURL = get_option('wp-piwik_url');
 
93
  } else {
94
  $intDisplayTo = 8;
95
  $strToken = get_site_option('wpmu-piwik_token');
96
  $strPiwikURL = get_site_option('wpmu-piwik_url');
 
97
  }
98
  if (!empty($strToken) && !empty($strPiwikURL)) {
99
  $intStatsPage = add_dashboard_page(
@@ -126,6 +132,27 @@ class wp_piwik {
126
  );
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  function set_plugin_meta($strLinks, $strFile) {
130
  $strPlugin = plugin_basename(__FILE__);
131
  if ($strFile == $strPlugin)
@@ -287,13 +314,15 @@ class wp_piwik {
287
  if (is_array($aryWidgets)) foreach ($aryWidgets as $strParams) {
288
  $aryParams = explode('_', $strParams);
289
  $aryDashboard[$strCol][$aryParams[0]] = array(
290
- 'params' => array(
291
- 'period' => (isset($aryParams[1])?$aryParams[1]:''),
292
- 'date' => (isset($aryParams[2])?$aryParams[2]:''),
293
- 'limit' => (isset($aryParams[3])?$aryParams[3]:'')
294
- ),
295
- 'closed' => (in_array($strParams, $aryClosed))
296
- );
 
 
297
  }
298
  }
299
  /***************************************************************************/ ?>
@@ -362,6 +391,7 @@ class wp_piwik {
362
  update_option('wp-piwik_filter', $_POST['wp-piwik_filter'],'');
363
  update_option('wp-piwik_displayto', $_POST['wp-piwik_displayto'],'');
364
  update_option('wp-piwik_disable_gapi', $_POST['wp-piwik_disable_gapi'],'');
 
365
  }
366
 
367
  function show_settings() {
@@ -425,6 +455,7 @@ class wp_piwik {
425
  $intSite = get_option('wp-piwik_siteid');
426
  $intAddJS = get_option('wp-piwik_addjs');
427
  $intDisableGAPI = get_option('wp-piwik_disable_gapi');
 
428
  $strJavaScript = $this->call_API('SitesManager.getJavascriptTag');
429
  if ($intAddJS)
430
  update_option('wp-piwik_jscode', $strJavaScript);
@@ -443,6 +474,12 @@ class wp_piwik {
443
  echo '<tr><td></td><td><span class="setting-description">'.
444
  __('WP-Piwik uses the Google Chart API to create graphs. To avoid this, just check this box.', 'wp-piwik').
445
  '</span></td></tr>';
 
 
 
 
 
 
446
  global $wp_roles;
447
  echo '<tr><td>'.__('Tracking filter', 'wp-piwik').':</td><td>';
448
  $aryFilter = get_option('wp-piwik_filter');
6
 
7
  Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer.
8
 
9
+ Version: 0.6.3
10
  Author: Andr&eacute; Br&auml;kling
11
  Author URI: http://www.braekling.de
12
 
53
  if (!self::$bolWPMU)
54
  add_filter('plugin_row_meta', array($this, 'set_plugin_meta'), 10, 2);
55
 
56
+ if (self::$bolWPMU || (get_option('wp-piwik_addjs') == 1))
57
  add_action('wp_footer', array($this, 'footer'));
58
 
59
  add_action('admin_menu', array($this, 'build_menu'));
60
+
61
+ $intDashboardWidget = get_option('wp-piwik_dbwidget', 0);
62
+ if ($intDashboardWidget > 0)
63
+ add_action('wp_dashboard_setup', array($this, 'extend_wp_dashboard_setup'));
64
  }
65
 
66
  function install() {
75
  get_currentuserinfo();
76
  $bolDisplay = true;
77
  if (!empty($current_user->roles)) {
78
+ echo 'HR3';
79
  $aryFilter = (self::$bolWPMU?get_site_option('wpmu-piwik_filter'):get_option('wp-piwik_filter'));
80
  foreach ($current_user->roles as $strRole)
81
  if (isset($aryFilter[$strRole]) && $aryFilter[$strRole])
82
  $bolDisplay = false;
83
  }
84
  $strJSCode = get_option('wp-piwik_jscode', '');
 
85
  if (self::$bolWPMU && empty($strJSCode)) {
86
  $aryReturn = $this->create_wpmu_site();
87
  $strJSCode = $aryReturn['js'];
94
  $intDisplayTo = get_option('wp-piwik_displayto', 8);
95
  $strToken = get_option('wp-piwik_token');
96
  $strPiwikURL = get_option('wp-piwik_url');
97
+ $bolDashboardWidget = get_option('wp-piwik_dbwidget', false);
98
  } else {
99
  $intDisplayTo = 8;
100
  $strToken = get_site_option('wpmu-piwik_token');
101
  $strPiwikURL = get_site_option('wpmu-piwik_url');
102
+ $bolDashboardWidget = false;
103
  }
104
  if (!empty($strToken) && !empty($strPiwikURL)) {
105
  $intStatsPage = add_dashboard_page(
132
  );
133
  }
134
 
135
+ function extend_wp_dashboard_setup() {
136
+ $intDashboardWidget = get_option('wp-piwik_dbwidget');
137
+ wp_add_dashboard_widget(
138
+ 'wp-piwik_dashboard_widget',
139
+ __('WP-Piwik', 'wp-piwik').' - '.($intDashboardWidget == 1?__('yesterday', 'wp-piwik'):__('today', 'wp-piwik')),
140
+ array (&$this, 'add_wp_dashboard_widget')
141
+ );
142
+ }
143
+
144
+ function add_wp_dashboard_widget() {
145
+ $intDashboardWidget = get_option('wp-piwik_dbwidget');
146
+ $arySetup = array(
147
+ 'params' => array(
148
+ 'period' => 'day',
149
+ 'date' => ($intDashboardWidget == 1?'yesterday':'today')
150
+ ),
151
+ 'inline' => true
152
+ );
153
+ $this->create_dashboard_widget('overview', $arySetup);
154
+ }
155
+
156
  function set_plugin_meta($strLinks, $strFile) {
157
  $strPlugin = plugin_basename(__FILE__);
158
  if ($strFile == $strPlugin)
314
  if (is_array($aryWidgets)) foreach ($aryWidgets as $strParams) {
315
  $aryParams = explode('_', $strParams);
316
  $aryDashboard[$strCol][$aryParams[0]] = array(
317
+ 'params' => array(
318
+ 'period' => (isset($aryParams[1])?$aryParams[1]:''),
319
+ 'date' => (isset($aryParams[2])?$aryParams[2]:''),
320
+ 'limit' => (isset($aryParams[3])?$aryParams[3]:'')
321
+ ),
322
+ 'closed' => (in_array($strParams, $aryClosed))
323
+ );
324
+ if (isset($_GET['date']) && preg_match('/^[0-9]{8}$/', $_GET['date']) && $aryParams[0] != 'visitors')
325
+ $aryDashboard[$strCol][$aryParams[0]]['params']['date'] = $_GET['date'];
326
  }
327
  }
328
  /***************************************************************************/ ?>
391
  update_option('wp-piwik_filter', $_POST['wp-piwik_filter'],'');
392
  update_option('wp-piwik_displayto', $_POST['wp-piwik_displayto'],'');
393
  update_option('wp-piwik_disable_gapi', $_POST['wp-piwik_disable_gapi'],'');
394
+ update_option('wp-piwik_dbwidget', $_POST['wp-piwik_dbwidget'], 0);
395
  }
396
 
397
  function show_settings() {
455
  $intSite = get_option('wp-piwik_siteid');
456
  $intAddJS = get_option('wp-piwik_addjs');
457
  $intDisableGAPI = get_option('wp-piwik_disable_gapi');
458
+ $intDashboardWidget = get_option('wp-piwik_dbwidget');
459
  $strJavaScript = $this->call_API('SitesManager.getJavascriptTag');
460
  if ($intAddJS)
461
  update_option('wp-piwik_jscode', $strJavaScript);
474
  echo '<tr><td></td><td><span class="setting-description">'.
475
  __('WP-Piwik uses the Google Chart API to create graphs. To avoid this, just check this box.', 'wp-piwik').
476
  '</span></td></tr>';
477
+ echo '<tr><td>'.__('Show overview on WordPress dashboard', 'wp-piwik').':</td><td>'.
478
+ '<select name="wp-piwik_dbwidget">'.
479
+ '<option value="0"'.($intDashboardWidget == 0?' selected=""':'').'>No.</option>'.
480
+ '<option value="1"'.($intDashboardWidget == 1?' selected=""':'').'>Yes (yesterday).</option>'.
481
+ '<option value="2"'.($intDashboardWidget == 2?' selected=""':'').'>Yes (today).</option>'.
482
+ '</select></td></tr>';
483
  global $wp_roles;
484
  echo '<tr><td>'.__('Tracking filter', 'wp-piwik').':</td><td>';
485
  $aryFilter = get_option('wp-piwik_filter');