WP-Matomo (WP-Piwik) - Version 0.10.0.5

Version Description

  • Bugfix: In some cases the update message did not disappear -> fixed
  • Important change: If you want to upgrade from 0.8.x to 0.10.x, please install 0.9.9.18 first: https://downloads.wordpress.org/plugin/wp-piwik.0.9.9.18.zip
Download this release

Release Info

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

Code changes from version 0.10.0.4 to 0.10.0.5

classes/WP_Piwik.php CHANGED
@@ -12,7 +12,7 @@ class WP_Piwik {
12
  *
13
  * @var Runtime environment variables
14
  */
15
- private static $intRevisionId = 2015051101, $version = '0.10.0.4', $blog_id, $pluginBasename = NULL, $logger, $settings, $request;
16
 
17
  /**
18
  * Constructor class to configure and register all WP-Piwik components
@@ -202,7 +202,7 @@ class WP_Piwik {
202
  self::$logger->log ( 'Running WP-Piwik uninstallation' );
203
  if (! defined ( 'WP_UNINSTALL_PLUGIN' ))
204
  exit ();
205
- delete_option ( 'wp-piwik-notices' );
206
  self::$settings->resetSettings ( true );
207
  }
208
 
@@ -237,13 +237,13 @@ class WP_Piwik {
237
  * set to true if the message should persist (default: false)
238
  */
239
  private function addNotice($type, $subject, $text, $stay = false) {
240
- $notices = get_option ( 'wp-piwik-notices', array () );
241
  $notices [$type] = array (
242
  'subject' => $subject,
243
  'text' => $text,
244
  'stay' => $stay
245
  );
246
- update_option ( 'wp-piwik-notices', $notices );
247
  }
248
 
249
  /**
@@ -253,14 +253,14 @@ class WP_Piwik {
253
  */
254
  public function showNotices() {
255
  $link = sprintf ( '<a href="' . $this->getSettingsURL () . '">%s</a>', __ ( 'Settings', 'wp-piwik' ) );
256
- if ($notices = get_option ( 'wp-piwik-notices' )) {
257
  foreach ( $notices as $type => $notice ) {
258
  printf ( '<div class="updated fade"><p>%s <strong>%s:</strong> %s: %s</p></div>', $notice ['subject'], __ ( 'Important', 'wp-piwik' ), $notice ['text'], $link );
259
  if (! $notice ['stay'])
260
  unset ( $notices [$type] );
261
  }
262
  }
263
- update_option ( 'wp-piwik-notices', $notices );
264
  }
265
 
266
  /**
@@ -595,7 +595,7 @@ class WP_Piwik {
595
  * @return boolean Is WP-Piwik installed?
596
  */
597
  private function isInstalled() {
598
- $oldSettings = ($this->isNetworkMode () ? get_site_option ( 'wp-piwik_global-settings', false ) : get_option ( 'wp-piwik_global-settings', false ));
599
  if ($oldSettings && isset( $oldSettings['revision'] ))
600
  self::$settings->setGlobalOption ( 'revision', $oldSettings['revision'] );
601
  return self::$settings->getGlobalOption ( 'revision' );
12
  *
13
  * @var Runtime environment variables
14
  */
15
+ private static $intRevisionId = 2015051101, $version = '0.10.0.5', $blog_id, $pluginBasename = NULL, $logger, $settings, $request;
16
 
17
  /**
18
  * Constructor class to configure and register all WP-Piwik components
202
  self::$logger->log ( 'Running WP-Piwik uninstallation' );
203
  if (! defined ( 'WP_UNINSTALL_PLUGIN' ))
204
  exit ();
205
+ delete_site_option ( 'wp-piwik-notices' );
206
  self::$settings->resetSettings ( true );
207
  }
208
 
237
  * set to true if the message should persist (default: false)
238
  */
239
  private function addNotice($type, $subject, $text, $stay = false) {
240
+ $notices = get_site_option ( 'wp-piwik-notices', array () );
241
  $notices [$type] = array (
242
  'subject' => $subject,
243
  'text' => $text,
244
  'stay' => $stay
245
  );
246
+ update_site_option ( 'wp-piwik-notices', $notices );
247
  }
248
 
249
  /**
253
  */
254
  public function showNotices() {
255
  $link = sprintf ( '<a href="' . $this->getSettingsURL () . '">%s</a>', __ ( 'Settings', 'wp-piwik' ) );
256
+ if ($notices = get_site_option ( 'wp-piwik-notices' )) {
257
  foreach ( $notices as $type => $notice ) {
258
  printf ( '<div class="updated fade"><p>%s <strong>%s:</strong> %s: %s</p></div>', $notice ['subject'], __ ( 'Important', 'wp-piwik' ), $notice ['text'], $link );
259
  if (! $notice ['stay'])
260
  unset ( $notices [$type] );
261
  }
262
  }
263
+ update_site_option ( 'wp-piwik-notices', $notices );
264
  }
265
 
266
  /**
595
  * @return boolean Is WP-Piwik installed?
596
  */
597
  private function isInstalled() {
598
+ $oldSettings = get_site_option ( 'wp-piwik_global-settings', false );
599
  if ($oldSettings && isset( $oldSettings['revision'] ))
600
  self::$settings->setGlobalOption ( 'revision', $oldSettings['revision'] );
601
  return self::$settings->getGlobalOption ( 'revision' );
readme.txt CHANGED
@@ -3,7 +3,7 @@
3
  Contributors: Braekling
4
  Requires at least: 4.0
5
  Tested up to: 4.2.2
6
- Stable tag: 0.10.0.4
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
 
@@ -123,10 +123,14 @@ Add WP-Piwik to your /wp-content/plugins folder and enable it as [Network Plugin
123
 
124
  == Upgrade Notice ==
125
 
126
- This is a full refactored version of WP-Piwik. Please check your settings after updating and make sure everything is working as expected.
127
 
128
  == Changelog ==
129
 
 
 
 
 
130
  = 0.10.0.4 =
131
  * Bugfix: Settings link in admin notices fixed
132
  * Bugfix: Shortcode result will appear where expected
3
  Contributors: Braekling
4
  Requires at least: 4.0
5
  Tested up to: 4.2.2
6
+ Stable tag: 0.10.0.5
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
 
123
 
124
  == Upgrade Notice ==
125
 
126
+ This is a full refactored version of WP-Piwik. Please check your settings after updating and make sure everything is working as expected. If you want to upgrade from 0.8.x to 0.10.x, please install 0.9.9.18 first: https://downloads.wordpress.org/plugin/wp-piwik.0.9.9.18.zip
127
 
128
  == Changelog ==
129
 
130
+ = 0.10.0.5 =
131
+ * Bugfix: In some cases the update message did not disappear -> fixed
132
+ * Important change: If you want to upgrade from 0.8.x to 0.10.x, please install 0.9.9.18 first: https://downloads.wordpress.org/plugin/wp-piwik.0.9.9.18.zip
133
+
134
  = 0.10.0.4 =
135
  * Bugfix: Settings link in admin notices fixed
136
  * Bugfix: Shortcode result will appear where expected
update/2015051101.php CHANGED
@@ -1,18 +1,31 @@
1
  <?php
2
-
3
- if (!$this->isConfigured()) {
4
- // Get & delete old version's options
5
- if (self::$settings->checkNetworkActivation ()) {
6
- $oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () );
7
- delete_site_option('wp-piwik_global-settings');
8
- } else {
9
- $oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () );
10
- delete_option('wp-piwik_global-settings');
11
- }
12
 
13
- $oldOptions = get_option ( 'wp-piwik_settings', array () );
14
- delete_option('wp-piwik_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
16
  if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled';
17
  elseif (!$oldGlobalOptions['track_mode']) $oldGlobalOptions['track_mode'] = 'default';
18
  elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js';
@@ -23,18 +36,6 @@ if (!$this->isConfigured()) {
23
  self::$settings->setGlobalOption ( $key, $value );
24
  foreach ( $oldOptions as $key => $value )
25
  self::$settings->setOption ( $key, $value );
26
-
27
- if (function_exists('is_multisite') && is_multisite()) {
28
- global $wpdb;
29
- $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
30
- if (is_array($aryBlogs))
31
- foreach ($aryBlogs as $aryBlog) {
32
- $oldOptions = get_blog_option ( $aryBlog->blog_id, 'wp-piwik_settings', array () );
33
- foreach ( $oldOptions as $key => $value )
34
- self::$settings->setOption ( $key, $value, $aryBlog->blog_id );
35
- delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings');
36
- }
37
- }
38
  }
39
 
40
  self::$settings->save ();
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
 
3
+ // Get & delete old version's options
4
+ if (self::$settings->checkNetworkActivation ()) {
5
+ $oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () );
6
+ delete_site_option('wp-piwik_global-settings');
7
+ } else {
8
+ $oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () );
9
+ delete_option('wp-piwik_global-settings');
10
+ }
11
+
12
+ $oldOptions = get_option ( 'wp-piwik_settings', array () );
13
+ delete_option('wp-piwik_settings');
14
+
15
+ if (function_exists('is_multisite') && is_multisite()) {
16
+ global $wpdb;
17
+ $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
18
+ if (is_array($aryBlogs))
19
+ foreach ($aryBlogs as $aryBlog) {
20
+ $oldOptions = get_blog_option ( $aryBlog->blog_id, 'wp-piwik_settings', array () );
21
+ if (!$this->isConfigured())
22
+ foreach ( $oldOptions as $key => $value )
23
+ self::$settings->setOption ( $key, $value, $aryBlog->blog_id );
24
+ delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings');
25
+ }
26
+ }
27
 
28
+ if (!$this->isConfigured()) {
29
  if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled';
30
  elseif (!$oldGlobalOptions['track_mode']) $oldGlobalOptions['track_mode'] = 'default';
31
  elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js';
36
  self::$settings->setGlobalOption ( $key, $value );
37
  foreach ( $oldOptions as $key => $value )
38
  self::$settings->setOption ( $key, $value );
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  self::$settings->save ();
update/80403.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
- // Capability read stats: Translate level to role
3
- $aryTranslate = array (
4
- 'level_10' => array (
5
- 'administrator' => true
6
- ),
7
- 'level_7' => array (
8
- 'editor' => true,
9
- 'administrator' => true
10
- ),
11
- 'level_2' => array (
12
- 'author' => true,
13
- 'editor' => true,
14
- 'administrator' => true
15
- ),
16
- 'level_1' => array (
17
- 'contributor' => true,
18
- 'author' => true,
19
- 'editor' => true,
20
- 'administrator' => true
21
- ),
22
- 'level_0' => array (
23
- 'subscriber' => true,
24
- 'contributor' => true,
25
- 'author' => true,
26
- 'editor' => true,
27
- 'administrator' => true
28
- )
29
- );
30
- $strDisplayToLevel = get_option ( 'wp-piwik_displayto', 'level_10' );
31
- if (! is_array ( $strDisplayToLevel ) && isset ( $aryTranslate [$strDisplayToLevel] ))
32
- $aryDisplayToCap = $aryTranslate [$strDisplayToLevel];
33
- else
34
- $aryDisplayToCap = array (
35
- 'administrator' => true
36
- );
37
- // Build settings arrays
38
- $aryDashboardWidgetRange = array (
39
- 0 => false,
40
- 1 => 'yesterday',
41
- 2 => 'today',
42
- 3 => 'last30'
43
- );
44
- if (self::$bolWPMU)
45
- $aryGlobal = array (
46
- 'revision' => get_site_option ( 'wpmu-piwik_revision', 0 ),
47
- 'add_tracking_code' => true,
48
- 'last_settings_update' => get_site_option ( 'wpmu-piwik_settingsupdate', time () ),
49
- 'piwik_token' => get_site_option ( 'wpmu-piwik_token', '' ),
50
- 'piwik_url' => get_site_option ( 'wpmu-piwik_url', '' ),
51
- 'dashboard_widget' => false,
52
- 'capability_stealth' => get_site_option ( 'wpmu-piwik_filter', array () ),
53
- 'capability_read_stats' => $aryDisplayToCap,
54
- 'piwik_shortcut' => false
55
- );
56
- else
57
- $aryGlobal = array (
58
- 'revision' => get_option ( 'wp-piwik_revision', 0 ),
59
- 'add_tracking_code' => get_option ( 'wp-piwik_addjs' ),
60
- 'last_settings_update' => get_option ( 'wp-piwik_settingsupdate', time () ),
61
- 'piwik_token' => get_option ( 'wp-piwik_token', '' ),
62
- 'piwik_url' => get_option ( 'wp-piwik_url', '' ),
63
- 'dashboard_widget' => $aryDashboardWidgetRange [get_option ( 'wp-piwik_dbwidget', 0 )],
64
- 'capability_stealth' => get_option ( 'wp-piwik_filter', array () ),
65
- 'capability_read_stats' => $aryDisplayToCap,
66
- 'piwik_shortcut' => get_option ( 'wp-piwik_piwiklink', false )
67
- );
68
- $this->installSite ( false );
69
- // Remove deprecated option values
70
- $aryRemoveOptions = array (
71
- 'wp-piwik_disable_gapi',
72
- 'wp-piwik_displayto',
73
- 'wp-piwik_revision',
74
- 'wp-piwik_addjs',
75
- 'wp-piwik_settingsupdate',
76
- 'wp-piwik_token',
77
- 'wp-piwik_url',
78
- 'wp-piwik_dbwidget',
79
- 'wp-piwik_filter',
80
- 'wp-piwik_piwiklink'
81
- );
82
- foreach ( $aryRemoveOptions as $strRemoveOption ) {
83
- if (self::$bolWPMU)
84
- delete_site_option ( $strRemoveOption );
85
- else
86
- delete_option ( $strRemoveOption );
87
- }
88
- foreach ( $aryGlobal as $key => $value )
89
- self::$settings->setGlobalOption ( $key, $value );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
update/80800.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption ( 'piwik_url', self::$settings->getGlobalOption ( 'piwik_url' ) . ((substr ( $strURL, - 1, 1 ) != '/' && substr ( $strURL, - 10, 10 ) != '/index.php') ? '/' : '') );
 
 
wp-piwik.php CHANGED
@@ -6,7 +6,7 @@ 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.10.0.4
10
  Author: Andr&eacute; Br&auml;kling
11
  Author URI: http://www.braekling.de
12
  Text Domain: wp-piwik
@@ -74,4 +74,4 @@ else {
74
  $GLOBALS ['wp-piwik_debug'] = false;
75
  if (class_exists ( 'WP_Piwik' ))
76
  $GLOBALS ['wp-piwik'] = new WP_Piwik ();
77
- }
6
 
7
  Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
8
 
9
+ Version: 0.10.0.5
10
  Author: Andr&eacute; Br&auml;kling
11
  Author URI: http://www.braekling.de
12
  Text Domain: wp-piwik
74
  $GLOBALS ['wp-piwik_debug'] = false;
75
  if (class_exists ( 'WP_Piwik' ))
76
  $GLOBALS ['wp-piwik'] = new WP_Piwik ();
77
+ }