Google Analytics for WordPress by MonsterInsights - Version 6.2.7

Version Description

= 6.0.0 =

This is a major release. Please back up your site before upgrading.

Download this release

Release Info

Developer chriscct7
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 6.2.7
Comparing to
See all releases

Code changes from version 6.2.6 to 6.2.7

assets/lib/pandora/class-am-notification.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  if ( ! class_exists( 'AM_Notification' ) ) {
3
  /**
4
  * Awesome Motive Notifications
@@ -7,12 +8,13 @@ if ( ! class_exists( 'AM_Notification' ) ) {
7
  * retrieve notifications for this product.
8
  *
9
  * @package AwesomeMotive
10
- * @author Benjamin Rojas
11
  * @license GPL-2.0+
12
- * @copyright Copyright (c) 2017, Retyp LLC
13
- * @version 1.0.0
14
  */
15
  class AM_Notification {
 
16
  /**
17
  * The api url we are calling.
18
  *
@@ -41,24 +43,6 @@ if ( ! class_exists( 'AM_Notification' ) ) {
41
  */
42
  public $plugin_version;
43
 
44
- /**
45
- * The list of installed plugins.
46
- *
47
- * @since 1.0.0
48
- *
49
- * @var array
50
- */
51
- public $plugin_list = array();
52
-
53
- /**
54
- * The list of installed themes.
55
- *
56
- * @since 1.0.0
57
- *
58
- * @var string
59
- */
60
- public $theme_list = array();
61
-
62
  /**
63
  * Flag if a notice has been registered.
64
  *
@@ -93,7 +77,9 @@ if ( ! class_exists( 'AM_Notification' ) ) {
93
  */
94
  public function custom_post_type() {
95
  register_post_type( 'amn_' . $this->plugin, array(
96
- 'supports' => false,
 
 
97
  ) );
98
  }
99
 
@@ -103,7 +89,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
103
  * @since 1.0.0
104
  */
105
  public function get_remote_notifications() {
106
- if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
107
  return;
108
  }
109
 
@@ -111,7 +97,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
111
 
112
  if ( $last_checked < strtotime( 'today midnight' ) ) {
113
  $plugin_notifications = $this->get_plugin_notifications( 1 );
114
- $notification_id = null;
115
 
116
  if ( ! empty( $plugin_notifications ) ) {
117
  // Unset it from the array.
@@ -124,8 +110,6 @@ if ( ! class_exists( 'AM_Notification' ) ) {
124
  'slug' => $this->plugin,
125
  'version' => $this->plugin_version,
126
  'last_notification' => $notification_id,
127
- 'plugins' => $this->get_plugins_list(),
128
- 'themes' => $this->get_themes_list(),
129
  ),
130
  ) ) );
131
 
@@ -149,17 +133,17 @@ if ( ! class_exists( 'AM_Notification' ) ) {
149
  }
150
 
151
  if ( empty( $notifications ) ) {
152
- $new_notification_id = wp_insert_post( array(
153
- 'post_content' => wp_kses_post( $data->content ),
154
- 'post_type' => 'amn_' . $this->plugin,
155
- ) );
 
 
156
 
157
  update_post_meta( $new_notification_id, 'notification_id', absint( $data->id ) );
158
  update_post_meta( $new_notification_id, 'type', sanitize_text_field( trim( $data->type ) ) );
159
  update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
160
  update_post_meta( $new_notification_id, 'location', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->location ) : json_encode( $data->location ) );
161
- update_post_meta( $new_notification_id, 'plugins', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plugins ) : json_encode( $data->plugins ) );
162
- update_post_meta( $new_notification_id, 'theme', sanitize_text_field( trim( $data->theme ) ) );
163
  update_post_meta( $new_notification_id, 'version', sanitize_text_field( trim( $data->version ) ) );
164
  update_post_meta( $new_notification_id, 'viewed', 0 );
165
  update_post_meta( $new_notification_id, 'expiration', $data->expiration ? absint( $data->expiration ) : false );
