@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
224 | 224 | self::$instance->notices = new MonsterInsights_Notice_Admin(); |
225 | 225 | self::$instance->reporting = new MonsterInsights_Reporting(); |
226 | - self::$instance->api_auth = new MonsterInsights_API_Auth(); |
|
227 | - self::$instance->routes = new MonsterInsights_Rest_Routes(); |
|
226 | + self::$instance->api_auth = new MonsterInsights_API_Auth(); |
|
227 | + self::$instance->routes = new MonsterInsights_Rest_Routes(); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | if ( monsterinsights_is_pro_version() ) { |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_DIR' ) ) { |
331 | - define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) ); |
|
331 | + define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_URL' ) ) { |
335 | - define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) ); |
|
335 | + define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) ); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | // Traditional WordPress plugin locale filter. |
355 | - $mi_locale = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' ); |
|
355 | + $mi_locale = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' ); |
|
356 | 356 | $mi_mofile = sprintf( '%1$s-%2$s.mo', 'google-analytics-for-wordpress', $mi_locale ); |
357 | 357 | |
358 | 358 | // Look for wp-content/languages/google-analytics-for-wordpress/google-analytics-for-wordpress-{lang}_{country}.mo |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | public function monsterinsights_wp_notice() { |
392 | 392 | $url = admin_url( 'plugins.php' ); |
393 | 393 | // Check for MS dashboard |
394 | - if( is_network_admin() ) { |
|
394 | + if ( is_network_admin() ) { |
|
395 | 395 | $url = network_admin_url( 'plugins.php' ); |
396 | 396 | } |
397 | 397 | ?> |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | public function monsterinsights_pro_notice() { |
413 | 413 | $url = admin_url( 'plugins.php' ); |
414 | 414 | // Check for MS dashboard |
415 | - if( is_network_admin() ) { |
|
415 | + if ( is_network_admin() ) { |
|
416 | 416 | $url = network_admin_url( 'plugins.php' ); |
417 | 417 | } |
418 | 418 | ?> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/options.php'; |
439 | 439 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/helpers.php'; |
440 | 440 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/deprecated.php'; |
441 | - $monsterinsights_settings = monsterinsights_get_options(); |
|
441 | + $monsterinsights_settings = monsterinsights_get_options(); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return void |
454 | 454 | */ |
455 | - public function load_licensing(){ |
|
455 | + public function load_licensing() { |
|
456 | 456 | if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
457 | 457 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/license-compat.php'; |
458 | 458 | self::$instance->license = new MonsterInsights_License_Compat(); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $instance->api_auth->delete_auth(); |
611 | 611 | |
612 | 612 | // Delete data |
613 | - $instance->reporting->delete_aggregate_data('site'); |
|
613 | + $instance->reporting->delete_aggregate_data( 'site' ); |
|
614 | 614 | |
615 | 615 | restore_current_blog(); |
616 | 616 | } |
@@ -618,13 +618,13 @@ discard block |
||
618 | 618 | $instance->api_auth->uninstall_network_auth(); |
619 | 619 | |
620 | 620 | // Delete network data |
621 | - $instance->reporting->delete_aggregate_data('network'); |
|
621 | + $instance->reporting->delete_aggregate_data( 'network' ); |
|
622 | 622 | } else { |
623 | 623 | // Delete auth |
624 | 624 | $instance->api_auth->delete_auth(); |
625 | 625 | |
626 | 626 | // Delete data |
627 | - $instance->reporting->delete_aggregate_data('site'); |
|
627 | + $instance->reporting->delete_aggregate_data( 'site' ); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * |
713 | 713 | * @return void |
714 | 714 | */ |
715 | -function monsterinsights_lite_call_install_and_upgrade(){ |
|
715 | +function monsterinsights_lite_call_install_and_upgrade() { |
|
716 | 716 | add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' ); |
717 | 717 | } |
718 | 718 |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return void |
454 | 454 | */ |
455 | - public function load_licensing(){ |
|
455 | + public function load_licensing() { |
|
456 | 456 | if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { |
457 | 457 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/license-compat.php'; |
458 | 458 | self::$instance->license = new MonsterInsights_License_Compat(); |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * |
713 | 713 | * @return void |
714 | 714 | */ |
715 | -function monsterinsights_lite_call_install_and_upgrade(){ |
|
715 | +function monsterinsights_lite_call_install_and_upgrade() { |
|
716 | 716 | add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' ); |
717 | 717 | } |
718 | 718 |
@@ -40,7 +40,8 @@ |
||
40 | 40 | // Load the MonsterInsights Connect class. |
41 | 41 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/connect.php'; |
42 | 42 | |
43 | - if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { // WPCS: CSRF ok, input var ok. |
|
43 | + if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { |
|
44 | +// WPCS: CSRF ok, input var ok. |
|
44 | 45 | // Only load the Onboarding wizard if the required parameter is present. |
45 | 46 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/onboarding-wizard.php'; |
46 | 47 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | final class MonsterInsights_Auth { |
20 | 20 | |
21 | - private $profile = array(); |
|
21 | + private $profile = array(); |
|
22 | 22 | private $network = array(); |
23 | 23 | |
24 | 24 | /** |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - public function set_analytics_profile( $data = array() ){ |
|
70 | + public function set_analytics_profile( $data = array() ) { |
|
71 | 71 | update_option( 'monsterinsights_site_profile', $data ); |
72 | - $this->profile = $data; |
|
72 | + $this->profile = $data; |
|
73 | 73 | |
74 | 74 | // If this is the first time, save the date when they connected. |
75 | 75 | $over_time = get_option( 'monsterinsights_over_time', array() ); |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - public function set_network_analytics_profile( $data = array() ){ |
|
82 | + public function set_network_analytics_profile( $data = array() ) { |
|
83 | 83 | update_site_option( 'monsterinsights_network_profile', $data ); |
84 | - $this->network = $data; |
|
84 | + $this->network = $data; |
|
85 | 85 | } |
86 | 86 | |
87 | - public function delete_analytics_profile( $migrate = true ){ |
|
87 | + public function delete_analytics_profile( $migrate = true ) { |
|
88 | 88 | if ( $migrate ) { |
89 | 89 | $newdata = array(); |
90 | 90 | if ( isset( $this->profile['ua'] ) ) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - public function delete_network_analytics_profile( $migrate = true ){ |
|
101 | + public function delete_network_analytics_profile( $migrate = true ) { |
|
102 | 102 | if ( $migrate ) { |
103 | 103 | $newdata = array(); |
104 | 104 | if ( isset( $this->network['ua'] ) ) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | do_action( 'monsterinsights_reports_delete_aggregate_data' ); |
133 | 133 | |
134 | - $this->profile = $data; |
|
134 | + $this->profile = $data; |
|
135 | 135 | $this->set_analytics_profile( $data ); |
136 | 136 | } |
137 | 137 | |
@@ -188,55 +188,55 @@ discard block |
||
188 | 188 | return ! empty( $this->network['ua'] ) ? monsterinsights_is_valid_ua( $this->network['ua'] ) : ''; |
189 | 189 | } |
190 | 190 | |
191 | - public function get_viewname(){ |
|
191 | + public function get_viewname() { |
|
192 | 192 | return ! empty( $this->profile['viewname'] ) ? $this->profile['viewname'] : ''; |
193 | 193 | } |
194 | 194 | |
195 | - public function get_network_viewname(){ |
|
195 | + public function get_network_viewname() { |
|
196 | 196 | return ! empty( $this->network['viewname'] ) ? $this->network['viewname'] : ''; |
197 | 197 | } |
198 | 198 | |
199 | - public function get_accountid(){ |
|
199 | + public function get_accountid() { |
|
200 | 200 | return ! empty( $this->profile['a'] ) ? $this->profile['a'] : ''; |
201 | 201 | } |
202 | 202 | |
203 | - public function get_network_accountid(){ |
|
203 | + public function get_network_accountid() { |
|
204 | 204 | return ! empty( $this->network['a'] ) ? $this->network['a'] : ''; |
205 | 205 | } |
206 | 206 | |
207 | - public function get_propertyid(){ |
|
207 | + public function get_propertyid() { |
|
208 | 208 | return ! empty( $this->profile['w'] ) ? $this->profile['w'] : ''; |
209 | 209 | } |
210 | 210 | |
211 | - public function get_network_propertyid(){ |
|
211 | + public function get_network_propertyid() { |
|
212 | 212 | return ! empty( $this->network['w'] ) ? $this->network['w'] : ''; |
213 | 213 | } |
214 | 214 | |
215 | - public function get_viewid(){ // also known as profileID |
|
215 | + public function get_viewid() { // also known as profileID |
|
216 | 216 | return ! empty( $this->profile['p'] ) ? $this->profile['p'] : ''; |
217 | 217 | } |
218 | 218 | |
219 | - public function get_network_viewid(){ // also known as profileID |
|
219 | + public function get_network_viewid() { // also known as profileID |
|
220 | 220 | return ! empty( $this->network['p'] ) ? $this->network['p'] : ''; |
221 | 221 | } |
222 | 222 | |
223 | - public function get_key(){ |
|
223 | + public function get_key() { |
|
224 | 224 | return ! empty( $this->profile['key'] ) ? $this->profile['key'] : ''; |
225 | 225 | } |
226 | 226 | |
227 | - public function get_network_key(){ |
|
227 | + public function get_network_key() { |
|
228 | 228 | return ! empty( $this->network['key'] ) ? $this->network['key'] : ''; |
229 | 229 | } |
230 | 230 | |
231 | - public function get_token(){ |
|
231 | + public function get_token() { |
|
232 | 232 | return ! empty( $this->profile['token'] ) ? $this->profile['token'] : ''; |
233 | 233 | } |
234 | 234 | |
235 | - public function get_network_token(){ |
|
235 | + public function get_network_token() { |
|
236 | 236 | return ! empty( $this->network['token'] ) ? $this->network['token'] : ''; |
237 | 237 | } |
238 | 238 | |
239 | - public function get_referral_url(){ |
|
239 | + public function get_referral_url() { |
|
240 | 240 | $url = ''; |
241 | 241 | |
242 | 242 | if ( $this->is_authed() ) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - public function set_analytics_profile( $data = array() ){ |
|
70 | + public function set_analytics_profile( $data = array() ) { |
|
71 | 71 | update_option( 'monsterinsights_site_profile', $data ); |
72 | 72 | $this->profile = $data; |
73 | 73 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - public function set_network_analytics_profile( $data = array() ){ |
|
82 | + public function set_network_analytics_profile( $data = array() ) { |
|
83 | 83 | update_site_option( 'monsterinsights_network_profile', $data ); |
84 | 84 | $this->network = $data; |
85 | 85 | } |
86 | 86 | |
87 | - public function delete_analytics_profile( $migrate = true ){ |
|
87 | + public function delete_analytics_profile( $migrate = true ) { |
|
88 | 88 | if ( $migrate ) { |
89 | 89 | $newdata = array(); |
90 | 90 | if ( isset( $this->profile['ua'] ) ) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - public function delete_network_analytics_profile( $migrate = true ){ |
|
101 | + public function delete_network_analytics_profile( $migrate = true ) { |
|
102 | 102 | if ( $migrate ) { |
103 | 103 | $newdata = array(); |
104 | 104 | if ( isset( $this->network['ua'] ) ) { |
@@ -188,55 +188,57 @@ discard block |
||
188 | 188 | return ! empty( $this->network['ua'] ) ? monsterinsights_is_valid_ua( $this->network['ua'] ) : ''; |
189 | 189 | } |
190 | 190 | |
191 | - public function get_viewname(){ |
|
191 | + public function get_viewname() { |
|
192 | 192 | return ! empty( $this->profile['viewname'] ) ? $this->profile['viewname'] : ''; |
193 | 193 | } |
194 | 194 | |
195 | - public function get_network_viewname(){ |
|
195 | + public function get_network_viewname() { |
|
196 | 196 | return ! empty( $this->network['viewname'] ) ? $this->network['viewname'] : ''; |
197 | 197 | } |
198 | 198 | |
199 | - public function get_accountid(){ |
|
199 | + public function get_accountid() { |
|
200 | 200 | return ! empty( $this->profile['a'] ) ? $this->profile['a'] : ''; |
201 | 201 | } |
202 | 202 | |
203 | - public function get_network_accountid(){ |
|
203 | + public function get_network_accountid() { |
|
204 | 204 | return ! empty( $this->network['a'] ) ? $this->network['a'] : ''; |
205 | 205 | } |
206 | 206 | |
207 | - public function get_propertyid(){ |
|
207 | + public function get_propertyid() { |
|
208 | 208 | return ! empty( $this->profile['w'] ) ? $this->profile['w'] : ''; |
209 | 209 | } |
210 | 210 | |
211 | - public function get_network_propertyid(){ |
|
211 | + public function get_network_propertyid() { |
|
212 | 212 | return ! empty( $this->network['w'] ) ? $this->network['w'] : ''; |
213 | 213 | } |
214 | 214 | |
215 | - public function get_viewid(){ // also known as profileID |
|
215 | + public function get_viewid() { |
|
216 | +// also known as profileID |
|
216 | 217 | return ! empty( $this->profile['p'] ) ? $this->profile['p'] : ''; |
217 | 218 | } |
218 | 219 | |
219 | - public function get_network_viewid(){ // also known as profileID |
|
220 | + public function get_network_viewid() { |
|
221 | +// also known as profileID |
|
220 | 222 | return ! empty( $this->network['p'] ) ? $this->network['p'] : ''; |
221 | 223 | } |
222 | 224 | |
223 | - public function get_key(){ |
|
225 | + public function get_key() { |
|
224 | 226 | return ! empty( $this->profile['key'] ) ? $this->profile['key'] : ''; |
225 | 227 | } |
226 | 228 | |
227 | - public function get_network_key(){ |
|
229 | + public function get_network_key() { |
|
228 | 230 | return ! empty( $this->network['key'] ) ? $this->network['key'] : ''; |
229 | 231 | } |
230 | 232 | |
231 | - public function get_token(){ |
|
233 | + public function get_token() { |
|
232 | 234 | return ! empty( $this->profile['token'] ) ? $this->profile['token'] : ''; |
233 | 235 | } |
234 | 236 | |
235 | - public function get_network_token(){ |
|
237 | + public function get_network_token() { |
|
236 | 238 | return ! empty( $this->network['token'] ) ? $this->network['token'] : ''; |
237 | 239 | } |
238 | 240 | |
239 | - public function get_referral_url(){ |
|
241 | + public function get_referral_url() { |
|
240 | 242 | $url = ''; |
241 | 243 | |
242 | 244 | if ( $this->is_authed() ) { |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
35 | 35 | |
36 | 36 | if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
37 | - // If dashboards disabled, first settings page |
|
38 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | - $hook = 'monsterinsights_settings'; |
|
37 | + // If dashboards disabled, first settings page |
|
38 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | + $hook = 'monsterinsights_settings'; |
|
40 | 40 | |
41 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
41 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
42 | 42 | } else { |
43 | - // if dashboards enabled, first dashboard |
|
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
43 | + // if dashboards enabled, first dashboard |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
45 | 45 | |
46 | - $hook = 'monsterinsights_reports'; |
|
46 | + $hook = 'monsterinsights_reports'; |
|
47 | 47 | |
48 | - add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
48 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
49 | 49 | |
50 | - // then settings page |
|
51 | - add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
50 | + // then settings page |
|
51 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
52 | 52 | |
53 | - // Add dashboard submenu. |
|
53 | + // Add dashboard submenu. |
|
54 | 54 | add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' ); |
55 | 55 | } |
56 | 56 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
78 | 78 | // menu page and the updater on the network panel |
79 | 79 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
80 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
80 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
84 | 84 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
85 | - return; |
|
85 | + return; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | function monsterinsights_add_admin_body_class( $classes ) { |
109 | 109 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
110 | 110 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
111 | - return $classes; |
|
111 | + return $classes; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return "$classes monsterinsights_page "; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
126 | 126 | |
127 | 127 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
128 | - return $classes; |
|
128 | + return $classes; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return "$classes insights_page_monsterinsights_tools "; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
142 | 142 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
143 | 143 | if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
144 | - return $classes; |
|
144 | + return $classes; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return "$classes insights_page_monsterinsights_addons "; |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | |
162 | 162 | // If lite, show a link where they can get pro from |
163 | 163 | if ( ! monsterinsights_is_pro_version() ) { |
164 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
165 | - array_unshift( $links, $get_pro ); |
|
164 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
165 | + array_unshift( $links, $get_pro ); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | // If Lite, support goes to forum. If pro, it goes to our website |
169 | 169 | if ( monsterinsights_is_pro_version() ) { |
170 | - $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>'; |
|
171 | - array_unshift( $links, $support ); |
|
170 | + $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>'; |
|
171 | + array_unshift( $links, $support ); |
|
172 | 172 | } else { |
173 | - $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>'; |
|
174 | - array_unshift( $links, $support ); |
|
173 | + $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>'; |
|
174 | + array_unshift( $links, $support ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
197 | 197 | |
198 | 198 | if ( monsterinsights_is_pro_version() ) { |
199 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
199 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
200 | 200 | |
201 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
202 | - require_once( $dir . $template . '.php' ); |
|
203 | - return true; |
|
204 | - } |
|
201 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
202 | + require_once( $dir . $template . '.php' ); |
|
203 | + return true; |
|
204 | + } |
|
205 | 205 | } else { |
206 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
206 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
207 | 207 | |
208 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
209 | - require_once( $dir . $template . '.php' ); |
|
210 | - return true; |
|
211 | - } |
|
208 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
209 | + require_once( $dir . $template . '.php' ); |
|
210 | + return true; |
|
211 | + } |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
215 | 215 | |
216 | 216 | if ( file_exists( $dir . $template . '.php' ) ) { |
217 | - require_once( $dir . $template . '.php' ); |
|
218 | - return true; |
|
217 | + require_once( $dir . $template . '.php' ); |
|
218 | + return true; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | return false; |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | function monsterinsights_admin_footer( $text ) { |
233 | 233 | global $current_screen; |
234 | 234 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
235 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
236 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
235 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
236 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
237 | 237 | } |
238 | 238 | return $text; |
239 | 239 | } |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | // Don't show on MonsterInsights pages |
245 | 245 | $screen = get_current_screen(); |
246 | 246 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
247 | - return; |
|
247 | + return; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | // Make sure they have the permissions to do something |
251 | 251 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
252 | - return; |
|
252 | + return; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | // Priority: |
@@ -266,45 +266,45 @@ discard block |
||
266 | 266 | |
267 | 267 | // 1. Google Analytics not authenticated |
268 | 268 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
269 | - $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
270 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
271 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
272 | - return; |
|
269 | + $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
270 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
271 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
272 | + return; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | // 2. License key not entered for pro |
276 | 276 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
277 | 277 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
278 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
279 | - $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>' ); |
|
280 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
281 | - return; |
|
278 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
279 | + $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>' ); |
|
280 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
281 | + return; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // 3. License key not valid/okay for pro |
285 | 285 | if ( monsterinsights_is_pro_version() ) { |
286 | - $message = ''; |
|
287 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
288 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
289 | - $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>' ); |
|
290 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
291 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
292 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
293 | - $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' ); |
|
294 | - } |
|
295 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
296 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
297 | - $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>' ); |
|
298 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
299 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
300 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
301 | - $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' ); |
|
302 | - } |
|
303 | - } |
|
304 | - if ( ! empty( $message ) ) { |
|
305 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
306 | - return; |
|
307 | - } |
|
286 | + $message = ''; |
|
287 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
288 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
289 | + $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>' ); |
|
290 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
291 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
292 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
293 | + $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' ); |
|
294 | + } |
|
295 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
296 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
297 | + $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>' ); |
|
298 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
299 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
300 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
301 | + $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' ); |
|
302 | + } |
|
303 | + } |
|
304 | + if ( ! empty( $message ) ) { |
|
305 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
306 | + return; |
|
307 | + } |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // 4. Notices for PHP/WP version deprecations |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | $notices = get_option( 'monsterinsights_notices' ); |
370 | 370 | if ( ! is_array( $notices ) ) { |
371 | - $notices = array(); |
|
371 | + $notices = array(); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | // 6. Authenticate, not manual |
@@ -376,12 +376,12 @@ discard block |
||
376 | 376 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
377 | 377 | |
378 | 378 | if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
379 | - echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
380 | - echo '<p>'; |
|
381 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
382 | - echo '</p>'; |
|
383 | - echo '</div>'; |
|
384 | - return; |
|
379 | + echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
380 | + echo '<p>'; |
|
381 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
382 | + echo '</p>'; |
|
383 | + echo '</div>'; |
|
384 | + return; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | // 7. Automatic updates not configured |
@@ -401,64 +401,64 @@ discard block |
||
401 | 401 | |
402 | 402 | // 8. WooUpsell |
403 | 403 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
404 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
405 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
406 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
407 | - echo '<p><strong>'; |
|
408 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
409 | - echo '</strong></p>'; |
|
410 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
411 | - echo '<p>'; |
|
412 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
413 | - echo '</p>'; |
|
414 | - echo '<p>'; |
|
415 | - 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' ); |
|
416 | - echo '</p>'; |
|
417 | - echo '<p>'; |
|
418 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
419 | - echo '</p>'; |
|
420 | - echo '<p>'; |
|
421 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
422 | - echo '</p>'; |
|
423 | - 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>' ); |
|
424 | - echo '</p>'; |
|
425 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
426 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
427 | - echo '</div>'; |
|
428 | - echo '</div>'; |
|
429 | - return; |
|
430 | - } |
|
404 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
405 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
406 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
407 | + echo '<p><strong>'; |
|
408 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
409 | + echo '</strong></p>'; |
|
410 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
411 | + echo '<p>'; |
|
412 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
413 | + echo '</p>'; |
|
414 | + echo '<p>'; |
|
415 | + 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' ); |
|
416 | + echo '</p>'; |
|
417 | + echo '<p>'; |
|
418 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
419 | + echo '</p>'; |
|
420 | + echo '<p>'; |
|
421 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
422 | + echo '</p>'; |
|
423 | + 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>' ); |
|
424 | + echo '</p>'; |
|
425 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
426 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
427 | + echo '</div>'; |
|
428 | + echo '</div>'; |
|
429 | + return; |
|
430 | + } |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | // 9. EDDUpsell |
434 | 434 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
435 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
436 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
437 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
438 | - echo '<p><strong>'; |
|
439 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
440 | - echo '</strong></p>'; |
|
441 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
442 | - echo '<p>'; |
|
443 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
444 | - echo '</p>'; |
|
445 | - echo '<p>'; |
|
446 | - 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' ); |
|
447 | - echo '</p>'; |
|
448 | - echo '<p>'; |
|
449 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
450 | - echo '</p>'; |
|
451 | - echo '<p>'; |
|
452 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
453 | - echo '</p>'; |
|
454 | - 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>' ); |
|
455 | - echo '</p>'; |
|
456 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
457 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
458 | - echo '</div>'; |
|
459 | - echo '</div>'; |
|
460 | - return; |
|
461 | - } |
|
435 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
436 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
437 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
438 | + echo '<p><strong>'; |
|
439 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
440 | + echo '</strong></p>'; |
|
441 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
442 | + echo '<p>'; |
|
443 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
444 | + echo '</p>'; |
|
445 | + echo '<p>'; |
|
446 | + 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' ); |
|
447 | + echo '</p>'; |
|
448 | + echo '<p>'; |
|
449 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
450 | + echo '</p>'; |
|
451 | + echo '<p>'; |
|
452 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
453 | + echo '</p>'; |
|
454 | + 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>' ); |
|
455 | + echo '</p>'; |
|
456 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
457 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
458 | + echo '</div>'; |
|
459 | + echo '</div>'; |
|
460 | + return; |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | // AM Notices |
477 | 477 | function monsterinsights_am_notice_optout( $super_admin ) { |
478 | 478 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
479 | - return false; |
|
479 | + return false; |
|
480 | 480 | } |
481 | 481 | return $super_admin; |
482 | 482 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
37 | 37 | // If dashboards disabled, first settings page |
38 | - add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
38 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
39 | 39 | $hook = 'monsterinsights_settings'; |
40 | 40 | |
41 | 41 | add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
42 | 42 | } else { |
43 | 43 | // if dashboards enabled, first dashboard |
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
45 | 45 | |
46 | 46 | $hook = 'monsterinsights_reports'; |
47 | 47 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
89 | 89 | $hook = 'monsterinsights_network'; |
90 | 90 | $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
91 | - add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
91 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
92 | 92 | |
93 | 93 | add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
94 | 94 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | function monsterinsights_add_admin_body_class_tools_page( $classes ) { |
125 | 125 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
126 | 126 | |
127 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
127 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
128 | 128 | return $classes; |
129 | 129 | } |
130 | 130 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function monsterinsights_add_admin_body_class_addons_page( $classes ) { |
142 | 142 | $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
143 | - if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
143 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
144 | 144 | return $classes; |
145 | 145 | } |
146 | 146 | |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | * @return array $links |
157 | 157 | */ |
158 | 158 | function monsterinsights_add_action_links( $links ) { |
159 | - $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>'; |
|
159 | + $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>'; |
|
160 | 160 | array_unshift( $links, $docs ); |
161 | 161 | |
162 | 162 | // If lite, show a link where they can get pro from |
163 | 163 | if ( ! monsterinsights_is_pro_version() ) { |
164 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
164 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/docs/" ) . '">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
165 | 165 | array_unshift( $links, $get_pro ); |
166 | 166 | } |
167 | 167 | |
168 | 168 | // If Lite, support goes to forum. If pro, it goes to our website |
169 | 169 | if ( monsterinsights_is_pro_version() ) { |
170 | - $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>'; |
|
170 | + $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>'; |
|
171 | 171 | array_unshift( $links, $support ); |
172 | 172 | } else { |
173 | - $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>'; |
|
173 | + $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>'; |
|
174 | 174 | array_unshift( $links, $support ); |
175 | 175 | } |
176 | 176 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
200 | 200 | |
201 | 201 | if ( file_exists( $dir . $template . '.php' ) ) { |
202 | - require_once( $dir . $template . '.php' ); |
|
202 | + require_once( $dir . $template . '.php' ); |
|
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | } else { |
206 | 206 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
207 | 207 | |
208 | 208 | if ( file_exists( $dir . $template . '.php' ) ) { |
209 | - require_once( $dir . $template . '.php' ); |
|
209 | + require_once( $dir . $template . '.php' ); |
|
210 | 210 | return true; |
211 | 211 | } |
212 | 212 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
215 | 215 | |
216 | 216 | if ( file_exists( $dir . $template . '.php' ) ) { |
217 | - require_once( $dir . $template . '.php' ); |
|
217 | + require_once( $dir . $template . '.php' ); |
|
218 | 218 | return true; |
219 | 219 | } |
220 | 220 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | global $current_screen; |
234 | 234 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
235 | 235 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
236 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
236 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
237 | 237 | } |
238 | 238 | return $text; |
239 | 239 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | // 1. Google Analytics not authenticated |
268 | 268 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
269 | 269 | $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
270 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
271 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
270 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ), '<a href="' . $page . '">', '</a>' ); |
|
271 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
272 | 272 | return; |
273 | 273 | } |
274 | 274 | |
@@ -276,17 +276,17 @@ discard block |
||
276 | 276 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
277 | 277 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
278 | 278 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
279 | - $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>' ); |
|
280 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
279 | + $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>' ); |
|
280 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | 284 | // 3. License key not valid/okay for pro |
285 | 285 | if ( monsterinsights_is_pro_version() ) { |
286 | 286 | $message = ''; |
287 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
287 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
288 | 288 | if ( MonsterInsights()->license->site_license_expired() ) { |
289 | - $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>' ); |
|
289 | + $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>' ); |
|
290 | 290 | } else if ( MonsterInsights()->license->site_license_disabled() ) { |
291 | 291 | $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
292 | 292 | } else if ( MonsterInsights()->license->site_license_invalid() ) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } else if ( MonsterInsights()->license->get_network_license_key() ) { |
296 | 296 | if ( MonsterInsights()->license->network_license_expired() ) { |
297 | - $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>' ); |
|
297 | + $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>' ); |
|
298 | 298 | } else if ( MonsterInsights()->license->network_license_disabled() ) { |
299 | 299 | $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
300 | 300 | } else if ( MonsterInsights()->license->network_license_invalid() ) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | if ( ! empty( $message ) ) { |
305 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
305 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
306 | 306 | return; |
307 | 307 | } |
308 | 308 | } |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | if ( version_compare( phpversion(), '5.4', '<' ) ) { |
316 | 316 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
317 | 317 | $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>' ); |
318 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
318 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
319 | 319 | return; |
320 | 320 | } |
321 | 321 | // WordPress 3.0 - 4.5 |
322 | 322 | else if ( version_compare( $wp_version, '4.6', '<' ) ) { |
323 | 323 | $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ); |
324 | 324 | $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 4.6 in April, 2019.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
325 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
325 | + echo '<div class="error"><p>' . $message . '</p></div>'; |
|
326 | 326 | return; |
327 | 327 | } |
328 | 328 | // PHP 5.4/5.5 |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | // } |
367 | 367 | // } |
368 | 368 | |
369 | - $notices = get_option( 'monsterinsights_notices' ); |
|
369 | + $notices = get_option( 'monsterinsights_notices' ); |
|
370 | 370 | if ( ! is_array( $notices ) ) { |
371 | 371 | $notices = array(); |
372 | 372 | } |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
376 | 376 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
377 | 377 | |
378 | - if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
|
378 | + if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) ) { |
|
379 | 379 | echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
380 | 380 | echo '<p>'; |
381 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
381 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); |
|
382 | 382 | echo '</p>'; |
383 | 383 | echo '</div>'; |
384 | 384 | return; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | // 8. WooUpsell |
403 | 403 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
404 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
404 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
405 | 405 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
406 | 406 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
407 | 407 | echo '<p><strong>'; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | echo '<p>'; |
421 | 421 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
422 | 422 | echo '</p>'; |
423 | - 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>' ); |
|
423 | + 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>' ); |
|
424 | 424 | echo '</p>'; |
425 | 425 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
426 | 426 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | // 9. EDDUpsell |
434 | 434 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
435 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
435 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
436 | 436 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
437 | 437 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
438 | 438 | echo '<p><strong>'; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | echo '<p>'; |
452 | 452 | echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
453 | 453 | echo '</p>'; |
454 | - 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>' ); |
|
454 | + 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>' ); |
|
455 | 455 | echo '</p>'; |
456 | 456 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
457 | 457 | echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
465 | 465 | $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
466 | 466 | $page = $page . '#/advanced'; |
467 | - $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>' ); |
|
468 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>'; |
|
467 | + $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>' ); |
|
468 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; |
|
469 | 469 | return; |
470 | 470 | } |
471 | 471 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * not be used by other developers. This hook's behavior may be modified |
39 | 39 | * or the hook may be removed at any time, without warning. |
40 | 40 | */ |
41 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
41 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
42 | 42 | return $reports; |
43 | 43 | } |
44 | 44 | |
@@ -60,6 +60,6 @@ discard block |
||
60 | 60 | */ |
61 | 61 | do_action( 'monsterinsights_head' ); |
62 | 62 | echo monsterinsights_ublock_notice(); |
63 | - monsterinsights_settings_error_page( 'monsterinsights-reports'); |
|
63 | + monsterinsights_settings_error_page( 'monsterinsights-reports' ); |
|
64 | 64 | monsterinsights_settings_inline_js(); |
65 | 65 | } |
@@ -44,37 +44,37 @@ discard block |
||
44 | 44 | |
45 | 45 | // Get addons data from transient or perform API query if no transient. |
46 | 46 | if ( false === ( $addons = get_transient( '_monsterinsights_addons' ) ) ) { |
47 | - $addons = monsterinsights_get_addons_data( $key ); |
|
47 | + $addons = monsterinsights_get_addons_data( $key ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // If no Addons exist, return false |
51 | 51 | if ( ! $addons ) { |
52 | - return false; |
|
52 | + return false; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Iterate through Addons, to build two arrays: |
56 | 56 | // - Addons the user is licensed to use, |
57 | 57 | // - Addons the user isn't licensed to use. |
58 | 58 | $results = array( |
59 | - 'licensed' => array(), |
|
60 | - 'unlicensed'=> array(), |
|
59 | + 'licensed' => array(), |
|
60 | + 'unlicensed'=> array(), |
|
61 | 61 | ); |
62 | 62 | foreach ( (array) $addons as $i => $addon ) { |
63 | 63 | |
64 | - // Determine whether the user is licensed to use this Addon or not. |
|
65 | - if ( |
|
66 | - empty( $type ) || |
|
67 | - ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
68 | - ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
69 | - ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
70 | - ) { |
|
71 | - // Unlicensed |
|
72 | - $results['unlicensed'][] = $addon; |
|
73 | - continue; |
|
74 | - } |
|
75 | - |
|
76 | - // Licensed |
|
77 | - $results['licensed'][] = $addon; |
|
64 | + // Determine whether the user is licensed to use this Addon or not. |
|
65 | + if ( |
|
66 | + empty( $type ) || |
|
67 | + ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
68 | + ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
69 | + ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
70 | + ) { |
|
71 | + // Unlicensed |
|
72 | + $results['unlicensed'][] = $addon; |
|
73 | + continue; |
|
74 | + } |
|
75 | + |
|
76 | + // Licensed |
|
77 | + $results['licensed'][] = $addon; |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | // Get Addons |
96 | 96 | // If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information. |
97 | 97 | if ( monsterinsights_is_pro_version() && $key ) { |
98 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
98 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
99 | 99 | } else { |
100 | - $addons = monsterinsights_get_all_addons_data(); |
|
100 | + $addons = monsterinsights_get_all_addons_data(); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // If there was an API error, set transient for only 10 minutes. |
104 | 104 | if ( ! $addons ) { |
105 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
106 | - return false; |
|
105 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
106 | + return false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // If there was an error retrieving the addons, set the error. |
110 | 110 | if ( isset( $addons->error ) ) { |
111 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
112 | - return false; |
|
111 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
112 | + return false; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Otherwise, our request worked. Save the data and return it. |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | $keys = array_keys( get_plugins() ); |
174 | 174 | |
175 | 175 | foreach ( $keys as $key ) { |
176 | - if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
177 | - return $key; |
|
178 | - } |
|
176 | + if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
177 | + return $key; |
|
178 | + } |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $slug; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct( $args = array() ) { |
27 | 27 | |
28 | - parent::__construct(); |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_upgrader( &$upgrader ) { |
40 | 40 | |
41 | - if ( is_object( $upgrader ) ) { |
|
42 | - $this->upgrader =& $upgrader; |
|
43 | - } |
|
41 | + if ( is_object( $upgrader ) ) { |
|
42 | + $this->upgrader =& $upgrader; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function set_result( $result ) { |
55 | 55 | |
56 | - $this->result = $result; |
|
56 | + $this->result = $result; |
|
57 | 57 | |
58 | 58 | } |
59 | 59 |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | public function __construct() { |
29 | 29 | |
30 | 30 | // Authentication Actions |
31 | - add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | - add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | - add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | - add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
31 | + add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | + add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | + add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | + add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
35 | 35 | |
36 | - add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | - add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
36 | + add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | + add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
38 | 38 | |
39 | - add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | - add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
39 | + add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) ); |
|
40 | + add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) ); |
|
41 | 41 | |
42 | 42 | add_filter( 'monsterinsights_maybe_authenticate_siteurl', array( $this, 'before_redirect' ) ); |
43 | 43 | } |
44 | 44 | |
45 | - public function get_tt(){ |
|
45 | + public function get_tt() { |
|
46 | 46 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
47 | 47 | if ( empty( $tt ) ) { |
48 | 48 | // if TT is empty, generate a new one, save it and then return it |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return $tt; |
53 | 53 | } |
54 | 54 | |
55 | - public function rotate_tt(){ |
|
55 | + public function rotate_tt() { |
|
56 | 56 | $tt = $this->generate_tt(); |
57 | 57 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
58 | 58 | } |
59 | 59 | |
60 | - public function generate_tt(){ |
|
60 | + public function generate_tt() { |
|
61 | 61 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
62 | 62 | } |
63 | 63 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | ); |
76 | 76 | } |
77 | 77 | |
78 | - public function maybe_authenticate(){ |
|
78 | + public function maybe_authenticate() { |
|
79 | 79 | |
80 | 80 | // Check nonce |
81 | 81 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
82 | 82 | |
83 | 83 | // current user can authenticate |
84 | 84 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
85 | - wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
85 | + wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | // we do not have a current auth |
101 | 101 | if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) { |
102 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
102 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
103 | 103 | } else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) { |
104 | - wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
104 | + wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $sitei = $this->get_sitei(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | wp_send_json_success(); |
163 | 163 | } |
164 | 164 | |
165 | - public function authenticate_listener(){ |
|
165 | + public function authenticate_listener() { |
|
166 | 166 | // Make sure it's for us |
167 | 167 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
168 | 168 | return; |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // Make sure has required params |
182 | - if ( empty( $_REQUEST['key'] ) || |
|
183 | - empty( $_REQUEST['token'] ) || |
|
184 | - empty( $_REQUEST['ua'] ) || |
|
185 | - empty( $_REQUEST['miview'] ) || |
|
186 | - empty( $_REQUEST['a'] ) || |
|
187 | - empty( $_REQUEST['w'] ) || |
|
182 | + if ( empty( $_REQUEST['key'] ) || |
|
183 | + empty( $_REQUEST['token'] ) || |
|
184 | + empty( $_REQUEST['ua'] ) || |
|
185 | + empty( $_REQUEST['miview'] ) || |
|
186 | + empty( $_REQUEST['a'] ) || |
|
187 | + empty( $_REQUEST['w'] ) || |
|
188 | 188 | empty( $_REQUEST['p'] ) |
189 | 189 | ) { |
190 | 190 | return; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $where = $this->is_network_admin() ? 'network' : 'site'; |
221 | 221 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
222 | 222 | |
223 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
223 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
224 | 224 | $url = add_query_arg( array( |
225 | 225 | 'mi_action' => 'auth', |
226 | 226 | 'success' => 'true', |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | exit; |
231 | 231 | } |
232 | 232 | |
233 | - public function maybe_reauthenticate(){ |
|
233 | + public function maybe_reauthenticate() { |
|
234 | 234 | |
235 | 235 | // Check nonce |
236 | 236 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
237 | 237 | |
238 | 238 | // current user can authenticate |
239 | 239 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
240 | - wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
240 | + wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | // we do have a current auth |
256 | 256 | if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
257 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
257 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
258 | 258 | } else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
259 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
259 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $siteurl = add_query_arg( array( |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
283 | 283 | } |
284 | 284 | |
285 | - public function reauthenticate_listener(){ |
|
285 | + public function reauthenticate_listener() { |
|
286 | 286 | // Make sure it's for us |
287 | 287 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
288 | 288 | return; |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | |
301 | 301 | // Make sure has required params |
302 | 302 | if ( |
303 | - empty( $_REQUEST['ua'] ) || |
|
304 | - empty( $_REQUEST['miview'] ) || |
|
305 | - empty( $_REQUEST['a'] ) || |
|
306 | - empty( $_REQUEST['w'] ) || |
|
303 | + empty( $_REQUEST['ua'] ) || |
|
304 | + empty( $_REQUEST['miview'] ) || |
|
305 | + empty( $_REQUEST['a'] ) || |
|
306 | + empty( $_REQUEST['w'] ) || |
|
307 | 307 | empty( $_REQUEST['p'] ) |
308 | 308 | ) { |
309 | 309 | return; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $where = $this->is_network_admin() ? 'network' : 'site'; |
341 | 341 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
342 | 342 | |
343 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
343 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
344 | 344 | $url = add_query_arg( array( |
345 | 345 | 'mi_action' => 'reauth', |
346 | 346 | 'success' => 'true', |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | exit; |
352 | 352 | } |
353 | 353 | |
354 | - public function maybe_verify(){ |
|
354 | + public function maybe_verify() { |
|
355 | 355 | |
356 | 356 | // Check nonce |
357 | 357 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
358 | 358 | |
359 | 359 | // current user can verify |
360 | 360 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
361 | - wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
361 | + wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | |
368 | 368 | // we have an auth to verify |
369 | 369 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
370 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
370 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
371 | 371 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
372 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
372 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | if ( monsterinsights_is_pro_version() ) { |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | $worked = $this->verify_auth(); |
383 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
383 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
384 | 384 | wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) ); |
385 | 385 | } else { |
386 | 386 | wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) ); |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | - public function verify_auth( $credentials = array() ){ |
|
390 | + public function verify_auth( $credentials = array() ) { |
|
391 | 391 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
392 | 392 | |
393 | 393 | if ( empty( $creds['key'] ) ) { |
@@ -406,14 +406,14 @@ discard block |
||
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | - public function maybe_delete(){ |
|
409 | + public function maybe_delete() { |
|
410 | 410 | |
411 | 411 | // Check nonce |
412 | 412 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
413 | 413 | |
414 | 414 | // current user can delete |
415 | 415 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
416 | - wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
416 | + wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | |
423 | 423 | // we have an auth to delete |
424 | 424 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
425 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
425 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
426 | 426 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
427 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
427 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | if ( monsterinsights_is_pro_version() ) { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true'; |
438 | 438 | |
439 | 439 | $worked = $this->delete_auth( $force ); |
440 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
440 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
441 | 441 | wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) ); |
442 | 442 | } else { |
443 | 443 | if ( $force ) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | - public function delete_auth( $force = false ){ |
|
451 | + public function delete_auth( $force = false ) { |
|
452 | 452 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
453 | 453 | return false; |
454 | 454 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | // If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways |
465 | 465 | if ( is_network_admin() ) { |
466 | 466 | $siteurl = network_admin_url(); |
467 | - if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) { |
|
467 | + if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) { |
|
468 | 468 | MonsterInsights()->auth->delete_network_analytics_profile( true ); |
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } else { |
472 | 472 | $siteurl = site_url(); |
473 | - if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) { |
|
473 | + if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) { |
|
474 | 474 | MonsterInsights()->auth->delete_analytics_profile( true ); |
475 | 475 | return true; |
476 | 476 | } |
@@ -547,15 +547,15 @@ discard block |
||
547 | 547 | // return $sitei; |
548 | 548 | // } |
549 | 549 | |
550 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
550 | + $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
551 | 551 | $secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : ''; |
552 | - $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
552 | + $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
553 | 553 | |
554 | 554 | $sitei = $auth_key . $secure_auth_key . $logged_in_key; |
555 | - $sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei ); |
|
555 | + $sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei ); |
|
556 | 556 | $sitei = sanitize_text_field( $sitei ); |
557 | 557 | $sitei = trim( $sitei ); |
558 | - $sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei; |
|
558 | + $sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei; |
|
559 | 559 | return $sitei; |
560 | 560 | } |
561 | 561 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - $site_license = array( |
|
45 | + $site_license = array( |
|
46 | 46 | 'key' => MonsterInsights()->license->get_site_license_key(), |
47 | 47 | 'type' => MonsterInsights()->license->get_site_license_type(), |
48 | 48 | 'is_disabled' => MonsterInsights()->license->site_license_disabled(), |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | // Array fields are needed even if empty. |
103 | 103 | $array_fields = array( 'view_reports', 'save_settings', 'ignore_users' ); |
104 | 104 | foreach ( $array_fields as $array_field ) { |
105 | - if ( ! isset( $options[ $array_field ] ) ) { |
|
106 | - $options[ $array_field ] = array(); |
|
105 | + if ( ! isset( $options[$array_field] ) ) { |
|
106 | + $options[$array_field] = array(); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | if ( isset( $options['custom_code'] ) ) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | if ( $empty ) { |
180 | - unset( $value[ $key ] ); |
|
180 | + unset( $value[$key] ); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } else { |
228 | 228 | $addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug ); |
229 | 229 | } |
230 | - $parsed_addons[ $addon->slug ] = $addon; |
|
230 | + $parsed_addons[$addon->slug] = $addon; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $installed = false; |
317 | 317 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
318 | 318 | |
319 | - if ( isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
319 | + if ( isset( $installed_plugins[$plugin_basename] ) ) { |
|
320 | 320 | $installed = true; |
321 | 321 | |
322 | 322 | if ( is_multisite() && is_network_admin() ) { |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | ); |
460 | 460 | |
461 | 461 | foreach ( $exclude as $e ) { |
462 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
463 | - unset( $new_settings[ $e ] ); |
|
462 | + if ( ! empty( $new_settings[$e] ) ) { |
|
463 | + unset( $new_settings[$e] ); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | foreach ( $exclude as $e ) { |
474 | - if ( ! empty( $settings[ $e ] ) ) { |
|
475 | - $new_settings = $settings[ $e ]; |
|
474 | + if ( ! empty( $settings[$e] ) ) { |
|
475 | + $new_settings = $settings[$e]; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | ), |
631 | 631 | admin_url( 'admin.php' ) |
632 | 632 | ); |
633 | - $url = esc_url( $url ); |
|
633 | + $url = esc_url( $url ); |
|
634 | 634 | |
635 | 635 | ob_start(); |
636 | 636 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |