@@ -34,13 +34,13 @@ |
||
34 | 34 | $track_user = monsterinsights_track_user(); |
35 | 35 | |
36 | 36 | if ( $track_user && ( $events_mode === 'js' || $events_mode === 'php' ) ) { |
37 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
38 | - new MonsterInsights_Analytics_Events(); |
|
37 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
38 | + new MonsterInsights_Analytics_Events(); |
|
39 | 39 | |
40 | - // Let's run form tracking if we find it |
|
41 | - if ( function_exists( 'monsterinsights_forms_output_after_script' ) ) { |
|
42 | - monsterinsights_forms_output_after_script( array() ); |
|
43 | - } |
|
40 | + // Let's run form tracking if we find it |
|
41 | + if ( function_exists( 'monsterinsights_forms_output_after_script' ) ) { |
|
42 | + monsterinsights_forms_output_after_script( array() ); |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | add_action( 'seedprod_monsterinsights_output_tracking', 'monsterinsights_seedprod_tracking', 6, 1 ); |
47 | 47 | \ No newline at end of file |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return void |
504 | 504 | */ |
505 | - public function load_licensing(){ |
|
505 | + public function load_licensing() { |
|
506 | 506 | if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
507 | 507 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php'; |
508 | 508 | self::$instance->license = new MonsterInsights_License(); |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * |
796 | 796 | * @return void |
797 | 797 | */ |
798 | -function monsterinsights_lite_call_install_and_upgrade(){ |
|
798 | +function monsterinsights_lite_call_install_and_upgrade() { |
|
799 | 799 | add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' ); |
800 | 800 | } |
801 | 801 |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | self::$instance->notices = new MonsterInsights_Notice_Admin(); |
234 | 234 | self::$instance->license_actions = new MonsterInsights_License_Actions(); |
235 | 235 | self::$instance->reporting = new MonsterInsights_Reporting(); |
236 | - self::$instance->api_auth = new MonsterInsights_API_Auth(); |
|
236 | + self::$instance->api_auth = new MonsterInsights_API_Auth(); |
|
237 | 237 | if ( defined( 'DOING_CRON' ) && DOING_CRON ) { |
238 | 238 | self::$instance->require_updater(); |
239 | 239 | } else { |
240 | 240 | add_action( 'admin_init', array( self::$instance, 'require_updater' ) ); |
241 | 241 | } |
242 | 242 | |
243 | - self::$instance->routes = new MonsterInsights_Rest_Routes(); |
|
243 | + self::$instance->routes = new MonsterInsights_Rest_Routes(); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if ( monsterinsights_is_pro_version() ) { |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_DIR' ) ) { |
354 | - define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) ); |
|
354 | + define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) ); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_URL' ) ) { |
358 | - define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) ); |
|
358 | + define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) ); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | // Traditional WordPress plugin locale filter. |
378 | - $mi_locale = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' ); |
|
378 | + $mi_locale = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' ); |
|
379 | 379 | $mi_mofile = sprintf( '%1$s-%2$s.mo', 'google-analytics-for-wordpress', $mi_locale ); |
380 | 380 | |
381 | 381 | // Look for wp-content/languages/google-analytics-for-wordpress/google-analytics-for-wordpress-{lang}_{country}.mo |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | public function monsterinsights_wp_notice() { |
415 | 415 | $url = admin_url( 'plugins.php' ); |
416 | 416 | // Check for MS dashboard |
417 | - if( is_network_admin() ) { |
|
417 | + if ( is_network_admin() ) { |
|
418 | 418 | $url = network_admin_url( 'plugins.php' ); |
419 | 419 | } |
420 | 420 | ?> |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | public function monsterinsights_pro_notice() { |
436 | 436 | $url = admin_url( 'plugins.php' ); |
437 | 437 | // Check for MS dashboard |
438 | - if( is_network_admin() ) { |
|
438 | + if ( is_network_admin() ) { |
|
439 | 439 | $url = network_admin_url( 'plugins.php' ); |
440 | 440 | } |
441 | 441 | ?> |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/options.php'; |
462 | 462 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/helpers.php'; |
463 | 463 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/deprecated.php'; |
464 | - $monsterinsights_settings = monsterinsights_get_options(); |
|
464 | + $monsterinsights_settings = monsterinsights_get_options(); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return void |
477 | 477 | */ |
478 | - public function load_licensing(){ |
|
478 | + public function load_licensing() { |
|
479 | 479 | if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
480 | 480 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php'; |
481 | 481 | self::$instance->license = new MonsterInsights_License(); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $instance->api_auth->delete_auth(); |
643 | 643 | |
644 | 644 | // Delete data |
645 | - $instance->reporting->delete_aggregate_data('site'); |
|
645 | + $instance->reporting->delete_aggregate_data( 'site' ); |
|
646 | 646 | |
647 | 647 | // Delete license |
648 | 648 | $instance->license->delete_site_license(); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | $instance->api_auth->uninstall_network_auth(); |
654 | 654 | |
655 | 655 | // Delete network data |
656 | - $instance->reporting->delete_aggregate_data('network'); |
|
656 | + $instance->reporting->delete_aggregate_data( 'network' ); |
|
657 | 657 | |
658 | 658 | // Delete network license |
659 | 659 | $instance->license->delete_network_license(); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $instance->api_auth->delete_auth(); |
663 | 663 | |
664 | 664 | // Delete data |
665 | - $instance->reporting->delete_aggregate_data('site'); |
|
665 | + $instance->reporting->delete_aggregate_data( 'site' ); |
|
666 | 666 | |
667 | 667 | // Delete license |
668 | 668 | $instance->license->delete_site_license(); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return void |
758 | 758 | */ |
759 | -function monsterinsights_lite_call_install_and_upgrade(){ |
|
759 | +function monsterinsights_lite_call_install_and_upgrade() { |
|
760 | 760 | add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' ); |
761 | 761 | } |
762 | 762 |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | public function __construct() { |
29 | 29 | |
30 | 30 | // Authentication Actions |
31 | - add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | - add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | - add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | - add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
31 | + add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | + add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | + add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | + add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
35 | 35 | |
36 | - add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | - add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
36 | + add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | + add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
38 | 38 | |
39 | - add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | - add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
39 | + add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | + add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function get_tt(){ |
|
43 | + public function get_tt() { |
|
44 | 44 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
45 | 45 | if ( empty( $tt ) ) { |
46 | 46 | // if TT is empty, generate a new one, save it and then return it |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | return $tt; |
51 | 51 | } |
52 | 52 | |
53 | - public function rotate_tt(){ |
|
53 | + public function rotate_tt() { |
|
54 | 54 | $tt = $this->generate_tt(); |
55 | 55 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
56 | 56 | } |
57 | 57 | |
58 | - public function generate_tt(){ |
|
58 | + public function generate_tt() { |
|
59 | 59 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
60 | 60 | } |
61 | 61 | |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | - public function maybe_authenticate(){ |
|
76 | + public function maybe_authenticate() { |
|
77 | 77 | |
78 | 78 | // Check nonce |
79 | 79 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
80 | 80 | |
81 | 81 | // current user can authenticate |
82 | 82 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
83 | - wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
83 | + wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | // Only for Pro users, require a license key to be entered first so we can link to things. |
91 | 91 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
92 | 92 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
93 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
93 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // we do not have a current auth |
97 | 97 | if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) { |
98 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
98 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
99 | 99 | } else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) { |
100 | - wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
100 | + wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $sitei = $this->get_sitei(); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | wp_send_json_success(); |
154 | 154 | } |
155 | 155 | |
156 | - public function authenticate_listener(){ |
|
156 | + public function authenticate_listener() { |
|
157 | 157 | // Make sure it's for us |
158 | 158 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
159 | 159 | return; |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | // Make sure has required params |
173 | - if ( empty( $_REQUEST['key'] ) || |
|
174 | - empty( $_REQUEST['token'] ) || |
|
175 | - empty( $_REQUEST['ua'] ) || |
|
176 | - empty( $_REQUEST['miview'] ) || |
|
177 | - empty( $_REQUEST['a'] ) || |
|
178 | - empty( $_REQUEST['w'] ) || |
|
173 | + if ( empty( $_REQUEST['key'] ) || |
|
174 | + empty( $_REQUEST['token'] ) || |
|
175 | + empty( $_REQUEST['ua'] ) || |
|
176 | + empty( $_REQUEST['miview'] ) || |
|
177 | + empty( $_REQUEST['a'] ) || |
|
178 | + empty( $_REQUEST['w'] ) || |
|
179 | 179 | empty( $_REQUEST['p'] ) |
180 | 180 | ) { |
181 | 181 | return; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $where = $this->is_network_admin() ? 'network' : 'site'; |
215 | 215 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
216 | 216 | |
217 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
217 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
218 | 218 | $url = add_query_arg( array( |
219 | 219 | 'mi_action' => 'auth', |
220 | 220 | 'success' => 'true', |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | exit; |
224 | 224 | } |
225 | 225 | |
226 | - public function maybe_reauthenticate(){ |
|
226 | + public function maybe_reauthenticate() { |
|
227 | 227 | |
228 | 228 | // Check nonce |
229 | 229 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
230 | 230 | |
231 | 231 | // current user can authenticate |
232 | 232 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
233 | - wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
233 | + wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | // Only for Pro users, require a license key to be entered first so we can link to things. |
241 | 241 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
242 | 242 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
243 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
243 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // we do have a current auth |
247 | 247 | if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
248 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
248 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
249 | 249 | } else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
250 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
250 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | $siteurl = add_query_arg( array( |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
273 | 273 | } |
274 | 274 | |
275 | - public function reauthenticate_listener(){ |
|
275 | + public function reauthenticate_listener() { |
|
276 | 276 | // Make sure it's for us |
277 | 277 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
278 | 278 | return; |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | |
291 | 291 | // Make sure has required params |
292 | 292 | if ( |
293 | - empty( $_REQUEST['ua'] ) || |
|
294 | - empty( $_REQUEST['miview'] ) || |
|
295 | - empty( $_REQUEST['a'] ) || |
|
296 | - empty( $_REQUEST['w'] ) || |
|
293 | + empty( $_REQUEST['ua'] ) || |
|
294 | + empty( $_REQUEST['miview'] ) || |
|
295 | + empty( $_REQUEST['a'] ) || |
|
296 | + empty( $_REQUEST['w'] ) || |
|
297 | 297 | empty( $_REQUEST['p'] ) |
298 | 298 | ) { |
299 | 299 | return; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $where = $this->is_network_admin() ? 'network' : 'site'; |
334 | 334 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
335 | 335 | |
336 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
336 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
337 | 337 | $url = add_query_arg( array( |
338 | 338 | 'mi_action' => 'reauth', |
339 | 339 | 'success' => 'true', |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | exit; |
343 | 343 | } |
344 | 344 | |
345 | - public function maybe_verify(){ |
|
345 | + public function maybe_verify() { |
|
346 | 346 | |
347 | 347 | // Check nonce |
348 | 348 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
349 | 349 | |
350 | 350 | // current user can verify |
351 | 351 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
352 | - wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
352 | + wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | |
359 | 359 | // we have an auth to verify |
360 | 360 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
361 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
361 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
362 | 362 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
363 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
363 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
367 | 367 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
368 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
368 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $worked = $this->verify_auth(); |
372 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
372 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
373 | 373 | wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) ); |
374 | 374 | } else { |
375 | 375 | wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) ); |
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - public function verify_auth( $credentials = array() ){ |
|
379 | + public function verify_auth( $credentials = array() ) { |
|
380 | 380 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
381 | 381 | |
382 | 382 | if ( empty( $creds['key'] ) ) { |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - public function maybe_delete(){ |
|
397 | + public function maybe_delete() { |
|
398 | 398 | |
399 | 399 | // Check nonce |
400 | 400 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
401 | 401 | |
402 | 402 | // current user can delete |
403 | 403 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
404 | - wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
404 | + wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -410,20 +410,20 @@ discard block |
||
410 | 410 | |
411 | 411 | // we have an auth to delete |
412 | 412 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
413 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
413 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
414 | 414 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
415 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
415 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
419 | 419 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
420 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
420 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | $force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true'; |
424 | 424 | |
425 | 425 | $worked = $this->delete_auth( $force ); |
426 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
426 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
427 | 427 | wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) ); |
428 | 428 | } else { |
429 | 429 | if ( $force ) { |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | - public function delete_auth( $force = false ){ |
|
437 | + public function delete_auth( $force = false ) { |
|
438 | 438 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
439 | 439 | return false; |
440 | 440 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -450,13 +450,13 @@ discard block |
||
450 | 450 | // If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways |
451 | 451 | if ( is_network_admin() ) { |
452 | 452 | $siteurl = network_admin_url(); |
453 | - if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) { |
|
453 | + if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) { |
|
454 | 454 | MonsterInsights()->auth->delete_network_analytics_profile( true ); |
455 | 455 | return true; |
456 | 456 | } |
457 | 457 | } else { |
458 | 458 | $siteurl = site_url(); |
459 | - if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) { |
|
459 | + if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) { |
|
460 | 460 | MonsterInsights()->auth->delete_analytics_profile( true ); |
461 | 461 | return true; |
462 | 462 | } |
@@ -528,15 +528,15 @@ discard block |
||
528 | 528 | // return $sitei; |
529 | 529 | // } |
530 | 530 | |
531 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
531 | + $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
532 | 532 | $secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : ''; |
533 | - $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
533 | + $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
534 | 534 | |
535 | 535 | $sitei = $auth_key . $secure_auth_key . $logged_in_key; |
536 | - $sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei ); |
|
536 | + $sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei ); |
|
537 | 537 | $sitei = sanitize_text_field( $sitei ); |
538 | 538 | $sitei = trim( $sitei ); |
539 | - $sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei; |
|
539 | + $sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei; |
|
540 | 540 | return $sitei; |
541 | 541 | } |
542 | 542 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
41 | 41 | } |
42 | 42 | |
43 | - public function get_tt(){ |
|
43 | + public function get_tt() { |
|
44 | 44 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
45 | 45 | if ( empty( $tt ) ) { |
46 | 46 | // if TT is empty, generate a new one, save it and then return it |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | return $tt; |
51 | 51 | } |
52 | 52 | |
53 | - public function rotate_tt(){ |
|
53 | + public function rotate_tt() { |
|
54 | 54 | $tt = $this->generate_tt(); |
55 | 55 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
56 | 56 | } |
57 | 57 | |
58 | - public function generate_tt(){ |
|
58 | + public function generate_tt() { |
|
59 | 59 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
60 | 60 | } |
61 | 61 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | - public function maybe_authenticate(){ |
|
76 | + public function maybe_authenticate() { |
|
77 | 77 | |
78 | 78 | // Check nonce |
79 | 79 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | wp_send_json_success(); |
154 | 154 | } |
155 | 155 | |
156 | - public function authenticate_listener(){ |
|
156 | + public function authenticate_listener() { |
|
157 | 157 | // Make sure it's for us |
158 | 158 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
159 | 159 | return; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | exit; |
224 | 224 | } |
225 | 225 | |
226 | - public function maybe_reauthenticate(){ |
|
226 | + public function maybe_reauthenticate() { |
|
227 | 227 | |
228 | 228 | // Check nonce |
229 | 229 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
273 | 273 | } |
274 | 274 | |
275 | - public function reauthenticate_listener(){ |
|
275 | + public function reauthenticate_listener() { |
|
276 | 276 | // Make sure it's for us |
277 | 277 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
278 | 278 | return; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | exit; |
343 | 343 | } |
344 | 344 | |
345 | - public function maybe_verify(){ |
|
345 | + public function maybe_verify() { |
|
346 | 346 | |
347 | 347 | // Check nonce |
348 | 348 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - public function verify_auth( $credentials = array() ){ |
|
379 | + public function verify_auth( $credentials = array() ) { |
|
380 | 380 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
381 | 381 | |
382 | 382 | if ( empty( $creds['key'] ) ) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - public function maybe_delete(){ |
|
397 | + public function maybe_delete() { |
|
398 | 398 | |
399 | 399 | // Check nonce |
400 | 400 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | - public function delete_auth( $force = false ){ |
|
437 | + public function delete_auth( $force = false ) { |
|
438 | 438 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
439 | 439 | return false; |
440 | 440 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -105,39 +105,39 @@ discard block |
||
105 | 105 | * @param array $config Array of updater config args. |
106 | 106 | */ |
107 | 107 | public function __construct( array $config ) { |
108 | - // Set class properties. |
|
109 | - $accepted_args = array( |
|
110 | - 'plugin_name', |
|
111 | - 'plugin_slug', |
|
112 | - 'plugin_path', |
|
113 | - 'plugin_url', |
|
114 | - 'remote_url', |
|
115 | - 'version', |
|
116 | - 'key' |
|
117 | - ); |
|
118 | - foreach ( $accepted_args as $arg ) { |
|
119 | - $this->$arg = $config[$arg]; |
|
120 | - } |
|
121 | - |
|
122 | - // If the user cannot update plugins, stop processing here. |
|
123 | - if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) { |
|
124 | - return; |
|
125 | - } |
|
126 | - |
|
127 | - // If it's our site, then return so we don't redirect loop. |
|
128 | - if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) { |
|
129 | - return; |
|
130 | - } |
|
131 | - |
|
132 | - // Load the updater hooks and filters. |
|
133 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) ); |
|
134 | - |
|
135 | - add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); |
|
136 | - add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 ); |
|
137 | - |
|
138 | - // ManageWP premium update filters |
|
139 | - //add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) ); |
|
140 | - //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) ); |
|
108 | + // Set class properties. |
|
109 | + $accepted_args = array( |
|
110 | + 'plugin_name', |
|
111 | + 'plugin_slug', |
|
112 | + 'plugin_path', |
|
113 | + 'plugin_url', |
|
114 | + 'remote_url', |
|
115 | + 'version', |
|
116 | + 'key' |
|
117 | + ); |
|
118 | + foreach ( $accepted_args as $arg ) { |
|
119 | + $this->$arg = $config[$arg]; |
|
120 | + } |
|
121 | + |
|
122 | + // If the user cannot update plugins, stop processing here. |
|
123 | + if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) { |
|
124 | + return; |
|
125 | + } |
|
126 | + |
|
127 | + // If it's our site, then return so we don't redirect loop. |
|
128 | + if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) { |
|
129 | + return; |
|
130 | + } |
|
131 | + |
|
132 | + // Load the updater hooks and filters. |
|
133 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) ); |
|
134 | + |
|
135 | + add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); |
|
136 | + add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 ); |
|
137 | + |
|
138 | + // ManageWP premium update filters |
|
139 | + //add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) ); |
|
140 | + //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) ); |
|
141 | 141 | |
142 | 142 | // Add additional info if the license is expired. |
143 | 143 | add_action( 'in_plugin_update_message-'. $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 ); |
@@ -162,33 +162,33 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function update_plugins_filter( $value ) { |
164 | 164 | |
165 | - // If no update object exists, return early. |
|
166 | - if ( empty( $value ) ) { |
|
167 | - return $value; |
|
168 | - } |
|
169 | - |
|
170 | - // Run update check by pinging the external API. If it fails, return the default update object. |
|
171 | - if ( ! $this->update ) { |
|
172 | - $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) ); |
|
173 | - if ( ! $this->update || ! empty( $this->update->error ) ) { |
|
174 | - $this->update = false; |
|
175 | - return $value; |
|
176 | - } |
|
177 | - } |
|
178 | - |
|
179 | - // Infuse the update object with our data if the version from the remote API is newer. |
|
180 | - if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) { |
|
181 | - // The $plugin_update object contains new_version, package, slug and last_update keys. |
|
182 | - //$this->update->full_slug = $this->plugin_slug; |
|
183 | - //$this->update->name = $this->plugin_name; |
|
184 | - $this->update->monsterinsights_plugin = true; |
|
185 | - $this->update->old_version = $this->version; |
|
186 | - $this->update->plugin = $this->plugin_path; |
|
187 | - $value->response[$this->plugin_path] = $this->update; |
|
188 | - } |
|
189 | - |
|
190 | - // Return the update object. |
|
191 | - return $value; |
|
165 | + // If no update object exists, return early. |
|
166 | + if ( empty( $value ) ) { |
|
167 | + return $value; |
|
168 | + } |
|
169 | + |
|
170 | + // Run update check by pinging the external API. If it fails, return the default update object. |
|
171 | + if ( ! $this->update ) { |
|
172 | + $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) ); |
|
173 | + if ( ! $this->update || ! empty( $this->update->error ) ) { |
|
174 | + $this->update = false; |
|
175 | + return $value; |
|
176 | + } |
|
177 | + } |
|
178 | + |
|
179 | + // Infuse the update object with our data if the version from the remote API is newer. |
|
180 | + if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) { |
|
181 | + // The $plugin_update object contains new_version, package, slug and last_update keys. |
|
182 | + //$this->update->full_slug = $this->plugin_slug; |
|
183 | + //$this->update->name = $this->plugin_name; |
|
184 | + $this->update->monsterinsights_plugin = true; |
|
185 | + $this->update->old_version = $this->version; |
|
186 | + $this->update->plugin = $this->plugin_path; |
|
187 | + $value->response[$this->plugin_path] = $this->update; |
|
188 | + } |
|
189 | + |
|
190 | + // Return the update object. |
|
191 | + return $value; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function http_request_args( $args, $url ) { |
205 | 205 | |
206 | - // If this is an SSL request and we are performing an upgrade routine, disable SSL verification. |
|
207 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) { |
|
208 | - $args['sslverify'] = false; |
|
209 | - } |
|
206 | + // If this is an SSL request and we are performing an upgrade routine, disable SSL verification. |
|
207 | + if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) { |
|
208 | + $args['sslverify'] = false; |
|
209 | + } |
|
210 | 210 | |
211 | - return $args; |
|
211 | + return $args; |
|
212 | 212 | |
213 | 213 | } |
214 | 214 | |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function plugins_api( $api, $action = '', $args = null ) { |
227 | 227 | |
228 | - $plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug ); |
|
228 | + $plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug ); |
|
229 | 229 | |
230 | - // If our plugin matches the request, set our own plugin data, else return the default response. |
|
231 | - if ( $plugin ) { |
|
232 | - return $this->set_plugins_api( $api ); |
|
233 | - } else { |
|
234 | - return $api; |
|
235 | - } |
|
230 | + // If our plugin matches the request, set our own plugin data, else return the default response. |
|
231 | + if ( $plugin ) { |
|
232 | + return $this->set_plugins_api( $api ); |
|
233 | + } else { |
|
234 | + return $api; |
|
235 | + } |
|
236 | 236 | |
237 | 237 | } |
238 | 238 | |
@@ -246,82 +246,82 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function set_plugins_api( $default_api ) { |
248 | 248 | |
249 | - // Perform the remote request to retrieve our plugin information. If it fails, return the default object. |
|
250 | - if ( ! $this->info ) { |
|
251 | - $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) ); |
|
252 | - if ( ! $this->info || ! empty( $this->info->error ) ) { |
|
253 | - $this->info = false; |
|
254 | - return $default_api; |
|
255 | - } |
|
256 | - } |
|
257 | - |
|
258 | - // Create a new stdClass object and populate it with our plugin information. |
|
259 | - $api = new stdClass; |
|
260 | - $api->name = isset( $this->info->name ) ? $this->info->name : ''; |
|
261 | - $api->slug = isset( $this->info->slug ) ? $this->info->slug : ''; |
|
262 | - $api->version = isset( $this->info->version ) ? $this->info->version : ''; |
|
263 | - $api->author = isset( $this->info->author ) ? $this->info->author : ''; |
|
264 | - $api->author_profile = isset( $this->info->author_profile ) ? $this->info->author_profile : ''; |
|
265 | - $api->requires = isset( $this->info->requires ) ? $this->info->requires : ''; |
|
266 | - $api->tested = isset( $this->info->tested ) ? $this->info->tested : ''; |
|
267 | - $api->last_updated = isset( $this->info->last_updated ) ? $this->info->last_updated : ''; |
|
268 | - $api->homepage = isset( $this->info->homepage ) ? $this->info->homepage : ''; |
|
269 | - |
|
270 | - $changelog = isset( $this->info->changelog ) ? $this->info->changelog : ''; |
|
271 | - $description = isset( $this->info->description ) ? $this->info->description : ''; |
|
272 | - |
|
273 | - if ( ! empty( $changelog ) ) { |
|
274 | - if ( ! empty( $description ) ) { |
|
275 | - $api->sections['description'] = $description; |
|
276 | - $api->sections['changelog'] = $changelog; |
|
277 | - } else { |
|
278 | - $api->sections['changelog'] = $changelog; |
|
279 | - } |
|
280 | - } else if ( ! empty( $description ) ) { |
|
281 | - $api->sections['description'] = $description; |
|
282 | - } else { |
|
283 | - $api->sections = array(); |
|
284 | - } |
|
285 | - |
|
286 | - $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : ''; |
|
287 | - |
|
288 | - // Return the new API object with our custom data. |
|
289 | - return $api; |
|
249 | + // Perform the remote request to retrieve our plugin information. If it fails, return the default object. |
|
250 | + if ( ! $this->info ) { |
|
251 | + $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) ); |
|
252 | + if ( ! $this->info || ! empty( $this->info->error ) ) { |
|
253 | + $this->info = false; |
|
254 | + return $default_api; |
|
255 | + } |
|
256 | + } |
|
257 | + |
|
258 | + // Create a new stdClass object and populate it with our plugin information. |
|
259 | + $api = new stdClass; |
|
260 | + $api->name = isset( $this->info->name ) ? $this->info->name : ''; |
|
261 | + $api->slug = isset( $this->info->slug ) ? $this->info->slug : ''; |
|
262 | + $api->version = isset( $this->info->version ) ? $this->info->version : ''; |
|
263 | + $api->author = isset( $this->info->author ) ? $this->info->author : ''; |
|
264 | + $api->author_profile = isset( $this->info->author_profile ) ? $this->info->author_profile : ''; |
|
265 | + $api->requires = isset( $this->info->requires ) ? $this->info->requires : ''; |
|
266 | + $api->tested = isset( $this->info->tested ) ? $this->info->tested : ''; |
|
267 | + $api->last_updated = isset( $this->info->last_updated ) ? $this->info->last_updated : ''; |
|
268 | + $api->homepage = isset( $this->info->homepage ) ? $this->info->homepage : ''; |
|
269 | + |
|
270 | + $changelog = isset( $this->info->changelog ) ? $this->info->changelog : ''; |
|
271 | + $description = isset( $this->info->description ) ? $this->info->description : ''; |
|
272 | + |
|
273 | + if ( ! empty( $changelog ) ) { |
|
274 | + if ( ! empty( $description ) ) { |
|
275 | + $api->sections['description'] = $description; |
|
276 | + $api->sections['changelog'] = $changelog; |
|
277 | + } else { |
|
278 | + $api->sections['changelog'] = $changelog; |
|
279 | + } |
|
280 | + } else if ( ! empty( $description ) ) { |
|
281 | + $api->sections['description'] = $description; |
|
282 | + } else { |
|
283 | + $api->sections = array(); |
|
284 | + } |
|
285 | + |
|
286 | + $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : ''; |
|
287 | + |
|
288 | + // Return the new API object with our custom data. |
|
289 | + return $api; |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | 293 | // Integration with ManageWP |
294 | 294 | public function premium_update_push( $premium_update ) { |
295 | - if ( ! function_exists( 'get_plugin_data' ) ) { |
|
296 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
297 | - } |
|
298 | - |
|
299 | - $update = $this->set_plugins_api( array() ); |
|
300 | - if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) { |
|
301 | - $plugin_data = get_plugin_data( $update->slug ); |
|
302 | - $plugin_data['type'] = 'plugin'; |
|
303 | - $plugin_data['slug'] = $update->slug; |
|
304 | - $plugin_data['new_version'] = $update->version; |
|
305 | - $premium_update[] = $plugin_data; |
|
306 | - } |
|
307 | - return $premium_update; |
|
295 | + if ( ! function_exists( 'get_plugin_data' ) ) { |
|
296 | + include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
297 | + } |
|
298 | + |
|
299 | + $update = $this->set_plugins_api( array() ); |
|
300 | + if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) { |
|
301 | + $plugin_data = get_plugin_data( $update->slug ); |
|
302 | + $plugin_data['type'] = 'plugin'; |
|
303 | + $plugin_data['slug'] = $update->slug; |
|
304 | + $plugin_data['new_version'] = $update->version; |
|
305 | + $premium_update[] = $plugin_data; |
|
306 | + } |
|
307 | + return $premium_update; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // Integration with ManageWP |
311 | 311 | public function premium_update( $premium_update ) { |
312 | - if ( ! function_exists( 'get_plugin_data' ) ) { |
|
313 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
314 | - } |
|
315 | - |
|
316 | - $update = $this->set_plugins_api( array() ); |
|
317 | - if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) { |
|
318 | - $plugin_data = get_plugin_data( $update->slug ); |
|
319 | - $plugin_data['type'] = 'plugin'; |
|
320 | - $plugin_data['slug'] = $update->slug; |
|
321 | - $plugin_data['url'] = $update->download_link; // OR provide your own callback function for managing the update |
|
322 | - array_push( $premium_update, $plugin_data ); |
|
323 | - } |
|
324 | - return $premium_update; |
|
312 | + if ( ! function_exists( 'get_plugin_data' ) ) { |
|
313 | + include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
314 | + } |
|
315 | + |
|
316 | + $update = $this->set_plugins_api( array() ); |
|
317 | + if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) { |
|
318 | + $plugin_data = get_plugin_data( $update->slug ); |
|
319 | + $plugin_data['type'] = 'plugin'; |
|
320 | + $plugin_data['slug'] = $update->slug; |
|
321 | + $plugin_data['url'] = $update->download_link; // OR provide your own callback function for managing the update |
|
322 | + array_push( $premium_update, $plugin_data ); |
|
323 | + } |
|
324 | + return $premium_update; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -337,47 +337,47 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function perform_remote_request( $action, $body = array(), $headers = array(), $return_format = 'json' ) { |
339 | 339 | |
340 | - // Build the body of the request. |
|
341 | - $body = wp_parse_args( |
|
342 | - $body, |
|
343 | - array( |
|
344 | - 'tgm-updater-action' => $action, |
|
345 | - 'tgm-updater-key' => $this->key, |
|
346 | - 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
347 | - 'tgm-updater-referer' => site_url(), |
|
348 | - 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
349 | - 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
350 | - ) |
|
351 | - ); |
|
352 | - $body = http_build_query( $body, '', '&' ); |
|
353 | - |
|
354 | - // Build the headers of the request. |
|
355 | - $headers = wp_parse_args( |
|
356 | - $headers, |
|
357 | - array( |
|
358 | - 'Content-Type' => 'application/x-www-form-urlencoded', |
|
359 | - 'Content-Length' => strlen( $body ) |
|
360 | - ) |
|
361 | - ); |
|
362 | - |
|
363 | - // Setup variable for wp_remote_post. |
|
364 | - $post = array( |
|
365 | - 'headers' => $headers, |
|
366 | - 'body' => $body |
|
367 | - ); |
|
368 | - |
|
369 | - // Perform the query and retrieve the response. |
|
370 | - $response = wp_remote_post( esc_url_raw( $this->remote_url ), $post ); |
|
371 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
372 | - $response_body = wp_remote_retrieve_body( $response ); |
|
373 | - |
|
374 | - // Bail out early if there are any errors. |
|
375 | - if ( 200 != $response_code || is_wp_error( $response_body ) ) { |
|
376 | - return false; |
|
377 | - } |
|
378 | - |
|
379 | - // Return the json decoded content. |
|
380 | - return json_decode( $response_body ); |
|
340 | + // Build the body of the request. |
|
341 | + $body = wp_parse_args( |
|
342 | + $body, |
|
343 | + array( |
|
344 | + 'tgm-updater-action' => $action, |
|
345 | + 'tgm-updater-key' => $this->key, |
|
346 | + 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
347 | + 'tgm-updater-referer' => site_url(), |
|
348 | + 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
349 | + 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
350 | + ) |
|
351 | + ); |
|
352 | + $body = http_build_query( $body, '', '&' ); |
|
353 | + |
|
354 | + // Build the headers of the request. |
|
355 | + $headers = wp_parse_args( |
|
356 | + $headers, |
|
357 | + array( |
|
358 | + 'Content-Type' => 'application/x-www-form-urlencoded', |
|
359 | + 'Content-Length' => strlen( $body ) |
|
360 | + ) |
|
361 | + ); |
|
362 | + |
|
363 | + // Setup variable for wp_remote_post. |
|
364 | + $post = array( |
|
365 | + 'headers' => $headers, |
|
366 | + 'body' => $body |
|
367 | + ); |
|
368 | + |
|
369 | + // Perform the query and retrieve the response. |
|
370 | + $response = wp_remote_post( esc_url_raw( $this->remote_url ), $post ); |
|
371 | + $response_code = wp_remote_retrieve_response_code( $response ); |
|
372 | + $response_body = wp_remote_retrieve_body( $response ); |
|
373 | + |
|
374 | + // Bail out early if there are any errors. |
|
375 | + if ( 200 != $response_code || is_wp_error( $response_body ) ) { |
|
376 | + return false; |
|
377 | + } |
|
378 | + |
|
379 | + // Return the json decoded content. |
|
380 | + return json_decode( $response_body ); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) ); |
141 | 141 | |
142 | 142 | // Add additional info if the license is expired. |
143 | - add_action( 'in_plugin_update_message-'. $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 ); |
|
143 | + add_action( 'in_plugin_update_message-' . $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public function maybe_show_license_expired_message( $plugin_data, $response ) { |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | |
258 | 258 | // Create a new stdClass object and populate it with our plugin information. |
259 | 259 | $api = new stdClass; |
260 | - $api->name = isset( $this->info->name ) ? $this->info->name : ''; |
|
261 | - $api->slug = isset( $this->info->slug ) ? $this->info->slug : ''; |
|
262 | - $api->version = isset( $this->info->version ) ? $this->info->version : ''; |
|
263 | - $api->author = isset( $this->info->author ) ? $this->info->author : ''; |
|
260 | + $api->name = isset( $this->info->name ) ? $this->info->name : ''; |
|
261 | + $api->slug = isset( $this->info->slug ) ? $this->info->slug : ''; |
|
262 | + $api->version = isset( $this->info->version ) ? $this->info->version : ''; |
|
263 | + $api->author = isset( $this->info->author ) ? $this->info->author : ''; |
|
264 | 264 | $api->author_profile = isset( $this->info->author_profile ) ? $this->info->author_profile : ''; |
265 | - $api->requires = isset( $this->info->requires ) ? $this->info->requires : ''; |
|
266 | - $api->tested = isset( $this->info->tested ) ? $this->info->tested : ''; |
|
267 | - $api->last_updated = isset( $this->info->last_updated ) ? $this->info->last_updated : ''; |
|
268 | - $api->homepage = isset( $this->info->homepage ) ? $this->info->homepage : ''; |
|
265 | + $api->requires = isset( $this->info->requires ) ? $this->info->requires : ''; |
|
266 | + $api->tested = isset( $this->info->tested ) ? $this->info->tested : ''; |
|
267 | + $api->last_updated = isset( $this->info->last_updated ) ? $this->info->last_updated : ''; |
|
268 | + $api->homepage = isset( $this->info->homepage ) ? $this->info->homepage : ''; |
|
269 | 269 | |
270 | - $changelog = isset( $this->info->changelog ) ? $this->info->changelog : ''; |
|
271 | - $description = isset( $this->info->description ) ? $this->info->description : ''; |
|
270 | + $changelog = isset( $this->info->changelog ) ? $this->info->changelog : ''; |
|
271 | + $description = isset( $this->info->description ) ? $this->info->description : ''; |
|
272 | 272 | |
273 | 273 | if ( ! empty( $changelog ) ) { |
274 | 274 | if ( ! empty( $description ) ) { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $api->sections = array(); |
284 | 284 | } |
285 | 285 | |
286 | - $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : ''; |
|
286 | + $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : ''; |
|
287 | 287 | |
288 | 288 | // Return the new API object with our custom data. |
289 | 289 | return $api; |
@@ -37,7 +37,8 @@ |
||
37 | 37 | // Load the Welcome class. |
38 | 38 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/welcome.php'; |
39 | 39 | |
40 | - if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { // WPCS: CSRF ok, input var ok. |
|
40 | + if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { |
|
41 | +// WPCS: CSRF ok, input var ok. |
|
41 | 42 | // Only load the Onboarding wizard if the required parameter is present. |
42 | 43 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/onboarding-wizard.php'; |
43 | 44 | } |
@@ -270,7 +270,7 @@ |
||
270 | 270 | ), |
271 | 271 | admin_url( 'admin.php' ) |
272 | 272 | ); |
273 | - $url = esc_url( $url ); |
|
273 | + $url = esc_url( $url ); |
|
274 | 274 | |
275 | 275 | ob_start(); |
276 | 276 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
@@ -52,7 +52,8 @@ |
||
52 | 52 | // Check for wizard-specific parameter |
53 | 53 | // Allow plugins to disable the onboarding wizard |
54 | 54 | // Check if current user is allowed to save settings. |
55 | - if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) { // WPCS: CSRF ok, input var ok. |
|
55 | + if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) { |
|
56 | +// WPCS: CSRF ok, input var ok. |
|
56 | 57 | return; |
57 | 58 | } |
58 | 59 |
@@ -28,7 +28,8 @@ |
||
28 | 28 | delete_transient( '_monsterinsights_activation_redirect' ); |
29 | 29 | |
30 | 30 | // Bail if activating from network, or bulk. |
31 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok. |
|
31 | + if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
32 | +// WPCS: CSRF ok, input var ok. |
|
32 | 33 | return; |
33 | 34 | } |
34 | 35 |
@@ -155,25 +155,25 @@ discard block |
||
155 | 155 | $this->network = is_network_admin() || ! empty( $args['network'] ); |
156 | 156 | |
157 | 157 | $default_token = $this->network ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token(); |
158 | - $default_key = $this->network ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(); |
|
158 | + $default_key = $this->network ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(); |
|
159 | 159 | |
160 | - $this->token = ! empty( $args['token'] ) ? $args['token'] : $default_token; |
|
161 | - $this->key = ! empty( $args['key'] ) ? $args['key'] : $default_key; |
|
162 | - $this->tt = ! empty( $args['tt'] ) ? $args['tt'] : ''; |
|
163 | - $this->return = ! empty( $args['return'] ) ? $args['return'] : ''; |
|
164 | - $this->start = ! empty( $args['start'] ) ? $args['start'] : ''; |
|
165 | - $this->end = ! empty( $args['end'] ) ? $args['end'] : ''; |
|
160 | + $this->token = ! empty( $args['token'] ) ? $args['token'] : $default_token; |
|
161 | + $this->key = ! empty( $args['key'] ) ? $args['key'] : $default_key; |
|
162 | + $this->tt = ! empty( $args['tt'] ) ? $args['tt'] : ''; |
|
163 | + $this->return = ! empty( $args['return'] ) ? $args['return'] : ''; |
|
164 | + $this->start = ! empty( $args['start'] ) ? $args['start'] : ''; |
|
165 | + $this->end = ! empty( $args['end'] ) ? $args['end'] : ''; |
|
166 | 166 | |
167 | 167 | // We need to do this hack so that the network panel + the site_url of the main site are distinct |
168 | 168 | $this->site_url = is_network_admin() ? network_admin_url() : site_url(); |
169 | 169 | |
170 | 170 | if ( monsterinsights_is_pro_version() ) { |
171 | - $this->license = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
171 | + $this->license = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
172 | 172 | } |
173 | 173 | $this->plugin = MonsterInsights()->plugin_slug; |
174 | 174 | $this->miversion = MONSTERINSIGHTS_VERSION; |
175 | - $this->sitei = ! empty( $args['sitei'] ) ? $args['sitei'] : ''; |
|
176 | - $this->testurl = ! empty( $args['testurl'] ) ? $args['testurl'] : ''; |
|
175 | + $this->sitei = ! empty( $args['sitei'] ) ? $args['sitei'] : ''; |
|
176 | + $this->testurl = ! empty( $args['testurl'] ) ? $args['testurl'] : ''; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function request() { |
187 | 187 | // Make sure we're not blocked |
188 | 188 | $blocked = $this->is_blocked( $this->url ); |
189 | - if ( $blocked || is_wp_error( $blocked ) ) { |
|
189 | + if ( $blocked || is_wp_error( $blocked ) ) { |
|
190 | 190 | if ( is_wp_error( $blocked ) ) { |
191 | 191 | return new WP_Error( 'api-error', sprintf( __( 'The firewall of your server is blocking outbound calls. Please contact your hosting provider to fix this issue. %s', 'google-analytics-for-wordpress' ), $blocked->get_error_message() ) ); |
192 | 192 | } else { |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | if ( 'GET' == $this->method ) { |
246 | - $body['time'] = time(); // just to avoid caching |
|
246 | + $body['time'] = time(); // just to avoid caching |
|
247 | 247 | } |
248 | 248 | |
249 | - $body['timezone'] = date('e'); |
|
249 | + $body['timezone'] = date( 'e' ); |
|
250 | 250 | |
251 | 251 | $body['network'] = $this->network ? 'network' : 'site'; |
252 | 252 | |
253 | - $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
253 | + $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
254 | 254 | |
255 | 255 | // This filter will be removed in the future. |
256 | 256 | $body = apply_filters( 'monsterinsights_api_request_body', $body ); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | ); |
282 | 282 | |
283 | 283 | // Perform the query and retrieve the response. |
284 | - $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
284 | + $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
285 | 285 | |
286 | 286 | //return new WP_Error( 'debug', '<pre>' . var_export( $response, true ) . '</pre>' ); |
287 | 287 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // If not a 200 status header, send back error. |
302 | 302 | if ( 200 != $response_code ) { |
303 | - $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
303 | + $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
304 | 304 | |
305 | 305 | if ( empty( $response_code ) ) { |
306 | 306 | return new WP_Error( $type, __( 'The API was unreachable.', 'google-analytics-for-wordpress' ) ); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // and for image linking purposes in Google Images. We use it to test outbound connections since it is run on google.com |
388 | 388 | // and is only a few bytes large. Plus on Google's main CDN so it loads in most places in 0.07 seconds or less. Perfect for our |
389 | 389 | // use case of quickly testing outbound connections. |
390 | - $testurl = ! empty( $this->testurl ) ? $this->testurl :'http://www.google.com/blank.html'; |
|
390 | + $testurl = ! empty( $this->testurl ) ? $this->testurl : 'http://www.google.com/blank.html'; |
|
391 | 391 | if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { |
392 | 392 | if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { |
393 | 393 | $wp_http = new WP_Http(); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | 'body' => '' |
403 | 403 | ); |
404 | 404 | $response = wp_remote_get( $testurl, $params ); |
405 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
405 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
406 | 406 | return false; |
407 | 407 | } else { |
408 | 408 | if ( is_wp_error( $response ) ) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | ); |
425 | 425 | $response = wp_remote_get( $testurl, $params ); |
426 | 426 | |
427 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
427 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
428 | 428 | return false; |
429 | 429 | } else { |
430 | 430 | if ( is_wp_error( $response ) ) { |
@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
35 | 35 | |
36 | 36 | if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
37 | - // If dashboards disabled, first settings page |
|
38 | - add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | - $hook = 'monsterinsights_settings'; |
|
37 | + // If dashboards disabled, first settings page |
|
38 | + add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | + $hook = 'monsterinsights_settings'; |
|
40 | 40 | |
41 | - add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
41 | + add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
42 | 42 | } else { |
43 | - // if dashboards enabled, first dashboard |
|
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
43 | + // if dashboards enabled, first dashboard |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
45 | 45 | |
46 | - $hook = 'monsterinsights_reports'; |
|
46 | + $hook = 'monsterinsights_reports'; |
|
47 | 47 | |
48 | - add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
48 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
49 | 49 | |
50 | - // then settings page |
|
51 | - add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
50 | + // then settings page |
|
51 | + add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // then tools |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // then addons |
58 | 58 | $network_key = MonsterInsights()->license->get_network_license_key(); |
59 | 59 | if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
60 | - add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' ); |
|
60 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | add_action( 'admin_menu', 'monsterinsights_admin_menu' ); |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
72 | 72 | // menu page and the updater on the network panel |
73 | 73 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
74 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
74 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
78 | 78 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
79 | - return; |
|
79 | + return; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | function monsterinsights_add_admin_body_class( $classes ) { |
102 | 102 | $screen = get_current_screen(); |
103 | 103 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
104 | - return $classes; |
|
104 | + return $classes; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return "$classes monsterinsights_page "; |
@@ -121,17 +121,17 @@ discard block |
||
121 | 121 | |
122 | 122 | // If lite, show a link where they can get pro from |
123 | 123 | if ( ! monsterinsights_is_pro_version() ) { |
124 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
125 | - array_unshift( $links, $get_pro ); |
|
124 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
125 | + array_unshift( $links, $get_pro ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // If Lite, support goes to forum. If pro, it goes to our website |
129 | 129 | if ( monsterinsights_is_pro_version() ) { |
130 | - $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
131 | - array_unshift( $links, $support ); |
|
130 | + $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
131 | + array_unshift( $links, $support ); |
|
132 | 132 | } else { |
133 | - $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
134 | - array_unshift( $links, $support ); |
|
133 | + $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
134 | + array_unshift( $links, $support ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
@@ -156,26 +156,26 @@ discard block |
||
156 | 156 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
157 | 157 | |
158 | 158 | if ( monsterinsights_is_pro_version() ) { |
159 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
159 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
160 | 160 | |
161 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
162 | - require_once( $dir . $template . '.php' ); |
|
163 | - return true; |
|
164 | - } |
|
161 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
162 | + require_once( $dir . $template . '.php' ); |
|
163 | + return true; |
|
164 | + } |
|
165 | 165 | } else { |
166 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
166 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
167 | 167 | |
168 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
169 | - require_once( $dir . $template . '.php' ); |
|
170 | - return true; |
|
171 | - } |
|
168 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
169 | + require_once( $dir . $template . '.php' ); |
|
170 | + return true; |
|
171 | + } |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
175 | 175 | |
176 | 176 | if ( file_exists( $dir . $template . '.php' ) ) { |
177 | - require_once( $dir . $template . '.php' ); |
|
178 | - return true; |
|
177 | + require_once( $dir . $template . '.php' ); |
|
178 | + return true; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // Get the current screen, and check whether we're viewing a MonsterInsights screen; |
192 | 192 | $screen = get_current_screen(); |
193 | 193 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
194 | - return; |
|
194 | + return; |
|
195 | 195 | } |
196 | 196 | if ( in_array( $screen->id, array( |
197 | 197 | 'insights_page_monsterinsights_settings', |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | |
206 | 206 | // If here, we're on an MonsterInsights screen, so output the header. |
207 | 207 | monsterinsights_load_admin_partial( 'header', array( |
208 | - 'mascot' => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ), |
|
209 | - 'logo' => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ), |
|
210 | - '2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
211 | - '2xlogo' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
208 | + 'mascot' => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ), |
|
209 | + 'logo' => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ), |
|
210 | + '2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
211 | + '2xlogo' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
212 | 212 | ) ); |
213 | 213 | } |
214 | 214 | add_action( 'in_admin_header','monsterinsights_admin_header', 100 ); |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | function monsterinsights_admin_footer( $text ) { |
225 | 225 | global $current_screen; |
226 | 226 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
227 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
228 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
227 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
228 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
229 | 229 | } |
230 | 230 | return $text; |
231 | 231 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | // Don't show on MonsterInsights pages |
237 | 237 | $screen = get_current_screen(); |
238 | 238 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
239 | - return; |
|
239 | + return; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // Make sure they have the permissions to do something |
243 | 243 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
244 | - return; |
|
244 | + return; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // Priority: |
@@ -258,45 +258,45 @@ discard block |
||
258 | 258 | |
259 | 259 | // 1. Google Analytics not authenticated |
260 | 260 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
261 | - $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
262 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
263 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
264 | - return; |
|
261 | + $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
262 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
263 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
264 | + return; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | // 2. License key not entered for pro |
268 | 268 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
269 | 269 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
270 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
271 | - $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
272 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
273 | - return; |
|
270 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
271 | + $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
272 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
273 | + return; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // 3. License key not valid/okay for pro |
277 | 277 | if ( monsterinsights_is_pro_version() ) { |
278 | - $message = ''; |
|
279 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
280 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
281 | - $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
282 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
283 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
284 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
285 | - $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
286 | - } |
|
287 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
288 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
289 | - $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
290 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
291 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
292 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
293 | - $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
294 | - } |
|
295 | - } |
|
296 | - if ( ! empty( $message ) ) { |
|
297 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
298 | - return; |
|
299 | - } |
|
278 | + $message = ''; |
|
279 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
280 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
281 | + $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
282 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
283 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
284 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
285 | + $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
286 | + } |
|
287 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
288 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
289 | + $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
290 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
291 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
292 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
293 | + $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
294 | + } |
|
295 | + } |
|
296 | + if ( ! empty( $message ) ) { |
|
297 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
298 | + return; |
|
299 | + } |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | // 4. Notices for PHP/WP version deprecations |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | $notices = get_option( 'monsterinsights_notices' ); |
362 | 362 | if ( ! is_array( $notices ) ) { |
363 | - $notices = array(); |
|
363 | + $notices = array(); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // 6. Authenticate, not manual |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
369 | 369 | |
370 | 370 | if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
371 | - echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
372 | - echo '<p>'; |
|
373 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
374 | - echo '</p>'; |
|
375 | - echo '</div>'; |
|
376 | - return; |
|
371 | + echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
372 | + echo '<p>'; |
|
373 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
374 | + echo '</p>'; |
|
375 | + echo '</div>'; |
|
376 | + return; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // 7. Automatic updates not configured |
@@ -393,64 +393,64 @@ discard block |
||
393 | 393 | |
394 | 394 | // 8. WooUpsell |
395 | 395 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
396 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
397 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
398 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
399 | - echo '<p><strong>'; |
|
400 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
401 | - echo '</strong></p>'; |
|
402 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
403 | - echo '<p>'; |
|
404 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
405 | - echo '</p>'; |
|
406 | - echo '<p>'; |
|
407 | - echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
408 | - echo '</p>'; |
|
409 | - echo '<p>'; |
|
410 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
411 | - echo '</p>'; |
|
412 | - echo '<p>'; |
|
413 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
414 | - echo '</p>'; |
|
415 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) .'">', ' »</a>' ); |
|
416 | - echo '</p>'; |
|
417 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
418 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
419 | - echo '</div>'; |
|
420 | - echo '</div>'; |
|
421 | - return; |
|
422 | - } |
|
396 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
397 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
398 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
399 | + echo '<p><strong>'; |
|
400 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
401 | + echo '</strong></p>'; |
|
402 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
403 | + echo '<p>'; |
|
404 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
405 | + echo '</p>'; |
|
406 | + echo '<p>'; |
|
407 | + echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
408 | + echo '</p>'; |
|
409 | + echo '<p>'; |
|
410 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
411 | + echo '</p>'; |
|
412 | + echo '<p>'; |
|
413 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
414 | + echo '</p>'; |
|
415 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) .'">', ' »</a>' ); |
|
416 | + echo '</p>'; |
|
417 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
418 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
419 | + echo '</div>'; |
|
420 | + echo '</div>'; |
|
421 | + return; |
|
422 | + } |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | // 9. EDDUpsell |
426 | 426 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
427 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
428 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
429 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
430 | - echo '<p><strong>'; |
|
431 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
432 | - echo '</strong></p>'; |
|
433 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
434 | - echo '<p>'; |
|
435 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
436 | - echo '</p>'; |
|
437 | - echo '<p>'; |
|
438 | - echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
439 | - echo '</p>'; |
|
440 | - echo '<p>'; |
|
441 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
442 | - echo '</p>'; |
|
443 | - echo '<p>'; |
|
444 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
445 | - echo '</p>'; |
|
446 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) .'">', ' »</a>' ); |
|
447 | - echo '</p>'; |
|
448 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
449 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
450 | - echo '</div>'; |
|
451 | - echo '</div>'; |
|
452 | - return; |
|
453 | - } |
|
427 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
428 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
429 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
430 | + echo '<p><strong>'; |
|
431 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
432 | + echo '</strong></p>'; |
|
433 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
434 | + echo '<p>'; |
|
435 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
436 | + echo '</p>'; |
|
437 | + echo '<p>'; |
|
438 | + echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
439 | + echo '</p>'; |
|
440 | + echo '<p>'; |
|
441 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
442 | + echo '</p>'; |
|
443 | + echo '<p>'; |
|
444 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
445 | + echo '</p>'; |
|
446 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) .'">', ' »</a>' ); |
|
447 | + echo '</p>'; |
|
448 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
449 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
450 | + echo '</div>'; |
|
451 | + echo '</div>'; |
|
452 | + return; |
|
453 | + } |
|
454 | 454 | } |
455 | 455 | } |
456 | 456 | add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | // AM Notices |
461 | 461 | function monsterinsights_am_notice_optout( $super_admin ) { |
462 | 462 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
463 | - return false; |
|
463 | + return false; |
|
464 | 464 | } |
465 | 465 | return $super_admin; |
466 | 466 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
37 | 37 | // If dashboards disabled, first settings page |
38 | - add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | + add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | 39 | $hook = 'monsterinsights_settings'; |
40 | 40 | |
41 | 41 | add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
42 | 42 | } else { |
43 | 43 | // if dashboards enabled, first dashboard |
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
45 | 45 | |
46 | 46 | $hook = 'monsterinsights_reports'; |
47 | 47 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
83 | 83 | $hook = 'monsterinsights_network'; |
84 | - add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
84 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
85 | 85 | |
86 | 86 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
87 | 87 | |
@@ -116,21 +116,21 @@ discard block |
||
116 | 116 | * @return array $links |
117 | 117 | */ |
118 | 118 | function monsterinsights_add_action_links( $links ) { |
119 | - $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="'. monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) .'"">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>'; |
|
119 | + $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) . '"">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>'; |
|
120 | 120 | array_unshift( $links, $docs ); |
121 | 121 | |
122 | 122 | // If lite, show a link where they can get pro from |
123 | 123 | if ( ! monsterinsights_is_pro_version() ) { |
124 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
124 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) . '">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
125 | 125 | array_unshift( $links, $get_pro ); |
126 | 126 | } |
127 | 127 | |
128 | 128 | // If Lite, support goes to forum. If pro, it goes to our website |
129 | 129 | if ( monsterinsights_is_pro_version() ) { |
130 | - $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
130 | + $support = '<a title="MonsterInsights Pro Support" href="' . monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
131 | 131 | array_unshift( $links, $support ); |
132 | 132 | } else { |
133 | - $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
133 | + $support = '<a title="MonsterInsights Lite Support" href="' . monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
134 | 134 | array_unshift( $links, $support ); |
135 | 135 | } |
136 | 136 | |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
160 | 160 | |
161 | 161 | if ( file_exists( $dir . $template . '.php' ) ) { |
162 | - require_once( $dir . $template . '.php' ); |
|
162 | + require_once( $dir . $template . '.php' ); |
|
163 | 163 | return true; |
164 | 164 | } |
165 | 165 | } else { |
166 | 166 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
167 | 167 | |
168 | 168 | if ( file_exists( $dir . $template . '.php' ) ) { |
169 | - require_once( $dir . $template . '.php' ); |
|
169 | + require_once( $dir . $template . '.php' ); |
|
170 | 170 | return true; |
171 | 171 | } |
172 | 172 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
175 | 175 | |
176 | 176 | if ( file_exists( $dir . $template . '.php' ) ) { |
177 | - require_once( $dir . $template . '.php' ); |
|
177 | + require_once( $dir . $template . '.php' ); |
|
178 | 178 | return true; |
179 | 179 | } |
180 | 180 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | '2xlogo' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
212 | 212 | ) ); |
213 | 213 | } |
214 | -add_action( 'in_admin_header','monsterinsights_admin_header', 100 ); |
|
214 | +add_action( 'in_admin_header', 'monsterinsights_admin_header', 100 ); |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * When user is on a MonsterInsights related admin page, display footer text |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | global $current_screen; |
226 | 226 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
227 | 227 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
228 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
228 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
229 | 229 | } |
230 | 230 | return $text; |
231 | 231 | } |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | // 1. Google Analytics not authenticated |
260 | 260 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
261 | 261 | $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
262 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
263 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
262 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ), '<a href="' . $page . '">', '</a>' ); |
|
263 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
269 | 269 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
270 | 270 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
271 | - $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
272 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
271 | + $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' ); |
|
272 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | // 3. License key not valid/okay for pro |
277 | 277 | if ( monsterinsights_is_pro_version() ) { |
278 | 278 | $message = ''; |
279 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
279 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
280 | 280 | if ( MonsterInsights()->license->site_license_expired() ) { |
281 | - $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
281 | + $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
282 | 282 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
283 | 283 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
284 | 284 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
288 | 288 | if ( MonsterInsights()->license->network_license_expired() ) { |
289 | - $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
289 | + $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
290 | 290 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
291 | 291 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
292 | 292 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | if ( ! empty( $message ) ) { |
297 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
297 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
298 | 298 | return; |
299 | 299 | } |
300 | 300 | } |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | if ( version_compare( phpversion(), '5.4', '<' ) ) { |
308 | 308 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
309 | 309 | $message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress will stop supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
310 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
310 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
311 | 311 | return; |
312 | 312 | } |
313 | 313 | // WordPress 3.0 - 4.5 |
314 | 314 | else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
315 | 315 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
316 | 316 | $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 4.6 in April, 2019.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
317 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
317 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
318 | 318 | return; |
319 | 319 | } |
320 | 320 | // PHP 5.4/5.5 |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | // } |
359 | 359 | // } |
360 | 360 | |
361 | - $notices = get_option( 'monsterinsights_notices' ); |
|
361 | + $notices = get_option( 'monsterinsights_notices' ); |
|
362 | 362 | if ( ! is_array( $notices ) ) { |
363 | 363 | $notices = array(); |
364 | 364 | } |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
368 | 368 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
369 | 369 | |
370 | - if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
|
370 | + if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) ) { |
|
371 | 371 | echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
372 | 372 | echo '<p>'; |
373 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
373 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); |
|
374 | 374 | echo '</p>'; |
375 | 375 | echo '</div>'; |
376 | 376 | return; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | // 8. WooUpsell |
395 | 395 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
396 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
396 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
397 | 397 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
398 | 398 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
399 | 399 | echo '<p><strong>'; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | echo '<p>'; |
413 | 413 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
414 | 414 | echo '</p>'; |
415 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) .'">', ' »</a>' ); |
|
415 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="' . monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) . '">', ' »</a>' ); |
|
416 | 416 | echo '</p>'; |
417 | 417 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
418 | 418 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | // 9. EDDUpsell |
426 | 426 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
427 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
427 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
428 | 428 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
429 | 429 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
430 | 430 | echo '<p><strong>'; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | echo '<p>'; |
444 | 444 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
445 | 445 | echo '</p>'; |
446 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) .'">', ' »</a>' ); |
|
446 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="' . monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) . '">', ' »</a>' ); |
|
447 | 447 | echo '</p>'; |
448 | 448 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
449 | 449 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -276,7 +276,7 @@ |
||
276 | 276 | // 3. License key not valid/okay for pro |
277 | 277 | if ( monsterinsights_is_pro_version() ) { |
278 | 278 | $message = ''; |
279 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
279 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
280 | 280 | if ( MonsterInsights()->license->site_license_expired() ) { |
281 | 281 | $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
282 | 282 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |