@@ -30,7 +30,7 @@ |
||
30 | 30 | do_action( 'monsterinsights_tracking_after_analytics' ); |
31 | 31 | do_action( 'monsterinsights_tracking_after', 'analytics' ); |
32 | 32 | |
33 | - $track_user = monsterinsights_track_user(); |
|
33 | + $track_user = monsterinsights_track_user(); |
|
34 | 34 | |
35 | 35 | if ( $track_user ) { |
36 | 36 | require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return array Array of the options to use. |
63 | 63 | */ |
64 | 64 | function monsterinsights_events_tracking( ) { |
65 | - $track_user = monsterinsights_track_user(); |
|
65 | + $track_user = monsterinsights_track_user(); |
|
66 | 66 | |
67 | 67 | if ( $track_user ) { |
68 | 68 | require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function monsterinsights_rss_link_tagger( $guid ) { |
87 | 87 | global $post; |
88 | 88 | |
89 | - if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
|
89 | + if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ) { |
|
90 | 90 | if ( is_feed() ) { |
91 | 91 | if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
92 | 92 | $delimiter = '#'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * not be used by other developers. This hook's behavior may be modified |
39 | 39 | * or the hook may be removed at any time, without warning. |
40 | 40 | */ |
41 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
41 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
42 | 42 | return $reports; |
43 | 43 | } |
44 | 44 | |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | */ |
61 | 61 | do_action( 'monsterinsights_head' ); |
62 | 62 | echo monsterinsights_ublock_notice(); |
63 | - monsterinsights_settings_error_page( 'monsterinsights-reports'); |
|
63 | + monsterinsights_settings_error_page( 'monsterinsights-reports' ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | function monsterinsights_refresh_reports_data() { |
67 | 67 | check_ajax_referer( 'mi-admin-nonce', 'security' ); |
68 | 68 | |
69 | 69 | // Get variables |
70 | - $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
71 | - $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
72 | - $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
73 | - $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
70 | + $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
71 | + $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
72 | + $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
73 | + $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
74 | 74 | |
75 | 75 | |
76 | 76 | // Current user can authenticate |
77 | 77 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
78 | - wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
78 | + wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // Only for Pro users, require a license key to be entered first so we can link to things. |
86 | - if ( monsterinsights_is_pro_version() ) { |
|
86 | + if ( monsterinsights_is_pro_version() ) { |
|
87 | 87 | if ( ! MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->is_network_licensed() ) { |
88 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
88 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
89 | 89 | } else if ( MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->site_license_has_error() ) { |
90 | 90 | // good to go: site licensed |
91 | 91 | } else if ( MonsterInsights()->license->is_network_licensed() && ! MonsterInsights()->license->network_license_has_error() ) { |
92 | 92 | // good to go: network licensed |
93 | 93 | } else { |
94 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
94 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | $site_auth = MonsterInsights()->auth->get_viewname(); |
100 | 100 | $ms_auth = is_multisite() && MonsterInsights()->auth->get_network_viewname(); |
101 | 101 | if ( ! $site_auth && ! $ms_auth ) { |
102 | - wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
102 | + wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if ( empty( $name ) ) { |
106 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
106 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | $report = MonsterInsights()->reporting->get_report( $name ); |
110 | 110 | |
111 | 111 | if ( empty( $report ) ) { |
112 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
112 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
113 | 113 | } |
114 | 114 | |
115 | - $args = array( 'start' => $start, 'end' => $end ); |
|
115 | + $args = array( 'start' => $start, 'end' => $end ); |
|
116 | 116 | if ( $isnetwork ) { |
117 | 117 | $args['network'] = true; |
118 | 118 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'success' => true |
127 | 127 | ) |
128 | 128 | ); |
129 | - wp_send_json_success( array( 'html' => $data ) ); |
|
129 | + wp_send_json_success( array( 'html' => $data ) ); |
|
130 | 130 | } else { |
131 | 131 | wp_send_json_error( array( 'message' => $data['error'], 'data' => $data['data'] ) ); |
132 | 132 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $site_license = array( |
|
43 | + $site_license = array( |
|
44 | 44 | 'key' => MonsterInsights()->license->get_site_license_key(), |
45 | 45 | 'type' => MonsterInsights()->license->get_site_license_type(), |
46 | 46 | 'is_disabled' => MonsterInsights()->license->site_license_disabled(), |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | // Array fields are needed even if empty. |
101 | 101 | $array_fields = array( 'view_reports', 'save_settings', 'ignore_users' ); |
102 | 102 | foreach ( $array_fields as $array_field ) { |
103 | - if ( ! isset( $options[ $array_field ] ) ) { |
|
104 | - $options[ $array_field ] = array(); |
|
103 | + if ( ! isset( $options[$array_field] ) ) { |
|
104 | + $options[$array_field] = array(); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | if ( isset( $options['custom_code'] ) ) { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | if ( $empty ) { |
178 | - unset( $value[ $key ] ); |
|
178 | + unset( $value[$key] ); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } else { |
226 | 226 | $addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug ); |
227 | 227 | } |
228 | - $parsed_addons[ $addon->slug ] = $addon; |
|
228 | + $parsed_addons[$addon->slug] = $addon; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $installed = false; |
311 | 311 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
312 | 312 | |
313 | - if ( isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
313 | + if ( isset( $installed_plugins[$plugin_basename] ) ) { |
|
314 | 314 | $installed = true; |
315 | 315 | $ms_active = is_plugin_active_for_network( $plugin_basename ); |
316 | 316 | $ss_active = is_plugin_active( $plugin_basename ); |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | ); |
456 | 456 | |
457 | 457 | foreach ( $exclude as $e ) { |
458 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
459 | - unset( $new_settings[ $e ] ); |
|
458 | + if ( ! empty( $new_settings[$e] ) ) { |
|
459 | + unset( $new_settings[$e] ); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | } |
468 | 468 | |
469 | 469 | foreach ( $exclude as $e ) { |
470 | - if ( ! empty( $settings[ $e ] ) ) { |
|
471 | - $new_settings = $settings[ $e ]; |
|
470 | + if ( ! empty( $settings[$e] ) ) { |
|
471 | + $new_settings = $settings[$e]; |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | ), |
617 | 617 | admin_url( 'admin.php' ) |
618 | 618 | ); |
619 | - $url = esc_url( $url ); |
|
619 | + $url = esc_url( $url ); |
|
620 | 620 | |
621 | 621 | ob_start(); |
622 | 622 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
@@ -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 |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
37 | 37 | // If dashboards disabled, first settings page |
38 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | 39 | $hook = 'monsterinsights_settings'; |
40 | 40 | |
41 | 41 | add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
42 | 42 | } else { |
43 | 43 | // if dashboards enabled, first dashboard |
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
45 | 45 | |
46 | 46 | $hook = 'monsterinsights_reports'; |
47 | 47 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
91 | 91 | $hook = 'monsterinsights_network'; |
92 | 92 | $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
93 | - add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
93 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
94 | 94 | |
95 | 95 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
96 | 96 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | function monsterinsights_add_admin_body_class_tools_page( $classes ) { |
127 | 127 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
128 | 128 | |
129 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
129 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
130 | 130 | return $classes; |
131 | 131 | } |
132 | 132 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
144 | 144 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
145 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
145 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
146 | 146 | return $classes; |
147 | 147 | } |
148 | 148 | |
@@ -158,21 +158,21 @@ discard block |
||
158 | 158 | * @return array $links |
159 | 159 | */ |
160 | 160 | function monsterinsights_add_action_links( $links ) { |
161 | - $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>'; |
|
161 | + $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>'; |
|
162 | 162 | array_unshift( $links, $docs ); |
163 | 163 | |
164 | 164 | // If lite, show a link where they can get pro from |
165 | 165 | if ( ! monsterinsights_is_pro_version() ) { |
166 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
166 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) . '">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
167 | 167 | array_unshift( $links, $get_pro ); |
168 | 168 | } |
169 | 169 | |
170 | 170 | // If Lite, support goes to forum. If pro, it goes to our website |
171 | 171 | if ( monsterinsights_is_pro_version() ) { |
172 | - $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>'; |
|
172 | + $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>'; |
|
173 | 173 | array_unshift( $links, $support ); |
174 | 174 | } else { |
175 | - $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>'; |
|
175 | + $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>'; |
|
176 | 176 | array_unshift( $links, $support ); |
177 | 177 | } |
178 | 178 | |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
202 | 202 | |
203 | 203 | if ( file_exists( $dir . $template . '.php' ) ) { |
204 | - require_once( $dir . $template . '.php' ); |
|
204 | + require_once( $dir . $template . '.php' ); |
|
205 | 205 | return true; |
206 | 206 | } |
207 | 207 | } else { |
208 | 208 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
209 | 209 | |
210 | 210 | if ( file_exists( $dir . $template . '.php' ) ) { |
211 | - require_once( $dir . $template . '.php' ); |
|
211 | + require_once( $dir . $template . '.php' ); |
|
212 | 212 | return true; |
213 | 213 | } |
214 | 214 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
217 | 217 | |
218 | 218 | if ( file_exists( $dir . $template . '.php' ) ) { |
219 | - require_once( $dir . $template . '.php' ); |
|
219 | + require_once( $dir . $template . '.php' ); |
|
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | global $current_screen; |
236 | 236 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
237 | 237 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
238 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
238 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
239 | 239 | } |
240 | 240 | return $text; |
241 | 241 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | // 1. Google Analytics not authenticated |
270 | 270 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
271 | 271 | $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
272 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
273 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
272 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ), '<a href="' . $page . '">', '</a>' ); |
|
273 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
274 | 274 | return; |
275 | 275 | } |
276 | 276 | |
@@ -278,17 +278,17 @@ discard block |
||
278 | 278 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
279 | 279 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
280 | 280 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
281 | - $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>' ); |
|
282 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
281 | + $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>' ); |
|
282 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
286 | 286 | // 3. License key not valid/okay for pro |
287 | 287 | if ( monsterinsights_is_pro_version() ) { |
288 | 288 | $message = ''; |
289 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
289 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
290 | 290 | if ( MonsterInsights()->license->site_license_expired() ) { |
291 | - $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>' ); |
|
291 | + $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>' ); |
|
292 | 292 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
293 | 293 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
294 | 294 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
298 | 298 | if ( MonsterInsights()->license->network_license_expired() ) { |
299 | - $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>' ); |
|
299 | + $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>' ); |
|
300 | 300 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
301 | 301 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
302 | 302 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | if ( ! empty( $message ) ) { |
307 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
307 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
308 | 308 | return; |
309 | 309 | } |
310 | 310 | } |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | if ( version_compare( phpversion(), '5.4', '<' ) ) { |
318 | 318 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
319 | 319 | $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>' ); |
320 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
320 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
321 | 321 | return; |
322 | 322 | } |
323 | 323 | // WordPress 3.0 - 4.5 |
324 | 324 | else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
325 | 325 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
326 | 326 | $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 4.6 in April, 2019.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
327 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
327 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
328 | 328 | return; |
329 | 329 | } |
330 | 330 | // PHP 5.4/5.5 |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | // } |
369 | 369 | // } |
370 | 370 | |
371 | - $notices = get_option( 'monsterinsights_notices' ); |
|
371 | + $notices = get_option( 'monsterinsights_notices' ); |
|
372 | 372 | if ( ! is_array( $notices ) ) { |
373 | 373 | $notices = array(); |
374 | 374 | } |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
378 | 378 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
379 | 379 | |
380 | - if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
|
380 | + if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) ) { |
|
381 | 381 | echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
382 | 382 | echo '<p>'; |
383 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
383 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); |
|
384 | 384 | echo '</p>'; |
385 | 385 | echo '</div>'; |
386 | 386 | return; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | // 8. WooUpsell |
405 | 405 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
406 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
406 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
407 | 407 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
408 | 408 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
409 | 409 | echo '<p><strong>'; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | echo '<p>'; |
423 | 423 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
424 | 424 | echo '</p>'; |
425 | - 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>' ); |
|
425 | + 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>' ); |
|
426 | 426 | echo '</p>'; |
427 | 427 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
428 | 428 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | // 9. EDDUpsell |
436 | 436 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
437 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
437 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
438 | 438 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
439 | 439 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
440 | 440 | echo '<p><strong>'; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | echo '<p>'; |
454 | 454 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
455 | 455 | echo '</p>'; |
456 | - 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>' ); |
|
456 | + 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>' ); |
|
457 | 457 | echo '</p>'; |
458 | 458 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
459 | 459 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
467 | 467 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
468 | 468 | $page = $page . '#/advanced'; |
469 | - $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>' ); |
|
470 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
469 | + $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>' ); |
|
470 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | } |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | public function __construct() { |
29 | 29 | |
30 | 30 | // Authentication Actions |
31 | - add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | - add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | - add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | - add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
31 | + add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | + add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | + add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | + add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
35 | 35 | |
36 | - add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | - add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
36 | + add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | + add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
38 | 38 | |
39 | - add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | - add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
39 | + add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | + add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
41 | 41 | |
42 | 42 | add_filter( 'monsterinsights_maybe_authenticate_siteurl', array( $this, 'before_redirect' ) ); |
43 | 43 | } |
44 | 44 | |
45 | - public function get_tt(){ |
|
45 | + public function get_tt() { |
|
46 | 46 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
47 | 47 | if ( empty( $tt ) ) { |
48 | 48 | // if TT is empty, generate a new one, save it and then return it |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return $tt; |
53 | 53 | } |
54 | 54 | |
55 | - public function rotate_tt(){ |
|
55 | + public function rotate_tt() { |
|
56 | 56 | $tt = $this->generate_tt(); |
57 | 57 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
58 | 58 | } |
59 | 59 | |
60 | - public function generate_tt(){ |
|
60 | + public function generate_tt() { |
|
61 | 61 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
62 | 62 | } |
63 | 63 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | ); |
76 | 76 | } |
77 | 77 | |
78 | - public function maybe_authenticate(){ |
|
78 | + public function maybe_authenticate() { |
|
79 | 79 | |
80 | 80 | // Check nonce |
81 | 81 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
82 | 82 | |
83 | 83 | // current user can authenticate |
84 | 84 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
85 | - wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
85 | + wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | // Only for Pro users, require a license key to be entered first so we can link to things. |
93 | 93 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
94 | 94 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
95 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
95 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // we do not have a current auth |
99 | 99 | if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) { |
100 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
100 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
101 | 101 | } else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) { |
102 | - wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
102 | + wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $sitei = $this->get_sitei(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | wp_send_json_success(); |
161 | 161 | } |
162 | 162 | |
163 | - public function authenticate_listener(){ |
|
163 | + public function authenticate_listener() { |
|
164 | 164 | // Make sure it's for us |
165 | 165 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
166 | 166 | return; |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // Make sure has required params |
180 | - if ( empty( $_REQUEST['key'] ) || |
|
181 | - empty( $_REQUEST['token'] ) || |
|
182 | - empty( $_REQUEST['ua'] ) || |
|
183 | - empty( $_REQUEST['miview'] ) || |
|
184 | - empty( $_REQUEST['a'] ) || |
|
185 | - empty( $_REQUEST['w'] ) || |
|
180 | + if ( empty( $_REQUEST['key'] ) || |
|
181 | + empty( $_REQUEST['token'] ) || |
|
182 | + empty( $_REQUEST['ua'] ) || |
|
183 | + empty( $_REQUEST['miview'] ) || |
|
184 | + empty( $_REQUEST['a'] ) || |
|
185 | + empty( $_REQUEST['w'] ) || |
|
186 | 186 | empty( $_REQUEST['p'] ) |
187 | 187 | ) { |
188 | 188 | return; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $where = $this->is_network_admin() ? 'network' : 'site'; |
219 | 219 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
220 | 220 | |
221 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
221 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
222 | 222 | $url = add_query_arg( array( |
223 | 223 | 'mi_action' => 'auth', |
224 | 224 | 'success' => 'true', |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | exit; |
229 | 229 | } |
230 | 230 | |
231 | - public function maybe_reauthenticate(){ |
|
231 | + public function maybe_reauthenticate() { |
|
232 | 232 | |
233 | 233 | // Check nonce |
234 | 234 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
235 | 235 | |
236 | 236 | // current user can authenticate |
237 | 237 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
238 | - wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
238 | + wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | // Only for Pro users, require a license key to be entered first so we can link to things. |
246 | 246 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
247 | 247 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
248 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
248 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // we do have a current auth |
252 | 252 | if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
253 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
253 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
254 | 254 | } else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
255 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
255 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | $siteurl = add_query_arg( array( |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
279 | 279 | } |
280 | 280 | |
281 | - public function reauthenticate_listener(){ |
|
281 | + public function reauthenticate_listener() { |
|
282 | 282 | // Make sure it's for us |
283 | 283 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
284 | 284 | return; |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | |
297 | 297 | // Make sure has required params |
298 | 298 | if ( |
299 | - empty( $_REQUEST['ua'] ) || |
|
300 | - empty( $_REQUEST['miview'] ) || |
|
301 | - empty( $_REQUEST['a'] ) || |
|
302 | - empty( $_REQUEST['w'] ) || |
|
299 | + empty( $_REQUEST['ua'] ) || |
|
300 | + empty( $_REQUEST['miview'] ) || |
|
301 | + empty( $_REQUEST['a'] ) || |
|
302 | + empty( $_REQUEST['w'] ) || |
|
303 | 303 | empty( $_REQUEST['p'] ) |
304 | 304 | ) { |
305 | 305 | return; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $where = $this->is_network_admin() ? 'network' : 'site'; |
337 | 337 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
338 | 338 | |
339 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
339 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
340 | 340 | $url = add_query_arg( array( |
341 | 341 | 'mi_action' => 'reauth', |
342 | 342 | 'success' => 'true', |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | exit; |
348 | 348 | } |
349 | 349 | |
350 | - public function maybe_verify(){ |
|
350 | + public function maybe_verify() { |
|
351 | 351 | |
352 | 352 | // Check nonce |
353 | 353 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
354 | 354 | |
355 | 355 | // current user can verify |
356 | 356 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
357 | - wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
357 | + wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -363,25 +363,25 @@ discard block |
||
363 | 363 | |
364 | 364 | // we have an auth to verify |
365 | 365 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
366 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
366 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
367 | 367 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
368 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
368 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
372 | 372 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
373 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
373 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | $worked = $this->verify_auth(); |
377 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
377 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
378 | 378 | wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) ); |
379 | 379 | } else { |
380 | 380 | wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) ); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - public function verify_auth( $credentials = array() ){ |
|
384 | + public function verify_auth( $credentials = array() ) { |
|
385 | 385 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
386 | 386 | |
387 | 387 | if ( empty( $creds['key'] ) ) { |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - public function maybe_delete(){ |
|
403 | + public function maybe_delete() { |
|
404 | 404 | |
405 | 405 | // Check nonce |
406 | 406 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
407 | 407 | |
408 | 408 | // current user can delete |
409 | 409 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
410 | - wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
410 | + wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -416,20 +416,20 @@ discard block |
||
416 | 416 | |
417 | 417 | // we have an auth to delete |
418 | 418 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
419 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
419 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
420 | 420 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
421 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
421 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
425 | 425 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
426 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
426 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | $force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true'; |
430 | 430 | |
431 | 431 | $worked = $this->delete_auth( $force ); |
432 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
432 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
433 | 433 | wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) ); |
434 | 434 | } else { |
435 | 435 | if ( $force ) { |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | - public function delete_auth( $force = false ){ |
|
443 | + public function delete_auth( $force = false ) { |
|
444 | 444 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
445 | 445 | return false; |
446 | 446 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -456,13 +456,13 @@ discard block |
||
456 | 456 | // If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways |
457 | 457 | if ( is_network_admin() ) { |
458 | 458 | $siteurl = network_admin_url(); |
459 | - if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) { |
|
459 | + if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) { |
|
460 | 460 | MonsterInsights()->auth->delete_network_analytics_profile( true ); |
461 | 461 | return true; |
462 | 462 | } |
463 | 463 | } else { |
464 | 464 | $siteurl = site_url(); |
465 | - if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) { |
|
465 | + if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) { |
|
466 | 466 | MonsterInsights()->auth->delete_analytics_profile( true ); |
467 | 467 | return true; |
468 | 468 | } |
@@ -539,15 +539,15 @@ discard block |
||
539 | 539 | // return $sitei; |
540 | 540 | // } |
541 | 541 | |
542 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
542 | + $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
543 | 543 | $secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : ''; |
544 | - $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
544 | + $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
545 | 545 | |
546 | 546 | $sitei = $auth_key . $secure_auth_key . $logged_in_key; |
547 | - $sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei ); |
|
547 | + $sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei ); |
|
548 | 548 | $sitei = sanitize_text_field( $sitei ); |
549 | 549 | $sitei = trim( $sitei ); |
550 | - $sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei; |
|
550 | + $sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei; |
|
551 | 551 | return $sitei; |
552 | 552 | } |
553 | 553 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function __construct() { |
63 | 63 | // Allow dashboard widget to be hidden on multisite installs |
64 | - $show_widget = is_multisite() ? apply_filters( 'monsterinsights_show_dashboard_widget', true ) : true; |
|
64 | + $show_widget = is_multisite() ? apply_filters( 'monsterinsights_show_dashboard_widget', true ) : true; |
|
65 | 65 | if ( ! $show_widget ) { |
66 | 66 | return false; |
67 | 67 | } |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | // Attept to place the widget at the top. |
95 | 95 | $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; |
96 | - $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[ self::WIDGET_KEY ] ); |
|
97 | - unset( $normal_dashboard[ self::WIDGET_KEY ] ); |
|
96 | + $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[self::WIDGET_KEY] ); |
|
97 | + unset( $normal_dashboard[self::WIDGET_KEY] ); |
|
98 | 98 | $sorted_dashboard = array_merge( $widget_instance, $normal_dashboard ); |
99 | 99 | $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; |
100 | 100 | } |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $b = (array) $b; |
250 | 250 | $result = $b; |
251 | 251 | foreach ( $a as $k => &$v ) { |
252 | - if ( is_array( $v ) && isset( $result[ $k ] ) ) { |
|
253 | - $result[ $k ] = self::wp_parse_args_recursive( $v, $result[ $k ] ); |
|
252 | + if ( is_array( $v ) && isset( $result[$k] ) ) { |
|
253 | + $result[$k] = self::wp_parse_args_recursive( $v, $result[$k] ); |
|
254 | 254 | } else { |
255 | - $result[ $k ] = $v; |
|
255 | + $result[$k] = $v; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 |