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 | Google Analytics for WordPress by MonsterInsights |
Version | 6.2.5 |
Comparing to | |
See all releases |
Code changes from version 6.2.4 to 6.2.5
- assets/lib/pandora/class-am-notification.php +225 -47
- googleanalytics.php +3 -3
- readme.txt +4 -1
assets/lib/pandora/class-am-notification.php
CHANGED
@@ -59,20 +59,29 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
59 |
*/
|
60 |
public $theme_list = array();
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* Construct.
|
64 |
*
|
65 |
* @since 1.0.0
|
66 |
*
|
67 |
-
* @param string $plugin
|
68 |
-
* @param
|
69 |
*/
|
70 |
public function __construct( $plugin = '', $version = 0 ) {
|
71 |
$this->plugin = $plugin;
|
72 |
$this->plugin_version = $version;
|
73 |
|
74 |
add_action( 'init', array( $this, 'custom_post_type' ) );
|
75 |
-
add_action( '
|
76 |
add_action( 'admin_notices', array( $this, 'display_notifications' ) );
|
77 |
add_action( 'wp_ajax_am_notification_dismiss', array( $this, 'dismiss_notification' ) );
|
78 |
}
|
@@ -84,7 +93,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
84 |
*/
|
85 |
public function custom_post_type() {
|
86 |
register_post_type( 'amn_' . $this->plugin, array(
|
87 |
-
'supports' => false
|
88 |
) );
|
89 |
}
|
90 |
|
@@ -94,61 +103,73 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
94 |
* @since 1.0.0
|
95 |
*/
|
96 |
public function get_remote_notifications() {
|
97 |
-
|
|
|
|
|
98 |
|
99 |
-
|
100 |
|
|
|
101 |
$plugin_notifications = $this->get_plugin_notifications( 1 );
|
|
|
102 |
|
103 |
-
$
|
104 |
-
if ( ! empty( $plugin_notifications) ) {
|
105 |
// Unset it from the array.
|
106 |
$notification = $plugin_notifications[0];
|
107 |
$notification_id = get_post_meta( $notification->ID, 'notification_id', true );
|
108 |
}
|
109 |
|
110 |
$response = wp_remote_retrieve_body( wp_remote_post( $this->api_url, array(
|
111 |
-
'sslverify' => false,
|
112 |
'body' => array(
|
113 |
'slug' => $this->plugin,
|
114 |
'version' => $this->plugin_version,
|
115 |
'last_notification' => $notification_id,
|
116 |
'plugins' => $this->get_plugins_list(),
|
117 |
-
'themes' => $this->get_themes_list()
|
118 |
-
)
|
119 |
) ) );
|
120 |
|
121 |
$data = json_decode( $response );
|
122 |
|
123 |
if ( ! empty( $data->id ) ) {
|
124 |
-
|
125 |
$notifications = array();
|
|
|
126 |
foreach ( (array) $data->slugs as $slug ) {
|
127 |
-
$notifications = array_merge(
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
if ( empty( $notifications ) ) {
|
136 |
-
|
137 |
$new_notification_id = wp_insert_post( array(
|
138 |
-
'post_content' => $data->content,
|
139 |
-
'post_type' => 'amn_' . $this->plugin
|
140 |
) );
|
141 |
|
142 |
-
update_post_meta( $new_notification_id, 'notification_id', $data->id );
|
143 |
-
update_post_meta( $new_notification_id, 'type', $data->type );
|
144 |
update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
|
145 |
-
update_post_meta( $new_notification_id, 'location', wp_json_encode( $data->location ) );
|
146 |
-
update_post_meta( $new_notification_id, 'plugins', wp_json_encode( $data->plugins ) );
|
147 |
-
update_post_meta( $new_notification_id, 'theme', $data->theme );
|
148 |
-
update_post_meta( $new_notification_id, 'version', $data->version );
|
149 |
update_post_meta( $new_notification_id, 'viewed', 0 );
|
|
|
|
|
150 |
}
|
|
|
151 |
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
// Set the option now so we can't run this again until after 24 hours.
|
@@ -162,14 +183,17 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
162 |
* @since 1.0.0
|
163 |
*
|
164 |
* @param integer $limit Set the limit for how many posts to retrieve.
|
165 |
-
* @param array
|
166 |
-
*
|
|
|
167 |
*/
|
168 |
public function get_plugin_notifications( $limit = -1, $args = array() ) {
|
169 |
-
return get_posts(
|
|
|
170 |
'showposts' => $limit,
|
171 |
-
'post_type' => 'amn_' . $this->plugin
|
172 |
-
|
|
|
173 |
}
|
174 |
|
175 |
/**
|
@@ -195,7 +219,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
195 |
'slug' => $slug,
|
196 |
'name' => $plugin['Name'],
|
197 |
'version' => $plugin['Version'],
|
198 |
-
'active' => is_plugin_active( $slug )
|
199 |
);
|
200 |
}
|
201 |
|
@@ -221,7 +245,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
221 |
'slug' => $slug,
|
222 |
'name' => $theme->Name,
|
223 |
'version' => $theme->Version,
|
224 |
-
'active' => (string) wp_get_theme()
|
225 |
);
|
226 |
}
|
227 |
|
@@ -234,20 +258,19 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
234 |
* @since 1.0.0
|
235 |
*/
|
236 |
public function display_notifications() {
|
237 |
-
|
238 |
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
|
239 |
return;
|
240 |
}
|
241 |
|
242 |
$plugin_notifications = $this->get_plugin_notifications( -1, array(
|
243 |
'post_status' => 'all',
|
244 |
-
'meta_key'
|
245 |
-
'meta_value'
|
246 |
) );
|
247 |
|
248 |
$plugin_notifications = $this->validate_notifications( $plugin_notifications );
|
249 |
|
250 |
-
if ( ! empty( $plugin_notifications ) ) {
|
251 |
foreach ( $plugin_notifications as $notification ) {
|
252 |
$dismissable = get_post_meta( $notification->ID, 'dismissable', true );
|
253 |
$type = get_post_meta( $notification->ID, 'type', true );
|
@@ -256,16 +279,19 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
256 |
<?php echo $notification->post_content; ?>
|
257 |
</div>
|
258 |
<script type="text/javascript">
|
259 |
-
jQuery(document).ready(
|
260 |
-
$(document).on('click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function(
|
261 |
-
$.post(
|
262 |
action: 'am_notification_dismiss',
|
263 |
notification_id: '<?php echo $notification->ID; ?>'
|
264 |
});
|
265 |
});
|
266 |
});
|
267 |
</script>
|
268 |
-
|
|
|
|
|
|
|
269 |
}
|
270 |
}
|
271 |
|
@@ -275,20 +301,22 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
275 |
* @since 1.0.0
|
276 |
*
|
277 |
* @param array $plugin_notifications An array of plugin notifications.
|
|
|
278 |
* @return array A filtered array of plugin notifications.
|
279 |
*/
|
280 |
public function validate_notifications( $plugin_notifications ) {
|
281 |
global $pagenow;
|
|
|
282 |
foreach ( $plugin_notifications as $key => $notification ) {
|
283 |
// Location validation.
|
284 |
$location = (array) json_decode( get_post_meta( $notification->ID, 'location', true ) );
|
285 |
$continue = false;
|
286 |
-
if ( ! in_array( 'everywhere', $location ) ) {
|
287 |
-
if ( in_array( 'index.php', $location ) && 'index.php'
|
288 |
$continue = true;
|
289 |
}
|
290 |
|
291 |
-
if ( in_array( 'plugins.php', $location ) && 'plugins.php'
|
292 |
$continue = true;
|
293 |
}
|
294 |
|
@@ -297,7 +325,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
297 |
}
|
298 |
}
|
299 |
|
300 |
-
// Plugin validation (OR conditional)
|
301 |
$plugins = (array) json_decode( get_post_meta( $notification->ID, 'plugins', true ) );
|
302 |
$continue = false;
|
303 |
if ( ! empty( $plugins ) ) {
|
@@ -314,7 +342,7 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
314 |
|
315 |
// Theme validation.
|
316 |
$theme = get_post_meta( $notification->ID, 'theme', true );
|
317 |
-
$continue = (string) wp_get_theme()
|
318 |
|
319 |
if ( ! empty( $theme ) && ! $continue ) {
|
320 |
unset( $plugin_notifications[ $key ] );
|
@@ -333,21 +361,171 @@ if ( ! class_exists( 'AM_Notification' ) ) {
|
|
333 |
}
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
return $plugin_notifications;
|
339 |
}
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
/**
|
342 |
* Dismiss the notification via AJAX.
|
343 |
*
|
344 |
* @since 1.0.0
|
345 |
*/
|
346 |
public function dismiss_notification() {
|
|
|
|
|
|
|
|
|
347 |
$notification_id = intval( $_POST['notification_id'] );
|
348 |
update_post_meta( $notification_id, 'viewed', 1 );
|
349 |
die;
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
}
|
353 |
}
|
59 |
*/
|
60 |
public $theme_list = array();
|
61 |
|
62 |
+
/**
|
63 |
+
* Flag if a notice has been registered.
|
64 |
+
*
|
65 |
+
* @since 1.0.0
|
66 |
+
*
|
67 |
+
* @var bool
|
68 |
+
*/
|
69 |
+
public static $registered = false;
|
70 |
+
|
71 |
/**
|
72 |
* Construct.
|
73 |
*
|
74 |
* @since 1.0.0
|
75 |
*
|
76 |
+
* @param string $plugin The plugin slug.
|
77 |
+
* @param mixed $version The version of the plugin.
|
78 |
*/
|
79 |
public function __construct( $plugin = '', $version = 0 ) {
|
80 |
$this->plugin = $plugin;
|
81 |
$this->plugin_version = $version;
|
82 |
|
83 |
add_action( 'init', array( $this, 'custom_post_type' ) );
|
84 |
+
add_action( 'admin_init', array( $this, 'get_remote_notifications' ), 100 );
|
85 |
add_action( 'admin_notices', array( $this, 'display_notifications' ) );
|
86 |
add_action( 'wp_ajax_am_notification_dismiss', array( $this, 'dismiss_notification' ) );
|
87 |
}
|
93 |
*/
|
94 |
public function custom_post_type() {
|
95 |
register_post_type( 'amn_' . $this->plugin, array(
|
96 |
+
'supports' => false,
|
97 |
) );
|
98 |
}
|
99 |
|
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 |
|
110 |
+
$last_checked = get_option( '_amn_' . $this->plugin . '_last_checked', strtotime( '-1 week' ) );
|
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.
|
118 |
$notification = $plugin_notifications[0];
|
119 |
$notification_id = get_post_meta( $notification->ID, 'notification_id', true );
|
120 |
}
|
121 |
|
122 |
$response = wp_remote_retrieve_body( wp_remote_post( $this->api_url, array(
|
|
|
123 |
'body' => array(
|
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 |
|
132 |
$data = json_decode( $response );
|
133 |
|
134 |
if ( ! empty( $data->id ) ) {
|
|
|
135 |
$notifications = array();
|
136 |
+
|
137 |
foreach ( (array) $data->slugs as $slug ) {
|
138 |
+
$notifications = array_merge(
|
139 |
+
$notifications,
|
140 |
+
(array) get_posts(
|
141 |
+
array(
|
142 |
+
'post_type' => 'amn_' . $slug,
|
143 |
+
'post_status' => 'all',
|
144 |
+
'meta_key' => 'notification_id',
|
145 |
+
'meta_value' => $data->id,
|
146 |
+
)
|
147 |
+
)
|
148 |
+
);
|
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 );
|
166 |
+
update_post_meta( $new_notification_id, 'plans', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plans ) : json_encode( $data->plans ) );
|
167 |
}
|
168 |
+
}
|
169 |
|
170 |
+
// Possibly revoke notifications.
|
171 |
+
if ( ! empty( $data->revoked ) ) {
|
172 |
+
$this->revoke_notifications( $data->revoked );
|
173 |
}
|
174 |
|
175 |
// Set the option now so we can't run this again until after 24 hours.
|
183 |
* @since 1.0.0
|
184 |
*
|
185 |
* @param integer $limit Set the limit for how many posts to retrieve.
|
186 |
+
* @param array $args Any top-level arguments to add to the array.
|
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 |
/**
|
219 |
'slug' => $slug,
|
220 |
'name' => $plugin['Name'],
|
221 |
'version' => $plugin['Version'],
|
222 |
+
'active' => is_plugin_active( $slug ),
|
223 |
);
|
224 |
}
|
225 |
|
245 |
'slug' => $slug,
|
246 |
'name' => $theme->Name,
|
247 |
'version' => $theme->Version,
|
248 |
+
'active' => (string) wp_get_theme() === $theme->Name,
|
249 |
);
|
250 |
}
|
251 |
|
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',
|
269 |
) );
|
270 |
|
271 |
$plugin_notifications = $this->validate_notifications( $plugin_notifications );
|
272 |
|
273 |
+
if ( ! empty( $plugin_notifications ) && ! self::$registered ) {
|
274 |
foreach ( $plugin_notifications as $notification ) {
|
275 |
$dismissable = get_post_meta( $notification->ID, 'dismissable', true );
|
276 |
$type = get_post_meta( $notification->ID, 'type', true );
|
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 |
+
}
|
293 |
+
|
294 |
+
self::$registered = true;
|
295 |
}
|
296 |
}
|
297 |
|
301 |
* @since 1.0.0
|
302 |
*
|
303 |
* @param array $plugin_notifications An array of plugin notifications.
|
304 |
+
*
|
305 |
* @return array A filtered array of plugin notifications.
|
306 |
*/
|
307 |
public function validate_notifications( $plugin_notifications ) {
|
308 |
global $pagenow;
|
309 |
+
|
310 |
foreach ( $plugin_notifications as $key => $notification ) {
|
311 |
// Location validation.
|
312 |
$location = (array) json_decode( get_post_meta( $notification->ID, 'location', true ) );
|
313 |
$continue = false;
|
314 |
+
if ( ! in_array( 'everywhere', $location, true ) ) {
|
315 |
+
if ( in_array( 'index.php', $location, true ) && 'index.php' === $pagenow ) {
|
316 |
$continue = true;
|
317 |
}
|
318 |
|
319 |
+
if ( in_array( 'plugins.php', $location, true ) && 'plugins.php' === $pagenow ) {
|
320 |
$continue = true;
|
321 |
}
|
322 |
|
325 |
}
|
326 |
}
|
327 |
|
328 |
+
// Plugin validation (OR conditional).
|
329 |
$plugins = (array) json_decode( get_post_meta( $notification->ID, 'plugins', true ) );
|
330 |
$continue = false;
|
331 |
if ( ! empty( $plugins ) ) {
|
342 |
|
343 |
// Theme validation.
|
344 |
$theme = get_post_meta( $notification->ID, 'theme', true );
|
345 |
+
$continue = (string) wp_get_theme() === $theme;
|
346 |
|
347 |
if ( ! empty( $theme ) && ! $continue ) {
|
348 |
unset( $plugin_notifications[ $key ] );
|
361 |
}
|
362 |
}
|
363 |
|
364 |
+
// Expiration validation.
|
365 |
+
$expiration = get_post_meta( $notification->ID, 'expiration', true );
|
366 |
+
$continue = false;
|
367 |
+
if ( ! empty( $expiration ) ) {
|
368 |
+
if ( $expiration > time() ) {
|
369 |
+
$continue = true;
|
370 |
+
}
|
371 |
+
|
372 |
+
if ( ! $continue ) {
|
373 |
+
unset( $plugin_notifications[ $key ] );
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
// Plan validation.
|
378 |
+
$plans = (array) json_decode( get_post_meta( $notification->ID, 'plans', true ) );
|
379 |
+
$continue = false;
|
380 |
+
if ( ! empty( $plans ) ) {
|
381 |
+
$level = $this->get_plan_level();
|
382 |
+
if ( in_array( $level, $plans, true ) ) {
|
383 |
+
$continue = true;
|
384 |
+
}
|
385 |
+
|
386 |
+
if ( ! $continue ) {
|
387 |
+
unset( $plugin_notifications[ $key ] );
|
388 |
+
}
|
389 |
+
}
|
390 |
}
|
391 |
|
392 |
return $plugin_notifications;
|
393 |
}
|
394 |
|
395 |
+
/**
|
396 |
+
* Grab the current plan level.
|
397 |
+
*
|
398 |
+
* @since 1.0.0
|
399 |
+
*
|
400 |
+
* @return string The current plan level.
|
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'] : '';
|
413 |
+
|
414 |
+
// Possibly check for a constant.
|
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 |
+
|
456 |
+
// Possibly check for a constant.
|
457 |
+
if ( empty( $key ) && defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
|
458 |
+
$key = OPTINMONSTER_REST_API_LICENSE_KEY;
|
459 |
+
}
|
460 |
+
|
461 |
+
// If the key is still empty, check for the old legacy key.
|
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.
|
469 |
+
if ( empty( $key ) && empty( $level ) ) {
|
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.
|
494 |
+
return $level;
|
495 |
+
}
|
496 |
+
|
497 |
/**
|
498 |
* Dismiss the notification via AJAX.
|
499 |
*
|
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 |
+
|
507 |
$notification_id = intval( $_POST['notification_id'] );
|
508 |
update_post_meta( $notification_id, 'viewed', 1 );
|
509 |
die;
|
510 |
}
|
511 |
|
512 |
+
/**
|
513 |
+
* Revokes notifications.
|
514 |
+
*
|
515 |
+
* @since 1.0.0
|
516 |
+
*
|
517 |
+
* @param array $ids An array of notification IDs to revoke.
|
518 |
+
*/
|
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 );
|
526 |
+
}
|
527 |
+
}
|
528 |
+
}
|
529 |
+
}
|
530 |
}
|
531 |
}
|
googleanalytics.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Author: MonsterInsights
|
7 |
* Author URI: https://www.monsterinsights.com/
|
8 |
*
|
9 |
-
* Version: 6.2.
|
10 |
* Requires at least: 3.9.0
|
11 |
* Tested up to: 4.8.1
|
12 |
*
|
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
|
|
69 |
* @access public
|
70 |
* @var string $version Plugin version.
|
71 |
*/
|
72 |
-
public $version = '6.2.
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
@@ -182,7 +182,7 @@ final class MonsterInsights_Lite {
|
|
182 |
}
|
183 |
|
184 |
if ( is_admin() ) {
|
185 |
-
new AM_Notification( 'mi
|
186 |
new AM_Deactivation_Survey( 'MonsterInsights', basename( __DIR__ ) );
|
187 |
}
|
188 |
|
6 |
* Author: MonsterInsights
|
7 |
* Author URI: https://www.monsterinsights.com/
|
8 |
*
|
9 |
+
* Version: 6.2.5
|
10 |
* Requires at least: 3.9.0
|
11 |
* Tested up to: 4.8.1
|
12 |
*
|
69 |
* @access public
|
70 |
* @var string $version Plugin version.
|
71 |
*/
|
72 |
+
public $version = '6.2.5';
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
182 |
}
|
183 |
|
184 |
if ( is_admin() ) {
|
185 |
+
new AM_Notification( 'mi', self::$instance->version );
|
186 |
new AM_Deactivation_Survey( 'MonsterInsights', basename( __DIR__ ) );
|
187 |
}
|
188 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.
|
7 |
Stable tag: 6.2.4
|
8 |
License: GPL v3
|
9 |
|
@@ -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.4: October 6, 2017 =
|
140 |
* Tweak: Adjusted how the optin tracking is sent to us.
|
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.0
|
7 |
Stable tag: 6.2.4
|
8 |
License: GPL v3
|
9 |
|
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.5: November 17, 2017 =
|
140 |
+
* Tweak: Compatibility with WordPress 4.9.
|
141 |
+
|
142 |
= 6.2.4: October 6, 2017 =
|
143 |
* Tweak: Adjusted how the optin tracking is sent to us.
|
144 |
|