@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
@@ -270,7 +270,7 @@ |
||
270 | 270 | ), |
271 | 271 | admin_url( 'admin.php' ) |
272 | 272 | ); |
273 | - $url = esc_url( $url ); |
|
273 | + $url = esc_url( $url ); |
|
274 | 274 | |
275 | 275 | ob_start(); |
276 | 276 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
@@ -52,7 +52,8 @@ |
||
52 | 52 | // Check for wizard-specific parameter |
53 | 53 | // Allow plugins to disable the onboarding wizard |
54 | 54 | // Check if current user is allowed to save settings. |
55 | - if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) { // WPCS: CSRF ok, input var ok. |
|
55 | + if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) { |
|
56 | +// WPCS: CSRF ok, input var ok. |
|
56 | 57 | return; |
57 | 58 | } |
58 | 59 |
@@ -28,7 +28,8 @@ |
||
28 | 28 | delete_transient( '_monsterinsights_activation_redirect' ); |
29 | 29 | |
30 | 30 | // Bail if activating from network, or bulk. |
31 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok. |
|
31 | + if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
32 | +// WPCS: CSRF ok, input var ok. |
|
32 | 33 | return; |
33 | 34 | } |
34 | 35 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | // If user is in admin ajax or doing cron, return |
19 | - if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
|
19 | + if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 |
@@ -276,7 +276,7 @@ |
||
276 | 276 | // 3. License key not valid/okay for pro |
277 | 277 | if ( monsterinsights_is_pro_version() ) { |
278 | 278 | $message = ''; |
279 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
279 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
280 | 280 | if ( MonsterInsights()->license->site_license_expired() ) { |
281 | 281 | $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
282 | 282 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
@@ -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_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_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_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_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' ) ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // then addons |
54 | 54 | $network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : ''; |
55 | 55 | if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
56 | - 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' ); |
|
56 | + 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' ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Add About us page. |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | function monsterinsights_get_menu_hook() { |
65 | 65 | $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
66 | 66 | if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
67 | - return 'monsterinsights_settings'; |
|
67 | + return 'monsterinsights_settings'; |
|
68 | 68 | } else { |
69 | - return 'monsterinsights_reports'; |
|
69 | + return 'monsterinsights_reports'; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
78 | 78 | // menu page and the updater on the network panel |
79 | 79 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
80 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
80 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
84 | 84 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
85 | - return; |
|
85 | + return; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | function monsterinsights_add_admin_body_class( $classes ) { |
114 | 114 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
115 | 115 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
116 | - return $classes; |
|
116 | + return $classes; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return "$classes monsterinsights_page "; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
131 | 131 | |
132 | 132 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
133 | - return $classes; |
|
133 | + return $classes; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return "$classes insights_page_monsterinsights_tools "; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
147 | 147 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
148 | 148 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
149 | - return $classes; |
|
149 | + return $classes; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return "$classes insights_page_monsterinsights_addons "; |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | |
167 | 167 | // If lite, show a link where they can get pro from |
168 | 168 | if ( ! monsterinsights_is_pro_version() ) { |
169 | - $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>'; |
|
170 | - array_unshift( $links, $get_pro ); |
|
169 | + $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>'; |
|
170 | + array_unshift( $links, $get_pro ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // If Lite, support goes to forum. If pro, it goes to our website |
174 | 174 | if ( monsterinsights_is_pro_version() ) { |
175 | - $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>'; |
|
176 | - array_unshift( $links, $support ); |
|
175 | + $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>'; |
|
176 | + array_unshift( $links, $support ); |
|
177 | 177 | } else { |
178 | - $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>'; |
|
179 | - array_unshift( $links, $support ); |
|
178 | + $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>'; |
|
179 | + array_unshift( $links, $support ); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
@@ -201,26 +201,26 @@ discard block |
||
201 | 201 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
202 | 202 | |
203 | 203 | if ( monsterinsights_is_pro_version() ) { |
204 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
204 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
205 | 205 | |
206 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
207 | - require_once( $dir . $template . '.php' ); |
|
208 | - return true; |
|
209 | - } |
|
206 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
207 | + require_once( $dir . $template . '.php' ); |
|
208 | + return true; |
|
209 | + } |
|
210 | 210 | } else { |
211 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
211 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
212 | 212 | |
213 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
214 | - require_once( $dir . $template . '.php' ); |
|
215 | - return true; |
|
216 | - } |
|
213 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
214 | + require_once( $dir . $template . '.php' ); |
|
215 | + return true; |
|
216 | + } |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
220 | 220 | |
221 | 221 | if ( file_exists( $dir . $template . '.php' ) ) { |
222 | - require_once( $dir . $template . '.php' ); |
|
223 | - return true; |
|
222 | + require_once( $dir . $template . '.php' ); |
|
223 | + return true; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return false; |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | function monsterinsights_admin_footer( $text ) { |
238 | 238 | global $current_screen; |
239 | 239 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
240 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
241 | - $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>' ); |
|
240 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
241 | + $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>' ); |
|
242 | 242 | } |
243 | 243 | return $text; |
244 | 244 | } |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | // Don't show on MonsterInsights pages |
250 | 250 | $screen = get_current_screen(); |
251 | 251 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
252 | - return; |
|
252 | + return; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | // Make sure they have the permissions to do something |
256 | 256 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
257 | - return; |
|
257 | + return; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Priority: |
@@ -272,84 +272,84 @@ discard block |
||
272 | 272 | // 1. Google Analytics not authenticated |
273 | 273 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
274 | 274 | |
275 | - $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' ) ); |
|
276 | - $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
277 | - $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
278 | - $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
279 | - $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
280 | - $urltwo = $submenu_base . '#/about/getting-started'; |
|
281 | - $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 2 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
282 | - 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>'; |
|
283 | - return; |
|
275 | + $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' ) ); |
|
276 | + $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
277 | + $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
278 | + $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
279 | + $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
280 | + $urltwo = $submenu_base . '#/about/getting-started'; |
|
281 | + $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 2 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
282 | + 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>'; |
|
283 | + return; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // 2. License key not entered for pro |
287 | 287 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
288 | 288 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
289 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
290 | - $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>' ); |
|
291 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
292 | - return; |
|
289 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
290 | + $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>' ); |
|
291 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
292 | + return; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // 3. License key not valid/okay for pro |
296 | 296 | if ( monsterinsights_is_pro_version() ) { |
297 | - $message = ''; |
|
298 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
299 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
300 | - $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>' ); |
|
301 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
302 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
303 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
304 | - $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' ); |
|
305 | - } |
|
306 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
307 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
308 | - $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>' ); |
|
309 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
310 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
311 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
312 | - $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' ); |
|
313 | - } |
|
314 | - } |
|
315 | - if ( ! empty( $message ) ) { |
|
316 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
317 | - return; |
|
318 | - } |
|
297 | + $message = ''; |
|
298 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
299 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
300 | + $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>' ); |
|
301 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
302 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
303 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
304 | + $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' ); |
|
305 | + } |
|
306 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
307 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
308 | + $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>' ); |
|
309 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
310 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
311 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
312 | + $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' ); |
|
313 | + } |
|
314 | + } |
|
315 | + if ( ! empty( $message ) ) { |
|
316 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
317 | + return; |
|
318 | + } |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | // 4. Notices for PHP/WP version deprecations |
322 | 322 | if ( current_user_can( 'update_core' ) ) { |
323 | - global $wp_version; |
|
324 | - |
|
325 | - // PHP 5.2/5.3 |
|
326 | - if ( version_compare( phpversion(), '5.4', '<' ) ) { |
|
327 | - $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
328 | - $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>' ); |
|
329 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
330 | - return; |
|
331 | - } |
|
332 | - // WordPress 3.0 - 4.5 |
|
333 | - else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
|
334 | - $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
335 | - $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>' ); |
|
336 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
337 | - return; |
|
338 | - } |
|
339 | - // PHP 5.4/5.5 |
|
340 | - // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
341 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
342 | - // $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>' ); |
|
343 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
344 | - // return; |
|
345 | - // } |
|
346 | - // // WordPress 4.6 - 4.8 |
|
347 | - // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
348 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
349 | - // $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>' ); |
|
350 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
351 | - // return; |
|
352 | - // } |
|
323 | + global $wp_version; |
|
324 | + |
|
325 | + // PHP 5.2/5.3 |
|
326 | + if ( version_compare( phpversion(), '5.4', '<' ) ) { |
|
327 | + $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
328 | + $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>' ); |
|
329 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
330 | + return; |
|
331 | + } |
|
332 | + // WordPress 3.0 - 4.5 |
|
333 | + else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
|
334 | + $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
335 | + $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>' ); |
|
336 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
337 | + return; |
|
338 | + } |
|
339 | + // PHP 5.4/5.5 |
|
340 | + // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
341 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
342 | + // $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>' ); |
|
343 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
344 | + // return; |
|
345 | + // } |
|
346 | + // // WordPress 4.6 - 4.8 |
|
347 | + // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
348 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
349 | + // $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>' ); |
|
350 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
351 | + // return; |
|
352 | + // } |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | // 5. Optin setting not configured |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $notices = get_option( 'monsterinsights_notices' ); |
381 | 381 | if ( ! is_array( $notices ) ) { |
382 | - $notices = array(); |
|
382 | + $notices = array(); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | // 6. Authenticate, not manual |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
388 | 388 | |
389 | 389 | if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
390 | - echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
391 | - echo '<p>'; |
|
392 | - 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>' ); |
|
393 | - echo '</p>'; |
|
394 | - echo '</div>'; |
|
395 | - return; |
|
390 | + echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
391 | + echo '<p>'; |
|
392 | + 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>' ); |
|
393 | + echo '</p>'; |
|
394 | + echo '</div>'; |
|
395 | + return; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | // 7. Automatic updates not configured |
@@ -412,72 +412,72 @@ discard block |
||
412 | 412 | |
413 | 413 | // 8. WooUpsell |
414 | 414 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
415 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
416 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
417 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
418 | - echo '<p><strong>'; |
|
419 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
420 | - echo '</strong></p>'; |
|
421 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
422 | - echo '<p>'; |
|
423 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
424 | - echo '</p>'; |
|
425 | - echo '<p>'; |
|
426 | - 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' ); |
|
427 | - echo '</p>'; |
|
428 | - echo '<p>'; |
|
429 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
430 | - echo '</p>'; |
|
431 | - echo '<p>'; |
|
432 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
433 | - echo '</p>'; |
|
434 | - 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>' ); |
|
435 | - echo '</p>'; |
|
436 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
437 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
438 | - echo '</div>'; |
|
439 | - echo '</div>'; |
|
440 | - return; |
|
441 | - } |
|
415 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
416 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
417 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
418 | + echo '<p><strong>'; |
|
419 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
420 | + echo '</strong></p>'; |
|
421 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
422 | + echo '<p>'; |
|
423 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
424 | + echo '</p>'; |
|
425 | + echo '<p>'; |
|
426 | + 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' ); |
|
427 | + echo '</p>'; |
|
428 | + echo '<p>'; |
|
429 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
430 | + echo '</p>'; |
|
431 | + echo '<p>'; |
|
432 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
433 | + echo '</p>'; |
|
434 | + 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>' ); |
|
435 | + echo '</p>'; |
|
436 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
437 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
438 | + echo '</div>'; |
|
439 | + echo '</div>'; |
|
440 | + return; |
|
441 | + } |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | // 9. EDDUpsell |
445 | 445 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
446 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
447 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
448 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
449 | - echo '<p><strong>'; |
|
450 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
451 | - echo '</strong></p>'; |
|
452 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
453 | - echo '<p>'; |
|
454 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
455 | - echo '</p>'; |
|
456 | - echo '<p>'; |
|
457 | - 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' ); |
|
458 | - echo '</p>'; |
|
459 | - echo '<p>'; |
|
460 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
461 | - echo '</p>'; |
|
462 | - echo '<p>'; |
|
463 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
464 | - echo '</p>'; |
|
465 | - 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>' ); |
|
466 | - echo '</p>'; |
|
467 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
468 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
469 | - echo '</div>'; |
|
470 | - echo '</div>'; |
|
471 | - return; |
|
472 | - } |
|
446 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
447 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
448 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
449 | + echo '<p><strong>'; |
|
450 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
451 | + echo '</strong></p>'; |
|
452 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
453 | + echo '<p>'; |
|
454 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
455 | + echo '</p>'; |
|
456 | + echo '<p>'; |
|
457 | + 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' ); |
|
458 | + echo '</p>'; |
|
459 | + echo '<p>'; |
|
460 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
461 | + echo '</p>'; |
|
462 | + echo '<p>'; |
|
463 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
464 | + echo '</p>'; |
|
465 | + 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>' ); |
|
466 | + echo '</p>'; |
|
467 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
468 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
469 | + echo '</div>'; |
|
470 | + echo '</div>'; |
|
471 | + return; |
|
472 | + } |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
476 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
477 | - $page = $page . '#/advanced'; |
|
478 | - $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>' ); |
|
479 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
480 | - return; |
|
476 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
477 | + $page = $page . '#/advanced'; |
|
478 | + $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>' ); |
|
479 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
480 | + return; |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | // AM Notices |
488 | 488 | function monsterinsights_am_notice_optout( $super_admin ) { |
489 | 489 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
490 | - return false; |
|
490 | + return false; |
|
491 | 491 | } |
492 | 492 | return $super_admin; |
493 | 493 | } |
@@ -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_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_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_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_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 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
89 | 89 | $hook = 'monsterinsights_network'; |
90 | 90 | $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
91 | - 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' ); |
|
91 | + 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' ); |
|
92 | 92 | |
93 | 93 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
94 | 94 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | function monsterinsights_add_admin_body_class_tools_page( $classes ) { |
130 | 130 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
131 | 131 | |
132 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
132 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
133 | 133 | return $classes; |
134 | 134 | } |
135 | 135 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
147 | 147 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
148 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
148 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
149 | 149 | return $classes; |
150 | 150 | } |
151 | 151 | |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | * @return array $links |
162 | 162 | */ |
163 | 163 | function monsterinsights_add_action_links( $links ) { |
164 | - $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>'; |
|
164 | + $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>'; |
|
165 | 165 | array_unshift( $links, $docs ); |
166 | 166 | |
167 | 167 | // If lite, show a link where they can get pro from |
168 | 168 | if ( ! monsterinsights_is_pro_version() ) { |
169 | - $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>'; |
|
169 | + $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>'; |
|
170 | 170 | array_unshift( $links, $get_pro ); |
171 | 171 | } |
172 | 172 | |
173 | 173 | // If Lite, support goes to forum. If pro, it goes to our website |
174 | 174 | if ( monsterinsights_is_pro_version() ) { |
175 | - $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>'; |
|
175 | + $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>'; |
|
176 | 176 | array_unshift( $links, $support ); |
177 | 177 | } else { |
178 | - $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>'; |
|
178 | + $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>'; |
|
179 | 179 | array_unshift( $links, $support ); |
180 | 180 | } |
181 | 181 | |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
205 | 205 | |
206 | 206 | if ( file_exists( $dir . $template . '.php' ) ) { |
207 | - require_once( $dir . $template . '.php' ); |
|
207 | + require_once( $dir . $template . '.php' ); |
|
208 | 208 | return true; |
209 | 209 | } |
210 | 210 | } else { |
211 | 211 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
212 | 212 | |
213 | 213 | if ( file_exists( $dir . $template . '.php' ) ) { |
214 | - require_once( $dir . $template . '.php' ); |
|
214 | + require_once( $dir . $template . '.php' ); |
|
215 | 215 | return true; |
216 | 216 | } |
217 | 217 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
220 | 220 | |
221 | 221 | if ( file_exists( $dir . $template . '.php' ) ) { |
222 | - require_once( $dir . $template . '.php' ); |
|
222 | + require_once( $dir . $template . '.php' ); |
|
223 | 223 | return true; |
224 | 224 | } |
225 | 225 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | global $current_screen; |
239 | 239 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
240 | 240 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
241 | - $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>' ); |
|
241 | + $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>' ); |
|
242 | 242 | } |
243 | 243 | return $text; |
244 | 244 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
280 | 280 | $urltwo = $submenu_base . '#/about/getting-started'; |
281 | 281 | $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 2 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
282 | - 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>'; |
|
282 | + 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>'; |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
@@ -287,17 +287,17 @@ discard block |
||
287 | 287 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
288 | 288 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
289 | 289 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
290 | - $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>' ); |
|
291 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
290 | + $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>' ); |
|
291 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | 295 | // 3. License key not valid/okay for pro |
296 | 296 | if ( monsterinsights_is_pro_version() ) { |
297 | 297 | $message = ''; |
298 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
298 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
299 | 299 | if ( MonsterInsights()->license->site_license_expired() ) { |
300 | - $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>' ); |
|
300 | + $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>' ); |
|
301 | 301 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
302 | 302 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
303 | 303 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | } |
306 | 306 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
307 | 307 | if ( MonsterInsights()->license->network_license_expired() ) { |
308 | - $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>' ); |
|
308 | + $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>' ); |
|
309 | 309 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
310 | 310 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
311 | 311 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | } |
315 | 315 | if ( ! empty( $message ) ) { |
316 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
316 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
317 | 317 | return; |
318 | 318 | } |
319 | 319 | } |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | if ( version_compare( phpversion(), '5.4', '<' ) ) { |
327 | 327 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
328 | 328 | $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>' ); |
329 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
329 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | // WordPress 3.0 - 4.5 |
333 | 333 | else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
334 | 334 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
335 | 335 | $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>' ); |
336 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
336 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
337 | 337 | return; |
338 | 338 | } |
339 | 339 | // PHP 5.4/5.5 |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // } |
378 | 378 | // } |
379 | 379 | |
380 | - $notices = get_option( 'monsterinsights_notices' ); |
|
380 | + $notices = get_option( 'monsterinsights_notices' ); |
|
381 | 381 | if ( ! is_array( $notices ) ) { |
382 | 382 | $notices = array(); |
383 | 383 | } |
@@ -386,10 +386,10 @@ discard block |
||
386 | 386 | $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
387 | 387 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
388 | 388 | |
389 | - if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
|
389 | + if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) ) { |
|
390 | 390 | echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
391 | 391 | echo '<p>'; |
392 | - 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>' ); |
|
392 | + 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>' ); |
|
393 | 393 | echo '</p>'; |
394 | 394 | echo '</div>'; |
395 | 395 | return; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | // 8. WooUpsell |
414 | 414 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
415 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
415 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
416 | 416 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
417 | 417 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
418 | 418 | echo '<p><strong>'; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | echo '<p>'; |
432 | 432 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
433 | 433 | echo '</p>'; |
434 | - 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>' ); |
|
434 | + 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>' ); |
|
435 | 435 | echo '</p>'; |
436 | 436 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
437 | 437 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | // 9. EDDUpsell |
445 | 445 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
446 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
446 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
447 | 447 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
448 | 448 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
449 | 449 | echo '<p><strong>'; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | echo '<p>'; |
463 | 463 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
464 | 464 | echo '</p>'; |
465 | - 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>' ); |
|
465 | + 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>' ); |
|
466 | 466 | echo '</p>'; |
467 | 467 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
468 | 468 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
476 | 476 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
477 | 477 | $page = $page . '#/advanced'; |
478 | - $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>' ); |
|
479 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
478 | + $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>' ); |
|
479 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; |
|
480 | 480 | return; |
481 | 481 | } |
482 | 482 | } |
@@ -87,7 +87,8 @@ |
||
87 | 87 | wp_cache_flush(); |
88 | 88 | $cachec = true; |
89 | 89 | } |
90 | - } else { // if existing install |
|
90 | + } else { |
|
91 | +// if existing install |
|
91 | 92 | if ( version_compare( $version, '6.0.11', '<' ) ) { |
92 | 93 | if ( ! $cachec ) { |
93 | 94 | wp_cache_flush(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // if new install or Yoast Era instal |
64 | 64 | if ( ! $version ) { |
65 | 65 | // See if from Yoast |
66 | - $yoast = get_option( 'yst_ga', false ); |
|
66 | + $yoast = get_option( 'yst_ga', false ); |
|
67 | 67 | |
68 | 68 | // In case from Yoast, start from scratch |
69 | 69 | delete_option( 'yoast-ga-access_token' ); |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | public function v700_upgrades() { |
314 | 314 | // 1. Default all event tracking and tracking to GA + JS respectively |
315 | 315 | // 3a Set tracking_mode to use analytics.js |
316 | - $this->new_settings['tracking_mode' ] = 'analytics'; |
|
316 | + $this->new_settings['tracking_mode'] = 'analytics'; |
|
317 | 317 | |
318 | 318 | |
319 | 319 | // 3b Set events mode to use JS if the events mode is not set explicitly to none |
320 | - if ( empty( $this->new_settings['events_mode' ] ) || $this->new_settings['events_mode' ] !== 'none' ) { |
|
321 | - $this->new_settings['events_mode' ] = 'js'; |
|
320 | + if ( empty( $this->new_settings['events_mode'] ) || $this->new_settings['events_mode'] !== 'none' ) { |
|
321 | + $this->new_settings['events_mode'] = 'js'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // 2. Migrate manual UA codes |
325 | 325 | // 2a Manual UA has the lowest priority |
326 | - if ( ! empty( $this->new_settings['manual_ua_code' ] ) ) { |
|
326 | + if ( ! empty( $this->new_settings['manual_ua_code'] ) ) { |
|
327 | 327 | // Set as manual UA code |
328 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ); |
|
328 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | // 2b Then try the oAuth UA code |
332 | - if ( ! empty( $this->new_settings['analytics_profile_code' ] ) ) { |
|
332 | + if ( ! empty( $this->new_settings['analytics_profile_code'] ) ) { |
|
333 | 333 | // Set as manual UA code |
334 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ); |
|
334 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // 3. Migrate License keys |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | 'track_internal_as_label', |
374 | 374 | ); |
375 | 375 | foreach ( $settings as $setting ) { |
376 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
377 | - unset( $this->new_settings[ $setting ] ); |
|
376 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
377 | + unset( $this->new_settings[$setting] ); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | } |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | ); |
419 | 419 | |
420 | 420 | foreach ( $settings as $setting ) { |
421 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
422 | - unset( $this->new_settings[ $setting ] ); |
|
421 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
422 | + unset( $this->new_settings[$setting] ); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | ); |
459 | 459 | |
460 | 460 | foreach ( $settings as $setting ) { |
461 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
462 | - unset( $this->new_settings[ $setting ] ); |
|
461 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
462 | + unset( $this->new_settings[$setting] ); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | } |
551 | 551 | preg_match( $regex, $cross_domain['domain'], $matches ); |
552 | 552 | if ( count( $matches ) > 0 ) { |
553 | - unset( $this->new_settings['cross_domains'][ $key ] ); |
|
553 | + unset( $this->new_settings['cross_domains'][$key] ); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | 'js', |
631 | 631 | 'tgz' |
632 | 632 | ); |
633 | - $extensions_to_add = array( |
|
633 | + $extensions_to_add = array( |
|
634 | 634 | 'docx', |
635 | 635 | 'pptx', |
636 | 636 | 'xlsx', |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ( ! is_array( $inbound_paths ) ) { |
62 | 62 | $inbound_paths = array(); |
63 | 63 | } else { |
64 | - foreach( $inbound_paths as $index => $pair ) { |
|
64 | + foreach ( $inbound_paths as $index => $pair ) { |
|
65 | 65 | // if empty pair, unset and continue |
66 | 66 | if ( empty( $pair['path'] ) ) { |
67 | 67 | unset( $inbound_paths[$index] ); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $download_extensions = array( $download_extensions ); |
88 | 88 | } |
89 | 89 | $i = 0; |
90 | - foreach( $download_extensions as $extension ){ |
|
91 | - $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
|
90 | + foreach ( $download_extensions as $extension ) { |
|
91 | + $download_extensions[$i] = esc_js( trim( $extension ) ); |
|
92 | 92 | $i++; |
93 | 93 | } |
94 | 94 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $download_extensions = array( $download_extensions ); |
88 | 88 | } |
89 | 89 | $i = 0; |
90 | - foreach( $download_extensions as $extension ){ |
|
90 | + foreach( $download_extensions as $extension ) { |
|
91 | 91 | $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
92 | 92 | $i++; |
93 | 93 | } |
@@ -33,13 +33,13 @@ |
||
33 | 33 | $track_user = monsterinsights_track_user(); |
34 | 34 | |
35 | 35 | if ( $track_user ) { |
36 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
37 | - new MonsterInsights_Analytics_Events(); |
|
36 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
37 | + new MonsterInsights_Analytics_Events(); |
|
38 | 38 | |
39 | - // Let's run form tracking if we find it |
|
40 | - if ( function_exists( 'monsterinsights_forms_output_after_script' ) ) { |
|
41 | - monsterinsights_forms_output_after_script( array() ); |
|
42 | - } |
|
39 | + // Let's run form tracking if we find it |
|
40 | + if ( function_exists( 'monsterinsights_forms_output_after_script' ) ) { |
|
41 | + monsterinsights_forms_output_after_script( array() ); |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | add_action( 'seedprod_monsterinsights_output_tracking', 'monsterinsights_seedprod_tracking', 6, 1 ); |
46 | 46 | \ No newline at end of file |
@@ -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'; |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
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,7 +75,7 @@ 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' ); |
@@ -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; |
@@ -228,7 +228,7 @@ 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' ); |
@@ -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; |
@@ -347,7 +347,7 @@ 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' ); |
@@ -381,7 +381,7 @@ discard block |
||
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,7 +400,7 @@ 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' ); |
@@ -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() ) { |
@@ -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'] ) { |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | // we do not have a current auth |
101 | 101 | if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) { |
102 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
102 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
103 | 103 | } else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) { |
104 | - wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
104 | + wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $sitei = $this->get_sitei(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | wp_send_json_success(); |
163 | 163 | } |
164 | 164 | |
165 | - public function authenticate_listener(){ |
|
165 | + public function authenticate_listener() { |
|
166 | 166 | // Make sure it's for us |
167 | 167 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
168 | 168 | return; |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // Make sure has required params |
182 | - if ( empty( $_REQUEST['key'] ) || |
|
183 | - empty( $_REQUEST['token'] ) || |
|
184 | - empty( $_REQUEST['ua'] ) || |
|
185 | - empty( $_REQUEST['miview'] ) || |
|
186 | - empty( $_REQUEST['a'] ) || |
|
187 | - empty( $_REQUEST['w'] ) || |
|
182 | + if ( empty( $_REQUEST['key'] ) || |
|
183 | + empty( $_REQUEST['token'] ) || |
|
184 | + empty( $_REQUEST['ua'] ) || |
|
185 | + empty( $_REQUEST['miview'] ) || |
|
186 | + empty( $_REQUEST['a'] ) || |
|
187 | + empty( $_REQUEST['w'] ) || |
|
188 | 188 | empty( $_REQUEST['p'] ) |
189 | 189 | ) { |
190 | 190 | return; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $where = $this->is_network_admin() ? 'network' : 'site'; |
221 | 221 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
222 | 222 | |
223 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
223 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
224 | 224 | $url = add_query_arg( array( |
225 | 225 | 'mi_action' => 'auth', |
226 | 226 | 'success' => 'true', |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | exit; |
231 | 231 | } |
232 | 232 | |
233 | - public function maybe_reauthenticate(){ |
|
233 | + public function maybe_reauthenticate() { |
|
234 | 234 | |
235 | 235 | // Check nonce |
236 | 236 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
237 | 237 | |
238 | 238 | // current user can authenticate |
239 | 239 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
240 | - wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
240 | + wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | // we do have a current auth |
256 | 256 | if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
257 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
257 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
258 | 258 | } else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
259 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
259 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $siteurl = add_query_arg( array( |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
283 | 283 | } |
284 | 284 | |
285 | - public function reauthenticate_listener(){ |
|
285 | + public function reauthenticate_listener() { |
|
286 | 286 | // Make sure it's for us |
287 | 287 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
288 | 288 | return; |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | |
301 | 301 | // Make sure has required params |
302 | 302 | if ( |
303 | - empty( $_REQUEST['ua'] ) || |
|
304 | - empty( $_REQUEST['miview'] ) || |
|
305 | - empty( $_REQUEST['a'] ) || |
|
306 | - empty( $_REQUEST['w'] ) || |
|
303 | + empty( $_REQUEST['ua'] ) || |
|
304 | + empty( $_REQUEST['miview'] ) || |
|
305 | + empty( $_REQUEST['a'] ) || |
|
306 | + empty( $_REQUEST['w'] ) || |
|
307 | 307 | empty( $_REQUEST['p'] ) |
308 | 308 | ) { |
309 | 309 | return; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $where = $this->is_network_admin() ? 'network' : 'site'; |
341 | 341 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
342 | 342 | |
343 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
343 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
344 | 344 | $url = add_query_arg( array( |
345 | 345 | 'mi_action' => 'reauth', |
346 | 346 | 'success' => 'true', |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | exit; |
352 | 352 | } |
353 | 353 | |
354 | - public function maybe_verify(){ |
|
354 | + public function maybe_verify() { |
|
355 | 355 | |
356 | 356 | // Check nonce |
357 | 357 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
358 | 358 | |
359 | 359 | // current user can verify |
360 | 360 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
361 | - wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
361 | + wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | |
368 | 368 | // we have an auth to verify |
369 | 369 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
370 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
370 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
371 | 371 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
372 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
372 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | if ( monsterinsights_is_pro_version() ) { |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | $worked = $this->verify_auth(); |
383 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
383 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
384 | 384 | wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) ); |
385 | 385 | } else { |
386 | 386 | wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) ); |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | - public function verify_auth( $credentials = array() ){ |
|
390 | + public function verify_auth( $credentials = array() ) { |
|
391 | 391 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
392 | 392 | |
393 | 393 | if ( empty( $creds['key'] ) ) { |
@@ -406,14 +406,14 @@ discard block |
||
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | - public function maybe_delete(){ |
|
409 | + public function maybe_delete() { |
|
410 | 410 | |
411 | 411 | // Check nonce |
412 | 412 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
413 | 413 | |
414 | 414 | // current user can delete |
415 | 415 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
416 | - wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
416 | + wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | |
423 | 423 | // we have an auth to delete |
424 | 424 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
425 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
425 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
426 | 426 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
427 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
427 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | if ( monsterinsights_is_pro_version() ) { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true'; |
438 | 438 | |
439 | 439 | $worked = $this->delete_auth( $force ); |
440 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
440 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
441 | 441 | wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) ); |
442 | 442 | } else { |
443 | 443 | if ( $force ) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | - public function delete_auth( $force = false ){ |
|
451 | + public function delete_auth( $force = false ) { |
|
452 | 452 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
453 | 453 | return false; |
454 | 454 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | // If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways |
465 | 465 | if ( is_network_admin() ) { |
466 | 466 | $siteurl = network_admin_url(); |
467 | - if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) { |
|
467 | + if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) { |
|
468 | 468 | MonsterInsights()->auth->delete_network_analytics_profile( true ); |
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } else { |
472 | 472 | $siteurl = site_url(); |
473 | - if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) { |
|
473 | + if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) { |
|
474 | 474 | MonsterInsights()->auth->delete_analytics_profile( true ); |
475 | 475 | return true; |
476 | 476 | } |
@@ -547,15 +547,15 @@ discard block |
||
547 | 547 | // return $sitei; |
548 | 548 | // } |
549 | 549 | |
550 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
550 | + $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
551 | 551 | $secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : ''; |
552 | - $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
552 | + $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
553 | 553 | |
554 | 554 | $sitei = $auth_key . $secure_auth_key . $logged_in_key; |
555 | - $sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei ); |
|
555 | + $sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei ); |
|
556 | 556 | $sitei = sanitize_text_field( $sitei ); |
557 | 557 | $sitei = trim( $sitei ); |
558 | - $sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei; |
|
558 | + $sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei; |
|
559 | 559 | return $sitei; |
560 | 560 | } |
561 | 561 |