@@ -35,54 +35,54 @@ |
||
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | 37 | switch( $cap ) { |
38 | - case 'monsterinsights_view_dashboard' : |
|
39 | - $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
38 | + case 'monsterinsights_view_dashboard' : |
|
39 | + $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
40 | 40 | |
41 | - $user_can_via_settings = false; |
|
42 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | - foreach ( $roles as $role ) { |
|
44 | - if ( is_string( $role ) ) { |
|
45 | - if ( user_can( $user_id, $role ) ) { |
|
46 | - $user_can_via_settings = true; |
|
47 | - break; |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | - if ( user_can( $user_id, $roles ) ) { |
|
53 | - $user_can_via_settings = true; |
|
54 | - } |
|
55 | - } |
|
41 | + $user_can_via_settings = false; |
|
42 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | + foreach ( $roles as $role ) { |
|
44 | + if ( is_string( $role ) ) { |
|
45 | + if ( user_can( $user_id, $role ) ) { |
|
46 | + $user_can_via_settings = true; |
|
47 | + break; |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | + if ( user_can( $user_id, $roles ) ) { |
|
53 | + $user_can_via_settings = true; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | - $caps = array(); |
|
59 | - } |
|
57 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | + $caps = array(); |
|
59 | + } |
|
60 | 60 | |
61 | - break; |
|
62 | - case 'monsterinsights_save_settings' : |
|
63 | - $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
61 | + break; |
|
62 | + case 'monsterinsights_save_settings' : |
|
63 | + $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
64 | 64 | |
65 | - $user_can_via_settings = false; |
|
66 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | - foreach ( $roles as $role ) { |
|
68 | - if ( is_string( $role ) ) { |
|
69 | - if ( user_can( $user_id, $role ) ) { |
|
70 | - $user_can_via_settings = true; |
|
71 | - break; |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | - if ( user_can( $user_id, $roles ) ) { |
|
77 | - $user_can_via_settings = true; |
|
78 | - } |
|
79 | - } |
|
65 | + $user_can_via_settings = false; |
|
66 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | + foreach ( $roles as $role ) { |
|
68 | + if ( is_string( $role ) ) { |
|
69 | + if ( user_can( $user_id, $role ) ) { |
|
70 | + $user_can_via_settings = true; |
|
71 | + break; |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | + if ( user_can( $user_id, $roles ) ) { |
|
77 | + $user_can_via_settings = true; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | - $caps = array(); |
|
83 | - } |
|
81 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | + $caps = array(); |
|
83 | + } |
|
84 | 84 | |
85 | - break; |
|
85 | + break; |
|
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | - switch( $cap ) { |
|
37 | + switch ( $cap ) { |
|
38 | 38 | case 'monsterinsights_view_dashboard' : |
39 | 39 | $roles = monsterinsights_get_option( 'view_reports', array() ); |
40 | 40 | |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
89 | -add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 ); |
|
90 | 89 | \ No newline at end of file |
90 | +add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 ); |
|
91 | 91 | \ No newline at end of file |
@@ -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 |
@@ -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 ); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | <span class="am-deactivate-survey-desc"> |
320 | 320 | <?php |
321 | 321 | // Translators: Placeholder for the plugin name. |
322 | - echo sprintf( esc_html__('If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); |
|
322 | + echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); |
|
323 | 323 | ?> |
324 | 324 | </span> |
325 | 325 | <div class="am-deactivate-survey-options"> |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | <button type="submit" class="am-deactivate-survey-submit button button-primary button-large"> |
340 | 340 | <?php |
341 | 341 | // Translators: Adds an ampersand. |
342 | - echo sprintf( esc_html__('Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); |
|
342 | + echo sprintf( esc_html__( 'Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); |
|
343 | 343 | ?> |
344 | 344 | </button> |
345 | 345 | <a href="#" class="am-deactivate-survey-deactivate"> |
346 | 346 | <?php |
347 | 347 | // Translators: Adds an ampersand. |
348 | - echo sprintf( esc_html__('Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); |
|
348 | + echo sprintf( esc_html__( 'Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); |
|
349 | 349 | ?> |
350 | 350 | </a> |
351 | 351 | </div> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | foreach ( $addresses as $key => $address ) { |
195 | 195 | if ( ! is_email( $address ) ) { |
196 | - unset( $addresses[ $key ] ); |
|
196 | + unset( $addresses[$key] ); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | - if ( ! isset( $this->args[ $type ] ) || ! is_array( $this->args[ $type ] ) ) { |
|
298 | - $this->args[ $type ] = array(); |
|
297 | + if ( ! isset( $this->args[$type] ) || ! is_array( $this->args[$type] ) ) { |
|
298 | + $this->args[$type] = array(); |
|
299 | 299 | } |
300 | 300 | |
301 | - $this->args[ $type ] = $merge ? array_merge( $this->args[ $type ], $value ) : $value; |
|
301 | + $this->args[$type] = $merge ? array_merge( $this->args[$type], $value ) : $value; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return $this; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function get_args( $type ) { |
317 | 317 | if ( ! empty( $type ) ) { |
318 | - return isset( $this->args[ $type ] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[ $type ], $this ) : array(); |
|
318 | + return isset( $this->args[$type] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[$type], $this ) : array(); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | return apply_filters( 'monsterinsights_emails_templates_get_args', $this->args, $this ); |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - public function build_email( $message=null ) { |
|
333 | + public function build_email( $message = null ) { |
|
334 | 334 | // process plain text email |
335 | 335 | if ( false === $this->html ) { |
336 | - $body = $this->get_template_part( 'body', $this->get_template(), true ); |
|
337 | - $body = wp_strip_all_tags( $body ); |
|
338 | - $message = str_replace( '{email}', $message, $body ); |
|
336 | + $body = $this->get_template_part( 'body', $this->get_template(), true ); |
|
337 | + $body = wp_strip_all_tags( $body ); |
|
338 | + $message = str_replace( '{email}', $message, $body ); |
|
339 | 339 | |
340 | 340 | return apply_filters( 'monsterinsights_email_message', $message, $this ); |
341 | 341 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | do_action( 'monsterinsights_email_footer', $email_parts['footer'] ); |
359 | 359 | |
360 | 360 | |
361 | - $body = implode( $email_parts ); |
|
361 | + $body = implode( $email_parts ); |
|
362 | 362 | $message = $this->process_tag( $message, false ); |
363 | 363 | $message = nl2br( $message ); |
364 | 364 | $message = str_replace( '{email}', $message, $body ); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return bool |
381 | 381 | */ |
382 | - public function send( $to, $subject, $message=null, $attachments = array() ) { |
|
382 | + public function send( $to, $subject, $message = null, $attachments = array() ) { |
|
383 | 383 | |
384 | 384 | if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
385 | 385 | _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send emails with MI_WP_Emails() until init/admin_init has been reached.', 'google-analytics-for-wordpress' ), null ); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $this->template = 'default'; |
511 | 511 | } |
512 | 512 | |
513 | - return apply_filters( 'monsterinsights_email_template', $this->template); |
|
513 | + return apply_filters( 'monsterinsights_email_template', $this->template ); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -303,7 +303,7 @@ |
||
303 | 303 | // 3. License key not valid/okay for pro |
304 | 304 | if ( monsterinsights_is_pro_version() ) { |
305 | 305 | $message = ''; |
306 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
306 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
307 | 307 | if ( MonsterInsights()->license->site_license_expired() ) { |
308 | 308 | // Translators: Adds a link to the license renewal. |
309 | 309 | $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>' ); |
@@ -27,22 +27,22 @@ discard block |
||
27 | 27 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
28 | 28 | |
29 | 29 | if ( $hook === 'monsterinsights_settings' ) { |
30 | - // If dashboards disabled, first settings page |
|
31 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | - $hook = 'monsterinsights_settings'; |
|
30 | + // If dashboards disabled, first settings page |
|
31 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | + $hook = 'monsterinsights_settings'; |
|
33 | 33 | |
34 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
34 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
35 | 35 | } else { |
36 | - // if dashboards enabled, first dashboard |
|
37 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
36 | + // if dashboards enabled, first dashboard |
|
37 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | 38 | |
39 | - add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
39 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
40 | 40 | |
41 | - // then settings page |
|
42 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
41 | + // then settings page |
|
42 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
43 | 43 | |
44 | - // Add dashboard submenu. |
|
45 | - add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' ); |
|
44 | + // Add dashboard submenu. |
|
45 | + add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $submenu_base = add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | add_submenu_page( $hook, __( 'Popular Posts:', 'google-analytics-for-wordpress' ), __( 'Popular Posts', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/popular-posts' ); |
52 | 52 | |
53 | 53 | if ( function_exists( 'aioseo' ) ) { |
54 | - $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
54 | + $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
55 | 55 | } else { |
56 | - $seo_url = $submenu_base . '#/seo'; |
|
56 | + $seo_url = $submenu_base . '#/seo'; |
|
57 | 57 | } |
58 | 58 | // then SEO |
59 | 59 | add_submenu_page( $hook, __( 'SEO', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // then addons |
65 | 65 | $network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : ''; |
66 | 66 | if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
67 | - add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
67 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Add About us page. |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | function monsterinsights_get_menu_hook() { |
98 | 98 | $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
99 | 99 | if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
100 | - return 'monsterinsights_settings'; |
|
100 | + return 'monsterinsights_settings'; |
|
101 | 101 | } else { |
102 | - return 'monsterinsights_reports'; |
|
102 | + return 'monsterinsights_reports'; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
111 | 111 | // menu page and the updater on the network panel |
112 | 112 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
113 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
113 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
117 | 117 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
118 | - return; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
129 | 129 | |
130 | 130 | if ( function_exists( 'aioseo' ) ) { |
131 | - $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
131 | + $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
132 | 132 | } else { |
133 | - $seo_url = $submenu_base . '#/seo'; |
|
133 | + $seo_url = $submenu_base . '#/seo'; |
|
134 | 134 | } |
135 | 135 | // then seo |
136 | 136 | add_submenu_page( $hook, __( 'SEO:', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url, 'monsterinsights_seo_page' ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | function monsterinsights_add_admin_body_class( $classes ) { |
155 | 155 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
156 | 156 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
157 | - return $classes; |
|
157 | + return $classes; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return "$classes monsterinsights_page "; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
172 | 172 | |
173 | 173 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
174 | - return $classes; |
|
174 | + return $classes; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return "$classes insights_page_monsterinsights_tools "; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
188 | 188 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
189 | 189 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
190 | - return $classes; |
|
190 | + return $classes; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return "$classes insights_page_monsterinsights_addons "; |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | |
208 | 208 | // If Lite, support goes to forum. If pro, it goes to our website |
209 | 209 | if ( monsterinsights_is_pro_version() ) { |
210 | - $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>'; |
|
211 | - array_unshift( $links, $support ); |
|
210 | + $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>'; |
|
211 | + array_unshift( $links, $support ); |
|
212 | 212 | } else { |
213 | - $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>'; |
|
214 | - array_unshift( $links, $support ); |
|
213 | + $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>'; |
|
214 | + array_unshift( $links, $support ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if ( is_network_admin() ) { |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
247 | 247 | |
248 | 248 | if ( monsterinsights_is_pro_version() ) { |
249 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
249 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
250 | 250 | |
251 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
252 | - require_once( $dir . $template . '.php' ); |
|
253 | - return true; |
|
254 | - } |
|
251 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
252 | + require_once( $dir . $template . '.php' ); |
|
253 | + return true; |
|
254 | + } |
|
255 | 255 | } else { |
256 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
256 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
257 | 257 | |
258 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
259 | - require_once( $dir . $template . '.php' ); |
|
260 | - return true; |
|
261 | - } |
|
258 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
259 | + require_once( $dir . $template . '.php' ); |
|
260 | + return true; |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
265 | 265 | |
266 | 266 | if ( file_exists( $dir . $template . '.php' ) ) { |
267 | - require_once( $dir . $template . '.php' ); |
|
268 | - return true; |
|
267 | + require_once( $dir . $template . '.php' ); |
|
268 | + return true; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return false; |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | function monsterinsights_admin_footer( $text ) { |
283 | 283 | global $current_screen; |
284 | 284 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
285 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
286 | - // Translators: Placeholders add a link to the wordpress.org repository. |
|
287 | - $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$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>' ); |
|
285 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
286 | + // Translators: Placeholders add a link to the wordpress.org repository. |
|
287 | + $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$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>' ); |
|
288 | 288 | } |
289 | 289 | return $text; |
290 | 290 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | // Don't show on MonsterInsights pages |
296 | 296 | $screen = get_current_screen(); |
297 | 297 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
298 | - return; |
|
298 | + return; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | // Make sure they have the permissions to do something |
302 | 302 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
303 | - return; |
|
303 | + return; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | // Priority: |
@@ -318,89 +318,89 @@ discard block |
||
318 | 318 | // 1. Google Analytics not authenticated |
319 | 319 | if ( ! is_network_admin() && ! monsterinsights_get_ua() && ! defined( 'MONSTERINSIGHTS_DISABLE_TRACKING' ) ) { |
320 | 320 | |
321 | - $submenu_base = is_network_admin() ? add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
322 | - $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
323 | - $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
324 | - $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
325 | - $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
326 | - $urltwo = $submenu_base . '#/about/getting-started'; |
|
327 | - $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
328 | - echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
329 | - return; |
|
321 | + $submenu_base = is_network_admin() ? add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
322 | + $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
323 | + $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
324 | + $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
325 | + $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
326 | + $urltwo = $submenu_base . '#/about/getting-started'; |
|
327 | + $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
328 | + echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
329 | + return; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // 2. License key not entered for pro |
333 | 333 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
334 | 334 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
335 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
336 | - // Translators: Adds a link to retrieve the license. |
|
337 | - $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>' ); |
|
338 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
339 | - return; |
|
335 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
336 | + // Translators: Adds a link to retrieve the license. |
|
337 | + $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>' ); |
|
338 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
339 | + return; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // 3. License key not valid/okay for pro |
343 | 343 | if ( monsterinsights_is_pro_version() ) { |
344 | - $message = ''; |
|
345 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
346 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
347 | - // Translators: Adds a link to the license renewal. |
|
348 | - $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>' ); |
|
349 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
350 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
351 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
352 | - $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' ); |
|
353 | - } |
|
354 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
355 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
356 | - // Translators: Adds a link to renew license. |
|
357 | - $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>' ); |
|
358 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
359 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
360 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
361 | - $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' ); |
|
362 | - } |
|
363 | - } |
|
364 | - if ( ! empty( $message ) ) { |
|
365 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
366 | - return; |
|
367 | - } |
|
344 | + $message = ''; |
|
345 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
346 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
347 | + // Translators: Adds a link to the license renewal. |
|
348 | + $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>' ); |
|
349 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
350 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
351 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
352 | + $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' ); |
|
353 | + } |
|
354 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
355 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
356 | + // Translators: Adds a link to renew license. |
|
357 | + $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>' ); |
|
358 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
359 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
360 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
361 | + $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' ); |
|
362 | + } |
|
363 | + } |
|
364 | + if ( ! empty( $message ) ) { |
|
365 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
366 | + return; |
|
367 | + } |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | // 4. Notices for PHP/WP version deprecations |
371 | 371 | if ( current_user_can( 'update_core' ) ) { |
372 | - global $wp_version; |
|
373 | - |
|
374 | - // PHP 5.2-5.5 |
|
375 | - if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
376 | - $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
377 | - // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
|
378 | - $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 stopped 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>' ); |
|
379 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
380 | - return; |
|
381 | - } |
|
382 | - // WordPress 3.0 - 4.5 |
|
383 | - else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
384 | - $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
385 | - // Translators: Placeholders add the current WordPress version and links to the MonsterInsights blog |
|
386 | - $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.9 in 2020.%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>' ); |
|
387 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
388 | - return; |
|
389 | - } |
|
390 | - // PHP 5.4/5.5 |
|
391 | - // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
392 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
393 | - // $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>' ); |
|
394 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
395 | - // return; |
|
396 | - // } |
|
397 | - // // WordPress 4.6 - 4.8 |
|
398 | - // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
399 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
400 | - // $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.9 in October, 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>' ); |
|
401 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
402 | - // return; |
|
403 | - // } |
|
372 | + global $wp_version; |
|
373 | + |
|
374 | + // PHP 5.2-5.5 |
|
375 | + if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
376 | + $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
377 | + // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
|
378 | + $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 stopped 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>' ); |
|
379 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
380 | + return; |
|
381 | + } |
|
382 | + // WordPress 3.0 - 4.5 |
|
383 | + else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
384 | + $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
385 | + // Translators: Placeholders add the current WordPress version and links to the MonsterInsights blog |
|
386 | + $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.9 in 2020.%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>' ); |
|
387 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
388 | + return; |
|
389 | + } |
|
390 | + // PHP 5.4/5.5 |
|
391 | + // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
392 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
393 | + // $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>' ); |
|
394 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
395 | + // return; |
|
396 | + // } |
|
397 | + // // WordPress 4.6 - 4.8 |
|
398 | + // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
399 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
400 | + // $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.9 in October, 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>' ); |
|
401 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
402 | + // return; |
|
403 | + // } |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // 5. Optin setting not configured |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | $notices = get_option( 'monsterinsights_notices' ); |
432 | 432 | if ( ! is_array( $notices ) ) { |
433 | - $notices = array(); |
|
433 | + $notices = array(); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | // 6. Authenticate, not manual |
@@ -474,75 +474,75 @@ discard block |
||
474 | 474 | |
475 | 475 | // 8. WooUpsell |
476 | 476 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
477 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
478 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
479 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
480 | - echo '<p><strong>'; |
|
481 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
482 | - echo '</strong></p>'; |
|
483 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
484 | - echo '<p>'; |
|
485 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
486 | - echo '</p>'; |
|
487 | - echo '<p>'; |
|
488 | - 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' ); |
|
489 | - echo '</p>'; |
|
490 | - echo '<p>'; |
|
491 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
492 | - echo '</p>'; |
|
493 | - echo '<p>'; |
|
494 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
495 | - echo '</p>'; |
|
496 | - // Translators: Placeholders add a link to the MonsterInsights website. |
|
497 | - 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>' ); |
|
498 | - echo '</p>'; |
|
499 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
500 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
501 | - echo '</div>'; |
|
502 | - echo '</div>'; |
|
503 | - echo '<style type="text/css">.monsterinsights-wooedd-upsell-left{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-right{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-image{width:100%;height:auto;padding:20px}.monsterinsights-wooedd-upsell-image-small{display:none}.monsterinsights-wooedd-upsell-row{display:table}.monsterinsights-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width:900px){.monsterinsights-wooedd-upsell-left{width:100%}.monsterinsights-wooedd-upsell-right{display:none}.monsterinsights-wooedd-upsell-image-small{display:block}.monsterinsights-wooedd-upsell-image-large{display:none}}</style>'; |
|
504 | - return; |
|
505 | - } |
|
477 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
478 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
479 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
480 | + echo '<p><strong>'; |
|
481 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
482 | + echo '</strong></p>'; |
|
483 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
484 | + echo '<p>'; |
|
485 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
486 | + echo '</p>'; |
|
487 | + echo '<p>'; |
|
488 | + 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' ); |
|
489 | + echo '</p>'; |
|
490 | + echo '<p>'; |
|
491 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
492 | + echo '</p>'; |
|
493 | + echo '<p>'; |
|
494 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
495 | + echo '</p>'; |
|
496 | + // Translators: Placeholders add a link to the MonsterInsights website. |
|
497 | + 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>' ); |
|
498 | + echo '</p>'; |
|
499 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
500 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
501 | + echo '</div>'; |
|
502 | + echo '</div>'; |
|
503 | + echo '<style type="text/css">.monsterinsights-wooedd-upsell-left{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-right{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-image{width:100%;height:auto;padding:20px}.monsterinsights-wooedd-upsell-image-small{display:none}.monsterinsights-wooedd-upsell-row{display:table}.monsterinsights-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width:900px){.monsterinsights-wooedd-upsell-left{width:100%}.monsterinsights-wooedd-upsell-right{display:none}.monsterinsights-wooedd-upsell-image-small{display:block}.monsterinsights-wooedd-upsell-image-large{display:none}}</style>'; |
|
504 | + return; |
|
505 | + } |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | // 9. EDDUpsell |
509 | 509 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
510 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
511 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
512 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
513 | - echo '<p><strong>'; |
|
514 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
515 | - echo '</strong></p>'; |
|
516 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
517 | - echo '<p>'; |
|
518 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
519 | - echo '</p>'; |
|
520 | - echo '<p>'; |
|
521 | - 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' ); |
|
522 | - echo '</p>'; |
|
523 | - echo '<p>'; |
|
524 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
525 | - echo '</p>'; |
|
526 | - echo '<p>'; |
|
527 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
528 | - echo '</p>'; |
|
529 | - 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>' ); |
|
530 | - echo '</p>'; |
|
531 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
532 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
533 | - echo '</div>'; |
|
534 | - echo '</div>'; |
|
535 | - return; |
|
536 | - } |
|
510 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
511 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
512 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
513 | + echo '<p><strong>'; |
|
514 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
515 | + echo '</strong></p>'; |
|
516 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
517 | + echo '<p>'; |
|
518 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
519 | + echo '</p>'; |
|
520 | + echo '<p>'; |
|
521 | + 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' ); |
|
522 | + echo '</p>'; |
|
523 | + echo '<p>'; |
|
524 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
525 | + echo '</p>'; |
|
526 | + echo '<p>'; |
|
527 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
528 | + echo '</p>'; |
|
529 | + 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>' ); |
|
530 | + echo '</p>'; |
|
531 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
532 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
533 | + echo '</div>'; |
|
534 | + echo '</div>'; |
|
535 | + return; |
|
536 | + } |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
540 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
541 | - $page = $page . '#/advanced'; |
|
542 | - // Translators: Adds a link to the settings panel. |
|
543 | - $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
544 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
545 | - return; |
|
540 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
541 | + $page = $page . '#/advanced'; |
|
542 | + // Translators: Adds a link to the settings panel. |
|
543 | + $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
544 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
545 | + return; |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // AM Notices |
553 | 553 | function monsterinsights_am_notice_optout( $super_admin ) { |
554 | 554 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
555 | - return false; |
|
555 | + return false; |
|
556 | 556 | } |
557 | 557 | return $super_admin; |
558 | 558 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | if ( $hook === 'monsterinsights_settings' ) { |
30 | 30 | // If dashboards disabled, first settings page |
31 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
31 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | 32 | $hook = 'monsterinsights_settings'; |
33 | 33 | |
34 | 34 | add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
35 | 35 | } else { |
36 | 36 | // if dashboards enabled, first dashboard |
37 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
37 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | 38 | |
39 | 39 | add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
40 | 40 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
122 | 122 | $hook = 'monsterinsights_network'; |
123 | 123 | $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
124 | - add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
124 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
125 | 125 | |
126 | 126 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
127 | 127 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function monsterinsights_add_admin_body_class_tools_page( $classes ) { |
171 | 171 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
172 | 172 | |
173 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
173 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
174 | 174 | return $classes; |
175 | 175 | } |
176 | 176 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
188 | 188 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
189 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
189 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
190 | 190 | return $classes; |
191 | 191 | } |
192 | 192 | |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | * @return array $links |
203 | 203 | */ |
204 | 204 | function monsterinsights_add_action_links( $links ) { |
205 | - $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>'; |
|
205 | + $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>'; |
|
206 | 206 | array_unshift( $links, $docs ); |
207 | 207 | |
208 | 208 | // If Lite, support goes to forum. If pro, it goes to our website |
209 | 209 | if ( monsterinsights_is_pro_version() ) { |
210 | - $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>'; |
|
210 | + $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>'; |
|
211 | 211 | array_unshift( $links, $support ); |
212 | 212 | } else { |
213 | - $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>'; |
|
213 | + $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>'; |
|
214 | 214 | array_unshift( $links, $support ); |
215 | 215 | } |
216 | 216 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | // If lite, show a link where they can get pro from |
226 | 226 | if ( ! monsterinsights_is_pro_version() ) { |
227 | - $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/lite/" ) .'" style="font-weight:700">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
227 | + $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/lite/" ) . '" style="font-weight:700">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
228 | 228 | array_unshift( $links, $get_pro ); |
229 | 229 | } |
230 | 230 | |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
250 | 250 | |
251 | 251 | if ( file_exists( $dir . $template . '.php' ) ) { |
252 | - require_once( $dir . $template . '.php' ); |
|
252 | + require_once( $dir . $template . '.php' ); |
|
253 | 253 | return true; |
254 | 254 | } |
255 | 255 | } else { |
256 | 256 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
257 | 257 | |
258 | 258 | if ( file_exists( $dir . $template . '.php' ) ) { |
259 | - require_once( $dir . $template . '.php' ); |
|
259 | + require_once( $dir . $template . '.php' ); |
|
260 | 260 | return true; |
261 | 261 | } |
262 | 262 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
265 | 265 | |
266 | 266 | if ( file_exists( $dir . $template . '.php' ) ) { |
267 | - require_once( $dir . $template . '.php' ); |
|
267 | + require_once( $dir . $template . '.php' ); |
|
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
285 | 285 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
286 | 286 | // Translators: Placeholders add a link to the wordpress.org repository. |
287 | - $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$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>' ); |
|
287 | + $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$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>' ); |
|
288 | 288 | } |
289 | 289 | return $text; |
290 | 290 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
326 | 326 | $urltwo = $submenu_base . '#/about/getting-started'; |
327 | 327 | $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
328 | - echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
328 | + echo '<div class="notice notice-info"><p style="font-weight:700">' . $title . '</p><p>' . $message . '</p><p><a href="' . $urlone . '" class="button-primary">' . $primary . '</a> <a href="' . $urltwo . '" class="button-secondary">' . $secondary . '</a></p></div>'; |
|
329 | 329 | return; |
330 | 330 | } |
331 | 331 | |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
335 | 335 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
336 | 336 | // Translators: Adds a link to retrieve the license. |
337 | - $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>' ); |
|
338 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
337 | + $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>' ); |
|
338 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
339 | 339 | return; |
340 | 340 | } |
341 | 341 | |
342 | 342 | // 3. License key not valid/okay for pro |
343 | 343 | if ( monsterinsights_is_pro_version() ) { |
344 | 344 | $message = ''; |
345 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
345 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
346 | 346 | if ( MonsterInsights()->license->site_license_expired() ) { |
347 | 347 | // Translators: Adds a link to the license renewal. |
348 | - $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>' ); |
|
348 | + $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>' ); |
|
349 | 349 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
350 | 350 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
351 | 351 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
355 | 355 | if ( MonsterInsights()->license->network_license_expired() ) { |
356 | 356 | // Translators: Adds a link to renew license. |
357 | - $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>' ); |
|
357 | + $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>' ); |
|
358 | 358 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
359 | 359 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
360 | 360 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | } |
363 | 363 | } |
364 | 364 | if ( ! empty( $message ) ) { |
365 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
365 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
366 | 366 | return; |
367 | 367 | } |
368 | 368 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
377 | 377 | // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
378 | 378 | $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 stopped 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>' ); |
379 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
379 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
380 | 380 | return; |
381 | 381 | } |
382 | 382 | // WordPress 3.0 - 4.5 |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
385 | 385 | // Translators: Placeholders add the current WordPress version and links to the MonsterInsights blog |
386 | 386 | $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.9 in 2020.%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>' ); |
387 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
387 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | // PHP 5.4/5.5 |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | // } |
429 | 429 | // } |
430 | 430 | |
431 | - $notices = get_option( 'monsterinsights_notices' ); |
|
431 | + $notices = get_option( 'monsterinsights_notices' ); |
|
432 | 432 | if ( ! is_array( $notices ) ) { |
433 | 433 | $notices = array(); |
434 | 434 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | |
475 | 475 | // 8. WooUpsell |
476 | 476 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
477 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
477 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
478 | 478 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
479 | 479 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
480 | 480 | echo '<p><strong>'; |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
495 | 495 | echo '</p>'; |
496 | 496 | // Translators: Placeholders add a link to the MonsterInsights website. |
497 | - 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>' ); |
|
497 | + 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>' ); |
|
498 | 498 | echo '</p>'; |
499 | 499 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
500 | 500 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | // 9. EDDUpsell |
509 | 509 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
510 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
510 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
511 | 511 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
512 | 512 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
513 | 513 | echo '<p><strong>'; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | echo '<p>'; |
527 | 527 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
528 | 528 | echo '</p>'; |
529 | - 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>' ); |
|
529 | + 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>' ); |
|
530 | 530 | echo '</p>'; |
531 | 531 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
532 | 532 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
541 | 541 | $page = $page . '#/advanced'; |
542 | 542 | // Translators: Adds a link to the settings panel. |
543 | - $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
544 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
543 | + $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' ); |
|
544 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | } |
@@ -97,7 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | $options = apply_filters( 'upgrader_package_options', $options ); |
99 | 99 | |
100 | - if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times |
|
100 | + if ( ! $options['is_multi'] ) { |
|
101 | +// call $this->header separately if running multiple times |
|
101 | 102 | $this->skin->header(); |
102 | 103 | } |
103 | 104 | |
@@ -288,7 +289,8 @@ discard block |
||
288 | 289 | return $reply; |
289 | 290 | } |
290 | 291 | |
291 | - if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote? |
|
292 | + if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { |
|
293 | +//Local file or remote? |
|
292 | 294 | return $package; //must be a local file.. |
293 | 295 | } |
294 | 296 | |
@@ -443,11 +445,13 @@ discard block |
||
443 | 445 | $remote_destination = $wp_filesystem->find_folder( $local_destination ); |
444 | 446 | |
445 | 447 | //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. |
446 | - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents. |
|
448 | + if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { |
|
449 | +//Only one folder? Then we want its contents. |
|
447 | 450 | $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); |
448 | 451 | } elseif ( count( $source_files ) == 0 ) { |
449 | 452 | return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? |
450 | - } else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
453 | + } else { |
|
454 | +// It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
451 | 455 | $source = trailingslashit( $args['source'] ); |
452 | 456 | } |
453 | 457 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if ( ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
125 | 125 | $message = empty( $message ) ? '' : ' ' . $message; |
126 | 126 | // Translators: Placeholders add the hook name, plugin version and bold text. |
127 | - trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html ( $message ) ); |
|
127 | + trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html( $message ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if ( ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
180 | 180 | // Translators: Placeholders add the hook name, plugin version and bold text. |
181 | 181 | trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s.', 'google-analytics-for-wordpress' ), $function, $version, '<strong>', '</strong>' ) ); |
182 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
182 | + trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
183 | 183 | // Alternatively we could dump this to a file. |
184 | 184 | } |
185 | 185 | } |
@@ -87,7 +87,8 @@ |
||
87 | 87 | delete_transient( '_monsterinsights_activation_redirect' ); |
88 | 88 | |
89 | 89 | // Bail if activating from network, or bulk. |
90 | - if ( isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok. |
|
90 | + if ( isset( $_GET['activate-multi'] ) ) { |
|
91 | +// WPCS: CSRF ok, input var ok. |
|
91 | 92 | return; |
92 | 93 | } |
93 | 94 |
@@ -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 | // Translators: Placeholder gets replaced with the error message. |
192 | 192 | 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() ) ); |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | if ( 'GET' == $this->method ) { |
247 | - $body['time'] = time(); // just to avoid caching |
|
247 | + $body['time'] = time(); // just to avoid caching |
|
248 | 248 | } |
249 | 249 | |
250 | - $body['timezone'] = date('e'); |
|
250 | + $body['timezone'] = date( 'e' ); |
|
251 | 251 | |
252 | 252 | $body['network'] = $this->network ? 'network' : 'site'; |
253 | 253 | |
254 | - $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
254 | + $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
255 | 255 | |
256 | 256 | // This filter will be removed in the future. |
257 | 257 | $body = apply_filters( 'monsterinsights_api_request_body', $body ); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | |
284 | 284 | // Perform the query and retrieve the response. |
285 | - $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
285 | + $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
286 | 286 | |
287 | 287 | //return new WP_Error( 'debug', '<pre>' . var_export( $response, true ) . '</pre>' ); |
288 | 288 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | // If not a 200 status header, send back error. |
303 | 303 | if ( 200 != $response_code ) { |
304 | - $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
304 | + $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
305 | 305 | |
306 | 306 | if ( empty( $response_code ) ) { |
307 | 307 | return new WP_Error( $type, __( 'The API was unreachable.', 'google-analytics-for-wordpress' ) ); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | // and for image linking purposes in Google Images. We use it to test outbound connections since it is run on google.com |
393 | 393 | // 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 |
394 | 394 | // use case of quickly testing outbound connections. |
395 | - $testurl = ! empty( $this->testurl ) ? $this->testurl :'https://www.google.com/blank.html'; |
|
395 | + $testurl = ! empty( $this->testurl ) ? $this->testurl : 'https://www.google.com/blank.html'; |
|
396 | 396 | if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { |
397 | 397 | if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { |
398 | 398 | $wp_http = new WP_Http(); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | 'body' => '' |
408 | 408 | ); |
409 | 409 | $response = wp_remote_get( $testurl, $params ); |
410 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
410 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
411 | 411 | return false; |
412 | 412 | } else { |
413 | 413 | if ( is_wp_error( $response ) ) { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | ); |
430 | 430 | $response = wp_remote_get( $testurl, $params ); |
431 | 431 | |
432 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
432 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
433 | 433 | return false; |
434 | 434 | } else { |
435 | 435 | if ( is_wp_error( $response ) ) { |