@@ -84,9 +84,9 @@ |
||
84 | 84 | * @return string Javascript to output. |
85 | 85 | */ |
86 | 86 | public function frontend_output( ) { |
87 | - $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
88 | - $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
89 | - $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
87 | + $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION . ' - https://www.monsterinsights.com/ -->'; |
|
88 | + $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
89 | + $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
90 | 90 | return $output; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return array Array of the options to use. |
58 | 58 | */ |
59 | 59 | public function frontend_tracking_options( ) { |
60 | - return array(); |
|
60 | + return array(); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @return string Javascript to output. |
74 | 74 | */ |
75 | 75 | public function frontend_output( ) { |
76 | - $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
77 | - $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
78 | - $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
79 | - return $output; |
|
76 | + $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
77 | + $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
78 | + $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
79 | + return $output; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -126,7 +126,7 @@ |
||
126 | 126 | function monsterinsights_rss_link_tagger( $guid ) { |
127 | 127 | global $post; |
128 | 128 | |
129 | - if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
|
129 | + if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ) { |
|
130 | 130 | if ( is_feed() ) { |
131 | 131 | if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
132 | 132 | $delimiter = '#'; |
@@ -126,7 +126,7 @@ |
||
126 | 126 | function monsterinsights_rss_link_tagger( $guid ) { |
127 | 127 | global $post; |
128 | 128 | |
129 | - if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
|
129 | + if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ) { |
|
130 | 130 | if ( is_feed() ) { |
131 | 131 | if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
132 | 132 | $delimiter = '#'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | do_action( 'monsterinsights_tracking_before_' . $mode ); |
38 | 38 | do_action( 'monsterinsights_tracking_before', $mode ); |
39 | 39 | if ( $mode === 'preview' ) { |
40 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php'; |
|
41 | - $tracking = new MonsterInsights_Tracking_Preview(); |
|
42 | - echo $tracking->frontend_output(); |
|
40 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php'; |
|
41 | + $tracking = new MonsterInsights_Tracking_Preview(); |
|
42 | + echo $tracking->frontend_output(); |
|
43 | 43 | } else { |
44 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php'; |
|
45 | - $tracking = new MonsterInsights_Tracking_Analytics(); |
|
46 | - echo $tracking->frontend_output(); |
|
44 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php'; |
|
45 | + $tracking = new MonsterInsights_Tracking_Analytics(); |
|
46 | + echo $tracking->frontend_output(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | do_action( 'monsterinsights_tracking_after_' . $mode ); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $track_user = monsterinsights_track_user(); |
70 | 70 | |
71 | 71 | if ( $track_user && ( $events_mode === 'js' || $events_mode === 'php' ) ) { |
72 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
73 | - new MonsterInsights_Analytics_Events(); |
|
72 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
73 | + new MonsterInsights_Analytics_Events(); |
|
74 | 74 | } else { |
75 | - // User is in the disabled group or events mode is off |
|
75 | + // User is in the disabled group or events mode is off |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | add_action( 'template_redirect', 'monsterinsights_events_tracking', 9 ); |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | global $post; |
92 | 92 | |
93 | 93 | if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
94 | - if ( is_feed() ) { |
|
95 | - if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
|
96 | - $delimiter = '#'; |
|
97 | - } else { |
|
98 | - $delimiter = '?'; |
|
99 | - if ( strpos( $guid, $delimiter ) > 0 ) { |
|
100 | - $delimiter = '&'; |
|
101 | - } |
|
102 | - } |
|
103 | - return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name ); |
|
104 | - } |
|
94 | + if ( is_feed() ) { |
|
95 | + if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
|
96 | + $delimiter = '#'; |
|
97 | + } else { |
|
98 | + $delimiter = '?'; |
|
99 | + if ( strpos( $guid, $delimiter ) > 0 ) { |
|
100 | + $delimiter = '&'; |
|
101 | + } |
|
102 | + } |
|
103 | + return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name ); |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | return $guid; |
107 | 107 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined( 'ABSPATH' ) ) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -72,7 +72,8 @@ discard block |
||
72 | 72 | // This is the version used for MI upgrade routines. |
73 | 73 | update_option( 'monsterinsights_db_version', '6.2.0' ); |
74 | 74 | |
75 | - } else if ( ! $version && $yoast ) { // if new install and has used Yoast previously |
|
75 | + } else if ( ! $version && $yoast ) { |
|
76 | +// if new install and has used Yoast previously |
|
76 | 77 | |
77 | 78 | $this->upgrade_from_yoast(); |
78 | 79 | // This is the version used for MI upgrade routines. |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | $cachec = true; |
84 | 85 | } |
85 | 86 | |
86 | - } else { // if existing install |
|
87 | + } else { |
|
88 | +// if existing install |
|
87 | 89 | if ( version_compare( $version, '6.0.2', '<' ) ) { |
88 | 90 | $this->v602_upgrades(); |
89 | 91 | } |
@@ -328,7 +330,7 @@ discard block |
||
328 | 330 | $network = false; |
329 | 331 | // Try network active Premium |
330 | 332 | $is_key = get_site_option( 'google-analytics-by-yoast-premium_license', array() ); |
331 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
333 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
332 | 334 | $key = $is_key['key']; |
333 | 335 | $found = true; |
334 | 336 | $network = true; |
@@ -337,7 +339,7 @@ discard block |
||
337 | 339 | // Try single site Premium |
338 | 340 | if ( ! $found ) { |
339 | 341 | $is_key = get_option( 'google-analytics-by-yoast-premium_license', array() ); |
340 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
342 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
341 | 343 | $key = $is_key['key']; |
342 | 344 | $found = true; |
343 | 345 | } |
@@ -346,7 +348,7 @@ discard block |
||
346 | 348 | // Try network active Premium |
347 | 349 | if ( ! $found ) { |
348 | 350 | $is_key = get_site_option( 'monsterinsights-pro_license', array() ); |
349 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
351 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
350 | 352 | $key = $is_key['key']; |
351 | 353 | $found = true; |
352 | 354 | $network = true; |
@@ -356,7 +358,7 @@ discard block |
||
356 | 358 | // Try single site Premium |
357 | 359 | if ( ! $found ) { |
358 | 360 | $is_key = get_option( 'monsterinsights-pro_license', array() ); |
359 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
361 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
360 | 362 | $key = $is_key['key']; |
361 | 363 | $found = true; |
362 | 364 | } |
@@ -365,7 +367,7 @@ discard block |
||
365 | 367 | // Try network active ecommmerce |
366 | 368 | if ( ! $found ) { |
367 | 369 | $is_key = get_site_option( 'ecommerce-addon_license', array() ); |
368 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
370 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
369 | 371 | $key = $is_key['key']; |
370 | 372 | $found = true; |
371 | 373 | $network = true; |
@@ -374,7 +376,7 @@ discard block |
||
374 | 376 | // Try single site ecommerce |
375 | 377 | if ( ! $found ) { |
376 | 378 | $is_key = get_option( 'ecommerce-addon_license', array() ); |
377 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
379 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
378 | 380 | $key = $is_key['key']; |
379 | 381 | $found = true; |
380 | 382 | } |
@@ -516,7 +518,7 @@ discard block |
||
516 | 518 | delete_option( 'yoast-ga-access_token' ); |
517 | 519 | delete_option( 'yoast-ga-refresh_token' ); |
518 | 520 | delete_option( 'yst_ga_api' ); |
519 | - } else { |
|
521 | + } else { |
|
520 | 522 | // if UA in profile profiles, remove others and use that |
521 | 523 | if ( ! empty( $options['analytics_profile' ] ) && ! empty( $profiles['ga_api_response_accounts'] ) && is_array( $profiles['ga_api_response_accounts'] ) ) { |
522 | 524 | foreach ( $profiles as $account ) { |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | // Fallback to make sure every default option has a value |
307 | 307 | $defaults = $this->get_yoast_default_values(); |
308 | 308 | if ( is_array( $defaults ) ) { |
309 | - foreach ( $defaults[ 'ga_general' ] as $key => $value ) { |
|
310 | - if ( ! isset( $options[ $key ] ) ) { |
|
311 | - $options[ $key ] = $value; |
|
309 | + foreach ( $defaults['ga_general'] as $key => $value ) { |
|
310 | + if ( ! isset( $options[$key] ) ) { |
|
311 | + $options[$key] = $value; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | // Set to the current version now that we've done all needed upgrades |
317 | 317 | $options['version'] = '5.5.3'; // Last Yoast codebase version |
318 | 318 | $saved_options = get_option( 'yst_ga' ); |
319 | - $saved_options[ 'ga_general' ] = $options; |
|
319 | + $saved_options['ga_general'] = $options; |
|
320 | 320 | update_option( 'yst_ga', $saved_options ); |
321 | 321 | |
322 | 322 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | $network = false; |
327 | 327 | // Try network active Premium |
328 | 328 | $is_key = get_site_option( 'google-analytics-by-yoast-premium_license', array() ); |
329 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
330 | - $key = $is_key['key']; |
|
329 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
330 | + $key = $is_key['key']; |
|
331 | 331 | $found = true; |
332 | 332 | $network = true; |
333 | 333 | } |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | // Try single site Premium |
336 | 336 | if ( ! $found ) { |
337 | 337 | $is_key = get_option( 'google-analytics-by-yoast-premium_license', array() ); |
338 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
339 | - $key = $is_key['key']; |
|
338 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
339 | + $key = $is_key['key']; |
|
340 | 340 | $found = true; |
341 | 341 | } |
342 | 342 | } |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | // Try network active Premium |
345 | 345 | if ( ! $found ) { |
346 | 346 | $is_key = get_site_option( 'monsterinsights-pro_license', array() ); |
347 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
348 | - $key = $is_key['key']; |
|
347 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
348 | + $key = $is_key['key']; |
|
349 | 349 | $found = true; |
350 | 350 | $network = true; |
351 | 351 | } |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | // Try single site Premium |
355 | 355 | if ( ! $found ) { |
356 | 356 | $is_key = get_option( 'monsterinsights-pro_license', array() ); |
357 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
358 | - $key = $is_key['key']; |
|
357 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
358 | + $key = $is_key['key']; |
|
359 | 359 | $found = true; |
360 | 360 | } |
361 | 361 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | // Try network active ecommmerce |
364 | 364 | if ( ! $found ) { |
365 | 365 | $is_key = get_site_option( 'ecommerce-addon_license', array() ); |
366 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
367 | - $key = $is_key['key']; |
|
366 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
367 | + $key = $is_key['key']; |
|
368 | 368 | $found = true; |
369 | 369 | $network = true; |
370 | 370 | } |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | // Try single site ecommerce |
373 | 373 | if ( ! $found ) { |
374 | 374 | $is_key = get_option( 'ecommerce-addon_license', array() ); |
375 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
376 | - $key = $is_key['key']; |
|
375 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
376 | + $key = $is_key['key']; |
|
377 | 377 | $found = true; |
378 | 378 | } |
379 | 379 | } |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
491 | - $options['cron_last_run'] = strtotime("-25 hours"); |
|
491 | + $options['cron_last_run'] = strtotime( "-25 hours" ); |
|
492 | 492 | } else { |
493 | 493 | // if UA in manual code field, remove analytics profile fields if set |
494 | - if ( ! empty( $options['manual_ua_code_field' ] ) ) { |
|
494 | + if ( ! empty( $options['manual_ua_code_field'] ) ) { |
|
495 | 495 | if ( isset( $options['analytics_profile_code'] ) ) { |
496 | 496 | unset( $options['analytics_profile_code'] ); |
497 | 497 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | delete_option( 'yoast-ga-access_token' ); |
503 | 503 | delete_option( 'yoast-ga-refresh_token' ); |
504 | 504 | delete_option( 'yst_ga_api' ); |
505 | - } else if ( ! empty( $options['analytics_profile_code' ] ) ) { |
|
505 | + } else if ( ! empty( $options['analytics_profile_code'] ) ) { |
|
506 | 506 | // if UA in profile fields, remove others and use that |
507 | 507 | $options['manual_ua_code'] = $options['analytics_profile_code']; |
508 | 508 | if ( isset( $options['analytics_profile_code'] ) ) { |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | delete_option( 'yoast-ga-access_token' ); |
515 | 515 | delete_option( 'yoast-ga-refresh_token' ); |
516 | 516 | delete_option( 'yst_ga_api' ); |
517 | - } else { |
|
517 | + } else { |
|
518 | 518 | // if UA in profile profiles, remove others and use that |
519 | - if ( ! empty( $options['analytics_profile' ] ) && ! empty( $profiles['ga_api_response_accounts'] ) && is_array( $profiles['ga_api_response_accounts'] ) ) { |
|
519 | + if ( ! empty( $options['analytics_profile'] ) && ! empty( $profiles['ga_api_response_accounts'] ) && is_array( $profiles['ga_api_response_accounts'] ) ) { |
|
520 | 520 | foreach ( $profiles as $account ) { |
521 | 521 | foreach ( $account['items'] as $profile ) { |
522 | 522 | foreach ( $profile['items'] as $subprofile ) { |
523 | - if ( isset( $subprofile['id'] ) && $subprofile['id'] == $options['analytics_profile' ] ) { |
|
523 | + if ( isset( $subprofile['id'] ) && $subprofile['id'] == $options['analytics_profile'] ) { |
|
524 | 524 | $options['manual_ua_code'] = $subprofile['ua_code']; |
525 | 525 | break 3; |
526 | 526 | } |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function v602_upgrades() { |
642 | 642 | $options = get_option( 'yst_ga', array() ); |
643 | - if ( ( empty( $this->new_settings[ 'manual_ua_code'] ) || $this->new_settings[ 'manual_ua_code'] === '1' ) && |
|
644 | - empty( $this->new_settings[ 'analytics_profile_code'] ) && |
|
643 | + if ( ( empty( $this->new_settings['manual_ua_code'] ) || $this->new_settings['manual_ua_code'] === '1' ) && |
|
644 | + empty( $this->new_settings['analytics_profile_code'] ) && |
|
645 | 645 | ! empty( $options ) && |
646 | 646 | is_array( $options ) && |
647 | 647 | ! empty( $options['ga_general']['manual_ua_code_field'] ) |
@@ -689,8 +689,8 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function v620_upgrades() { |
691 | 691 | // Turns off debug mode if its on. |
692 | - if ( empty( $this->new_settings['debug_mode' ] ) ) { |
|
693 | - $this->new_settings['debug_mode' ] = 0; |
|
692 | + if ( empty( $this->new_settings['debug_mode'] ) ) { |
|
693 | + $this->new_settings['debug_mode'] = 0; |
|
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
@@ -727,25 +727,25 @@ discard block |
||
727 | 727 | |
728 | 728 | // 3. Default all event tracking and tracking to GA + JS respectively |
729 | 729 | // 3a Set tracking_mode to use analytics.js |
730 | - $this->new_settings['tracking_mode' ] = 'analytics'; |
|
730 | + $this->new_settings['tracking_mode'] = 'analytics'; |
|
731 | 731 | |
732 | 732 | |
733 | 733 | // 3b Set events mode to use JS if the events mode is not set explicitly to none |
734 | - if ( empty( $this->new_settings['events_mode' ] ) || $this->new_settings['events_mode' ] !== 'none' ) { |
|
735 | - $this->new_settings['events_mode' ] = 'js'; |
|
734 | + if ( empty( $this->new_settings['events_mode'] ) || $this->new_settings['events_mode'] !== 'none' ) { |
|
735 | + $this->new_settings['events_mode'] = 'js'; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | // 4. Migrate manual UA codes |
739 | 739 | // 4a Manual UA has the lowest priority |
740 | - if ( ! empty( $this->new_settings['manual_ua_code' ] ) ) { |
|
740 | + if ( ! empty( $this->new_settings['manual_ua_code'] ) ) { |
|
741 | 741 | // Set as manual UA code |
742 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ); |
|
742 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | // 4b Then try the oAuth UA code |
746 | - if ( ! empty( $this->new_settings['analytics_profile_code' ] ) ) { |
|
746 | + if ( ! empty( $this->new_settings['analytics_profile_code'] ) ) { |
|
747 | 747 | // Set as manual UA code |
748 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ); |
|
748 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | // 5. Migrate License keys |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | 'grids', 'icl_post_language', 'mlcf_email', 'mlcf_name', 'navigation-skins', 'page', 'punch-fonts', 'return_tab', 'skins', |
774 | 774 | 'wpcf_email', 'wpcf_your_name' ); |
775 | 775 | foreach ( $settings as $setting ) { |
776 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
777 | - unset( $this->new_settings[ $setting ] ); |
|
776 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
777 | + unset( $this->new_settings[$setting] ); |
|
778 | 778 | } |
779 | 779 | } |
780 | 780 | |
@@ -797,11 +797,11 @@ discard block |
||
797 | 797 | // 5. Remove deprecated settings |
798 | 798 | $settings = array( '_repeated', 'ajax', 'asmselect0', 'bawac_force_nonce', 'cf_email', 'cf_message', 'cf_name', 'cf_number', |
799 | 799 | 'cf_phone', 'cf_subject', 'credentials', 'cron_failed', 'cron_last_run', 'firebug_lite', 'global-css', 'google_auth_code', |
800 | - 'grids', 'icl_post_language', 'mlcf_email', 'mlcf_name','navigation-skins', 'page', 'punch-fonts', 'return_tab', 'skins', |
|
800 | + 'grids', 'icl_post_language', 'mlcf_email', 'mlcf_name', 'navigation-skins', 'page', 'punch-fonts', 'return_tab', 'skins', |
|
801 | 801 | 'wpcf_email', 'wpcf_your_name' ); |
802 | 802 | foreach ( $settings as $setting ) { |
803 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
804 | - unset( $this->new_settings[ $setting ] ); |
|
803 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
804 | + unset( $this->new_settings[$setting] ); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | } |
6 | 6 | |
7 | 7 | function monsterinsights_tools_url_builder() { |
8 | - ob_start();?> |
|
8 | + ob_start(); ?> |
|
9 | 9 | <div class="monsterinsights-upsell-under-box"> |
10 | 10 | <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2> |
11 | 11 | <p class="monsterinsights-upsell-lite-text"><?php esc_html_e( "By upgrading to MonsterInsights Pro, you can unlock the MonsterInsights URL builder that helps you better track your advertising and email marketing campaigns.", 'google-analytics-for-wordpress' ); ?></p> |
@@ -24,9 +24,9 @@ |
||
24 | 24 | ?> |
25 | 25 | <div id="monsterinsights-settings-general"> |
26 | 26 | <?php |
27 | - // Output any notices now |
|
28 | - do_action( 'monsterinsights_settings_support_tab_notice' ); |
|
29 | - ?> |
|
27 | + // Output any notices now |
|
28 | + do_action( 'monsterinsights_settings_support_tab_notice' ); |
|
29 | + ?> |
|
30 | 30 | <?php //Status page coming soon. ?> |
31 | 31 | <!-- <hr /> --> |
32 | 32 | </div> |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Callback for displaying the UI for support tab. |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - add_action( 'admin_print_scripts', array( $this, 'js' ), 20 ); |
|
58 | - add_action( 'admin_print_scripts', array( $this, 'css' ) ); |
|
59 | - add_action( 'admin_footer', array( $this, 'modal' ) ); |
|
57 | + add_action( 'admin_print_scripts', array( $this, 'js' ), 20 ); |
|
58 | + add_action( 'admin_print_scripts', array( $this, 'css' ) ); |
|
59 | + add_action( 'admin_footer', array( $this, 'modal' ) ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function is_dev_url() { |
69 | 69 | // If it is an AM dev site, return false, so we can see them on our dev sites. |
70 | - if ( defined ('AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) { |
|
70 | + if ( defined( 'AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | } |
103 | 103 | if ( substr_count( $host, '.' ) > 1 ) { |
104 | - $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
104 | + $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
105 | 105 | foreach ( $subdomains_to_check as $subdomain ) { |
106 | 106 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
107 | 107 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | <div class="am-deactivate-survey-wrap"> |
314 | 314 | <form class="am-deactivate-survey" method="post"> |
315 | 315 | <span class="am-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', 'google-analytics-for-wordpress' ); ?></span> |
316 | - <span class="am-deactivate-survey-desc"><?php echo sprintf( esc_html__('If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); ?></span> |
|
316 | + <span class="am-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); ?></span> |
|
317 | 317 | <div class="am-deactivate-survey-options"> |
318 | 318 | <?php foreach ( $options as $id => $option ) : ?> |
319 | 319 | <div class="am-deactivate-survey-option"> |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | <?php endforeach; ?> |
329 | 329 | </div> |
330 | 330 | <div class="am-deactivate-survey-footer"> |
331 | - <button type="submit" class="am-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__('Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></button> |
|
332 | - <a href="#" class="am-deactivate-survey-deactivate"><?php echo sprintf( esc_html__('Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></a> |
|
331 | + <button type="submit" class="am-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></button> |
|
332 | + <a href="#" class="am-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></a> |
|
333 | 333 | </div> |
334 | 334 | </form> |
335 | 335 | </div> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return; |
191 | 191 | } |
192 | 192 | |
193 | - $plugin_notifications = $this->get_plugin_notifications( - 1, array( |
|
193 | + $plugin_notifications = $this->get_plugin_notifications( -1, array( |
|
194 | 194 | 'post_status' => 'all', |
195 | 195 | 'meta_key' => 'viewed', |
196 | 196 | 'meta_value' => '0', |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ( ! $continue ) { |
252 | - unset( $plugin_notifications[ $key ] ); |
|
252 | + unset( $plugin_notifications[$key] ); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | if ( ! $continue ) { |
267 | - unset( $plugin_notifications[ $key ] ); |
|
267 | + unset( $plugin_notifications[$key] ); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $continue = (string) wp_get_theme() === $theme; |
274 | 274 | |
275 | 275 | if ( ! empty( $theme ) && ! $continue ) { |
276 | - unset( $plugin_notifications[ $key ] ); |
|
276 | + unset( $plugin_notifications[$key] ); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Version validation. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | if ( ! $continue ) { |
288 | - unset( $plugin_notifications[ $key ] ); |
|
288 | + unset( $plugin_notifications[$key] ); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | if ( ! $continue ) { |
301 | - unset( $plugin_notifications[ $key ] ); |
|
301 | + unset( $plugin_notifications[$key] ); |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | if ( ! $continue ) { |
315 | - unset( $plugin_notifications[ $key ] ); |
|
315 | + unset( $plugin_notifications[$key] ); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | public function revoke_notifications( $ids ) { |
445 | 445 | // Loop through each of the IDs and find the post that has it as meta. |
446 | 446 | foreach ( (array) $ids as $id ) { |
447 | - $notifications = $this->get_plugin_notifications( - 1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) ); |
|
447 | + $notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) ); |
|
448 | 448 | if ( $notifications ) { |
449 | 449 | foreach ( $notifications as $notification ) { |
450 | 450 | update_post_meta( $notification->ID, 'viewed', 1 ); |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Helper method for deleting a setting's value. |
|
199 | - * |
|
200 | - * @since 6.0.0 |
|
201 | - * @access public |
|
202 | - * |
|
203 | - * @param string $key The setting key. |
|
204 | - * @return boolean True if removed, false if not. |
|
205 | - */ |
|
198 | + * Helper method for deleting a setting's value. |
|
199 | + * |
|
200 | + * @since 6.0.0 |
|
201 | + * @access public |
|
202 | + * |
|
203 | + * @param string $key The setting key. |
|
204 | + * @return boolean True if removed, false if not. |
|
205 | + */ |
|
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | 208 | if ( empty( $key ) ){ |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * Helper method for deleting multiple settings value. |
|
249 | - * |
|
250 | - * @since 6.0.0 |
|
251 | - * @access public |
|
252 | - * |
|
253 | - * @param string $key The setting key. |
|
254 | - * @return boolean True if removed, false if not. |
|
255 | - */ |
|
248 | + * Helper method for deleting multiple settings value. |
|
249 | + * |
|
250 | + * @since 6.0.0 |
|
251 | + * @access public |
|
252 | + * |
|
253 | + * @param string $key The setting key. |
|
254 | + * @return boolean True if removed, false if not. |
|
255 | + */ |
|
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | 258 | if ( empty( $keys ) || ! is_array( $keys ) ){ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function monsterinsights_get_option( $key = '', $default = false ) { |
49 | 49 | global $monsterinsights_settings; |
50 | - $value = ! empty( $monsterinsights_settings[ $key ] ) ? $monsterinsights_settings[ $key ] : $default; |
|
50 | + $value = ! empty( $monsterinsights_settings[$key] ) ? $monsterinsights_settings[$key] : $default; |
|
51 | 51 | $value = apply_filters( 'monsterinsights_get_option', $value, $key, $default ); |
52 | 52 | return apply_filters( 'monsterinsights_get_option_' . $key, $value, $key, $default ); |
53 | 53 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_update_option( $key = '', $value = false ) { |
147 | 147 | |
148 | 148 | // If no key, exit |
149 | - if ( empty( $key ) ){ |
|
149 | + if ( empty( $key ) ) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $value = apply_filters( 'monsterinsights_update_option', $value, $key ); |
178 | 178 | |
179 | 179 | // Next let's try to update the value |
180 | - $settings[ $key ] = $value; |
|
180 | + $settings[$key] = $value; |
|
181 | 181 | $did_update = false; |
182 | 182 | //if ( $update_network_option ) { |
183 | 183 | // $did_update = update_site_option( $option_name, $settings ); |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | //} |
187 | 187 | |
188 | 188 | // If it updated, let's update the global variable |
189 | - if ( $did_update ){ |
|
189 | + if ( $did_update ) { |
|
190 | 190 | global $monsterinsights_settings; |
191 | - $monsterinsights_settings[ $key ] = $value; |
|
191 | + $monsterinsights_settings[$key] = $value; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $did_update; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | - if ( empty( $key ) ){ |
|
208 | + if ( empty( $key ) ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | //} |
225 | 225 | |
226 | 226 | // Next let's try to remove the key |
227 | - if( isset( $settings[ $key ] ) ) { |
|
228 | - unset( $settings[ $key ] ); |
|
227 | + if ( isset( $settings[$key] ) ) { |
|
228 | + unset( $settings[$key] ); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $did_update = false; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | //} |
237 | 237 | |
238 | 238 | // If it updated, let's update the global variable |
239 | - if ( $did_update ){ |
|
239 | + if ( $did_update ) { |
|
240 | 240 | global $monsterinsights_settings; |
241 | 241 | $monsterinsights_settings = $settings; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
258 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | // Next let's try to remove the keys |
277 | 277 | foreach ( $keys as $key ) { |
278 | - if( isset( $settings[ $key ] ) ) { |
|
279 | - unset( $settings[ $key ] ); |
|
278 | + if ( isset( $settings[$key] ) ) { |
|
279 | + unset( $settings[$key] ); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //} |
289 | 289 | |
290 | 290 | // If it updated, let's update the global variable |
291 | - if ( $did_update ){ |
|
291 | + if ( $did_update ) { |
|
292 | 292 | global $monsterinsights_settings; |
293 | 293 | $monsterinsights_settings = $settings; |
294 | 294 | } |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | ); |
380 | 380 | |
381 | 381 | foreach ( $exclude as $e ) { |
382 | - if ( ! empty( $settings[ $e ] ) ) { |
|
383 | - unset( $settings[ $e ] ); |
|
382 | + if ( ! empty( $settings[$e] ) ) { |
|
383 | + unset( $settings[$e] ); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | return wp_json_encode( $settings ); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_update_option( $key = '', $value = false ) { |
147 | 147 | |
148 | 148 | // If no key, exit |
149 | - if ( empty( $key ) ){ |
|
149 | + if ( empty( $key ) ) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | //} |
187 | 187 | |
188 | 188 | // If it updated, let's update the global variable |
189 | - if ( $did_update ){ |
|
189 | + if ( $did_update ) { |
|
190 | 190 | global $monsterinsights_settings; |
191 | 191 | $monsterinsights_settings[ $key ] = $value; |
192 | 192 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | - if ( empty( $key ) ){ |
|
208 | + if ( empty( $key ) ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | //} |
237 | 237 | |
238 | 238 | // If it updated, let's update the global variable |
239 | - if ( $did_update ){ |
|
239 | + if ( $did_update ) { |
|
240 | 240 | global $monsterinsights_settings; |
241 | 241 | $monsterinsights_settings = $settings; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
258 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //} |
289 | 289 | |
290 | 290 | // If it updated, let's update the global variable |
291 | - if ( $did_update ){ |
|
291 | + if ( $did_update ) { |
|
292 | 292 | global $monsterinsights_settings; |
293 | 293 | $monsterinsights_settings = $settings; |
294 | 294 | } |