@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | foreach ( $addresses as $key => $address ) { |
195 | 195 | if ( ! is_email( $address ) ) { |
196 | - unset( $addresses[ $key ] ); |
|
196 | + unset( $addresses[$key] ); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | - if ( ! isset( $this->args[ $type ] ) || ! is_array( $this->args[ $type ] ) ) { |
|
298 | - $this->args[ $type ] = array(); |
|
297 | + if ( ! isset( $this->args[$type] ) || ! is_array( $this->args[$type] ) ) { |
|
298 | + $this->args[$type] = array(); |
|
299 | 299 | } |
300 | 300 | |
301 | - $this->args[ $type ] = $merge ? array_merge( $this->args[ $type ], $value ) : $value; |
|
301 | + $this->args[$type] = $merge ? array_merge( $this->args[$type], $value ) : $value; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return $this; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function get_args( $type ) { |
317 | 317 | if ( ! empty( $type ) ) { |
318 | - return isset( $this->args[ $type ] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[ $type ], $this ) : array(); |
|
318 | + return isset( $this->args[$type] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[$type], $this ) : array(); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | return apply_filters( 'monsterinsights_emails_templates_get_args', $this->args, $this ); |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - public function build_email( $message=null ) { |
|
333 | + public function build_email( $message = null ) { |
|
334 | 334 | // process plain text email |
335 | 335 | if ( false === $this->html ) { |
336 | - $body = $this->get_template_part( 'body', $this->get_template(), true ); |
|
337 | - $body = wp_strip_all_tags( $body ); |
|
338 | - $message = str_replace( '{email}', $message, $body ); |
|
336 | + $body = $this->get_template_part( 'body', $this->get_template(), true ); |
|
337 | + $body = wp_strip_all_tags( $body ); |
|
338 | + $message = str_replace( '{email}', $message, $body ); |
|
339 | 339 | |
340 | 340 | return apply_filters( 'monsterinsights_email_message', $message, $this ); |
341 | 341 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | do_action( 'monsterinsights_email_footer', $email_parts['footer'] ); |
359 | 359 | |
360 | 360 | |
361 | - $body = implode( $email_parts ); |
|
361 | + $body = implode( $email_parts ); |
|
362 | 362 | $message = $this->process_tag( $message, false ); |
363 | 363 | $message = nl2br( $message ); |
364 | 364 | $message = str_replace( '{email}', $message, $body ); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return bool |
381 | 381 | */ |
382 | - public function send( $to, $subject, $message=null, $attachments = array() ) { |
|
382 | + public function send( $to, $subject, $message = null, $attachments = array() ) { |
|
383 | 383 | |
384 | 384 | if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
385 | 385 | _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send emails with MI_WP_Emails() until init/admin_init has been reached.', 'google-analytics-for-wordpress' ), null ); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $this->template = 'default'; |
511 | 511 | } |
512 | 512 | |
513 | - return apply_filters( 'monsterinsights_email_template', $this->template); |
|
513 | + return apply_filters( 'monsterinsights_email_template', $this->template ); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -303,7 +303,7 @@ |
||
303 | 303 | // 3. License key not valid/okay for pro |
304 | 304 | if ( monsterinsights_is_pro_version() ) { |
305 | 305 | $message = ''; |
306 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
306 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
307 | 307 | if ( MonsterInsights()->license->site_license_expired() ) { |
308 | 308 | // Translators: Adds a link to the license renewal. |
309 | 309 | $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
@@ -27,22 +27,22 @@ discard block |
||
27 | 27 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
28 | 28 | |
29 | 29 | if ( $hook === 'monsterinsights_settings' ) { |
30 | - // If dashboards disabled, first settings page |
|
31 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | - $hook = 'monsterinsights_settings'; |
|
30 | + // If dashboards disabled, first settings page |
|
31 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | + $hook = 'monsterinsights_settings'; |
|
33 | 33 | |
34 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
34 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
35 | 35 | } else { |
36 | - // if dashboards enabled, first dashboard |
|
37 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
36 | + // if dashboards enabled, first dashboard |
|
37 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | 38 | |
39 | - add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
39 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
40 | 40 | |
41 | - // then settings page |
|
42 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
41 | + // then settings page |
|
42 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
43 | 43 | |
44 | - // Add dashboard submenu. |
|
45 | - add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' ); |
|
44 | + // Add dashboard submenu. |
|
45 | + add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $submenu_base = add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | add_submenu_page( $hook, __( 'Popular Posts:', 'google-analytics-for-wordpress' ), __( 'Popular Posts', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/popular-posts' ); |
52 | 52 | |
53 | 53 | if ( function_exists( 'aioseo' ) ) { |
54 | - $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
54 | + $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
55 | 55 | } else { |
56 | - $seo_url = $submenu_base . '#/seo'; |
|
56 | + $seo_url = $submenu_base . '#/seo'; |
|
57 | 57 | } |
58 | 58 | // then SEO |
59 | 59 | add_submenu_page( $hook, __( 'SEO', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // then addons |
65 | 65 | $network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : ''; |
66 | 66 | if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
67 | - add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
67 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Add About us page. |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | function monsterinsights_get_menu_hook() { |
98 | 98 | $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
99 | 99 | if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
100 | - return 'monsterinsights_settings'; |
|
100 | + return 'monsterinsights_settings'; |
|
101 | 101 | } else { |
102 | - return 'monsterinsights_reports'; |
|
102 | + return 'monsterinsights_reports'; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
111 | 111 | // menu page and the updater on the network panel |
112 | 112 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
113 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
113 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
117 | 117 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
118 | - return; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
129 | 129 | |
130 | 130 | if ( function_exists( 'aioseo' ) ) { |
131 | - $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
131 | + $seo_url = monsterinsights_aioseo_dashboard_url(); |
|
132 | 132 | } else { |
133 | - $seo_url = $submenu_base . '#/seo'; |
|
133 | + $seo_url = $submenu_base . '#/seo'; |
|
134 | 134 | } |
135 | 135 | // then seo |
136 | 136 | add_submenu_page( $hook, __( 'SEO:', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url, 'monsterinsights_seo_page' ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | function monsterinsights_add_admin_body_class( $classes ) { |
155 | 155 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
156 | 156 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
157 | - return $classes; |
|
157 | + return $classes; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return "$classes monsterinsights_page "; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
172 | 172 | |
173 | 173 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
174 | - return $classes; |
|
174 | + return $classes; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return "$classes insights_page_monsterinsights_tools "; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
188 | 188 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
189 | 189 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
190 | - return $classes; |
|
190 | + return $classes; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return "$classes insights_page_monsterinsights_addons "; |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | |
208 | 208 | // If Lite, support goes to forum. If pro, it goes to our website |
209 | 209 | if ( monsterinsights_is_pro_version() ) { |
210 | - $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
211 | - array_unshift( $links, $support ); |
|
210 | + $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
211 | + array_unshift( $links, $support ); |
|
212 | 212 | } else { |
213 | - $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
214 | - array_unshift( $links, $support ); |
|
213 | + $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
214 | + array_unshift( $links, $support ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if ( is_network_admin() ) { |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
247 | 247 | |
248 | 248 | if ( monsterinsights_is_pro_version() ) { |
249 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
249 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
250 | 250 | |
251 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
252 | - require_once( $dir . $template . '.php' ); |
|
253 | - return true; |
|
254 | - } |
|
251 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
252 | + require_once( $dir . $template . '.php' ); |
|
253 | + return true; |
|
254 | + } |
|
255 | 255 | } else { |
256 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
256 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
257 | 257 | |
258 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
259 | - require_once( $dir . $template . '.php' ); |
|
260 | - return true; |
|
261 | - } |
|
258 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
259 | + require_once( $dir . $template . '.php' ); |
|
260 | + return true; |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
265 | 265 | |
266 | 266 | if ( file_exists( $dir . $template . '.php' ) ) { |
267 | - require_once( $dir . $template . '.php' ); |
|
268 | - return true; |
|
267 | + require_once( $dir . $template . '.php' ); |
|
268 | + return true; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return false; |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | function monsterinsights_admin_footer( $text ) { |
283 | 283 | global $current_screen; |
284 | 284 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
285 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
286 | - // Translators: Placeholders add a link to the wordpress.org repository. |
|
287 | - $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
285 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
286 | + // Translators: Placeholders add a link to the wordpress.org repository. |
|
287 | + $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
288 | 288 | } |
289 | 289 | return $text; |
290 | 290 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | // Don't show on MonsterInsights pages |
296 | 296 | $screen = get_current_screen(); |
297 | 297 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
298 | - return; |
|
298 | + return; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | // Make sure they have the permissions to do something |
302 | 302 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
303 | - return; |
|
303 | + return; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | // Priority: |
@@ -318,58 +318,58 @@ discard block |
||
318 | 318 | // 1. Google Analytics not authenticated |
319 | 319 | if ( ! is_network_admin() && ! monsterinsights_get_ua() && ! monsterinsights_get_v4_id() && ! defined( 'MONSTERINSIGHTS_DISABLE_TRACKING' ) ) { |
320 | 320 | |
321 | - $submenu_base = is_network_admin() ? add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
322 | - $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
323 | - $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
324 | - $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
325 | - $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
326 | - $urltwo = $submenu_base . '#/about/getting-started'; |
|
327 | - $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
328 | - echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
329 | - return; |
|
321 | + $submenu_base = is_network_admin() ? add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
322 | + $title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' ); |
|
323 | + $primary = esc_html__( 'Connect MonsterInsights and Setup Website Analytics', 'google-analytics-for-wordpress' ); |
|
324 | + $urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
325 | + $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
|
326 | + $urltwo = $submenu_base . '#/about/getting-started'; |
|
327 | + $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
|
328 | + echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
329 | + return; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // 2. License key not entered for pro |
333 | 333 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
334 | 334 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
335 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
336 | - // Translators: Adds a link to retrieve the license. |
|
337 | - $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
338 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
339 | - return; |
|
335 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
336 | + // Translators: Adds a link to retrieve the license. |
|
337 | + $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
338 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
339 | + return; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // 3. License key not valid/okay for pro |
343 | 343 | if ( monsterinsights_is_pro_version() ) { |
344 | - $message = ''; |
|
345 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
346 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
347 | - // Translators: Adds a link to the license renewal. |
|
348 | - $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
349 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
350 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
351 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
352 | - $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
353 | - } |
|
354 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
355 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
356 | - // Translators: Adds a link to renew license. |
|
357 | - $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
358 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
359 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
360 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
361 | - $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
362 | - } |
|
363 | - } |
|
364 | - if ( ! empty( $message ) ) { |
|
365 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
366 | - return; |
|
367 | - } |
|
344 | + $message = ''; |
|
345 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
346 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
347 | + // Translators: Adds a link to the license renewal. |
|
348 | + $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
349 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
350 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
351 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
352 | + $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
353 | + } |
|
354 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
355 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
356 | + // Translators: Adds a link to renew license. |
|
357 | + $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
358 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
359 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
360 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
361 | + $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
362 | + } |
|
363 | + } |
|
364 | + if ( ! empty( $message ) ) { |
|
365 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
366 | + return; |
|
367 | + } |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | // 4. Notices for PHP/WP version deprecations |
371 | 371 | if ( current_user_can( 'update_core' ) ) { |
372 | - global $wp_version; |
|
372 | + global $wp_version; |
|
373 | 373 | |
374 | 374 | $compatible_php_version = apply_filters( 'monsterinsights_compatible_php_version', false ); |
375 | 375 | $compatible_wp_version = apply_filters( 'monsterinsights_compatible_wp_version', false ); |
@@ -393,28 +393,28 @@ discard block |
||
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
396 | - // WordPress 4.9 |
|
397 | - /* else if ( version_compare( $wp_version, '5.0', '<' ) ) { |
|
396 | + // WordPress 4.9 |
|
397 | + /* else if ( version_compare( $wp_version, '5.0', '<' ) ) { |
|
398 | 398 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
399 | 399 | // Translators: Placeholders add the current WordPress version and links to the MonsterInsights blog |
400 | 400 | $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 5.0 in 2021.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
401 | 401 | echo '<div class="error"><p>'. $message.'</p></div>'; |
402 | 402 | return; |
403 | 403 | } */ |
404 | - // PHP 5.4/5.5 |
|
405 | - // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
406 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
407 | - // $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>' ); |
|
408 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
409 | - // return; |
|
410 | - // } |
|
411 | - // // WordPress 4.6 - 4.8 |
|
412 | - // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
413 | - // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
414 | - // $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>' ); |
|
415 | - // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
416 | - // return; |
|
417 | - // } |
|
404 | + // PHP 5.4/5.5 |
|
405 | + // else if ( version_compare( phpversion(), '5.6', '<' ) ) { |
|
406 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
407 | + // $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>' ); |
|
408 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
409 | + // return; |
|
410 | + // } |
|
411 | + // // WordPress 4.6 - 4.8 |
|
412 | + // else if ( version_compare( $wp_version, '4.9', '<' ) ) { |
|
413 | + // $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
|
414 | + // $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>' ); |
|
415 | + // echo '<div class="error"><p>'. $message.'</p></div>'; |
|
416 | + // return; |
|
417 | + // } |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // 5. Optin setting not configured |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | $notices = get_option( 'monsterinsights_notices' ); |
446 | 446 | if ( ! is_array( $notices ) ) { |
447 | - $notices = array(); |
|
447 | + $notices = array(); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | // 6. Authenticate, not manual |
@@ -488,75 +488,75 @@ discard block |
||
488 | 488 | |
489 | 489 | // 8. WooUpsell |
490 | 490 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
491 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
492 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
493 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
494 | - echo '<p><strong>'; |
|
495 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
496 | - echo '</strong></p>'; |
|
497 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
498 | - echo '<p>'; |
|
499 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
500 | - echo '</p>'; |
|
501 | - echo '<p>'; |
|
502 | - 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' ); |
|
503 | - echo '</p>'; |
|
504 | - echo '<p>'; |
|
505 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
506 | - echo '</p>'; |
|
507 | - echo '<p>'; |
|
508 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
509 | - echo '</p>'; |
|
510 | - // Translators: Placeholders add a link to the MonsterInsights website. |
|
511 | - 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>' ); |
|
512 | - echo '</p>'; |
|
513 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
514 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
515 | - echo '</div>'; |
|
516 | - echo '</div>'; |
|
517 | - echo '<style type="text/css">.monsterinsights-wooedd-upsell-left{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-right{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-image{width:100%;height:auto;padding:20px}.monsterinsights-wooedd-upsell-image-small{display:none}.monsterinsights-wooedd-upsell-row{display:table}.monsterinsights-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width:900px){.monsterinsights-wooedd-upsell-left{width:100%}.monsterinsights-wooedd-upsell-right{display:none}.monsterinsights-wooedd-upsell-image-small{display:block}.monsterinsights-wooedd-upsell-image-large{display:none}}</style>'; |
|
518 | - return; |
|
519 | - } |
|
491 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
492 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
493 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
494 | + echo '<p><strong>'; |
|
495 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
496 | + echo '</strong></p>'; |
|
497 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
498 | + echo '<p>'; |
|
499 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
500 | + echo '</p>'; |
|
501 | + echo '<p>'; |
|
502 | + 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' ); |
|
503 | + echo '</p>'; |
|
504 | + echo '<p>'; |
|
505 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
506 | + echo '</p>'; |
|
507 | + echo '<p>'; |
|
508 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
509 | + echo '</p>'; |
|
510 | + // Translators: Placeholders add a link to the MonsterInsights website. |
|
511 | + 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>' ); |
|
512 | + echo '</p>'; |
|
513 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
514 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
515 | + echo '</div>'; |
|
516 | + echo '</div>'; |
|
517 | + echo '<style type="text/css">.monsterinsights-wooedd-upsell-left{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-right{width:50%;display:table-cell;float:left}.monsterinsights-wooedd-upsell-image{width:100%;height:auto;padding:20px}.monsterinsights-wooedd-upsell-image-small{display:none}.monsterinsights-wooedd-upsell-row{display:table}.monsterinsights-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width:900px){.monsterinsights-wooedd-upsell-left{width:100%}.monsterinsights-wooedd-upsell-right{display:none}.monsterinsights-wooedd-upsell-image-small{display:block}.monsterinsights-wooedd-upsell-image-large{display:none}}</style>'; |
|
518 | + return; |
|
519 | + } |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | // 9. EDDUpsell |
523 | 523 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
524 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
525 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
526 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
527 | - echo '<p><strong>'; |
|
528 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
529 | - echo '</strong></p>'; |
|
530 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
531 | - echo '<p>'; |
|
532 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
533 | - echo '</p>'; |
|
534 | - echo '<p>'; |
|
535 | - 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' ); |
|
536 | - echo '</p>'; |
|
537 | - echo '<p>'; |
|
538 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
539 | - echo '</p>'; |
|
540 | - echo '<p>'; |
|
541 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
542 | - echo '</p>'; |
|
543 | - 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>' ); |
|
544 | - echo '</p>'; |
|
545 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
546 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
547 | - echo '</div>'; |
|
548 | - echo '</div>'; |
|
549 | - return; |
|
550 | - } |
|
524 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
525 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
526 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
527 | + echo '<p><strong>'; |
|
528 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
529 | + echo '</strong></p>'; |
|
530 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
531 | + echo '<p>'; |
|
532 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
533 | + echo '</p>'; |
|
534 | + echo '<p>'; |
|
535 | + 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' ); |
|
536 | + echo '</p>'; |
|
537 | + echo '<p>'; |
|
538 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
539 | + echo '</p>'; |
|
540 | + echo '<p>'; |
|
541 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
542 | + echo '</p>'; |
|
543 | + 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>' ); |
|
544 | + echo '</p>'; |
|
545 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
546 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
547 | + echo '</div>'; |
|
548 | + echo '</div>'; |
|
549 | + return; |
|
550 | + } |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
554 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
555 | - $page = $page . '#/advanced'; |
|
556 | - // Translators: Adds a link to the settings panel. |
|
557 | - $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>' ); |
|
558 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
559 | - return; |
|
554 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
555 | + $page = $page . '#/advanced'; |
|
556 | + // Translators: Adds a link to the settings panel. |
|
557 | + $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>' ); |
|
558 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
559 | + return; |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // AM Notices |
567 | 567 | function monsterinsights_am_notice_optout( $super_admin ) { |
568 | 568 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
569 | - return false; |
|
569 | + return false; |
|
570 | 570 | } |
571 | 571 | return $super_admin; |
572 | 572 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | if ( $hook === 'monsterinsights_settings' ) { |
30 | 30 | // If dashboards disabled, first settings page |
31 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
31 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
32 | 32 | $hook = 'monsterinsights_settings'; |
33 | 33 | |
34 | 34 | add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
35 | 35 | } else { |
36 | 36 | // if dashboards enabled, first dashboard |
37 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
37 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | 38 | |
39 | 39 | add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
40 | 40 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
122 | 122 | $hook = 'monsterinsights_network'; |
123 | 123 | $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
124 | - add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
124 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
125 | 125 | |
126 | 126 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
127 | 127 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function monsterinsights_add_admin_body_class_tools_page( $classes ) { |
171 | 171 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
172 | 172 | |
173 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
173 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
174 | 174 | return $classes; |
175 | 175 | } |
176 | 176 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
188 | 188 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
189 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
189 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
190 | 190 | return $classes; |
191 | 191 | } |
192 | 192 | |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | * @return array $links |
203 | 203 | */ |
204 | 204 | function monsterinsights_add_action_links( $links ) { |
205 | - $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="'. monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>'; |
|
205 | + $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) . '">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>'; |
|
206 | 206 | array_unshift( $links, $docs ); |
207 | 207 | |
208 | 208 | // If Lite, support goes to forum. If pro, it goes to our website |
209 | 209 | if ( monsterinsights_is_pro_version() ) { |
210 | - $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
210 | + $support = '<a title="MonsterInsights Pro Support" href="' . monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
211 | 211 | array_unshift( $links, $support ); |
212 | 212 | } else { |
213 | - $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
213 | + $support = '<a title="MonsterInsights Lite Support" href="' . monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
214 | 214 | array_unshift( $links, $support ); |
215 | 215 | } |
216 | 216 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | // If lite, show a link where they can get pro from |
226 | 226 | if ( ! monsterinsights_is_pro_version() ) { |
227 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/" ) .'" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
227 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/" ) . '" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
228 | 228 | array_unshift( $links, $get_pro ); |
229 | 229 | } |
230 | 230 | |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
250 | 250 | |
251 | 251 | if ( file_exists( $dir . $template . '.php' ) ) { |
252 | - require_once( $dir . $template . '.php' ); |
|
252 | + require_once( $dir . $template . '.php' ); |
|
253 | 253 | return true; |
254 | 254 | } |
255 | 255 | } else { |
256 | 256 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
257 | 257 | |
258 | 258 | if ( file_exists( $dir . $template . '.php' ) ) { |
259 | - require_once( $dir . $template . '.php' ); |
|
259 | + require_once( $dir . $template . '.php' ); |
|
260 | 260 | return true; |
261 | 261 | } |
262 | 262 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
265 | 265 | |
266 | 266 | if ( file_exists( $dir . $template . '.php' ) ) { |
267 | - require_once( $dir . $template . '.php' ); |
|
267 | + require_once( $dir . $template . '.php' ); |
|
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
285 | 285 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
286 | 286 | // Translators: Placeholders add a link to the wordpress.org repository. |
287 | - $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
287 | + $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
288 | 288 | } |
289 | 289 | return $text; |
290 | 290 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' ); |
326 | 326 | $urltwo = $submenu_base . '#/about/getting-started'; |
327 | 327 | $message = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' ); |
328 | - echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>'; |
|
328 | + echo '<div class="notice notice-info"><p style="font-weight:700">' . $title . '</p><p>' . $message . '</p><p><a href="' . $urlone . '" class="button-primary">' . $primary . '</a> <a href="' . $urltwo . '" class="button-secondary">' . $secondary . '</a></p></div>'; |
|
329 | 329 | return; |
330 | 330 | } |
331 | 331 | |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
335 | 335 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
336 | 336 | // Translators: Adds a link to retrieve the license. |
337 | - $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
338 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
337 | + $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' ); |
|
338 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
339 | 339 | return; |
340 | 340 | } |
341 | 341 | |
342 | 342 | // 3. License key not valid/okay for pro |
343 | 343 | if ( monsterinsights_is_pro_version() ) { |
344 | 344 | $message = ''; |
345 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
345 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
346 | 346 | if ( MonsterInsights()->license->site_license_expired() ) { |
347 | 347 | // Translators: Adds a link to the license renewal. |
348 | - $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
348 | + $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
349 | 349 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
350 | 350 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
351 | 351 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
355 | 355 | if ( MonsterInsights()->license->network_license_expired() ) { |
356 | 356 | // Translators: Adds a link to renew license. |
357 | - $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
357 | + $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
358 | 358 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
359 | 359 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
360 | 360 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | } |
363 | 363 | } |
364 | 364 | if ( ! empty( $message ) ) { |
365 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
365 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
366 | 366 | return; |
367 | 367 | } |
368 | 368 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | if ( $message ) { |
392 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
392 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | // } |
443 | 443 | // } |
444 | 444 | |
445 | - $notices = get_option( 'monsterinsights_notices' ); |
|
445 | + $notices = get_option( 'monsterinsights_notices' ); |
|
446 | 446 | if ( ! is_array( $notices ) ) { |
447 | 447 | $notices = array(); |
448 | 448 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | // 8. WooUpsell |
490 | 490 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
491 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
491 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
492 | 492 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
493 | 493 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
494 | 494 | echo '<p><strong>'; |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
509 | 509 | echo '</p>'; |
510 | 510 | // Translators: Placeholders add a link to the MonsterInsights website. |
511 | - 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>' ); |
|
511 | + 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>' ); |
|
512 | 512 | echo '</p>'; |
513 | 513 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
514 | 514 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | // 9. EDDUpsell |
523 | 523 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
524 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
524 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
525 | 525 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
526 | 526 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
527 | 527 | echo '<p><strong>'; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | echo '<p>'; |
541 | 541 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
542 | 542 | echo '</p>'; |
543 | - 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>' ); |
|
543 | + 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>' ); |
|
544 | 544 | echo '</p>'; |
545 | 545 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
546 | 546 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
555 | 555 | $page = $page . '#/advanced'; |
556 | 556 | // Translators: Adds a link to the settings panel. |
557 | - $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>' ); |
|
558 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
557 | + $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>' ); |
|
558 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | } |
@@ -618,10 +618,10 @@ discard block |
||
618 | 618 | 'Your Measurement Protocol API Secret is currently left blank, so you won\'t be able to use some of the tracking features with your GA4 property. %1$sPlease enter your Measurement Protocol API Secret here.%2$s', |
619 | 619 | 'google-analytics-for-wordpress' |
620 | 620 | ), |
621 | - '<a href="' . esc_url( $page ). '">', |
|
621 | + '<a href="' . esc_url( $page ) . '">', |
|
622 | 622 | '</a>' |
623 | 623 | ); |
624 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
624 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | add_action( 'admin_notices', 'monsterinsights_empty_measurement_protocol_token' ); |
@@ -97,7 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | $options = apply_filters( 'upgrader_package_options', $options ); |
99 | 99 | |
100 | - if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times |
|
100 | + if ( ! $options['is_multi'] ) { |
|
101 | +// call $this->header separately if running multiple times |
|
101 | 102 | $this->skin->header(); |
102 | 103 | } |
103 | 104 | |
@@ -288,7 +289,8 @@ discard block |
||
288 | 289 | return $reply; |
289 | 290 | } |
290 | 291 | |
291 | - if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote? |
|
292 | + if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { |
|
293 | +//Local file or remote? |
|
292 | 294 | return $package; //must be a local file.. |
293 | 295 | } |
294 | 296 | |
@@ -443,11 +445,13 @@ discard block |
||
443 | 445 | $remote_destination = $wp_filesystem->find_folder( $local_destination ); |
444 | 446 | |
445 | 447 | //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. |
446 | - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents. |
|
448 | + if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { |
|
449 | +//Only one folder? Then we want its contents. |
|
447 | 450 | $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); |
448 | 451 | } elseif ( count( $source_files ) == 0 ) { |
449 | 452 | return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? |
450 | - } else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
453 | + } else { |
|
454 | +// It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
451 | 455 | $source = trailingslashit( $args['source'] ); |
452 | 456 | } |
453 | 457 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if ( ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
125 | 125 | $message = empty( $message ) ? '' : ' ' . $message; |
126 | 126 | // Translators: Placeholders add the hook name, plugin version and bold text. |
127 | - trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html ( $message ) ); |
|
127 | + trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html( $message ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if ( ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
180 | 180 | // Translators: Placeholders add the hook name, plugin version and bold text. |
181 | 181 | trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s.', 'google-analytics-for-wordpress' ), $function, $version, '<strong>', '</strong>' ) ); |
182 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
182 | + trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
183 | 183 | // Alternatively we could dump this to a file. |
184 | 184 | } |
185 | 185 | } |
@@ -87,7 +87,8 @@ |
||
87 | 87 | delete_transient( '_monsterinsights_activation_redirect' ); |
88 | 88 | |
89 | 89 | // Bail if activating from network, or bulk. |
90 | - if ( isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok. |
|
90 | + if ( isset( $_GET['activate-multi'] ) ) { |
|
91 | +// WPCS: CSRF ok, input var ok. |
|
91 | 92 | return; |
92 | 93 | } |
93 | 94 |
@@ -155,25 +155,25 @@ discard block |
||
155 | 155 | $this->network = is_network_admin() || ! empty( $args['network'] ); |
156 | 156 | |
157 | 157 | $default_token = $this->network ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token(); |
158 | - $default_key = $this->network ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(); |
|
158 | + $default_key = $this->network ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(); |
|
159 | 159 | |
160 | - $this->token = ! empty( $args['token'] ) ? $args['token'] : $default_token; |
|
161 | - $this->key = ! empty( $args['key'] ) ? $args['key'] : $default_key; |
|
162 | - $this->tt = ! empty( $args['tt'] ) ? $args['tt'] : ''; |
|
163 | - $this->return = ! empty( $args['return'] ) ? $args['return'] : ''; |
|
164 | - $this->start = ! empty( $args['start'] ) ? $args['start'] : ''; |
|
165 | - $this->end = ! empty( $args['end'] ) ? $args['end'] : ''; |
|
160 | + $this->token = ! empty( $args['token'] ) ? $args['token'] : $default_token; |
|
161 | + $this->key = ! empty( $args['key'] ) ? $args['key'] : $default_key; |
|
162 | + $this->tt = ! empty( $args['tt'] ) ? $args['tt'] : ''; |
|
163 | + $this->return = ! empty( $args['return'] ) ? $args['return'] : ''; |
|
164 | + $this->start = ! empty( $args['start'] ) ? $args['start'] : ''; |
|
165 | + $this->end = ! empty( $args['end'] ) ? $args['end'] : ''; |
|
166 | 166 | |
167 | 167 | // We need to do this hack so that the network panel + the site_url of the main site are distinct |
168 | 168 | $this->site_url = is_network_admin() ? network_admin_url() : site_url(); |
169 | 169 | |
170 | 170 | if ( monsterinsights_is_pro_version() ) { |
171 | - $this->license = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
171 | + $this->license = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
172 | 172 | } |
173 | 173 | $this->plugin = MonsterInsights()->plugin_slug; |
174 | 174 | $this->miversion = MONSTERINSIGHTS_VERSION; |
175 | - $this->sitei = ! empty( $args['sitei'] ) ? $args['sitei'] : ''; |
|
176 | - $this->testurl = ! empty( $args['testurl'] ) ? $args['testurl'] : ''; |
|
175 | + $this->sitei = ! empty( $args['sitei'] ) ? $args['sitei'] : ''; |
|
176 | + $this->testurl = ! empty( $args['testurl'] ) ? $args['testurl'] : ''; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function request() { |
187 | 187 | // Make sure we're not blocked |
188 | 188 | $blocked = $this->is_blocked( $this->url ); |
189 | - if ( $blocked || is_wp_error( $blocked ) ) { |
|
189 | + if ( $blocked || is_wp_error( $blocked ) ) { |
|
190 | 190 | if ( is_wp_error( $blocked ) ) { |
191 | 191 | // Translators: Placeholder gets replaced with the error message. |
192 | 192 | return new WP_Error( 'api-error', sprintf( __( 'The firewall of your server is blocking outbound calls. Please contact your hosting provider to fix this issue. %s', 'google-analytics-for-wordpress' ), $blocked->get_error_message() ) ); |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | if ( 'GET' == $this->method ) { |
247 | - $body['time'] = time(); // just to avoid caching |
|
247 | + $body['time'] = time(); // just to avoid caching |
|
248 | 248 | } |
249 | 249 | |
250 | - $body['timezone'] = date('e'); |
|
250 | + $body['timezone'] = date( 'e' ); |
|
251 | 251 | |
252 | 252 | $body['network'] = $this->network ? 'network' : 'site'; |
253 | 253 | |
254 | - $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
254 | + $body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''; |
|
255 | 255 | |
256 | 256 | // This filter will be removed in the future. |
257 | 257 | $body = apply_filters( 'monsterinsights_api_request_body', $body ); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | |
284 | 284 | // Perform the query and retrieve the response. |
285 | - $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
285 | + $response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data ); |
|
286 | 286 | |
287 | 287 | //return new WP_Error( 'debug', '<pre>' . var_export( $response, true ) . '</pre>' ); |
288 | 288 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | // If not a 200 status header, send back error. |
303 | 303 | if ( 200 != $response_code ) { |
304 | - $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
304 | + $type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error'; |
|
305 | 305 | |
306 | 306 | if ( empty( $response_code ) ) { |
307 | 307 | return new WP_Error( $type, __( 'The API was unreachable.', 'google-analytics-for-wordpress' ) ); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | // and for image linking purposes in Google Images. We use it to test outbound connections since it is run on google.com |
393 | 393 | // and is only a few bytes large. Plus on Google's main CDN so it loads in most places in 0.07 seconds or less. Perfect for our |
394 | 394 | // use case of quickly testing outbound connections. |
395 | - $testurl = ! empty( $this->testurl ) ? $this->testurl :'https://www.google.com/blank.html'; |
|
395 | + $testurl = ! empty( $this->testurl ) ? $this->testurl : 'https://www.google.com/blank.html'; |
|
396 | 396 | if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { |
397 | 397 | if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { |
398 | 398 | $wp_http = new WP_Http(); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | 'body' => '' |
408 | 408 | ); |
409 | 409 | $response = wp_remote_get( $testurl, $params ); |
410 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
410 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
411 | 411 | return false; |
412 | 412 | } else { |
413 | 413 | if ( is_wp_error( $response ) ) { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | ); |
430 | 430 | $response = wp_remote_get( $testurl, $params ); |
431 | 431 | |
432 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
432 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
433 | 433 | return false; |
434 | 434 | } else { |
435 | 435 | if ( is_wp_error( $response ) ) { |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function __construct($baseDirectory = __DIR__) |
15 | 15 | { |
16 | - $this->directory = $baseDirectory; |
|
17 | - $this->prefix = __NAMESPACE__ . '\\'; |
|
18 | - $this->prefixLength = strlen($this->prefix); |
|
16 | + $this->directory = $baseDirectory; |
|
17 | + $this->prefix = __NAMESPACE__ . '\\'; |
|
18 | + $this->prefixLength = strlen($this->prefix); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public static function register($prepend = false) |
27 | 27 | { |
28 | - spl_autoload_register(array(new self, 'autoload'), true, $prepend); |
|
28 | + spl_autoload_register(array(new self, 'autoload'), true, $prepend); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function autoload($className) |
37 | 37 | { |
38 | - if (0 === strpos($className, $this->prefix)) { |
|
39 | - $parts = explode('\\', substr($className, $this->prefixLength)); |
|
40 | - $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; |
|
38 | + if (0 === strpos($className, $this->prefix)) { |
|
39 | + $parts = explode('\\', substr($className, $this->prefixLength)); |
|
40 | + $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; |
|
41 | 41 | |
42 | - if (is_file($filepath)) { |
|
43 | - require($filepath); |
|
44 | - } |
|
45 | - } |
|
42 | + if (is_file($filepath)) { |
|
43 | + require($filepath); |
|
44 | + } |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @param string $baseDirectory Base directory where the source files are located. |
13 | 13 | */ |
14 | - public function __construct($baseDirectory = __DIR__) |
|
14 | + public function __construct( $baseDirectory = __DIR__ ) |
|
15 | 15 | { |
16 | 16 | $this->directory = $baseDirectory; |
17 | 17 | $this->prefix = __NAMESPACE__ . '\\'; |
18 | - $this->prefixLength = strlen($this->prefix); |
|
18 | + $this->prefixLength = strlen( $this->prefix ); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param bool $prepend Prepend the autoloader on the stack instead of appending it. |
25 | 25 | */ |
26 | - public static function register($prepend = false) |
|
26 | + public static function register( $prepend = false ) |
|
27 | 27 | { |
28 | - spl_autoload_register(array(new self, 'autoload'), true, $prepend); |
|
28 | + spl_autoload_register( array( new self, 'autoload' ), true, $prepend ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param string $className Fully qualified name of a class. |
35 | 35 | */ |
36 | - public function autoload($className) |
|
36 | + public function autoload( $className ) |
|
37 | 37 | { |
38 | - if (0 === strpos($className, $this->prefix)) { |
|
39 | - $parts = explode('\\', substr($className, $this->prefixLength)); |
|
40 | - $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; |
|
38 | + if ( 0 === strpos( $className, $this->prefix ) ) { |
|
39 | + $parts = explode( '\\', substr( $className, $this->prefixLength ) ); |
|
40 | + $filepath = $this->directory . DIRECTORY_SEPARATOR . implode( DIRECTORY_SEPARATOR, $parts ) . '.php'; |
|
41 | 41 | |
42 | - if (is_file($filepath)) { |
|
43 | - require($filepath); |
|
42 | + if ( is_file( $filepath ) ) { |
|
43 | + require( $filepath ); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace PHPInsight; |
4 | 4 | |
5 | -class Autoloader |
|
6 | -{ |
|
5 | +class Autoloader { |
|
7 | 6 | private $directory; |
8 | 7 | private $prefix; |
9 | 8 | private $prefixLength; |
@@ -11,8 +10,7 @@ discard block |
||
11 | 10 | /** |
12 | 11 | * @param string $baseDirectory Base directory where the source files are located. |
13 | 12 | */ |
14 | - public function __construct($baseDirectory = __DIR__) |
|
15 | - { |
|
13 | + public function __construct($baseDirectory = __DIR__) { |
|
16 | 14 | $this->directory = $baseDirectory; |
17 | 15 | $this->prefix = __NAMESPACE__ . '\\'; |
18 | 16 | $this->prefixLength = strlen($this->prefix); |
@@ -23,8 +21,7 @@ discard block |
||
23 | 21 | * |
24 | 22 | * @param bool $prepend Prepend the autoloader on the stack instead of appending it. |
25 | 23 | */ |
26 | - public static function register($prepend = false) |
|
27 | - { |
|
24 | + public static function register($prepend = false) { |
|
28 | 25 | spl_autoload_register(array(new self, 'autoload'), true, $prepend); |
29 | 26 | } |
30 | 27 | |
@@ -33,8 +30,7 @@ discard block |
||
33 | 30 | * |
34 | 31 | * @param string $className Fully qualified name of a class. |
35 | 32 | */ |
36 | - public function autoload($className) |
|
37 | - { |
|
33 | + public function autoload($className) { |
|
38 | 34 | if (0 === strpos($className, $this->prefix)) { |
39 | 35 | $parts = explode('\\', substr($className, $this->prefixLength)); |
40 | 36 | $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * Classification of opinions |
66 | 66 | * @var array |
67 | 67 | */ |
68 | - private $classes = array('pos', 'neg', 'neu'); |
|
68 | + private $classes = array( 'pos', 'neg', 'neu' ); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Token score per class |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | * @param str $dataFolder base folder |
115 | 115 | * Sets defaults and loads/caches dictionaries |
116 | 116 | */ |
117 | - public function __construct($dataFolder = false) { |
|
117 | + public function __construct( $dataFolder = false ) { |
|
118 | 118 | |
119 | 119 | //set the base folder for the data models |
120 | - $this->setDataFolder($dataFolder); |
|
120 | + $this->setDataFolder( $dataFolder ); |
|
121 | 121 | |
122 | 122 | //load and cache directories, get ignore and prefix lists |
123 | 123 | $this->loadDefaults(); |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | * @param str $sentence Text to analyze |
130 | 130 | * @return int Score |
131 | 131 | */ |
132 | - public function score($sentence) { |
|
132 | + public function score( $sentence ) { |
|
133 | 133 | |
134 | 134 | //For each negative prefix in the list |
135 | - foreach ($this->negPrefixList as $negPrefix) { |
|
135 | + foreach ( $this->negPrefixList as $negPrefix ) { |
|
136 | 136 | |
137 | 137 | //Search if that prefix is in the document |
138 | - if (strpos($sentence, $negPrefix) !== false) { |
|
138 | + if ( strpos( $sentence, $negPrefix ) !== false ) { |
|
139 | 139 | //Reove the white space after the negative prefix |
140 | - $sentence = str_replace($negPrefix . ' ', $negPrefix, $sentence); |
|
140 | + $sentence = str_replace( $negPrefix . ' ', $negPrefix, $sentence ); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | 144 | //Tokenise Document |
145 | - $tokens = $this->_getTokens($sentence); |
|
145 | + $tokens = $this->_getTokens( $sentence ); |
|
146 | 146 | // calculate the score in each category |
147 | 147 | |
148 | 148 | $total_score = 0; |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | $scores = array(); |
152 | 152 | |
153 | 153 | //Loop through all of the different classes set in the $classes variable |
154 | - foreach ($this->classes as $class) { |
|
154 | + foreach ( $this->classes as $class ) { |
|
155 | 155 | |
156 | 156 | //In the scores array add another dimention for the class and set it's value to 1. EG $scores->neg->1 |
157 | 157 | $scores[$class] = 1; |
158 | 158 | |
159 | 159 | //For each of the individual words used loop through to see if they match anything in the $dictionary |
160 | - foreach ($tokens as $token) { |
|
160 | + foreach ( $tokens as $token ) { |
|
161 | 161 | |
162 | 162 | //If statement so to ignore tokens which are either too long or too short or in the $ignoreList |
163 | - if (strlen($token) > $this->minTokenLength && strlen($token) < $this->maxTokenLength && !in_array($token, $this->ignoreList)) { |
|
163 | + if ( strlen( $token ) > $this->minTokenLength && strlen( $token ) < $this->maxTokenLength && ! in_array( $token, $this->ignoreList ) ) { |
|
164 | 164 | //If dictionary[token][class] is set |
165 | - if (isset($this->dictionary[$token][$class])) { |
|
165 | + if ( isset( $this->dictionary[$token][$class] ) ) { |
|
166 | 166 | //Set count equal to it |
167 | 167 | $count = $this->dictionary[$token][$class]; |
168 | 168 | } else { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | //Score[class] is calcumeted by $scores[class] x $count +1 divided by the $classTokCounts[class] + $tokCount |
173 | - $scores[$class] *= ($count + 1); |
|
173 | + $scores[$class] *= ( $count + 1 ); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | //Makes the scores relative percents |
182 | - foreach ($this->classes as $class) { |
|
182 | + foreach ( $this->classes as $class ) { |
|
183 | 183 | $total_score += $scores[$class]; |
184 | 184 | } |
185 | 185 | |
186 | - foreach ($this->classes as $class) { |
|
187 | - $scores[$class] = round($scores[$class] / $total_score, 3); |
|
186 | + foreach ( $this->classes as $class ) { |
|
187 | + $scores[$class] = round( $scores[$class] / $total_score, 3 ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | //Sort array in reverse order |
191 | - arsort($scores); |
|
191 | + arsort( $scores ); |
|
192 | 192 | |
193 | 193 | return $scores; |
194 | 194 | } |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | * @param str $sentence |
200 | 200 | * @return str pos|neu|neg |
201 | 201 | */ |
202 | - public function categorise($sentence) { |
|
202 | + public function categorise( $sentence ) { |
|
203 | 203 | |
204 | - $scores = $this->score($sentence); |
|
204 | + $scores = $this->score( $sentence ); |
|
205 | 205 | |
206 | 206 | //Classification is the key to the scores array |
207 | - $classification = key($scores); |
|
207 | + $classification = key( $scores ); |
|
208 | 208 | |
209 | 209 | return $classification; |
210 | 210 | } |
@@ -215,30 +215,30 @@ discard block |
||
215 | 215 | * @param str $class |
216 | 216 | * @return boolean |
217 | 217 | */ |
218 | - public function setDictionary($class) { |
|
218 | + public function setDictionary( $class ) { |
|
219 | 219 | /** |
220 | 220 | * For some people this file extention causes some problems! |
221 | 221 | */ |
222 | 222 | $fn = "{$this->dataFolder}data.{$class}.php"; |
223 | 223 | |
224 | - if (file_exists($fn)) { |
|
225 | - $temp = file_get_contents($fn); |
|
226 | - $words = unserialize($temp); |
|
224 | + if ( file_exists( $fn ) ) { |
|
225 | + $temp = file_get_contents( $fn ); |
|
226 | + $words = unserialize( $temp ); |
|
227 | 227 | } else { |
228 | 228 | echo 'File does not exist: ' . $fn; |
229 | 229 | } |
230 | 230 | |
231 | 231 | //Loop through all of the entries |
232 | - foreach ($words as $word) { |
|
232 | + foreach ( $words as $word ) { |
|
233 | 233 | |
234 | 234 | $this->docCount++; |
235 | 235 | $this->classDocCounts[$class]++; |
236 | 236 | |
237 | 237 | //Trim word |
238 | - $word = trim($word); |
|
238 | + $word = trim( $word ); |
|
239 | 239 | |
240 | 240 | //If this word isn't already in the dictionary with this class |
241 | - if (!isset($this->dictionary[$word][$class])) { |
|
241 | + if ( ! isset( $this->dictionary[$word][$class] ) ) { |
|
242 | 242 | |
243 | 243 | //Add to this word to the dictionary and set counter value as one. This function ensures that if a word is in the text file more than once it still is only accounted for one in the array |
244 | 244 | $this->dictionary[$word][$class] = 1; |
@@ -256,22 +256,22 @@ discard block |
||
256 | 256 | * @param str $dataFolder base folder |
257 | 257 | * @param bool $loadDefaults true - load everything by default | false - just change the directory |
258 | 258 | */ |
259 | - public function setDataFolder($dataFolder = false, $loadDefaults = false){ |
|
259 | + public function setDataFolder( $dataFolder = false, $loadDefaults = false ) { |
|
260 | 260 | //if $dataFolder not provided, load default, else set the provided one |
261 | - if($dataFolder == false){ |
|
261 | + if ( $dataFolder == false ) { |
|
262 | 262 | $this->dataFolder = __DIR__ . '/data/'; |
263 | 263 | } |
264 | - else{ |
|
265 | - if(file_exists($dataFolder)){ |
|
264 | + else { |
|
265 | + if ( file_exists( $dataFolder ) ) { |
|
266 | 266 | $this->dataFolder = $dataFolder; |
267 | 267 | } |
268 | - else{ |
|
269 | - echo 'Error: could not find the directory - '.$dataFolder; |
|
268 | + else { |
|
269 | + echo 'Error: could not find the directory - ' . $dataFolder; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | 273 | //load default directories, ignore and prefixe lists |
274 | - if($loadDefaults !== false){ |
|
274 | + if ( $loadDefaults !== false ) { |
|
275 | 275 | $this->loadDefaults(); |
276 | 276 | } |
277 | 277 | } |
@@ -279,29 +279,29 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * Load and cache directories, get ignore and prefix lists |
281 | 281 | */ |
282 | - private function loadDefaults(){ |
|
282 | + private function loadDefaults() { |
|
283 | 283 | // Load and cache dictionaries |
284 | - foreach ($this->classes as $class) { |
|
285 | - if (!$this->setDictionary($class)) { |
|
284 | + foreach ( $this->classes as $class ) { |
|
285 | + if ( ! $this->setDictionary( $class ) ) { |
|
286 | 286 | echo "Error: Dictionary for class '$class' could not be loaded"; |
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | - if (!isset($this->dictionary) || empty($this->dictionary)) |
|
290 | + if ( ! isset( $this->dictionary ) || empty( $this->dictionary ) ) |
|
291 | 291 | echo 'Error: Dictionaries not set'; |
292 | 292 | |
293 | 293 | //Run function to get ignore list |
294 | - $this->ignoreList = $this->getList('ign'); |
|
294 | + $this->ignoreList = $this->getList( 'ign' ); |
|
295 | 295 | |
296 | 296 | //If ingnoreList not get give error message |
297 | - if (!isset($this->ignoreList)) |
|
297 | + if ( ! isset( $this->ignoreList ) ) |
|
298 | 298 | echo 'Error: Ignore List not set'; |
299 | 299 | |
300 | 300 | //Get the list of negative prefixes |
301 | - $this->negPrefixList = $this->getList('prefix'); |
|
301 | + $this->negPrefixList = $this->getList( 'prefix' ); |
|
302 | 302 | |
303 | 303 | //If neg prefix list not set give error |
304 | - if (!isset($this->negPrefixList)) |
|
304 | + if ( ! isset( $this->negPrefixList ) ) |
|
305 | 305 | echo 'Error: Ignore List not set'; |
306 | 306 | } |
307 | 307 | |
@@ -311,20 +311,20 @@ discard block |
||
311 | 311 | * @param str $string String being broken up |
312 | 312 | * @return array An array of tokens |
313 | 313 | */ |
314 | - private function _getTokens($string) { |
|
314 | + private function _getTokens( $string ) { |
|
315 | 315 | |
316 | 316 | // Replace line endings with spaces |
317 | - $string = str_replace("\r\n", " ", $string); |
|
317 | + $string = str_replace( "\r\n", " ", $string ); |
|
318 | 318 | |
319 | 319 | //Clean the string so is free from accents |
320 | - $string = $this->_cleanString($string); |
|
320 | + $string = $this->_cleanString( $string ); |
|
321 | 321 | |
322 | 322 | //Make all texts lowercase as the database of words in in lowercase |
323 | - $string = strtolower($string); |
|
324 | - $string = preg_replace('/[[:punct:]]+/', '', $string); |
|
323 | + $string = strtolower( $string ); |
|
324 | + $string = preg_replace( '/[[:punct:]]+/', '', $string ); |
|
325 | 325 | |
326 | 326 | //Break string into individual words using explode putting them into an array |
327 | - $matches = explode(' ', $string); |
|
327 | + $matches = explode( ' ', $string ); |
|
328 | 328 | |
329 | 329 | //Return array with each individual token |
330 | 330 | return $matches; |
@@ -336,28 +336,28 @@ discard block |
||
336 | 336 | * @param str $type |
337 | 337 | * @return array |
338 | 338 | */ |
339 | - public function getList($type) { |
|
339 | + public function getList( $type ) { |
|
340 | 340 | //Set up empty word list array |
341 | 341 | $wordList = array(); |
342 | 342 | |
343 | 343 | $fn = "{$this->dataFolder}data.{$type}.php"; |
344 | 344 | ; |
345 | - if (file_exists($fn)) { |
|
346 | - $temp = file_get_contents($fn); |
|
347 | - $words = unserialize($temp); |
|
345 | + if ( file_exists( $fn ) ) { |
|
346 | + $temp = file_get_contents( $fn ); |
|
347 | + $words = unserialize( $temp ); |
|
348 | 348 | } else { |
349 | 349 | return 'File does not exist: ' . $fn; |
350 | 350 | } |
351 | 351 | |
352 | 352 | //Loop through results |
353 | - foreach ($words as $word) { |
|
353 | + foreach ( $words as $word ) { |
|
354 | 354 | //remove any slashes |
355 | - $word = stripcslashes($word); |
|
355 | + $word = stripcslashes( $word ); |
|
356 | 356 | //Trim word |
357 | - $trimmed = trim($word); |
|
357 | + $trimmed = trim( $word ); |
|
358 | 358 | |
359 | 359 | //Push results into $wordList array |
360 | - array_push($wordList, $trimmed); |
|
360 | + array_push( $wordList, $trimmed ); |
|
361 | 361 | } |
362 | 362 | //Return $wordList |
363 | 363 | return $wordList; |
@@ -369,49 +369,49 @@ discard block |
||
369 | 369 | * @param str $string |
370 | 370 | * @return str |
371 | 371 | */ |
372 | - private function _cleanString($string) { |
|
372 | + private function _cleanString( $string ) { |
|
373 | 373 | |
374 | 374 | $diac = |
375 | - /* A */ chr(192) . chr(193) . chr(194) . chr(195) . chr(196) . chr(197) . |
|
376 | - /* a */ chr(224) . chr(225) . chr(226) . chr(227) . chr(228) . chr(229) . |
|
377 | - /* O */ chr(210) . chr(211) . chr(212) . chr(213) . chr(214) . chr(216) . |
|
378 | - /* o */ chr(242) . chr(243) . chr(244) . chr(245) . chr(246) . chr(248) . |
|
379 | - /* E */ chr(200) . chr(201) . chr(202) . chr(203) . |
|
380 | - /* e */ chr(232) . chr(233) . chr(234) . chr(235) . |
|
381 | - /* Cc */ chr(199) . chr(231) . |
|
382 | - /* I */ chr(204) . chr(205) . chr(206) . chr(207) . |
|
383 | - /* i */ chr(236) . chr(237) . chr(238) . chr(239) . |
|
384 | - /* U */ chr(217) . chr(218) . chr(219) . chr(220) . |
|
385 | - /* u */ chr(249) . chr(250) . chr(251) . chr(252) . |
|
386 | - /* yNn */ chr(255) . chr(209) . chr(241); |
|
387 | - |
|
388 | - return strtolower(strtr($string, $diac, 'AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn')); |
|
375 | + /* A */ chr( 192 ) . chr( 193 ) . chr( 194 ) . chr( 195 ) . chr( 196 ) . chr( 197 ) . |
|
376 | + /* a */ chr( 224 ) . chr( 225 ) . chr( 226 ) . chr( 227 ) . chr( 228 ) . chr( 229 ) . |
|
377 | + /* O */ chr( 210 ) . chr( 211 ) . chr( 212 ) . chr( 213 ) . chr( 214 ) . chr( 216 ) . |
|
378 | + /* o */ chr( 242 ) . chr( 243 ) . chr( 244 ) . chr( 245 ) . chr( 246 ) . chr( 248 ) . |
|
379 | + /* E */ chr( 200 ) . chr( 201 ) . chr( 202 ) . chr( 203 ) . |
|
380 | + /* e */ chr( 232 ) . chr( 233 ) . chr( 234 ) . chr( 235 ) . |
|
381 | + /* Cc */ chr( 199 ) . chr( 231 ) . |
|
382 | + /* I */ chr( 204 ) . chr( 205 ) . chr( 206 ) . chr( 207 ) . |
|
383 | + /* i */ chr( 236 ) . chr( 237 ) . chr( 238 ) . chr( 239 ) . |
|
384 | + /* U */ chr( 217 ) . chr( 218 ) . chr( 219 ) . chr( 220 ) . |
|
385 | + /* u */ chr( 249 ) . chr( 250 ) . chr( 251 ) . chr( 252 ) . |
|
386 | + /* yNn */ chr( 255 ) . chr( 209 ) . chr( 241 ); |
|
387 | + |
|
388 | + return strtolower( strtr( $string, $diac, 'AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn' ) ); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Deletes old data/data.* files |
393 | 393 | * Creates new files from updated source fi |
394 | 394 | */ |
395 | - public function reloadDictionaries(){ |
|
395 | + public function reloadDictionaries() { |
|
396 | 396 | |
397 | - foreach($this->classes as $class){ |
|
397 | + foreach ( $this->classes as $class ) { |
|
398 | 398 | $fn = "{$this->dataFolder}data.{$class}.php"; |
399 | - if (file_exists($fn)) { |
|
400 | - unlink($fn); |
|
399 | + if ( file_exists( $fn ) ) { |
|
400 | + unlink( $fn ); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | 404 | $dictionaries = __DIR__ . '/dictionaries/'; |
405 | 405 | |
406 | - foreach($this->classes as $class){ |
|
406 | + foreach ( $this->classes as $class ) { |
|
407 | 407 | $dict = "{$dictionaries}source.{$class}.php"; |
408 | 408 | |
409 | - require_once($dict); |
|
409 | + require_once( $dict ); |
|
410 | 410 | |
411 | 411 | $data = $class; |
412 | 412 | |
413 | 413 | $fn = "{$this->dataFolder}data.{$class}.php"; |
414 | - file_put_contents($fn, serialize($$data)); |
|
414 | + file_put_contents( $fn, serialize( $$data ) ); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 |
@@ -256,22 +256,20 @@ discard block |
||
256 | 256 | * @param str $dataFolder base folder |
257 | 257 | * @param bool $loadDefaults true - load everything by default | false - just change the directory |
258 | 258 | */ |
259 | - public function setDataFolder($dataFolder = false, $loadDefaults = false){ |
|
259 | + public function setDataFolder($dataFolder = false, $loadDefaults = false) { |
|
260 | 260 | //if $dataFolder not provided, load default, else set the provided one |
261 | - if($dataFolder == false){ |
|
261 | + if($dataFolder == false) { |
|
262 | 262 | $this->dataFolder = __DIR__ . '/data/'; |
263 | - } |
|
264 | - else{ |
|
265 | - if(file_exists($dataFolder)){ |
|
263 | + } else { |
|
264 | + if(file_exists($dataFolder)) { |
|
266 | 265 | $this->dataFolder = $dataFolder; |
267 | - } |
|
268 | - else{ |
|
266 | + } else { |
|
269 | 267 | echo 'Error: could not find the directory - '.$dataFolder; |
270 | 268 | } |
271 | 269 | } |
272 | 270 | |
273 | 271 | //load default directories, ignore and prefixe lists |
274 | - if($loadDefaults !== false){ |
|
272 | + if($loadDefaults !== false) { |
|
275 | 273 | $this->loadDefaults(); |
276 | 274 | } |
277 | 275 | } |
@@ -279,7 +277,7 @@ discard block |
||
279 | 277 | /** |
280 | 278 | * Load and cache directories, get ignore and prefix lists |
281 | 279 | */ |
282 | - private function loadDefaults(){ |
|
280 | + private function loadDefaults() { |
|
283 | 281 | // Load and cache dictionaries |
284 | 282 | foreach ($this->classes as $class) { |
285 | 283 | if (!$this->setDictionary($class)) { |
@@ -287,22 +285,25 @@ discard block |
||
287 | 285 | } |
288 | 286 | } |
289 | 287 | |
290 | - if (!isset($this->dictionary) || empty($this->dictionary)) |
|
291 | - echo 'Error: Dictionaries not set'; |
|
288 | + if (!isset($this->dictionary) || empty($this->dictionary)) { |
|
289 | + echo 'Error: Dictionaries not set'; |
|
290 | + } |
|
292 | 291 | |
293 | 292 | //Run function to get ignore list |
294 | 293 | $this->ignoreList = $this->getList('ign'); |
295 | 294 | |
296 | 295 | //If ingnoreList not get give error message |
297 | - if (!isset($this->ignoreList)) |
|
298 | - echo 'Error: Ignore List not set'; |
|
296 | + if (!isset($this->ignoreList)) { |
|
297 | + echo 'Error: Ignore List not set'; |
|
298 | + } |
|
299 | 299 | |
300 | 300 | //Get the list of negative prefixes |
301 | 301 | $this->negPrefixList = $this->getList('prefix'); |
302 | 302 | |
303 | 303 | //If neg prefix list not set give error |
304 | - if (!isset($this->negPrefixList)) |
|
305 | - echo 'Error: Ignore List not set'; |
|
304 | + if (!isset($this->negPrefixList)) { |
|
305 | + echo 'Error: Ignore List not set'; |
|
306 | + } |
|
306 | 307 | } |
307 | 308 | |
308 | 309 | /** |
@@ -392,9 +393,9 @@ discard block |
||
392 | 393 | * Deletes old data/data.* files |
393 | 394 | * Creates new files from updated source fi |
394 | 395 | */ |
395 | - public function reloadDictionaries(){ |
|
396 | + public function reloadDictionaries() { |
|
396 | 397 | |
397 | - foreach($this->classes as $class){ |
|
398 | + foreach($this->classes as $class) { |
|
398 | 399 | $fn = "{$this->dataFolder}data.{$class}.php"; |
399 | 400 | if (file_exists($fn)) { |
400 | 401 | unlink($fn); |
@@ -403,7 +404,7 @@ discard block |
||
403 | 404 | |
404 | 405 | $dictionaries = __DIR__ . '/dictionaries/'; |
405 | 406 | |
406 | - foreach($this->classes as $class){ |
|
407 | + foreach($this->classes as $class) { |
|
407 | 408 | $dict = "{$dictionaries}source.{$class}.php"; |
408 | 409 | |
409 | 410 | require_once($dict); |
@@ -7,6 +7,6 @@ |
||
7 | 7 | * file that was distributed with this source code. |
8 | 8 | */ |
9 | 9 | |
10 | -require __DIR__.'/lib/PHPInsight/Autoloader.php'; |
|
10 | +require __DIR__ . '/lib/PHPInsight/Autoloader.php'; |
|
11 | 11 | |
12 | 12 | PHPInsight\Autoloader::register(); |