@@ -47,17 +47,17 @@ |
||
47 | 47 | if ( ! empty( $data['data']['countries'] ) ) { |
48 | 48 | $country_names = monsterinsights_get_country_list( true ); |
49 | 49 | foreach ( $data['data']['countries'] as $key => $country ) { |
50 | - $data['data']['countries'][ $key ]['name'] = isset( $country_names[ $country['iso'] ] ) ? $country_names[ $country['iso'] ] : $country['iso']; |
|
50 | + $data['data']['countries'][$key]['name'] = isset( $country_names[$country['iso']] ) ? $country_names[$country['iso']] : $country['iso']; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Escape urls for the top pages report. |
55 | 55 | if ( ! empty( $data['data']['toppages'] ) ) { |
56 | 56 | foreach ( $data['data']['toppages'] as $key => $page ) { |
57 | - $title = $data['data']['toppages'][ $key ]['title']; |
|
58 | - $url = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][ $key ]['hostname'] ); |
|
57 | + $title = $data['data']['toppages'][$key]['title']; |
|
58 | + $url = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][$key]['hostname'] ); |
|
59 | 59 | |
60 | - $data['data']['toppages'][ $key ]['hostname'] = $url; |
|
60 | + $data['data']['toppages'][$key]['hostname'] = $url; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 |
@@ -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' ) ); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | // and for image linking purposes in Google Images. We use it to test outbound connections since it is run on google.com |
389 | 389 | // 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 |
390 | 390 | // use case of quickly testing outbound connections. |
391 | - $testurl = ! empty( $this->testurl ) ? $this->testurl :'http://www.google.com/blank.html'; |
|
391 | + $testurl = ! empty( $this->testurl ) ? $this->testurl : 'http://www.google.com/blank.html'; |
|
392 | 392 | if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { |
393 | 393 | if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { |
394 | 394 | $wp_http = new WP_Http(); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | 'body' => '' |
404 | 404 | ); |
405 | 405 | $response = wp_remote_get( $testurl, $params ); |
406 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
406 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
407 | 407 | return false; |
408 | 408 | } else { |
409 | 409 | if ( is_wp_error( $response ) ) { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | ); |
426 | 426 | $response = wp_remote_get( $testurl, $params ); |
427 | 427 | |
428 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
428 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
429 | 429 | return false; |
430 | 430 | } else { |
431 | 431 | if ( is_wp_error( $response ) ) { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'kad_admin_js', // Pinnacle theme |
379 | 379 | 'dt-chart', // DesignThemes core features plugin |
380 | 380 | 'tweeetshare_font_script', // TweetShare - Click To Tweet |
381 | - 'tweeetshare_jquery_script', // TweetShare - Click To Tweet |
|
381 | + 'tweeetshare_jquery_script', // TweetShare - Click To Tweet |
|
382 | 382 | 'tweeetshare_jqueryui_script', // TweetShare - Click To Tweet |
383 | 383 | 'tweeetshare_custom_script', // TweetShare - Click To Tweet |
384 | 384 | 'imagify-promise-polyfill', // Imagify |
@@ -397,16 +397,16 @@ discard block |
||
397 | 397 | 'rml-modal', // WP Real Media Library |
398 | 398 | 'rml-order', // WP Real Media Library |
399 | 399 | 'rml-meta', // WP Real Media Library |
400 | - 'rml-uploader', // WP Real Media Library |
|
401 | - 'rml-options', // WP Real Media Library |
|
402 | - 'rml-usersettings', // WP Real Media Library |
|
400 | + 'rml-uploader', // WP Real Media Library |
|
401 | + 'rml-options', // WP Real Media Library |
|
402 | + 'rml-usersettings', // WP Real Media Library |
|
403 | 403 | 'rml-main', // WP Real Media Library |
404 | 404 | 'control-panel-sweet-alert', // Ken Theme |
405 | 405 | 'sweet-alert-js', // Vitrine Theme |
406 | 406 | 'theme-admin-script', // Vitrine Theme |
407 | 407 | 'sweetalert', // Church Suite Theme by Webnus |
408 | 408 | 'be_alerts_charts', // WooCommerce bolder product alerts |
409 | - 'magayo-lottery-results', // Magayo Lottery Results |
|
409 | + 'magayo-lottery-results', // Magayo Lottery Results |
|
410 | 410 | 'control-panel-sweet-alert', // Ken Theme |
411 | 411 | 'cpm_chart', // WP Project Manager |
412 | 412 | 'adminscripts', // Artisan Nayma Theme |
@@ -501,20 +501,20 @@ discard block |
||
501 | 501 | |
502 | 502 | global $wp_styles; |
503 | 503 | foreach ( $wp_styles->queue as $handle ) { |
504 | - if ( strpos( $wp_styles->registered[ $handle ]->src, 'wp-content' ) === false ) { |
|
504 | + if ( strpos( $wp_styles->registered[$handle]->src, 'wp-content' ) === false ) { |
|
505 | 505 | return; |
506 | 506 | } |
507 | 507 | |
508 | - if ( strpos( $wp_styles->registered[ $handle ]->handle, 'monsterinsights' ) !== false ) { |
|
508 | + if ( strpos( $wp_styles->registered[$handle]->handle, 'monsterinsights' ) !== false ) { |
|
509 | 509 | return; |
510 | 510 | } |
511 | 511 | |
512 | 512 | foreach ( $third_party as $partial ) { |
513 | - if ( strpos( $wp_styles->registered[ $handle ]->handle, $partial ) !== false ) { |
|
513 | + if ( strpos( $wp_styles->registered[$handle]->handle, $partial ) !== false ) { |
|
514 | 514 | wp_dequeue_style( $handle ); // Remove css file from MI screen |
515 | 515 | wp_deregister_style( $handle ); |
516 | 516 | break; |
517 | - } else if ( strpos( $wp_styles->registered[ $handle ]->src, $partial ) !== false ) { |
|
517 | + } else if ( strpos( $wp_styles->registered[$handle]->src, $partial ) !== false ) { |
|
518 | 518 | wp_dequeue_style( $handle ); // Remove css file from MI screen |
519 | 519 | wp_deregister_style( $handle ); |
520 | 520 | break; |
@@ -524,20 +524,20 @@ discard block |
||
524 | 524 | |
525 | 525 | global $wp_scripts; |
526 | 526 | foreach ( $wp_scripts->queue as $handle ) { |
527 | - if ( strpos( $wp_scripts->registered[ $handle ]->src, 'wp-content' ) === false ) { |
|
527 | + if ( strpos( $wp_scripts->registered[$handle]->src, 'wp-content' ) === false ) { |
|
528 | 528 | return; |
529 | 529 | } |
530 | 530 | |
531 | - if ( strpos( $wp_scripts->registered[ $handle ]->handle, 'monsterinsights' ) !== false ) { |
|
531 | + if ( strpos( $wp_scripts->registered[$handle]->handle, 'monsterinsights' ) !== false ) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
535 | 535 | foreach ( $third_party as $partial ) { |
536 | - if ( strpos( $wp_scripts->registered[ $handle ]->handle, $partial ) !== false ) { |
|
536 | + if ( strpos( $wp_scripts->registered[$handle]->handle, $partial ) !== false ) { |
|
537 | 537 | wp_dequeue_script( $handle ); // Remove JS file from MI screen |
538 | 538 | wp_deregister_script( $handle ); |
539 | 539 | break; |
540 | - } else if ( strpos( $wp_scripts->registered[ $handle ]->src, $partial ) !== false ) { |
|
540 | + } else if ( strpos( $wp_scripts->registered[$handle]->src, $partial ) !== false ) { |
|
541 | 541 | wp_dequeue_script( $handle ); // Remove JS file from MI screen |
542 | 542 | wp_deregister_script( $handle ); |
543 | 543 | break; |
@@ -611,14 +611,14 @@ discard block |
||
611 | 611 | foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) { |
612 | 612 | foreach ( $hooks as $name => $arr ) { |
613 | 613 | if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) { |
614 | - unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] ); |
|
614 | + unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] ); |
|
615 | 615 | continue; |
616 | 616 | } |
617 | 617 | if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) { |
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { |
621 | - unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] ); |
|
621 | + unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] ); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | } |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) { |
629 | 629 | foreach ( $hooks as $name => $arr ) { |
630 | 630 | if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) { |
631 | - unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] ); |
|
631 | + unset( $wp_filter['admin_notices']->callbacks[$priority][$name] ); |
|
632 | 632 | continue; |
633 | 633 | } |
634 | 634 | if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) { |
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { |
638 | - unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] ); |
|
638 | + unset( $wp_filter['admin_notices']->callbacks[$priority][$name] ); |
|
639 | 639 | } |
640 | 640 | } |
641 | 641 | } |
@@ -645,14 +645,14 @@ discard block |
||
645 | 645 | foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) { |
646 | 646 | foreach ( $hooks as $name => $arr ) { |
647 | 647 | if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) { |
648 | - unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] ); |
|
648 | + unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] ); |
|
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) { |
652 | 652 | continue; |
653 | 653 | } |
654 | 654 | if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { |
655 | - unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] ); |
|
655 | + unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] ); |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | } |
@@ -713,10 +713,10 @@ discard block |
||
713 | 713 | // Put together redirect URL |
714 | 714 | $url = add_query_arg( |
715 | 715 | array( |
716 | - 'utm_source' => $source, // Pro/Lite Plugin |
|
717 | - 'utm_medium' => sanitize_key( $medium ), // Area of MonsterInsights (example Reports) |
|
716 | + 'utm_source' => $source, // Pro/Lite Plugin |
|
717 | + 'utm_medium' => sanitize_key( $medium ), // Area of MonsterInsights (example Reports) |
|
718 | 718 | 'utm_campaign' => sanitize_key( $campaign ), // Which link (example eCommerce Report) |
719 | - 'utm_content' => $content, // Version number of MI |
|
719 | + 'utm_content' => $content, // Version number of MI |
|
720 | 720 | ), |
721 | 721 | trailingslashit( $url ) |
722 | 722 | ); |
@@ -811,10 +811,10 @@ discard block |
||
811 | 811 | */ |
812 | 812 | function monsterinsights_yearinreview_admin_menu_tooltip() { |
813 | 813 | |
814 | - $dismiss_tooltip = get_option( 'monsterinsights_yearinreview_dismiss_admin_tooltip', false ); |
|
815 | - $activated = get_option( 'monsterinsights_over_time', array() ); |
|
816 | - $ua_code = monsterinsights_get_ua(); |
|
817 | - $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
|
814 | + $dismiss_tooltip = get_option( 'monsterinsights_yearinreview_dismiss_admin_tooltip', false ); |
|
815 | + $activated = get_option( 'monsterinsights_over_time', array() ); |
|
816 | + $ua_code = monsterinsights_get_ua(); |
|
817 | + $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
|
818 | 818 | |
819 | 819 | if ( $dashboards_disabled ) { |
820 | 820 | return; |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | } |
831 | 831 | |
832 | 832 | // equivalent to: 01/01/2020 @ 12:00am (UTC) |
833 | - $new_year = '1577836800'; |
|
833 | + $new_year = '1577836800'; |
|
834 | 834 | |
835 | 835 | // equivalent to: 01/02/2020 @ 12:00am (UTC) |
836 | 836 | $start_time = '1577923200'; |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | // equivalent to: 01/13/2020 @ 12:00am (UTC) |
839 | 839 | $end_time = '1578873600'; |
840 | 840 | |
841 | - if ( $dismiss_tooltip ) { |
|
841 | + if ( $dismiss_tooltip ) { |
|
842 | 842 | return; |
843 | 843 | } |
844 | 844 |
@@ -838,7 +838,7 @@ |
||
838 | 838 | // equivalent to: 01/13/2020 @ 12:00am (UTC) |
839 | 839 | $end_time = '1578873600'; |
840 | 840 | |
841 | - if ( $dismiss_tooltip ) { |
|
841 | + if ( $dismiss_tooltip ) { |
|
842 | 842 | return; |
843 | 843 | } |
844 | 844 |