@@ -187,82 +171,26 @@ if ( ! class_exists( 'AM_Notification' ) ) {
187
  *
188
  * @return WP_Post[] WP_Post that match the query.
189
  */
190
- public function get_plugin_notifications( $limit = -1, $args = array() ) {
191
  return get_posts(
192
  array(
193
- 'showposts' => $limit,
194
- 'post_type' => 'amn_' . $this->plugin,
195
  ) + $args
196
  );
197
  }
198
 
199
- /**
200
- * Retrieve a list of plugins that are currently installed.
201
- *
202
- * @since 1.0.0
203
- *
204
- * @return array An array of plugins that are currently installed.
205
- */
206
- public function get_plugins_list() {
207
- if ( ! empty( $this->plugin_list ) ) {
208
- return $this->plugin_list;
209
- }
210
-
211
- if ( ! function_exists( 'get_plugins' ) ) {
212
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
213
- }
214
-
215
- $plugins = get_plugins();
216
-
217
- foreach ( $plugins as $slug => $plugin ) {
218
- $this->plugin_list[ $slug ] = array(
219
- 'slug' => $slug,
220
- 'name' => $plugin['Name'],
221
- 'version' => $plugin['Version'],
222
- 'active' => is_plugin_active( $slug ),
223
- );
224
- }
225
-
226
- return $this->plugin_list;
227
- }
228
-
229
- /**
230
- * Retrieve a list of themes that are currently installed.
231
- *
232
- * @since 1.0.0
233
- *
234
- * @return array An array of themes that are currently installed.
235
- */
236
- public function get_themes_list() {
237
- if ( ! empty( $this->theme_list ) ) {
238
- return $this->theme_list;
239
- }
240
-
241
- $themes = wp_get_themes();
242
-
243
- foreach ( $themes as $slug => $theme ) {
244
- $this->theme_list[ $slug ] = array(
245
- 'slug' => $slug,
246
- 'name' => $theme->Name,
247
- 'version' => $theme->Version,
248
- 'active' => (string) wp_get_theme() === $theme->Name,
249
- );
250
- }
251
-
252
- return $this->theme_list;
253
- }
254
-
255
  /**
256
  * Display any notifications that should be displayed.
257
  *
258
  * @since 1.0.0
259
  */
260
  public function display_notifications() {
261
- if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
262
  return;
263
  }
264
 
265
- $plugin_notifications = $this->get_plugin_notifications( -1, array(
266
  'post_status' => 'all',
267
  'meta_key' => 'viewed',
268
  'meta_value' => '0',
@@ -279,14 +207,14 @@ if ( ! class_exists( 'AM_Notification' ) ) {
279
  <?php echo $notification->post_content; ?>
280
  </div>
281
  <script type="text/javascript">
282
- jQuery(document).ready(function ($) {
283
- $(document).on('click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function (event) {
284
- $.post(ajaxurl, {
285
  action: 'am_notification_dismiss',
286
  notification_id: '<?php echo $notification->ID; ?>'
287
- });
288
- });
289
- });
290
  </script>
291
  <?php
292
  }
@@ -401,12 +329,11 @@ if ( ! class_exists( 'AM_Notification' ) ) {
401
  */
402
  public function get_plan_level() {
403
  // Prepare variables.
404
- $key = '';
405
- $level = '';
406
- $option = false;
407
  switch ( $this->plugin ) {
408
- case 'wpforms-lite' :
409
- case 'wpforms' :
410
  $option = get_option( 'wpforms_license' );
411
  $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
412
  $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
@@ -415,41 +342,34 @@ if ( ! class_exists( 'AM_Notification' ) ) {
415
  if ( empty( $key ) && defined( 'WPFORMS_LICENSE_KEY' ) ) {
416
  $key = WPFORMS_LICENSE_KEY;
417
  }
418
- break;
419
- case 'mi-lite' :
420
- case 'mi' :
421
- $option = get_option( 'monsterinsights_license' );
422
- $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
423
- $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
424
-
425
- // Possibly check for a constant.
426
- if ( empty( $key ) && defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
427
- $key = MONSTERINSIGHTS_LICENSE_KEY;
428
- }
429
- break;
430
- case 'sol-lite' :
431
- case 'sol' :
432
- $option = get_option( 'soliloquy' );
433
- $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
434
- $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
435
-
436
- // Possibly check for a constant.
437
- if ( empty( $key ) && defined( 'SOLILOQUY_LICENSE_KEY' ) ) {
438
- $key = SOLILOQUY_LICENSE_KEY;
439
- }
440
- break;
441
- case 'envira-lite' :
442
- case 'envira' :
443
- $option = get_option( 'envira_gallery' );
444
- $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
445
- $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
446
 
447
- // Possibly check for a constant.
448
- if ( empty( $key ) && defined( 'ENVIRA_LICENSE_KEY' ) ) {
449
- $key = ENVIRA_LICENSE_KEY;
 
 
 
 
 
 
 
 
 
 
450
  }
451
- break;
452
- case 'om' :
453
  $option = get_option( 'optin_monster_api' );
454
  $key = is_array( $option ) && isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : '';
455
 
@@ -462,7 +382,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
462
  if ( empty( $key ) ) {
463
  $key = is_array( $option ) && isset( $option['api']['key'] ) ? $option['api']['key'] : '';
464
  }
465
- break;
466
  }
467
 
468
  // Possibly set the level to 'none' if the key is empty and no level has been set.
@@ -470,24 +390,29 @@ if ( ! class_exists( 'AM_Notification' ) ) {
470
  $level = 'none';
471
  }
472
 
 
 
 
 
 
473
  // Normalize the level.
474
  switch ( $level ) {
475
- case 'bronze' :
476
- case 'personal' :
477
  $level = 'basic';
478
- break;
479
- case 'silver' :
480
- case 'multi' :
481
  $level = 'plus';
482
- break;
483
- case 'gold' :
484
- case 'developer' :
485
  $level = 'pro';
486
- break;
487
- case 'platinum' :
488
- case 'master' :
489
  $level = 'ultimate';
490
- break;
491
  }
492
 
493
  // Return the plan level.
@@ -500,7 +425,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
500
  * @since 1.0.0
501
  */
502
  public function dismiss_notification() {
503
- if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
504
  die;
505
  }
506
 
@@ -519,7 +444,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
519
  public function revoke_notifications( $ids ) {
520
  // Loop through each of the IDs and find the post that has it as meta.
521
  foreach ( (array) $ids as $id ) {
522
- $notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) );
523
  if ( $notifications ) {
524
  foreach ( $notifications as $notification ) {
525
  update_post_meta( $notification->ID, 'viewed', 1 );
1
  <?php
2
+
3
  if ( ! class_exists( 'AM_Notification' ) ) {
4
  /**
5
  * Awesome Motive Notifications
8
  * retrieve notifications for this product.
9
  *
10
  * @package AwesomeMotive
11
+ * @author AwesomeMotive Team
12
  * @license GPL-2.0+
13
+ * @copyright Copyright (c) 2018, Awesome Motive LLC
14
+ * @version 1.0.4
15
  */
16
  class AM_Notification {
17
+
18
  /**
19
  * The api url we are calling.
20
  *
43
  */
44
  public $plugin_version;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Flag if a notice has been registered.
48
  *
77
  */
78
  public function custom_post_type() {
79
  register_post_type( 'amn_' . $this->plugin, array(
80
+ 'label' => $this->plugin . ' Announcements',
81
+ 'can_export' => false,
82
+ 'supports' => false,
83
  ) );
84
  }
85
 
89
  * @since 1.0.0
90
  */
91
  public function get_remote_notifications() {
92
+ if ( ! current_user_can( apply_filters( 'am_notifications_display', is_super_admin() ) ) ) {
93
  return;
94
  }
95
 
97
 
98
  if ( $last_checked < strtotime( 'today midnight' ) ) {
99
  $plugin_notifications = $this->get_plugin_notifications( 1 );
100
+ $notification_id = null;
101
 
102
  if ( ! empty( $plugin_notifications ) ) {
103
  // Unset it from the array.
110
  'slug' => $this->plugin,
111
  'version' => $this->plugin_version,
112
  'last_notification' => $notification_id,
 
 
113
  ),
114
  ) ) );
115
 
133
  }
134
 
135
  if ( empty( $notifications ) ) {
136
+ $new_notification_id = wp_insert_post(
137
+ array(
138
+ 'post_content' => wp_kses_post( $data->content ),
139
+ 'post_type' => 'amn_' . $this->plugin,
140
+ )
141
+ );
142
 
143
  update_post_meta( $new_notification_id, 'notification_id', absint( $data->id ) );
144
  update_post_meta( $new_notification_id, 'type', sanitize_text_field( trim( $data->type ) ) );
145
  update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
146
  update_post_meta( $new_notification_id, 'location', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->location ) : json_encode( $data->location ) );
 
 
147
  update_post_meta( $new_notification_id, 'version', sanitize_text_field( trim( $data->version ) ) );
148
  update_post_meta( $new_notification_id, 'viewed', 0 );
149
  update_post_meta( $new_notification_id, 'expiration', $data->expiration ? absint( $data->expiration ) : false );
171
  *
172
  * @return WP_Post[] WP_Post that match the query.
173
  */
174
+ public function get_plugin_notifications( $limit = - 1, $args = array() ) {
175
  return get_posts(
176
  array(
177
+ 'posts_per_page' => $limit,
178
+ 'post_type' => 'amn_' . $this->plugin,
179
  ) + $args
180
  );
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * Display any notifications that should be displayed.
185
  *
186
  * @since 1.0.0
187
  */
188
  public function display_notifications() {
189
+ if ( ! current_user_can( apply_filters( 'am_notifications_display', is_super_admin() ) ) ) {
190
  return;
191
  }
192
 
193
+ $plugin_notifications = $this->get_plugin_notifications( - 1, array(
194
  'post_status' => 'all',
195
  'meta_key' => 'viewed',
196
  'meta_value' => '0',
207
  <?php echo $notification->post_content; ?>
208
  </div>
209
  <script type="text/javascript">
210
+ jQuery( document ).ready( function ( $ ) {
211
+ $( document ).on( 'click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function ( event ) {
212
+ $.post( ajaxurl, {
213
  action: 'am_notification_dismiss',
214
  notification_id: '<?php echo $notification->ID; ?>'
215
+ } );
216
+ } );
217
+ } );
218
  </script>
219
  <?php
220
  }
329
  */
330
  public function get_plan_level() {
331
  // Prepare variables.
332
+ $key = '';
333
+ $level = '';
334
+
335
  switch ( $this->plugin ) {
336
+ case 'wpforms':
 
337
  $option = get_option( 'wpforms_license' );
338
  $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
339
  $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
342
  if ( empty( $key ) && defined( 'WPFORMS_LICENSE_KEY' ) ) {
343
  $key = WPFORMS_LICENSE_KEY;
344
  }
345
+ break;
346
+ case 'mi-lite':
347
+ case 'mi':
348
+ if ( version_compare( MONSTERINSIGHTS_VERSION, '6.9.0', '>=' ) ) {
349
+ if ( MonsterInsights()->license->get_site_license_type() ) {
350
+ $key = MonsterInsights()->license->get_site_license_key();
351
+ $type = MonsterInsights()->license->get_site_license_type();
352
+ } else if ( MonsterInsights()->license->get_network_license_type() ) {
353
+ $key = MonsterInsights()->license->get_network_license_key();
354
+ $type = MonsterInsights()->license->get_network_license_type();
355
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
 
357
+ // Check key fallbacks
358
+ if ( empty( $key ) ) {
359
+ $key = MonsterInsights()->license->get_license_key();
360
+ }
361
+ } else {
362
+ $option = get_option( 'monsterinsights_license' );
363
+ $key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
364
+ $level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
365
+
366
+ // Possibly check for a constant.
367
+ if ( empty( $key ) && defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
368
+ $key = MONSTERINSIGHTS_LICENSE_KEY;
369
+ }
370
  }
371
+ break;
372
+ case 'om':
373
  $option = get_option( 'optin_monster_api' );
374
  $key = is_array( $option ) && isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : '';
375
 
382
  if ( empty( $key ) ) {
383
  $key = is_array( $option ) && isset( $option['api']['key'] ) ? $option['api']['key'] : '';
384
  }
385
+ break;
386
  }
387
 
388
  // Possibly set the level to 'none' if the key is empty and no level has been set.
390
  $level = 'none';
391
  }
392
 
393
+ // Possibly set the level to 'unknown' if a key is entered, but no level can be determined (such as manually entered key)
394
+ if ( ! empty( $key ) && empty( $level ) ) {
395
+ $level = 'unknown';
396
+ }
397
+
398
  // Normalize the level.
399
  switch ( $level ) {
400
+ case 'bronze':
401
+ case 'personal':
402
  $level = 'basic';
403
+ break;
404
+ case 'silver':
405
+ case 'multi':
406
  $level = 'plus';
407
+ break;
408
+ case 'gold':
409
+ case 'developer':
410
  $level = 'pro';
411
+ break;
412
+ case 'platinum':
413
+ case 'master':
414
  $level = 'ultimate';
415
+ break;
416
  }
417
 
418
  // Return the plan level.
425
  * @since 1.0.0
426
  */
427
  public function dismiss_notification() {
428
+ if ( ! current_user_can( apply_filters( 'am_notifications_display', is_super_admin() ) ) ) {
429
  die;
430
  }
431
 
444
  public function revoke_notifications( $ids ) {
445
  // Loop through each of the IDs and find the post that has it as meta.
446
  foreach ( (array) $ids as $id ) {
447
+ $notifications = $this->get_plugin_notifications( - 1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) );
448
  if ( $notifications ) {
449
  foreach ( $notifications as $notification ) {
450
  update_post_meta( $notification->ID, 'viewed', 1 );
googleanalytics.php CHANGED
@@ -6,9 +6,9 @@
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
- * Version: 6.2.6
10
  * Requires at least: 3.9.0
11
- * Tested up to: 4.8.1
12
  *
13
  * License: GPL v3
14
  *
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
- public $version = '6.2.6';
73
 
74
  /**
75
  * Plugin file.
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
+ * Version: 6.2.7
10
  * Requires at least: 3.9.0
11
+ * Tested up to: 4.9.1
12
  *
13
  * License: GPL v3
14
  *
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
+ public $version = '6.2.7';
73
 
74
  /**
75
  * Plugin file.
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: chriscct7, smub
3
  Donate link: http://www.wpbeginner.com/wpbeginner-needs-your-help/
4
  Tags: analytics, analytics dashboard, google analytics, google analytics dashboard, google analytics widget, universal google analytics, statistics, tracking, stats, google, yoast, google analytics by yoast, ga, monster insights, monsterinsights, universal analytics, web stats, ecommerce, ecommerce tracking
5
  Requires at least: 3.9
6
- Tested up to: 4.9.0
7
- Stable tag: 6.2.6
8
  License: GPL v3
9
 
10
  The best Google Analytics plugin for WordPress. See how visitors find and use your website, so you can keep them coming back.
@@ -136,6 +136,9 @@ You can also learn about other <a href="http://www.wpbeginner.com/category/plugi
136
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
137
 
138
  == Changelog ==
 
 
 
139
  = 6.2.6: November 17, 2017 =
140
  * Tweak: Compatibility with WordPress 4.9.
141
 
3
  Donate link: http://www.wpbeginner.com/wpbeginner-needs-your-help/
4
  Tags: analytics, analytics dashboard, google analytics, google analytics dashboard, google analytics widget, universal google analytics, statistics, tracking, stats, google, yoast, google analytics by yoast, ga, monster insights, monsterinsights, universal analytics, web stats, ecommerce, ecommerce tracking
5
  Requires at least: 3.9
6
+ Tested up to: 4.9.3
7
+ Stable tag: 6.2.7
8
  License: GPL v3
9
 
10
  The best Google Analytics plugin for WordPress. See how visitors find and use your website, so you can keep them coming back.
136
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
137
 
138
  == Changelog ==
139
+ = 6.2.7: January 19, 2017 =
140
+ * Tweak: Adjustments to notifications.
141
+
142
  = 6.2.6: November 17, 2017 =
143
  * Tweak: Compatibility with WordPress 4.9.
144