@@ -467,26 +467,26 @@ |
||
467 | 467 | $profile = is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile() : MonsterInsights()->auth->get_analytics_profile(); |
468 | 468 | |
469 | 469 | if ( !empty($profile['ua']) && empty($profile['v4']) && !monsterinsights_is_own_admin_page() ) { |
470 | - $title = __('Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress'); |
|
471 | - $message = __('Google Analytics 3 (UA) and support was sunset on July 1, 2023. Your website is currently NOT tracking any analytics. </br>Create or connect a new Google Analytics 4 property immediately to start tracking.', 'google-analytics-for-wordpress'); |
|
470 | + $title = __('Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress'); |
|
471 | + $message = __('Google Analytics 3 (UA) and support was sunset on July 1, 2023. Your website is currently NOT tracking any analytics. </br>Create or connect a new Google Analytics 4 property immediately to start tracking.', 'google-analytics-for-wordpress'); |
|
472 | 472 | |
473 | - $wizard_url = admin_url('admin.php?page=monsterinsights-onboarding'); |
|
473 | + $wizard_url = admin_url('admin.php?page=monsterinsights-onboarding'); |
|
474 | 474 | |
475 | - echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_ua_sunset">'; |
|
476 | - echo '<p><strong>' . $title . '</strong></p>'; |
|
477 | - echo '<p>' . $message . '</p>'; |
|
478 | - echo '<p>'; |
|
479 | - echo '<a href="https://www.monsterinsights.com/docs/connect-google-analytics/" |
|
475 | + echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_ua_sunset">'; |
|
476 | + echo '<p><strong>' . $title . '</strong></p>'; |
|
477 | + echo '<p>' . $message . '</p>'; |
|
478 | + echo '<p>'; |
|
479 | + echo '<a href="https://www.monsterinsights.com/docs/connect-google-analytics/" |
|
480 | 480 | target="_blank" rel="noopener noreferrer">' . |
481 | - __( 'Learn How to Create a GA4 Property', 'google-analytics-for-wordpress' ) . |
|
482 | - '</a><br>'; |
|
483 | - echo '<a href="' . $wizard_url . '">' . |
|
484 | - __( 'Connect a Property', 'google-analytics-for-wordpress' ) . |
|
485 | - '</a><br>'; |
|
486 | - echo '</p>'; |
|
487 | - echo '</div>'; |
|
488 | - |
|
489 | - return; |
|
481 | + __( 'Learn How to Create a GA4 Property', 'google-analytics-for-wordpress' ) . |
|
482 | + '</a><br>'; |
|
483 | + echo '<a href="' . $wizard_url . '">' . |
|
484 | + __( 'Connect a Property', 'google-analytics-for-wordpress' ) . |
|
485 | + '</a><br>'; |
|
486 | + echo '</p>'; |
|
487 | + echo '</div>'; |
|
488 | + |
|
489 | + return; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | $is_plugins_page = 'plugins' === get_current_screen()->id; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if (!defined('ABSPATH')) { |
|
14 | +if ( ! defined( 'ABSPATH' ) ) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | $menu_notification_indicator = MonsterInsights()->notifications->get_license_expired_indicator(); |
39 | 39 | } |
40 | 40 | |
41 | - if ($hook === 'monsterinsights_settings') { |
|
41 | + if ( $hook === 'monsterinsights_settings' ) { |
|
42 | 42 | // If dashboards disabled, first settings page |
43 | - add_menu_page(__('MonsterInsights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress') . $menu_notification_indicator, 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543'); |
|
43 | + add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . $menu_notification_indicator, 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' ); |
|
44 | 44 | $hook = 'monsterinsights_settings'; |
45 | 45 | |
46 | - add_submenu_page($hook, __('MonsterInsights', 'google-analytics-for-wordpress'), __('Settings', 'google-analytics-for-wordpress'), 'monsterinsights_save_settings', 'monsterinsights_settings'); |
|
46 | + add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
47 | 47 | } else { |
48 | 48 | // if dashboards enabled, first dashboard |
49 | - add_menu_page(__('General:', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress') . $menu_notification_indicator, 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543'); |
|
49 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . $menu_notification_indicator, 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' ); |
|
50 | 50 | |
51 | 51 | if ( ! MonsterInsights()->setup_checklist->is_dismissed() ) { |
52 | 52 | add_submenu_page( $hook, __( 'Setup Checklist', 'google-analytics-for-wordpress' ), __( 'Setup Checklist', 'google-analytics-for-wordpress' ) . MonsterInsights()->setup_checklist->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings#/setup-checklist', 'monsterinsights_settings_page' ); |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - $submenu_base = add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php')); |
|
76 | + $submenu_base = add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
77 | 77 | |
78 | 78 | add_submenu_page( $hook, __( 'Site Notes:', 'google-analytics-for-wordpress' ), __( 'Site Notes', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/site-notes' ); |
79 | 79 | |
80 | 80 | // Add Popular Posts menu item. |
81 | - add_submenu_page($hook, __('Popular Posts:', 'google-analytics-for-wordpress'), __('Popular Posts', 'google-analytics-for-wordpress'), 'monsterinsights_save_settings', $submenu_base . '#/popular-posts'); |
|
81 | + add_submenu_page( $hook, __( 'Popular Posts:', 'google-analytics-for-wordpress' ), __( 'Popular Posts', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/popular-posts' ); |
|
82 | 82 | |
83 | 83 | // Add submenu under `Insights` main menu for user journey report. |
84 | 84 | add_submenu_page( $hook, __( 'User Journey:', 'google-analytics-for-wordpress' ), __( 'User Journey', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports#/user-journey-report' ); |
@@ -89,113 +89,113 @@ discard block |
||
89 | 89 | $seo_url = $submenu_base . '#/seo'; |
90 | 90 | } |
91 | 91 | // then SEO |
92 | - add_submenu_page($hook, __('SEO', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url); |
|
92 | + add_submenu_page( $hook, __( 'SEO', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url ); |
|
93 | 93 | |
94 | 94 | // then tools |
95 | - add_submenu_page($hook, __('Tools:', 'google-analytics-for-wordpress'), __('Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/tools'); |
|
95 | + add_submenu_page( $hook, __( 'Tools:', 'google-analytics-for-wordpress' ), __( 'Tools', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/tools' ); |
|
96 | 96 | |
97 | 97 | // then addons |
98 | 98 | $network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : ''; |
99 | - if (!monsterinsights_is_network_active() || (monsterinsights_is_network_active() && empty($network_key))) { |
|
100 | - add_submenu_page($hook, __('Addons:', 'google-analytics-for-wordpress'), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __('Addons', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons'); |
|
99 | + if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
|
100 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | add_submenu_page( |
104 | 104 | $hook, |
105 | - __('UserFeedback:', 'google-analytics-for-wordpress'), |
|
106 | - __('UserFeedback', 'google-analytics-for-wordpress') . $newIndicator, |
|
105 | + __( 'UserFeedback:', 'google-analytics-for-wordpress' ), |
|
106 | + __( 'UserFeedback', 'google-analytics-for-wordpress' ) . $newIndicator, |
|
107 | 107 | 'manage_options', |
108 | 108 | $submenu_base . '#/userfeedback' |
109 | 109 | ); |
110 | 110 | |
111 | 111 | // then About Us page. |
112 | - add_submenu_page($hook, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about'); |
|
112 | + add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' ); |
|
113 | 113 | |
114 | - if (!monsterinsights_is_pro_version() && !strstr(plugin_basename(__FILE__), 'dashboard-for')) { |
|
114 | + if ( ! monsterinsights_is_pro_version() && ! strstr( plugin_basename( __FILE__ ), 'dashboard-for' ) ) { |
|
115 | 115 | // automated promotion |
116 | - monsterinsights_automated_menu($hook); |
|
116 | + monsterinsights_automated_menu( $hook ); |
|
117 | 117 | } |
118 | 118 | |
119 | - add_submenu_page($hook, __('Growth Tools:', 'google-analytics-for-wordpress'), __('Growth Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/growth-tools'); |
|
119 | + add_submenu_page( $hook, __( 'Growth Tools:', 'google-analytics-for-wordpress' ), __( 'Growth Tools', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/growth-tools' ); |
|
120 | 120 | |
121 | 121 | // then Upgrade To Pro. |
122 | - if (!monsterinsights_is_pro_version()) { |
|
123 | - add_submenu_page($hook, __('Upgrade to Pro:', 'google-analytics-for-wordpress'), '<span class="monsterinsights-upgrade-submenu"> ' . __('Upgrade to Pro', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link('admin-menu', 'submenu', "https://www.monsterinsights.com/lite/")); |
|
122 | + if ( ! monsterinsights_is_pro_version() ) { |
|
123 | + add_submenu_page( $hook, __( 'Upgrade to Pro:', 'google-analytics-for-wordpress' ), '<span class="monsterinsights-upgrade-submenu"> ' . __( 'Upgrade to Pro', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link( 'admin-menu', 'submenu', "https://www.monsterinsights.com/lite/" ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if ( class_exists( 'WooCommerce' ) ) { |
127 | 127 | // Show the Payments submenu only when WooCommerce is active. |
128 | 128 | add_submenu_page( |
129 | 129 | $hook, |
130 | - __('Payments:', 'google-analytics-for-wordpress'), |
|
131 | - __('Payments', 'google-analytics-for-wordpress'), |
|
130 | + __( 'Payments:', 'google-analytics-for-wordpress' ), |
|
131 | + __( 'Payments', 'google-analytics-for-wordpress' ), |
|
132 | 132 | 'manage_options', |
133 | 133 | $submenu_base . '#/payments' |
134 | 134 | ); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | -add_action('admin_menu', 'monsterinsights_admin_menu'); |
|
138 | +add_action( 'admin_menu', 'monsterinsights_admin_menu' ); |
|
139 | 139 | |
140 | 140 | |
141 | -function monsterinsights_automated_menu($hook){ |
|
141 | +function monsterinsights_automated_menu( $hook ) { |
|
142 | 142 | $display = false; |
143 | 143 | |
144 | - $now = apply_filters('monsterinsights_automated_promotion_date', wp_date('M d, Y h:i:s a')); |
|
144 | + $now = apply_filters( 'monsterinsights_automated_promotion_date', wp_date( 'M d, Y h:i:s a' ) ); |
|
145 | 145 | $conditions = [ |
146 | 146 | [ |
147 | - 'title' => __('Earth Day', 'google-analytics-for-wordpress'), |
|
148 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 17, 2023')), |
|
149 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 18, 2023')), |
|
147 | + 'title' => __( 'Earth Day', 'google-analytics-for-wordpress' ), |
|
148 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Apr 17, 2023' ) ), |
|
149 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Apr 18, 2023' ) ), |
|
150 | 150 | 'utm_campaign' => 'lite-promo', |
151 | 151 | 'utm_source' => 'liteplugin', |
152 | 152 | 'utm_medium' => 'earth-day', |
153 | 153 | ], |
154 | 154 | [ |
155 | - 'title' => __('Cinco De Mayo!', 'google-analytics-for-wordpress'), |
|
156 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('May 01, 2023')), |
|
157 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('May 08, 2023')), |
|
155 | + 'title' => __( 'Cinco De Mayo!', 'google-analytics-for-wordpress' ), |
|
156 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'May 01, 2023' ) ), |
|
157 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'May 08, 2023' ) ), |
|
158 | 158 | 'utm_campaign' => 'lite-promo', |
159 | 159 | 'utm_source' => 'liteplugin', |
160 | 160 | 'utm_medium' => 'cinco-de-mayo', |
161 | 161 | ], |
162 | 162 | [ |
163 | - 'title' => __('Upgrade to GA4', 'google-analytics-for-wordpress'), |
|
164 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jun 01, 2023')), |
|
165 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('July 01, 2023')), |
|
163 | + 'title' => __( 'Upgrade to GA4', 'google-analytics-for-wordpress' ), |
|
164 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Jun 01, 2023' ) ), |
|
165 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'July 01, 2023' ) ), |
|
166 | 166 | 'utm_campaign' => 'lite-promo', |
167 | 167 | 'utm_source' => 'liteplugin', |
168 | 168 | 'utm_medium' => 'goodbye-ga3', |
169 | 169 | ], |
170 | 170 | [ |
171 | - 'title' => __('Summer Sale', 'google-analytics-for-wordpress'), |
|
172 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jul 29, 2023')), |
|
173 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('Aug 05, 2023')), |
|
171 | + 'title' => __( 'Summer Sale', 'google-analytics-for-wordpress' ), |
|
172 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Jul 29, 2023' ) ), |
|
173 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Aug 05, 2023' ) ), |
|
174 | 174 | 'utm_campaign' => 'lite-promo', |
175 | 175 | 'utm_source' => 'liteplugin', |
176 | 176 | 'utm_medium' => 'dogdays', |
177 | 177 | ], |
178 | 178 | [ |
179 | - 'title' => __('Fortune Cookie Day', 'google-analytics-for-wordpress'), |
|
180 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 12, 2023')), |
|
181 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 13, 2023')), |
|
179 | + 'title' => __( 'Fortune Cookie Day', 'google-analytics-for-wordpress' ), |
|
180 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Sep 12, 2023' ) ), |
|
181 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Sep 13, 2023' ) ), |
|
182 | 182 | 'utm_campaign' => 'lite-promo', |
183 | 183 | 'utm_source' => 'liteplugin', |
184 | 184 | 'utm_medium' => 'fortune-cookie', |
185 | 185 | ], |
186 | 186 | [ |
187 | - 'title' => __('Halloween Sale', 'google-analytics-for-wordpress'), |
|
188 | - 'start_time' => wp_date('M d, Y h:i:s a', strtotime('Oct 26, 2023')), |
|
189 | - 'end_time' => wp_date('M d, Y h:i:s a', strtotime('Nov 04, 2023')), |
|
187 | + 'title' => __( 'Halloween Sale', 'google-analytics-for-wordpress' ), |
|
188 | + 'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Oct 26, 2023' ) ), |
|
189 | + 'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Nov 04, 2023' ) ), |
|
190 | 190 | 'utm_campaign' => 'lite-promo', |
191 | 191 | 'utm_source' => 'liteplugin', |
192 | 192 | 'utm_medium' => 'halloween', |
193 | 193 | ], |
194 | 194 | ]; |
195 | 195 | |
196 | - foreach($conditions as $key => $condition){ |
|
197 | - if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])){ |
|
198 | - add_submenu_page($hook, $condition['title'], '<span class="monsterinsights-automated-submenu"> ' . $condition['title'] . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link($condition['utm_medium'], $condition['utm_campaign'], "https://www.monsterinsights.com/lite-promo/")); |
|
196 | + foreach ( $conditions as $key => $condition ) { |
|
197 | + if ( strtotime( $now ) >= strtotime( $condition['start_time'] ) && strtotime( $now ) <= strtotime( $condition['end_time'] ) ) { |
|
198 | + add_submenu_page( $hook, $condition['title'], '<span class="monsterinsights-automated-submenu"> ' . $condition['title'] . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link( $condition['utm_medium'], $condition['utm_campaign'], "https://www.monsterinsights.com/lite-promo/" ) ); |
|
199 | 199 | break; |
200 | 200 | } |
201 | 201 | } |
@@ -206,22 +206,22 @@ discard block |
||
206 | 206 | */ |
207 | 207 | function monsterinsights_woocommerce_menu_item() |
208 | 208 | { |
209 | - if (class_exists('WooCommerce')) { |
|
209 | + if ( class_exists( 'WooCommerce' ) ) { |
|
210 | 210 | // Add "Insights" sub menu item for WooCommerce Analytics menu |
211 | - if (class_exists('MonsterInsights_eCommerce')) { |
|
212 | - add_submenu_page('wc-admin&path=/analytics/overview', __('Insights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress'), 'monsterinsights_view_dashboard', admin_url('admin.php?page=monsterinsights_reports#/ecommerce'), '', 2); |
|
211 | + if ( class_exists( 'MonsterInsights_eCommerce' ) ) { |
|
212 | + add_submenu_page( 'wc-admin&path=/analytics/overview', __( 'Insights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', admin_url( 'admin.php?page=monsterinsights_reports#/ecommerce' ), '', 2 ); |
|
213 | 213 | } else { |
214 | - $submenu_base = add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php')); |
|
215 | - add_submenu_page('wc-admin&path=/analytics/overview', __('Insights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/woocommerce-insights', '', 1); |
|
214 | + $submenu_base = add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ); |
|
215 | + add_submenu_page( 'wc-admin&path=/analytics/overview', __( 'Insights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/woocommerce-insights', '', 1 ); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | -add_action('admin_menu', 'monsterinsights_woocommerce_menu_item', 11); |
|
219 | +add_action( 'admin_menu', 'monsterinsights_woocommerce_menu_item', 11 ); |
|
220 | 220 | |
221 | 221 | function monsterinsights_get_menu_hook() |
222 | 222 | { |
223 | - $dashboards_disabled = monsterinsights_get_option('dashboards_disabled', false); |
|
224 | - if ($dashboards_disabled || (current_user_can('monsterinsights_save_settings') && !current_user_can('monsterinsights_view_dashboard'))) { |
|
223 | + $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
|
224 | + if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
|
225 | 225 | return 'monsterinsights_settings'; |
226 | 226 | } else { |
227 | 227 | return 'monsterinsights_reports'; |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | |
236 | 236 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
237 | 237 | // menu page and the updater on the network panel |
238 | - if (!function_exists('is_plugin_active_for_network')) { |
|
239 | - require_once(ABSPATH . '/wp-admin/includes/plugin.php'); |
|
238 | + if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
|
239 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
240 | 240 | } |
241 | 241 | |
242 | - $plugin = plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE); |
|
243 | - if (!is_plugin_active_for_network($plugin)) { |
|
242 | + $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
|
243 | + if ( ! is_plugin_active_for_network( $plugin ) ) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
@@ -252,31 +252,31 @@ discard block |
||
252 | 252 | |
253 | 253 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
254 | 254 | $hook = 'monsterinsights_network'; |
255 | - $submenu_base = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php')); |
|
256 | - add_menu_page(__('Network Settings:', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress') . $menu_notification_indicator, 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543'); |
|
255 | + $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
|
256 | + add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . $menu_notification_indicator, 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' ); |
|
257 | 257 | |
258 | - add_submenu_page($hook, __('Network Settings:', 'google-analytics-for-wordpress'), __('Network Settings', 'google-analytics-for-wordpress'), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page'); |
|
258 | + add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' ); |
|
259 | 259 | |
260 | - add_submenu_page($hook, __('General Reports:', 'google-analytics-for-wordpress'), __('Reports', 'google-analytics-for-wordpress'), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page'); |
|
260 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
261 | 261 | |
262 | - if (function_exists('aioseo')) { |
|
262 | + if ( function_exists( 'aioseo' ) ) { |
|
263 | 263 | $seo_url = monsterinsights_aioseo_dashboard_url(); |
264 | 264 | } else { |
265 | 265 | $seo_url = $submenu_base . '#/seo'; |
266 | 266 | } |
267 | 267 | // then seo |
268 | - add_submenu_page($hook, __('SEO:', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url, 'monsterinsights_seo_page'); |
|
268 | + add_submenu_page( $hook, __( 'SEO:', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url, 'monsterinsights_seo_page' ); |
|
269 | 269 | |
270 | 270 | // then addons |
271 | - add_submenu_page($hook, __('Addons:', 'google-analytics-for-wordpress'), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __('Addons', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons'); |
|
271 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons' ); |
|
272 | 272 | |
273 | - $submenu_base = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php')); |
|
273 | + $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ); |
|
274 | 274 | |
275 | 275 | // Add About us page. |
276 | - add_submenu_page($hook, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about'); |
|
276 | + add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' ); |
|
277 | 277 | } |
278 | 278 | |
279 | -add_action('network_admin_menu', 'monsterinsights_network_admin_menu', 5); |
|
279 | +add_action( 'network_admin_menu', 'monsterinsights_network_admin_menu', 5 ); |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Adds one or more classes to the body tag in the dashboard. |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return String Altered body classes. |
287 | 287 | */ |
288 | -function monsterinsights_add_admin_body_class($classes) |
|
288 | +function monsterinsights_add_admin_body_class( $classes ) |
|
289 | 289 | { |
290 | - $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
|
291 | - if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) { |
|
290 | + $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
|
291 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
|
292 | 292 | return $classes; |
293 | 293 | } |
294 | 294 | |
295 | 295 | return "$classes monsterinsights_page "; |
296 | 296 | } |
297 | 297 | |
298 | -add_filter('admin_body_class', 'monsterinsights_add_admin_body_class', 10, 1); |
|
298 | +add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class', 10, 1 ); |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Adds one or more classes to the body tag in the dashboard. |
@@ -304,18 +304,18 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return String Altered body classes. |
306 | 306 | */ |
307 | -function monsterinsights_add_admin_body_class_tools_page($classes) |
|
307 | +function monsterinsights_add_admin_body_class_tools_page( $classes ) |
|
308 | 308 | { |
309 | - $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
|
309 | + $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
|
310 | 310 | |
311 | - if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_tools') === false || 'insights_page_monsterinsights_tools' === $screen->id) { |
|
311 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) { |
|
312 | 312 | return $classes; |
313 | 313 | } |
314 | 314 | |
315 | 315 | return "$classes insights_page_monsterinsights_tools "; |
316 | 316 | } |
317 | 317 | |
318 | -add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_tools_page', 10, 1); |
|
318 | +add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class_tools_page', 10, 1 ); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Adds one or more classes to the body tag in the dashboard. |
@@ -324,17 +324,17 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @return String Altered body classes. |
326 | 326 | */ |
327 | -function monsterinsights_add_admin_body_class_addons_page($classes) |
|
327 | +function monsterinsights_add_admin_body_class_addons_page( $classes ) |
|
328 | 328 | { |
329 | - $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
|
330 | - if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_addons') === false || 'insights_page_monsterinsights_addons' === $screen->id) { |
|
329 | + $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; |
|
330 | + if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) { |
|
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | return "$classes insights_page_monsterinsights_addons "; |
335 | 335 | } |
336 | 336 | |
337 | -add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_addons_page', 10, 1); |
|
337 | +add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class_addons_page', 10, 1 ); |
|
338 | 338 | |
339 | 339 | /** |
340 | 340 | * Add a link to the settings page to the plugins list |
@@ -343,39 +343,39 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return array $links |
345 | 345 | */ |
346 | -function monsterinsights_add_action_links($links) |
|
346 | +function monsterinsights_add_action_links( $links ) |
|
347 | 347 | { |
348 | - $docs = '<a title="' . esc_attr__('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>'; |
|
349 | - array_unshift($links, $docs); |
|
348 | + $docs = '<a title="' . esc_attr__( '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>'; |
|
349 | + array_unshift( $links, $docs ); |
|
350 | 350 | |
351 | 351 | // If Lite, support goes to forum. If pro, it goes to our website |
352 | - if (monsterinsights_is_pro_version()) { |
|
353 | - $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>'; |
|
354 | - array_unshift($links, $support); |
|
352 | + if ( monsterinsights_is_pro_version() ) { |
|
353 | + $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>'; |
|
354 | + array_unshift( $links, $support ); |
|
355 | 355 | } else { |
356 | - $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>'; |
|
357 | - array_unshift($links, $support); |
|
356 | + $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>'; |
|
357 | + array_unshift( $links, $support ); |
|
358 | 358 | } |
359 | 359 | |
360 | - if (is_network_admin()) { |
|
361 | - $settings_link = '<a href="' . esc_url(network_admin_url('admin.php?page=monsterinsights_network')) . '">' . esc_html__('Network Settings', 'google-analytics-for-wordpress') . '</a>'; |
|
360 | + if ( is_network_admin() ) { |
|
361 | + $settings_link = '<a href="' . esc_url( network_admin_url( 'admin.php?page=monsterinsights_network' ) ) . '">' . esc_html__( 'Network Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
|
362 | 362 | } else { |
363 | - $settings_link = '<a href="' . esc_url(admin_url('admin.php?page=monsterinsights_settings')) . '">' . esc_html__('Settings', 'google-analytics-for-wordpress') . '</a>'; |
|
363 | + $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - array_unshift($links, $settings_link); |
|
366 | + array_unshift( $links, $settings_link ); |
|
367 | 367 | |
368 | 368 | // If lite, show a link where they can get pro from |
369 | - if (!monsterinsights_is_pro_version()) { |
|
370 | - $get_pro = '<a title="' . esc_attr__('Get MonsterInsights Pro', 'google-analytics-for-wordpress') . '" target="_blank" rel="noopener" href="' . monsterinsights_get_upgrade_link('all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/") . '" style="font-weight:700; color: #1da867;">' . esc_html__('Get MonsterInsights Pro', 'google-analytics-for-wordpress') . '</a>'; |
|
371 | - array_unshift($links, $get_pro); |
|
369 | + if ( ! monsterinsights_is_pro_version() ) { |
|
370 | + $get_pro = '<a title="' . esc_attr__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" target="_blank" rel="noopener" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/" ) . '" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
371 | + array_unshift( $links, $get_pro ); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | return $links; |
375 | 375 | } |
376 | 376 | |
377 | -add_filter('plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links'); |
|
378 | -add_filter('network_admin_plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links'); |
|
377 | +add_filter( 'plugin_action_links_' . plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ), 'monsterinsights_add_action_links' ); |
|
378 | +add_filter( 'network_admin_plugin_action_links_' . plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ), 'monsterinsights_add_action_links' ); |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * Loads a partial view for the Administration screen |
@@ -389,31 +389,31 @@ discard block |
||
389 | 389 | * @since 6.0.0 |
390 | 390 | * |
391 | 391 | */ |
392 | -function monsterinsights_load_admin_partial($template, $data = array()) |
|
392 | +function monsterinsights_load_admin_partial( $template, $data = array() ) |
|
393 | 393 | { |
394 | 394 | |
395 | - if (monsterinsights_is_pro_version()) { |
|
396 | - $dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'pro/includes/admin/partials'); |
|
395 | + if ( monsterinsights_is_pro_version() ) { |
|
396 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
397 | 397 | |
398 | - if (file_exists($dir . $template . '.php')) { |
|
399 | - require_once($dir . $template . '.php'); |
|
398 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
399 | + require_once( $dir . $template . '.php' ); |
|
400 | 400 | |
401 | 401 | return true; |
402 | 402 | } |
403 | 403 | } else { |
404 | - $dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'lite/includes/admin/partials'); |
|
404 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
405 | 405 | |
406 | - if (file_exists($dir . $template . '.php')) { |
|
407 | - require_once($dir . $template . '.php'); |
|
406 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
407 | + require_once( $dir . $template . '.php' ); |
|
408 | 408 | |
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | - $dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'includes/admin/partials'); |
|
413 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
|
414 | 414 | |
415 | - if (file_exists($dir . $template . '.php')) { |
|
416 | - require_once($dir . $template . '.php'); |
|
415 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
416 | + require_once( $dir . $template . '.php' ); |
|
417 | 417 | |
418 | 418 | return true; |
419 | 419 | } |
@@ -430,24 +430,24 @@ discard block |
||
430 | 430 | * @return string |
431 | 431 | * @since 6.0.0 |
432 | 432 | */ |
433 | -function monsterinsights_admin_footer($text) |
|
433 | +function monsterinsights_admin_footer( $text ) |
|
434 | 434 | { |
435 | 435 | global $current_screen; |
436 | - if (!empty($current_screen->id) && strpos($current_screen->id, 'monsterinsights') !== false) { |
|
436 | + if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
|
437 | 437 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
438 | 438 | // Translators: Placeholders add a link to the wordpress.org repository. |
439 | - $text = sprintf(esc_html__('Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress'), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>'); |
|
439 | + $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | return $text; |
443 | 443 | } |
444 | 444 | |
445 | -add_filter('admin_footer_text', 'monsterinsights_admin_footer', 1, 2); |
|
445 | +add_filter( 'admin_footer_text', 'monsterinsights_admin_footer', 1, 2 ); |
|
446 | 446 | |
447 | 447 | function monsterinsights_admin_setup_notices() |
448 | 448 | { |
449 | 449 | // Make sure they have the permissions to do something |
450 | - if (!current_user_can('monsterinsights_save_settings')) { |
|
450 | + if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
451 | 451 | return; |
452 | 452 | } |
453 | 453 | |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | // 0. UA sunset supported alert |
467 | 467 | $profile = is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile() : MonsterInsights()->auth->get_analytics_profile(); |
468 | 468 | |
469 | - if ( !empty($profile['ua']) && empty($profile['v4']) && !monsterinsights_is_own_admin_page() ) { |
|
470 | - $title = __('Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress'); |
|
471 | - $message = __('Google Analytics 3 (UA) and support was sunset on July 1, 2023. Your website is currently NOT tracking any analytics. </br>Create or connect a new Google Analytics 4 property immediately to start tracking.', 'google-analytics-for-wordpress'); |
|
469 | + if ( ! empty( $profile['ua'] ) && empty( $profile['v4'] ) && ! monsterinsights_is_own_admin_page() ) { |
|
470 | + $title = __( 'Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress' ); |
|
471 | + $message = __( 'Google Analytics 3 (UA) and support was sunset on July 1, 2023. Your website is currently NOT tracking any analytics. </br>Create or connect a new Google Analytics 4 property immediately to start tracking.', 'google-analytics-for-wordpress' ); |
|
472 | 472 | |
473 | - $wizard_url = admin_url('admin.php?page=monsterinsights-onboarding'); |
|
473 | + $wizard_url = admin_url( 'admin.php?page=monsterinsights-onboarding' ); |
|
474 | 474 | |
475 | 475 | echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_ua_sunset">'; |
476 | 476 | echo '<p><strong>' . $title . '</strong></p>'; |
@@ -508,38 +508,38 @@ discard block |
||
508 | 508 | |
509 | 509 | // 2. License key not entered for pro |
510 | 510 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
511 | - if (monsterinsights_is_pro_version() && empty($key)) { |
|
512 | - $page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings'); |
|
511 | + if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
|
512 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
513 | 513 | // Translators: Adds a link to retrieve the license. |
514 | - $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>'); |
|
514 | + $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>' ); |
|
515 | 515 | echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore |
516 | 516 | |
517 | 517 | return; |
518 | 518 | } |
519 | 519 | |
520 | 520 | // 3. License key not valid/okay for pro |
521 | - if (monsterinsights_is_pro_version()) { |
|
521 | + if ( monsterinsights_is_pro_version() ) { |
|
522 | 522 | $message = ''; |
523 | - if (MonsterInsights()->license->get_site_license_key()) { |
|
524 | - if (MonsterInsights()->license->site_license_expired()) { |
|
523 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
524 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
525 | 525 | // Translators: Adds a link to the license renewal. |
526 | - $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>'); |
|
527 | - } else if (MonsterInsights()->license->site_license_disabled()) { |
|
528 | - $message = esc_html__('Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress'); |
|
529 | - } else if (MonsterInsights()->license->site_license_invalid()) { |
|
530 | - $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'); |
|
526 | + $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>' ); |
|
527 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
528 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
529 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
530 | + $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' ); |
|
531 | 531 | } |
532 | - } else if (MonsterInsights()->license->get_network_license_key()) { |
|
533 | - if (MonsterInsights()->license->network_license_expired()) { |
|
532 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
533 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
534 | 534 | // Translators: Adds a link to renew license. |
535 | - $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>'); |
|
536 | - } else if (MonsterInsights()->license->network_license_disabled()) { |
|
537 | - $message = esc_html__('Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress'); |
|
538 | - } else if (MonsterInsights()->license->network_license_invalid()) { |
|
539 | - $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'); |
|
535 | + $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>' ); |
|
536 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
537 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
538 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
539 | + $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' ); |
|
540 | 540 | } |
541 | 541 | } |
542 | - if (!empty($message)) { |
|
542 | + if ( ! empty( $message ) ) { |
|
543 | 543 | echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore |
544 | 544 | |
545 | 545 | return; |
@@ -547,28 +547,28 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | // 4. Notices for PHP/WP version deprecations |
550 | - if (current_user_can('update_core')) { |
|
550 | + if ( current_user_can( 'update_core' ) ) { |
|
551 | 551 | global $wp_version; |
552 | 552 | |
553 | - $compatible_php_version = apply_filters('monsterinsights_compatible_php_version', false); |
|
554 | - $compatible_wp_version = apply_filters('monsterinsights_compatible_wp_version', false); |
|
553 | + $compatible_php_version = apply_filters( 'monsterinsights_compatible_php_version', false ); |
|
554 | + $compatible_wp_version = apply_filters( 'monsterinsights_compatible_wp_version', false ); |
|
555 | 555 | |
556 | - $url = monsterinsights_get_url('global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/'); |
|
556 | + $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ); |
|
557 | 557 | |
558 | 558 | $message = false; |
559 | - if (version_compare(phpversion(), $compatible_php_version['required'], '<')) { |
|
559 | + if ( version_compare( phpversion(), $compatible_php_version['required'], '<' ) ) { |
|
560 | 560 | // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
561 | - $message = sprintf(esc_html__('Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress'), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>'); |
|
562 | - } else if (version_compare(phpversion(), $compatible_php_version['warning'], '<')) { |
|
561 | + $message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' ); |
|
562 | + } else if ( version_compare( phpversion(), $compatible_php_version['warning'], '<' ) ) { |
|
563 | 563 | // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
564 | - $message = sprintf(esc_html__('Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in November, 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>'); |
|
565 | - } else if (version_compare(phpversion(), $compatible_php_version['recommended'], '<')) { |
|
564 | + $message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in November, 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>' ); |
|
565 | + } else if ( version_compare( phpversion(), $compatible_php_version['recommended'], '<' ) ) { |
|
566 | 566 | // Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break. |
567 | - $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 is working towards discontinuing support for your PHP version.%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>'); |
|
567 | + $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 is working towards discontinuing support for your PHP version.%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>' ); |
|
568 | 568 | } |
569 | 569 | |
570 | - if ($message) { |
|
571 | - echo '<div class="error"><p>' . wp_kses($message, [ |
|
570 | + if ( $message ) { |
|
571 | + echo '<div class="error"><p>' . wp_kses( $message, [ |
|
572 | 572 | 'br' => array(), |
573 | 573 | 'b' => array(), |
574 | 574 | 'strong' => array(), |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | 'target' => array(), |
579 | 579 | 'title' => array(), |
580 | 580 | ), |
581 | - ]) . '</p></div>'; |
|
581 | + ] ) . '</p></div>'; |
|
582 | 582 | return; |
583 | 583 | } |
584 | 584 | |
@@ -632,26 +632,26 @@ discard block |
||
632 | 632 | // } |
633 | 633 | // } |
634 | 634 | |
635 | - $notices = get_option('monsterinsights_notices'); |
|
636 | - if (!is_array($notices)) { |
|
635 | + $notices = get_option( 'monsterinsights_notices' ); |
|
636 | + if ( ! is_array( $notices ) ) { |
|
637 | 637 | $notices = array(); |
638 | 638 | } |
639 | 639 | |
640 | 640 | // 6. Authenticate, not manual |
641 | 641 | $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
642 | - $url = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings'); |
|
642 | + $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
643 | 643 | $tracking_code = monsterinsights_get_v4_id_to_output(); |
644 | 644 | // Translators: Placeholders add links to the settings panel. |
645 | - $manual_text = sprintf(esc_html__('Important: You are currently using manual GA4 Measurement ID 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>'); |
|
646 | - $migrated = monsterinsights_get_option('gadwp_migrated', 0); |
|
647 | - if ($migrated > 0) { |
|
648 | - $url = admin_url('admin.php?page=monsterinsights-getting-started&monsterinsights-migration=1'); |
|
645 | + $manual_text = sprintf( esc_html__( 'Important: You are currently using manual GA4 Measurement ID 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>' ); |
|
646 | + $migrated = monsterinsights_get_option( 'gadwp_migrated', 0 ); |
|
647 | + if ( $migrated > 0 ) { |
|
648 | + $url = admin_url( 'admin.php?page=monsterinsights-getting-started&monsterinsights-migration=1' ); |
|
649 | 649 | // Translators: Placeholders add links to the settings panel. |
650 | - $text = esc_html__('Click %1$shere%2$s to reauthenticate to be able to access reports. For more information why this is required, see our %3$sblog post%4$s.', 'google-analytics-for-wordpress'); |
|
651 | - $manual_text = sprintf($text, '<a href="' . esc_url($url) . '">', '</a>', '<a href="' . monsterinsights_get_url('notice', 'manual-ua', 'https://www.exactmetrics.com/why-did-we-implement-the-new-google-analytics-authentication-flow-challenges-explained/') . '" target="_blank">', '</a>'); |
|
650 | + $text = esc_html__( 'Click %1$shere%2$s to reauthenticate to be able to access reports. For more information why this is required, see our %3$sblog post%4$s.', 'google-analytics-for-wordpress' ); |
|
651 | + $manual_text = sprintf( $text, '<a href="' . esc_url( $url ) . '">', '</a>', '<a href="' . monsterinsights_get_url( 'notice', 'manual-ua', 'https://www.exactmetrics.com/why-did-we-implement-the-new-google-analytics-authentication-flow-challenges-explained/' ) . '" target="_blank">', '</a>' ); |
|
652 | 652 | } |
653 | 653 | |
654 | - if (empty($authed) && !isset($notices['monsterinsights_auth_not_manual']) && !empty($tracking_code)) { |
|
654 | + if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) && ! empty( $tracking_code ) ) { |
|
655 | 655 | echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
656 | 656 | echo '<p>'; |
657 | 657 | echo $manual_text; // phpcs:ignore |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | // } |
678 | 678 | |
679 | 679 | // 8. WooUpsell |
680 | - if (!monsterinsights_is_pro_version() && class_exists('WooCommerce') && $is_plugins_page) { |
|
681 | - if (!isset($notices['monsterinsights_woocommerce_tracking_available'])) { |
|
680 | + if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) && $is_plugins_page ) { |
|
681 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { |
|
682 | 682 | $woo_notice_template = '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available"> |
683 | 683 | %1$s |
684 | 684 | <div class="monsterinsights-wooedd-upsell-left"> |
@@ -694,28 +694,28 @@ discard block |
||
694 | 694 | |
695 | 695 | $woo_notice_button = sprintf( |
696 | 696 | // Translators: Placeholders add a link to the MonsterInsights website. |
697 | - esc_html__('%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress'), |
|
698 | - '<a class="button button-primary button-hero" target="_blank" href="' . esc_url(monsterinsights_get_upgrade_link('admin-notices', 'woocommerce-upgrade')) . '">', |
|
697 | + esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), |
|
698 | + '<a class="button button-primary button-hero" target="_blank" href="' . esc_url( monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) ) . '">', |
|
699 | 699 | ' »</a>' |
700 | 700 | ); |
701 | 701 | |
702 | 702 | $woo_notice_offer = sprintf( |
703 | 703 | '<div class="monsterinsights-wooedd-upsell-offer">%1$s</div>', |
704 | - __('Save <span>50%</span> Off MonsterInsights Pro', 'google-analytics-for-wordpress') |
|
704 | + __( 'Save <span>50%</span> Off MonsterInsights Pro', 'google-analytics-for-wordpress' ) |
|
705 | 705 | ); |
706 | 706 | |
707 | - $woo_notice_bg = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/monsterinsights-woo-edd-upsell.svg'; |
|
708 | - $woo_notice_offer_icon = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-offer-icon.svg'; |
|
707 | + $woo_notice_bg = esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/monsterinsights-woo-edd-upsell.svg'; |
|
708 | + $woo_notice_offer_icon = esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/woo-offer-icon.svg'; |
|
709 | 709 | $woo_notice_style = "<style>.monsterinsights-wooedd-upsell-left .button-hero,.monsterinsights-wooedd-upsell-offer{width:270px;margin-bottom:20px;text-align:center}.monsterinsights-wooedd-upsell-row{display:flex;background-image:url($woo_notice_bg);background-repeat:no-repeat;background-position:96% bottom}.monsterinsights-wooedd-upsell-left{margin-left:20px}.monsterinsights-wooedd-upsell-offer{background:#fafeb0;padding:6px 0;position:relative;font-weight:700;font-size:15px;line-height:28px}.monsterinsights-wooedd-upsell-offer span{color:#338eef}.monsterinsights-wooedd-upsell-offer:before{content:url('$woo_notice_offer_icon');position:absolute;left:-23px;bottom:-30px}@media (max-width:1300px){.monsterinsights-wooedd-upsell-row{background-size:60%}}@media (max-width:900px){.monsterinsights-wooedd-upsell-row{background-image:none}.monsterinsights-wooedd-upsell-left,.monsterinsights-wooedd-upsell-left .button-hero,.monsterinsights-wooedd-upsell-offer{width:100%}}</style>"; |
710 | 710 | |
711 | 711 | echo sprintf( |
712 | 712 | $woo_notice_template, |
713 | 713 | $woo_notice_style, |
714 | - __('Add eCommerce Analytics to your WooCommerce Store', 'google-analytics-for-wordpress'), |
|
715 | - __('Unlock all of our advanced eCommerce features specifically designed to help your store make more money..', 'google-analytics-for-wordpress'), |
|
716 | - __('MonsterInsights Pro users instantly gain access to valuable insights such as average order value, conversion rates, as well as marketing performance with UTM tracking.', 'google-analytics-for-wordpress'), |
|
717 | - __('And by upgrading, Pro users also get enhanced tracking for Forms, User Journeys, PPC Pixels, Custom UserID tracking, SEO Reports, and much more.', 'google-analytics-for-wordpress'), |
|
718 | - __('Start making better data-driven decisions today!', 'google-analytics-for-wordpress'), |
|
714 | + __( 'Add eCommerce Analytics to your WooCommerce Store', 'google-analytics-for-wordpress' ), |
|
715 | + __( 'Unlock all of our advanced eCommerce features specifically designed to help your store make more money..', 'google-analytics-for-wordpress' ), |
|
716 | + __( 'MonsterInsights Pro users instantly gain access to valuable insights such as average order value, conversion rates, as well as marketing performance with UTM tracking.', 'google-analytics-for-wordpress' ), |
|
717 | + __( 'And by upgrading, Pro users also get enhanced tracking for Forms, User Journeys, PPC Pixels, Custom UserID tracking, SEO Reports, and much more.', 'google-analytics-for-wordpress' ), |
|
718 | + __( 'Start making better data-driven decisions today!', 'google-analytics-for-wordpress' ), |
|
719 | 719 | $woo_notice_offer, |
720 | 720 | $woo_notice_button |
721 | 721 | ); |
@@ -724,30 +724,30 @@ discard block |
||
724 | 724 | } |
725 | 725 | |
726 | 726 | // 9. EDDUpsell |
727 | - if (!monsterinsights_is_pro_version() && class_exists('Easy_Digital_Downloads') && $is_plugins_page) { |
|
728 | - if (!isset($notices['monsterinsights_edd_tracking_available'])) { |
|
727 | + if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) && $is_plugins_page ) { |
|
728 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { |
|
729 | 729 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
730 | 730 | echo '<div class="monsterinsights-wooedd-upsell-left">'; |
731 | 731 | echo '<p><strong>'; |
732 | - echo esc_html('Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress'); |
|
732 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
733 | 733 | echo '</strong></p>'; |
734 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
734 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
735 | 735 | echo '<p>'; |
736 | - echo esc_html('MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress'); |
|
736 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
737 | 737 | echo '</p>'; |
738 | 738 | echo '<p>'; |
739 | - 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'); |
|
739 | + 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' ); |
|
740 | 740 | echo '</p>'; |
741 | 741 | echo '<p>'; |
742 | - echo esc_html('Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress'); |
|
742 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
743 | 743 | echo '</p>'; |
744 | 744 | echo '<p>'; |
745 | - echo esc_html('Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress'); |
|
745 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
746 | 746 | echo '</p>'; |
747 | - echo sprintf(esc_html__('%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress'), '<a class="button button-primary button-hero" target="_blank" href="' . esc_url(monsterinsights_get_upgrade_link('admin-notices', 'edd-upgrade')) . '">', ' »</a>'); |
|
747 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" target="_blank" href="' . esc_url( monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) ) . '">', ' »</a>' ); |
|
748 | 748 | echo '</p>'; |
749 | 749 | echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
750 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
750 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
751 | 751 | echo '</div>'; |
752 | 752 | echo '</div>'; |
753 | 753 | |
@@ -756,32 +756,32 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | |
759 | - if (isset($notices['monsterinsights_cross_domains_extracted']) && false === $notices['monsterinsights_cross_domains_extracted']) { |
|
760 | - $page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings'); |
|
759 | + if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) { |
|
760 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
761 | 761 | $page = $page . '#/advanced'; |
762 | 762 | // Translators: Adds a link to the settings panel. |
763 | - $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>'); |
|
763 | + $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>' ); |
|
764 | 764 | echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; // phpcs:ignore |
765 | 765 | |
766 | 766 | return; |
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
770 | -add_action('admin_notices', 'monsterinsights_admin_setup_notices'); |
|
771 | -add_action('network_admin_notices', 'monsterinsights_admin_setup_notices'); |
|
770 | +add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
|
771 | +add_action( 'network_admin_notices', 'monsterinsights_admin_setup_notices' ); |
|
772 | 772 | |
773 | 773 | |
774 | 774 | // AM Notices |
775 | -function monsterinsights_am_notice_optout($super_admin) |
|
775 | +function monsterinsights_am_notice_optout( $super_admin ) |
|
776 | 776 | { |
777 | - if (monsterinsights_get_option('hide_am_notices', false) || monsterinsights_get_option('network_hide_am_notices', false)) { |
|
777 | + if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
|
778 | 778 | return false; |
779 | 779 | } |
780 | 780 | |
781 | 781 | return $super_admin; |
782 | 782 | } |
783 | 783 | |
784 | -add_filter("am_notifications_display", 'monsterinsights_am_notice_optout', 10, 1); |
|
784 | +add_filter( "am_notifications_display", 'monsterinsights_am_notice_optout', 10, 1 ); |
|
785 | 785 | |
786 | 786 | /** |
787 | 787 | * Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers. |
@@ -801,20 +801,20 @@ discard block |
||
801 | 801 | <?php |
802 | 802 | } |
803 | 803 | |
804 | -add_action('admin_head', 'monsterinsights_admin_menu_inline_styles', 300); |
|
804 | +add_action( 'admin_head', 'monsterinsights_admin_menu_inline_styles', 300 ); |
|
805 | 805 | |
806 | 806 | /** |
807 | 807 | * Display notice in admin when measurement protocol is left blank |
808 | 808 | */ |
809 | 809 | function monsterinsights_empty_measurement_protocol_token() |
810 | 810 | { |
811 | - if (!class_exists('MonsterInsights_eCommerce') && !class_exists('MonsterInsights_Forms')) { |
|
811 | + if ( ! class_exists( 'MonsterInsights_eCommerce' ) && ! class_exists( 'MonsterInsights_Forms' ) ) { |
|
812 | 812 | return; |
813 | 813 | } |
814 | 814 | |
815 | 815 | $page = is_network_admin() |
816 | - ? network_admin_url('admin.php?page=monsterinsights_network') |
|
817 | - : admin_url('admin.php?page=monsterinsights_settings'); |
|
816 | + ? network_admin_url( 'admin.php?page=monsterinsights_network' ) |
|
817 | + : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
818 | 818 | |
819 | 819 | $api_secret = is_network_admin() |
820 | 820 | ? MonsterInsights()->auth->get_network_measurement_protocol_secret() |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | |
823 | 823 | $current_code = monsterinsights_get_v4_id_to_output(); |
824 | 824 | |
825 | - if (empty($current_code) || !empty($api_secret)) { |
|
825 | + if ( empty( $current_code ) || ! empty( $api_secret ) ) { |
|
826 | 826 | return; |
827 | 827 | } |
828 | 828 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | 'Your Measurement Protocol API Secret is currently left blank. To see more advanced analytics please enter a Measurement API Secret. %1$sLearn how to find your API Secret%2$s.', |
833 | 833 | 'google-analytics-for-wordpress' |
834 | 834 | ), |
835 | - '<a target="_blank" href="' . monsterinsights_get_url('notice', 'empty-measurement-protocol-secret', 'https://www.monsterinsights.com/docs/how-to-create-your-measurement-protocol-api-secret-in-ga4/') . '">', |
|
835 | + '<a target="_blank" href="' . monsterinsights_get_url( 'notice', 'empty-measurement-protocol-secret', 'https://www.monsterinsights.com/docs/how-to-create-your-measurement-protocol-api-secret-in-ga4/' ) . '">', |
|
836 | 836 | '</a>' |
837 | 837 | ); |
838 | 838 | echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @access public |
24 | 24 | * |
25 | 25 | */ |
26 | -function monsterinsights_admin_menu() |
|
27 | -{ |
|
26 | +function monsterinsights_admin_menu() { |
|
28 | 27 | $hook = monsterinsights_get_menu_hook(); |
29 | 28 | $menu_icon_inline = monsterinsights_get_inline_menu_icon(); |
30 | 29 | $newIndicator = sprintf( |
@@ -138,7 +137,7 @@ discard block |
||
138 | 137 | add_action('admin_menu', 'monsterinsights_admin_menu'); |
139 | 138 | |
140 | 139 | |
141 | -function monsterinsights_automated_menu($hook){ |
|
140 | +function monsterinsights_automated_menu($hook) { |
|
142 | 141 | $display = false; |
143 | 142 | |
144 | 143 | $now = apply_filters('monsterinsights_automated_promotion_date', wp_date('M d, Y h:i:s a')); |
@@ -193,8 +192,8 @@ discard block |
||
193 | 192 | ], |
194 | 193 | ]; |
195 | 194 | |
196 | - foreach($conditions as $key => $condition){ |
|
197 | - if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])){ |
|
195 | + foreach($conditions as $key => $condition) { |
|
196 | + if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])) { |
|
198 | 197 | add_submenu_page($hook, $condition['title'], '<span class="monsterinsights-automated-submenu"> ' . $condition['title'] . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link($condition['utm_medium'], $condition['utm_campaign'], "https://www.monsterinsights.com/lite-promo/")); |
199 | 198 | break; |
200 | 199 | } |
@@ -204,8 +203,7 @@ discard block |
||
204 | 203 | /** |
205 | 204 | * Add this separately so all the Woo menu items are loaded and the position parameter works correctly. |
206 | 205 | */ |
207 | -function monsterinsights_woocommerce_menu_item() |
|
208 | -{ |
|
206 | +function monsterinsights_woocommerce_menu_item() { |
|
209 | 207 | if (class_exists('WooCommerce')) { |
210 | 208 | // Add "Insights" sub menu item for WooCommerce Analytics menu |
211 | 209 | if (class_exists('MonsterInsights_eCommerce')) { |
@@ -218,8 +216,7 @@ discard block |
||
218 | 216 | } |
219 | 217 | add_action('admin_menu', 'monsterinsights_woocommerce_menu_item', 11); |
220 | 218 | |
221 | -function monsterinsights_get_menu_hook() |
|
222 | -{ |
|
219 | +function monsterinsights_get_menu_hook() { |
|
223 | 220 | $dashboards_disabled = monsterinsights_get_option('dashboards_disabled', false); |
224 | 221 | if ($dashboards_disabled || (current_user_can('monsterinsights_save_settings') && !current_user_can('monsterinsights_view_dashboard'))) { |
225 | 222 | return 'monsterinsights_settings'; |
@@ -228,8 +225,7 @@ discard block |
||
228 | 225 | } |
229 | 226 | } |
230 | 227 | |
231 | -function monsterinsights_network_admin_menu() |
|
232 | -{ |
|
228 | +function monsterinsights_network_admin_menu() { |
|
233 | 229 | // Get the base class object. |
234 | 230 | $base = MonsterInsights(); |
235 | 231 | |
@@ -285,8 +281,7 @@ discard block |
||
285 | 281 | * |
286 | 282 | * @return String Altered body classes. |
287 | 283 | */ |
288 | -function monsterinsights_add_admin_body_class($classes) |
|
289 | -{ |
|
284 | +function monsterinsights_add_admin_body_class($classes) { |
|
290 | 285 | $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
291 | 286 | if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) { |
292 | 287 | return $classes; |
@@ -304,8 +299,7 @@ discard block |
||
304 | 299 | * |
305 | 300 | * @return String Altered body classes. |
306 | 301 | */ |
307 | -function monsterinsights_add_admin_body_class_tools_page($classes) |
|
308 | -{ |
|
302 | +function monsterinsights_add_admin_body_class_tools_page($classes) { |
|
309 | 303 | $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
310 | 304 | |
311 | 305 | if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_tools') === false || 'insights_page_monsterinsights_tools' === $screen->id) { |
@@ -324,8 +318,7 @@ discard block |
||
324 | 318 | * |
325 | 319 | * @return String Altered body classes. |
326 | 320 | */ |
327 | -function monsterinsights_add_admin_body_class_addons_page($classes) |
|
328 | -{ |
|
321 | +function monsterinsights_add_admin_body_class_addons_page($classes) { |
|
329 | 322 | $screen = function_exists('get_current_screen') ? get_current_screen() : false; |
330 | 323 | if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_addons') === false || 'insights_page_monsterinsights_addons' === $screen->id) { |
331 | 324 | return $classes; |
@@ -343,8 +336,7 @@ discard block |
||
343 | 336 | * |
344 | 337 | * @return array $links |
345 | 338 | */ |
346 | -function monsterinsights_add_action_links($links) |
|
347 | -{ |
|
339 | +function monsterinsights_add_action_links($links) { |
|
348 | 340 | $docs = '<a title="' . esc_attr__('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>'; |
349 | 341 | array_unshift($links, $docs); |
350 | 342 | |
@@ -389,8 +381,7 @@ discard block |
||
389 | 381 | * @since 6.0.0 |
390 | 382 | * |
391 | 383 | */ |
392 | -function monsterinsights_load_admin_partial($template, $data = array()) |
|
393 | -{ |
|
384 | +function monsterinsights_load_admin_partial($template, $data = array()) { |
|
394 | 385 | |
395 | 386 | if (monsterinsights_is_pro_version()) { |
396 | 387 | $dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'pro/includes/admin/partials'); |
@@ -430,8 +421,7 @@ discard block |
||
430 | 421 | * @return string |
431 | 422 | * @since 6.0.0 |
432 | 423 | */ |
433 | -function monsterinsights_admin_footer($text) |
|
434 | -{ |
|
424 | +function monsterinsights_admin_footer($text) { |
|
435 | 425 | global $current_screen; |
436 | 426 | if (!empty($current_screen->id) && strpos($current_screen->id, 'monsterinsights') !== false) { |
437 | 427 | $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
@@ -444,8 +434,7 @@ discard block |
||
444 | 434 | |
445 | 435 | add_filter('admin_footer_text', 'monsterinsights_admin_footer', 1, 2); |
446 | 436 | |
447 | -function monsterinsights_admin_setup_notices() |
|
448 | -{ |
|
437 | +function monsterinsights_admin_setup_notices() { |
|
449 | 438 | // Make sure they have the permissions to do something |
450 | 439 | if (!current_user_can('monsterinsights_save_settings')) { |
451 | 440 | return; |
@@ -772,8 +761,7 @@ discard block |
||
772 | 761 | |
773 | 762 | |
774 | 763 | // AM Notices |
775 | -function monsterinsights_am_notice_optout($super_admin) |
|
776 | -{ |
|
764 | +function monsterinsights_am_notice_optout($super_admin) { |
|
777 | 765 | if (monsterinsights_get_option('hide_am_notices', false) || monsterinsights_get_option('network_hide_am_notices', false)) { |
778 | 766 | return false; |
779 | 767 | } |
@@ -786,8 +774,7 @@ discard block |
||
786 | 774 | /** |
787 | 775 | * Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers. |
788 | 776 | */ |
789 | -function monsterinsights_admin_menu_inline_styles() |
|
790 | -{ |
|
777 | +function monsterinsights_admin_menu_inline_styles() { |
|
791 | 778 | ?> |
792 | 779 | <style type="text/css"> |
793 | 780 | #toplevel_page_monsterinsights_reports .wp-menu-image img, |
@@ -806,8 +793,7 @@ discard block |
||
806 | 793 | /** |
807 | 794 | * Display notice in admin when measurement protocol is left blank |
808 | 795 | */ |
809 | -function monsterinsights_empty_measurement_protocol_token() |
|
810 | -{ |
|
796 | +function monsterinsights_empty_measurement_protocol_token() { |
|
811 | 797 | if (!class_exists('MonsterInsights_eCommerce') && !class_exists('MonsterInsights_Forms')) { |
812 | 798 | return; |
813 | 799 | } |
@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function admin_styles() { |
68 | 68 | |
69 | - $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
69 | + $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
70 | 70 | |
71 | 71 | // Load Common admin styles. |
72 | - wp_register_style('monsterinsights-admin-common-style', plugins_url('assets/css/admin-common' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE), array(), monsterinsights_get_asset_version()); |
|
73 | - wp_enqueue_style('monsterinsights-admin-common-style'); |
|
72 | + wp_register_style( 'monsterinsights-admin-common-style', plugins_url( 'assets/css/admin-common' . $suffix . '.css', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version() ); |
|
73 | + wp_enqueue_style( 'monsterinsights-admin-common-style' ); |
|
74 | 74 | |
75 | 75 | // Get current screen. |
76 | 76 | $screen = get_current_screen(); |
77 | 77 | |
78 | 78 | // Bail if we're not on a MonsterInsights screen. |
79 | - if (empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) { |
|
79 | + if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // For the settings page, load the Vue app styles. |
84 | - if (monsterinsights_is_settings_page()) { |
|
85 | - if (!defined('MONSTERINSIGHTS_LOCAL_JS_URL')) { |
|
84 | + if ( monsterinsights_is_settings_page() ) { |
|
85 | + if ( ! defined( 'MONSTERINSIGHTS_LOCAL_JS_URL' ) ) { |
|
86 | 86 | $this->enqueue_script_specific_css( 'src/modules/settings/settings.js' ); |
87 | 87 | } |
88 | 88 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
93 | - if (monsterinsights_is_reports_page()) { |
|
94 | - if (!defined('MONSTERINSIGHTS_LOCAL_JS_URL')) { |
|
93 | + if ( monsterinsights_is_reports_page() ) { |
|
94 | + if ( ! defined( 'MONSTERINSIGHTS_LOCAL_JS_URL' ) ) { |
|
95 | 95 | $this->enqueue_script_specific_css( 'src/modules/reports/reports.js' ); |
96 | 96 | } |
97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Tooltips |
102 | - wp_enqueue_script('jquery-ui-tooltip'); |
|
102 | + wp_enqueue_script( 'jquery-ui-tooltip' ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | public function admin_scripts() { |
111 | 111 | |
112 | 112 | // Our Common Admin JS. |
113 | - $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
113 | + $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
114 | 114 | |
115 | - wp_enqueue_script('monsterinsights-admin-common-script', plugins_url('assets/js/admin-common' . $suffix . '.js', MONSTERINSIGHTS_PLUGIN_FILE), array('jquery'), monsterinsights_get_asset_version(), true); |
|
115 | + wp_enqueue_script( 'monsterinsights-admin-common-script', plugins_url( 'assets/js/admin-common' . $suffix . '.js', MONSTERINSIGHTS_PLUGIN_FILE ), array( 'jquery' ), monsterinsights_get_asset_version(), true ); |
|
116 | 116 | |
117 | 117 | wp_localize_script( |
118 | 118 | 'monsterinsights-admin-common-script', |
119 | 119 | 'monsterinsights_admin_common', |
120 | 120 | array( |
121 | - 'ajax' => admin_url('admin-ajax.php'), |
|
122 | - 'dismiss_notice_nonce' => wp_create_nonce('monsterinsights-dismiss-notice'), |
|
121 | + 'ajax' => admin_url( 'admin-ajax.php' ), |
|
122 | + 'dismiss_notice_nonce' => wp_create_nonce( 'monsterinsights-dismiss-notice' ), |
|
123 | 123 | ) |
124 | 124 | ); |
125 | 125 | |
@@ -127,98 +127,98 @@ discard block |
||
127 | 127 | $screen = get_current_screen(); |
128 | 128 | |
129 | 129 | // Bail if we're not on a MonsterInsights screen. |
130 | - if (empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) { |
|
130 | + if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | $version_path = monsterinsights_is_pro_version() ? 'pro' : 'lite'; |
135 | 135 | |
136 | 136 | // For the settings page, load the Vue app. |
137 | - if (monsterinsights_is_settings_page()) { |
|
137 | + if ( monsterinsights_is_settings_page() ) { |
|
138 | 138 | $app_js_url = self::get_js_url( 'src/modules/settings/settings.js' ); |
139 | - wp_register_script('monsterinsights-vue-script', $app_js_url, array(), monsterinsights_get_asset_version(), true); |
|
140 | - wp_enqueue_script('monsterinsights-vue-script'); |
|
139 | + wp_register_script( 'monsterinsights-vue-script', $app_js_url, array(), monsterinsights_get_asset_version(), true ); |
|
140 | + wp_enqueue_script( 'monsterinsights-vue-script' ); |
|
141 | 141 | |
142 | 142 | $plugins = get_plugins(); |
143 | 143 | $install_amp_url = false; |
144 | - if (monsterinsights_can_install_plugins()) { |
|
144 | + if ( monsterinsights_can_install_plugins() ) { |
|
145 | 145 | $amp_key = 'amp/amp.php'; |
146 | - if (array_key_exists($amp_key, $plugins)) { |
|
147 | - $install_amp_url = wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=' . $amp_key), 'activate-plugin_' . $amp_key); |
|
146 | + if ( array_key_exists( $amp_key, $plugins ) ) { |
|
147 | + $install_amp_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $amp_key ), 'activate-plugin_' . $amp_key ); |
|
148 | 148 | } else { |
149 | - $install_amp_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=amp'), 'install-plugin_amp'); |
|
149 | + $install_amp_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=amp' ), 'install-plugin_amp' ); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | $install_woocommerce_url = false; |
154 | - if (monsterinsights_can_install_plugins()) { |
|
154 | + if ( monsterinsights_can_install_plugins() ) { |
|
155 | 155 | $woo_key = 'woocommerce/woocommerce.php'; |
156 | - if (array_key_exists($woo_key, $plugins)) { |
|
157 | - $install_woocommerce_url = wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=' . $woo_key), 'activate-plugin_' . $woo_key); |
|
156 | + if ( array_key_exists( $woo_key, $plugins ) ) { |
|
157 | + $install_woocommerce_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $woo_key ), 'activate-plugin_' . $woo_key ); |
|
158 | 158 | } else { |
159 | - $install_woocommerce_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=woocommerce'), 'install-plugin_woocommerce'); |
|
159 | + $install_woocommerce_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' ); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | $prepared_dimensions = array(); |
164 | - if (class_exists('MonsterInsights_Admin_Custom_Dimensions')) { |
|
164 | + if ( class_exists( 'MonsterInsights_Admin_Custom_Dimensions' ) ) { |
|
165 | 165 | $dimensions = new MonsterInsights_Admin_Custom_Dimensions(); |
166 | 166 | $dimensions = $dimensions->custom_dimensions(); |
167 | 167 | $prepared_dimensions = array(); |
168 | - foreach ($dimensions as $dimension_type => $dimension) { |
|
168 | + foreach ( $dimensions as $dimension_type => $dimension ) { |
|
169 | 169 | $dimension['type'] = $dimension_type; |
170 | 170 | $prepared_dimensions[] = $dimension; |
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | - $is_authed = (MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed()); |
|
174 | + $is_authed = ( MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed() ); |
|
175 | 175 | |
176 | 176 | wp_localize_script( |
177 | 177 | 'monsterinsights-vue-script', |
178 | 178 | 'monsterinsights', |
179 | 179 | array( |
180 | - 'ajax' => admin_url('admin-ajax.php'), |
|
181 | - 'nonce' => wp_create_nonce('mi-admin-nonce'), |
|
180 | + 'ajax' => admin_url( 'admin-ajax.php' ), |
|
181 | + 'nonce' => wp_create_nonce( 'mi-admin-nonce' ), |
|
182 | 182 | 'network' => is_network_admin(), |
183 | - 'translations' => wp_get_jed_locale_data(monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress'), |
|
184 | - 'assets' => plugins_url($version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE), |
|
183 | + 'translations' => wp_get_jed_locale_data( monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress' ), |
|
184 | + 'assets' => plugins_url( $version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE ), |
|
185 | 185 | 'roles' => monsterinsights_get_roles(), |
186 | 186 | 'roles_manage_options' => monsterinsights_get_manage_options_roles(), |
187 | 187 | 'shareasale_id' => monsterinsights_get_shareasale_id(), |
188 | - 'shareasale_url' => monsterinsights_get_shareasale_url(monsterinsights_get_shareasale_id(), ''), |
|
189 | - 'addons_url' => is_multisite() ? network_admin_url('admin.php?page=monsterinsights_network#/addons') : admin_url('admin.php?page=monsterinsights_settings#/addons'), |
|
190 | - 'seo_settings_page_url' => is_multisite() ? network_admin_url('admin.php?page=monsterinsights_network#/seo') : admin_url('admin.php?page=monsterinsights_settings#/seo'), |
|
191 | - 'aioseo_dashboard_url' => is_multisite() ? network_admin_url('admin.php?page=aioseo') : admin_url('admin.php?page=aioseo'), |
|
192 | - 'wp_plugins_page_url' => is_multisite() ? network_admin_url('plugins.php') : admin_url('plugins.php'), |
|
193 | - 'email_summary_url' => admin_url('admin.php?monsterinsights_email_preview&monsterinsights_email_template=summary'), |
|
188 | + 'shareasale_url' => monsterinsights_get_shareasale_url( monsterinsights_get_shareasale_id(), '' ), |
|
189 | + 'addons_url' => is_multisite() ? network_admin_url( 'admin.php?page=monsterinsights_network#/addons' ) : admin_url( 'admin.php?page=monsterinsights_settings#/addons' ), |
|
190 | + 'seo_settings_page_url' => is_multisite() ? network_admin_url( 'admin.php?page=monsterinsights_network#/seo' ) : admin_url( 'admin.php?page=monsterinsights_settings#/seo' ), |
|
191 | + 'aioseo_dashboard_url' => is_multisite() ? network_admin_url( 'admin.php?page=aioseo' ) : admin_url( 'admin.php?page=aioseo' ), |
|
192 | + 'wp_plugins_page_url' => is_multisite() ? network_admin_url( 'plugins.php' ) : admin_url( 'plugins.php' ), |
|
193 | + 'email_summary_url' => admin_url( 'admin.php?monsterinsights_email_preview&monsterinsights_email_template=summary' ), |
|
194 | 194 | 'install_amp_url' => $install_amp_url, |
195 | 195 | 'install_woo_url' => $install_woocommerce_url, |
196 | 196 | 'dimensions' => $prepared_dimensions, |
197 | - 'wizard_url' => is_network_admin() ? network_admin_url('index.php?page=monsterinsights-onboarding') : admin_url('index.php?page=monsterinsights-onboarding'), |
|
197 | + 'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=monsterinsights-onboarding' ) : admin_url( 'index.php?page=monsterinsights-onboarding' ), |
|
198 | 198 | 'install_plugins' => monsterinsights_can_install_plugins(), |
199 | - 'unfiltered_html' => current_user_can('unfiltered_html'), |
|
200 | - 'activate_nonce' => wp_create_nonce('monsterinsights-activate'), |
|
201 | - 'deactivate_nonce' => wp_create_nonce('monsterinsights-deactivate'), |
|
202 | - 'install_nonce' => wp_create_nonce('monsterinsights-install'), |
|
199 | + 'unfiltered_html' => current_user_can( 'unfiltered_html' ), |
|
200 | + 'activate_nonce' => wp_create_nonce( 'monsterinsights-activate' ), |
|
201 | + 'deactivate_nonce' => wp_create_nonce( 'monsterinsights-deactivate' ), |
|
202 | + 'install_nonce' => wp_create_nonce( 'monsterinsights-install' ), |
|
203 | 203 | // Used to add notices for future deprecations. |
204 | 204 | 'versions' => monsterinsights_get_php_wp_version_warning_data(), |
205 | 205 | 'plugin_version' => MONSTERINSIGHTS_VERSION, |
206 | 206 | 'is_admin' => true, |
207 | - 'admin_email' => get_option('admin_email'), |
|
207 | + 'admin_email' => get_option( 'admin_email' ), |
|
208 | 208 | 'site_url' => get_site_url(), |
209 | - 'reports_url' => add_query_arg('page', 'monsterinsights_reports', admin_url('admin.php')), |
|
210 | - 'ecommerce_report_url' => add_query_arg('page', 'monsterinsights_reports#/ecommerce', admin_url('admin.php')), |
|
211 | - 'ecommerce_settings_tab_url' => add_query_arg('page', 'monsterinsights_settings#/ecommerce', admin_url('admin.php')), |
|
212 | - 'first_run_notice' => apply_filters('monsterinsights_settings_first_time_notice_hide', monsterinsights_get_option('monsterinsights_first_run_notice')), |
|
213 | - 'getting_started_url' => is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network#/about') : admin_url('admin.php?page=monsterinsights_settings#/about/getting-started'), |
|
209 | + 'reports_url' => add_query_arg( 'page', 'monsterinsights_reports', admin_url( 'admin.php' ) ), |
|
210 | + 'ecommerce_report_url' => add_query_arg( 'page', 'monsterinsights_reports#/ecommerce', admin_url( 'admin.php' ) ), |
|
211 | + 'ecommerce_settings_tab_url' => add_query_arg( 'page', 'monsterinsights_settings#/ecommerce', admin_url( 'admin.php' ) ), |
|
212 | + 'first_run_notice' => apply_filters( 'monsterinsights_settings_first_time_notice_hide', monsterinsights_get_option( 'monsterinsights_first_run_notice' ) ), |
|
213 | + 'getting_started_url' => is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network#/about' ) : admin_url( 'admin.php?page=monsterinsights_settings#/about/getting-started' ), |
|
214 | 214 | 'authed' => $is_authed, |
215 | - 'new_pretty_link_url' => admin_url('post-new.php?post_type=pretty-link'), |
|
216 | - 'wpmailsmtp_admin_url' => admin_url('admin.php?page=wp-mail-smtp'), |
|
215 | + 'new_pretty_link_url' => admin_url( 'post-new.php?post_type=pretty-link' ), |
|
216 | + 'wpmailsmtp_admin_url' => admin_url( 'admin.php?page=wp-mail-smtp' ), |
|
217 | 217 | 'load_headline_analyzer_settings' => monsterinsights_load_gutenberg_app() ? 'true' : 'false', |
218 | - 'exit_url' => add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php')), |
|
219 | - 'timezone' => date('e'), |
|
218 | + 'exit_url' => add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ), |
|
219 | + 'timezone' => date( 'e' ), |
|
220 | 220 | 'funnelkit_stripe_woo_page_url' => admin_url( 'admin.php?page=wc-settings&tab=fkwcs_api_settings' ), |
221 | - 'funnelkit_stripe_woo_nonce' => wp_create_nonce('monsterinsights-funnelkit-stripe-woo-nonce'), |
|
221 | + 'funnelkit_stripe_woo_nonce' => wp_create_nonce( 'monsterinsights-funnelkit-stripe-woo-nonce' ), |
|
222 | 222 | ) |
223 | 223 | ); |
224 | 224 | |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
229 | - if (monsterinsights_is_reports_page()) { |
|
229 | + if ( monsterinsights_is_reports_page() ) { |
|
230 | 230 | |
231 | 231 | $app_js_url = self::get_js_url( 'src/modules/reports/reports.js' ); |
232 | - wp_register_script('monsterinsights-vue-reports', $app_js_url, array(), monsterinsights_get_asset_version(), true); |
|
233 | - wp_enqueue_script('monsterinsights-vue-reports'); |
|
232 | + wp_register_script( 'monsterinsights-vue-reports', $app_js_url, array(), monsterinsights_get_asset_version(), true ); |
|
233 | + wp_enqueue_script( 'monsterinsights-vue-reports' ); |
|
234 | 234 | |
235 | 235 | // We do not have a current auth. |
236 | 236 | $auth = MonsterInsights()->auth; |
@@ -241,32 +241,32 @@ discard block |
||
241 | 241 | 'monsterinsights-vue-reports', |
242 | 242 | 'monsterinsights', |
243 | 243 | array( |
244 | - 'ajax' => admin_url('admin-ajax.php'), |
|
245 | - 'nonce' => wp_create_nonce('mi-admin-nonce'), |
|
244 | + 'ajax' => admin_url( 'admin-ajax.php' ), |
|
245 | + 'nonce' => wp_create_nonce( 'mi-admin-nonce' ), |
|
246 | 246 | 'network' => is_network_admin(), |
247 | - 'translations' => wp_get_jed_locale_data(monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress'), |
|
248 | - 'assets' => plugins_url($version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE), |
|
249 | - 'pro_assets' => plugins_url($version_path . '/assets', MONSTERINSIGHTS_PLUGIN_FILE), |
|
247 | + 'translations' => wp_get_jed_locale_data( monsterinsights_is_pro_version() ? 'ga-premium' : 'google-analytics-for-wordpress' ), |
|
248 | + 'assets' => plugins_url( $version_path . '/assets/vue', MONSTERINSIGHTS_PLUGIN_FILE ), |
|
249 | + 'pro_assets' => plugins_url( $version_path . '/assets', MONSTERINSIGHTS_PLUGIN_FILE ), |
|
250 | 250 | 'shareasale_id' => monsterinsights_get_shareasale_id(), |
251 | - 'shareasale_url' => monsterinsights_get_shareasale_url(monsterinsights_get_shareasale_id(), ''), |
|
252 | - 'addons_url' => is_multisite() ? network_admin_url('admin.php?page=monsterinsights_network#/addons') : admin_url('admin.php?page=monsterinsights_settings#/addons'), |
|
253 | - 'timezone' => date('e'), // phpcs:ignore |
|
251 | + 'shareasale_url' => monsterinsights_get_shareasale_url( monsterinsights_get_shareasale_id(), '' ), |
|
252 | + 'addons_url' => is_multisite() ? network_admin_url( 'admin.php?page=monsterinsights_network#/addons' ) : admin_url( 'admin.php?page=monsterinsights_settings#/addons' ), |
|
253 | + 'timezone' => date( 'e' ), // phpcs:ignore |
|
254 | 254 | 'authed' => $site_auth || $ms_auth, |
255 | - 'settings_url' => add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php')), |
|
255 | + 'settings_url' => add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) ), |
|
256 | 256 | // Used to add notices for future deprecations. |
257 | 257 | 'versions' => monsterinsights_get_php_wp_version_warning_data(), |
258 | 258 | 'plugin_version' => MONSTERINSIGHTS_VERSION, |
259 | 259 | 'is_admin' => true, |
260 | - 'admin_email' => get_option('admin_email'), |
|
260 | + 'admin_email' => get_option( 'admin_email' ), |
|
261 | 261 | 'site_url' => get_site_url(), |
262 | - 'wizard_url' => is_network_admin() ? network_admin_url('index.php?page=monsterinsights-onboarding') : admin_url('index.php?page=monsterinsights-onboarding'), |
|
263 | - 'install_nonce' => wp_create_nonce('monsterinsights-install'), |
|
264 | - 'activate_nonce' => wp_create_nonce('monsterinsights-activate'), |
|
265 | - 'deactivate_nonce' => wp_create_nonce('monsterinsights-deactivate'), |
|
266 | - 'update_settings' => current_user_can('monsterinsights_save_settings'), |
|
267 | - 'migrated' => monsterinsights_get_option('gadwp_migrated', 0), |
|
262 | + 'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=monsterinsights-onboarding' ) : admin_url( 'index.php?page=monsterinsights-onboarding' ), |
|
263 | + 'install_nonce' => wp_create_nonce( 'monsterinsights-install' ), |
|
264 | + 'activate_nonce' => wp_create_nonce( 'monsterinsights-activate' ), |
|
265 | + 'deactivate_nonce' => wp_create_nonce( 'monsterinsights-deactivate' ), |
|
266 | + 'update_settings' => current_user_can( 'monsterinsights_save_settings' ), |
|
267 | + 'migrated' => monsterinsights_get_option( 'gadwp_migrated', 0 ), |
|
268 | 268 | 'yearinreview' => monsterinsights_yearinreview_dates(), |
269 | - 'reports_url' => add_query_arg('page', 'monsterinsights_reports', admin_url('admin.php')), |
|
269 | + 'reports_url' => add_query_arg( 'page', 'monsterinsights_reports', admin_url( 'admin.php' ) ), |
|
270 | 270 | ) |
271 | 271 | ); |
272 | 272 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | // ublock notice |
277 | - add_action('admin_print_footer_scripts', array( $this, 'monsterinsights_settings_ublock_error_js' ), 9999999); |
|
277 | + add_action( 'admin_print_footer_scripts', array( $this, 'monsterinsights_settings_ublock_error_js' ), 9999999 ); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -306,31 +306,31 @@ discard block |
||
306 | 306 | $version_path = monsterinsights_is_pro_version() ? 'pro' : 'lite'; |
307 | 307 | $plugin_path = plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ); |
308 | 308 | |
309 | - if ( ! isset( self::$manifest_data[ $js_file_path ] ) ) { |
|
309 | + if ( ! isset( self::$manifest_data[$js_file_path] ) ) { |
|
310 | 310 | return; |
311 | 311 | } |
312 | 312 | |
313 | - $js_imports = self::$manifest_data[ $js_file_path ]['imports']; |
|
313 | + $js_imports = self::$manifest_data[$js_file_path]['imports']; |
|
314 | 314 | $css_file_path = $plugin_path . $version_path . '/assets/vue/'; |
315 | 315 | |
316 | 316 | // Add JS own CSS file. |
317 | - if ( isset( self::$manifest_data[ $js_file_path ]['css'] ) ) { |
|
318 | - self::add_js_own_css_files( self::$manifest_data[ $js_file_path ]['css'], $version_path ); |
|
317 | + if ( isset( self::$manifest_data[$js_file_path]['css'] ) ) { |
|
318 | + self::add_js_own_css_files( self::$manifest_data[$js_file_path]['css'], $version_path ); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | // Loop through all imported js file of entry file. |
322 | - foreach( $js_imports as $js_filename ) { |
|
322 | + foreach ( $js_imports as $js_filename ) { |
|
323 | 323 | // Check imported file available in manifest.json |
324 | - if ( ! isset( self::$manifest_data[ $js_filename ] ) ) { |
|
324 | + if ( ! isset( self::$manifest_data[$js_filename] ) ) { |
|
325 | 325 | continue; |
326 | 326 | } |
327 | 327 | |
328 | 328 | // Check imported js file has it's own css. |
329 | - if ( ! isset( self::$manifest_data[ $js_filename ]['css'] ) ) { |
|
329 | + if ( ! isset( self::$manifest_data[$js_filename]['css'] ) ) { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - $js_file_css = self::$manifest_data[ $js_filename ]['css']; |
|
333 | + $js_file_css = self::$manifest_data[$js_filename]['css']; |
|
334 | 334 | |
335 | 335 | // css must be array. |
336 | 336 | if ( ! is_array( $js_file_css ) ) { |
@@ -380,11 +380,11 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | // If the file is not available on manifest. |
383 | - if ( ! isset( self::$manifest_data[ $path ] ) ) { |
|
383 | + if ( ! isset( self::$manifest_data[$path] ) ) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - $js_file = self::$manifest_data[ $path ]['file']; |
|
387 | + $js_file = self::$manifest_data[$path]['file']; |
|
388 | 388 | $version_path = monsterinsights_is_pro_version() ? 'pro' : 'lite'; |
389 | 389 | |
390 | 390 | return plugins_url( $version_path . '/assets/vue/' . $js_file, MONSTERINSIGHTS_PLUGIN_FILE ); |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | class MonsterInsights_MetaBox_ExcludePage { |
13 | 13 | |
14 | 14 | public function __construct() { |
15 | - add_action( 'init', [ $this, 'register_meta' ] ); |
|
15 | + add_action( 'init', [$this, 'register_meta'] ); |
|
16 | 16 | |
17 | 17 | if ( ! is_admin() ) { |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | - add_action( 'load-post.php', [ $this, 'meta_box_init' ] ); |
|
22 | - add_action( 'load-post-new.php', [ $this, 'meta_box_init' ] ); |
|
21 | + add_action( 'load-post.php', [$this, 'meta_box_init'] ); |
|
22 | + add_action( 'load-post-new.php', [$this, 'meta_box_init'] ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | private function is_gutenberg_editor() { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if ( $this->is_gutenberg_editor() && $this->posttype_supports_gutenberg() ) { |
76 | 76 | return; |
77 | 77 | } |
78 | - add_action( 'add_meta_boxes', [ $this, 'create_meta_box' ] ); |
|
78 | + add_action( 'add_meta_boxes', [$this, 'create_meta_box'] ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function register_meta() { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | add_meta_box( |
101 | 101 | 'monsterinsights-metabox', |
102 | 102 | 'MonsterInsights', |
103 | - [ $this, 'print_metabox_html' ], |
|
103 | + [$this, 'print_metabox_html'], |
|
104 | 104 | null, |
105 | 105 | 'side', |
106 | 106 | 'high' |
@@ -332,20 +332,20 @@ |
||
332 | 332 | $site_key = is_network_admin() ? $auth->get_network_key() : $auth->get_key(); |
333 | 333 | |
334 | 334 | if ( !hash_equals( $site_key, $key ) ) { |
335 | - wp_send_json_error([ |
|
336 | - 'error' => __( 'Invalid site key.', 'google-analytics-for-wordpress' ) |
|
337 | - ], 401); |
|
335 | + wp_send_json_error([ |
|
336 | + 'error' => __( 'Invalid site key.', 'google-analytics-for-wordpress' ) |
|
337 | + ], 401); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | $v4 = is_network_admin() ? $auth->get_network_v4_id() : $auth->get_v4_id(); |
341 | 341 | $has_secret = is_network_admin() ? |
342 | - !empty( $auth->get_network_measurement_protocol_secret() ) : |
|
343 | - !empty( $auth->get_measurement_protocol_secret() ); |
|
342 | + !empty( $auth->get_network_measurement_protocol_secret() ) : |
|
343 | + !empty( $auth->get_measurement_protocol_secret() ); |
|
344 | 344 | |
345 | 345 | wp_send_json([ |
346 | - 'v4' => $v4, |
|
347 | - 'has_mp_secret' => $has_secret, |
|
348 | - 'plugin_version' => MonsterInsights()->version |
|
346 | + 'v4' => $v4, |
|
347 | + 'has_mp_secret' => $has_secret, |
|
348 | + 'plugin_version' => MonsterInsights()->version |
|
349 | 349 | ]); |
350 | 350 | } |
351 | 351 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ), |
74 | 74 | admin_url( 'admin.php' ) |
75 | 75 | ); |
76 | - $url = esc_url( $url ); |
|
76 | + $url = esc_url( $url ); |
|
77 | 77 | |
78 | 78 | // Start output bufferring to catch the filesystem form if credentials are needed. |
79 | 79 | ob_start(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
140 | 140 | $activate = activate_plugin( $plugin, null, true ); |
141 | 141 | } else { |
142 | - $activate = activate_plugin( $plugin ); |
|
142 | + $activate = activate_plugin( $plugin ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /* Restrict thirt-party redirections on activation */ |
@@ -327,26 +327,25 @@ discard block |
||
327 | 327 | $auth = MonsterInsights()->auth; |
328 | 328 | |
329 | 329 | // Authenticate with public key |
330 | - $key = sanitize_text_field($_REQUEST['key']); |
|
330 | + $key = sanitize_text_field( $_REQUEST['key'] ); |
|
331 | 331 | |
332 | 332 | $site_key = is_network_admin() ? $auth->get_network_key() : $auth->get_key(); |
333 | 333 | |
334 | - if ( !hash_equals( $site_key, $key ) ) { |
|
335 | - wp_send_json_error([ |
|
334 | + if ( ! hash_equals( $site_key, $key ) ) { |
|
335 | + wp_send_json_error( [ |
|
336 | 336 | 'error' => __( 'Invalid site key.', 'google-analytics-for-wordpress' ) |
337 | - ], 401); |
|
337 | + ], 401 ); |
|
338 | 338 | } |
339 | 339 | |
340 | - $v4 = is_network_admin() ? $auth->get_network_v4_id() : $auth->get_v4_id(); |
|
340 | + $v4 = is_network_admin() ? $auth->get_network_v4_id() : $auth->get_v4_id(); |
|
341 | 341 | $has_secret = is_network_admin() ? |
342 | - !empty( $auth->get_network_measurement_protocol_secret() ) : |
|
343 | - !empty( $auth->get_measurement_protocol_secret() ); |
|
342 | + ! empty( $auth->get_network_measurement_protocol_secret() ) : ! empty( $auth->get_measurement_protocol_secret() ); |
|
344 | 343 | |
345 | - wp_send_json([ |
|
344 | + wp_send_json( [ |
|
346 | 345 | 'v4' => $v4, |
347 | 346 | 'has_mp_secret' => $has_secret, |
348 | 347 | 'plugin_version' => MonsterInsights()->version |
349 | - ]); |
|
348 | + ] ); |
|
350 | 349 | } |
351 | 350 | |
352 | 351 | add_action( 'wp_ajax_nopriv_monsterinsights_get_plugin_info', 'monsterinsights_handle_get_plugin_info' ); |
@@ -364,16 +363,16 @@ discard block |
||
364 | 363 | $mediums = array( 'cpc', 'banner', 'email' ); |
365 | 364 | $campaigns = array( 'campaign-name', 'slogan', 'promo-code' ); |
366 | 365 | |
367 | - for ( $i = 1; $i <= 13; $i ++ ) { |
|
366 | + for ( $i = 1; $i <= 13; $i++ ) { |
|
368 | 367 | $rand_key = array_rand( $sources ); |
369 | 368 | |
370 | 369 | $report[] = array( |
371 | 370 | 'transaction_id' => wp_rand( 12, 30 ), |
372 | 371 | 'steps' => wp_rand( 3, 8 ), |
373 | 372 | 'order_total' => wp_rand( 10, 50 ), |
374 | - 'utm_source' => $sources[ $rand_key ], |
|
375 | - 'utm_medium' => $mediums[ $rand_key ], |
|
376 | - 'utm_campaign' => $campaigns[ $rand_key ], |
|
373 | + 'utm_source' => $sources[$rand_key], |
|
374 | + 'utm_medium' => $mediums[$rand_key], |
|
375 | + 'utm_campaign' => $campaigns[$rand_key], |
|
377 | 376 | 'purchase_date' => '--', |
378 | 377 | ); |
379 | 378 | } |
@@ -409,7 +408,7 @@ discard block |
||
409 | 408 | // Run a security check first. |
410 | 409 | check_ajax_referer( 'monsterinsights-funnelkit-stripe-woo-nonce', 'nonce' ); |
411 | 410 | |
412 | - $fkwcs_con_status = get_option('fkwcs_con_status'); |
|
411 | + $fkwcs_con_status = get_option( 'fkwcs_con_status' ); |
|
413 | 412 | |
414 | 413 | if ( 'success' === $fkwcs_con_status ) { |
415 | 414 | echo json_encode( true ); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | $usesauth = 'Network'; |
73 | 73 | } |
74 | 74 | |
75 | - // Get auth connection type |
|
76 | - $auth = MonsterInsights()->auth; |
|
75 | + // Get auth connection type |
|
76 | + $auth = MonsterInsights()->auth; |
|
77 | 77 | |
78 | - $auth_mode = 'v4'; |
|
78 | + $auth_mode = 'v4'; |
|
79 | 79 | |
80 | 80 | $data['php_version'] = phpversion(); |
81 | 81 | $data['mi_version'] = MONSTERINSIGHTS_VERSION; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $data['usercount'] = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set'; |
100 | 100 | $data['usesauth'] = $usesauth; |
101 | 101 | $data['timezoneoffset'] = date( 'P' ); |
102 | - $data['ga_auth_mode'] = $auth_mode; |
|
102 | + $data['ga_auth_mode'] = $auth_mode; |
|
103 | 103 | |
104 | 104 | // Retrieve current plugin information |
105 | 105 | if ( ! function_exists( 'get_plugins' ) ) { |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | $tracking['minute'] = rand( 0, 59 ); |
169 | 169 | $tracking['second'] = rand( 0, 59 ); |
170 | 170 | $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) + |
171 | - ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
172 | - ( $tracking['minute'] * MINUTE_IN_SECONDS ) + |
|
173 | - $tracking['second']; |
|
171 | + ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
172 | + ( $tracking['minute'] * MINUTE_IN_SECONDS ) + |
|
173 | + $tracking['second']; |
|
174 | 174 | $tracking['initsend'] = strtotime( "next sunday" ) + $tracking['offset']; |
175 | 175 | |
176 | 176 | wp_schedule_event( $tracking['initsend'], 'weekly', 'monsterinsights_usage_tracking_cron' ); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $data['usercount'] = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set'; |
100 | 100 | $data['usesauth'] = $usesauth; |
101 | 101 | $data['timezoneoffset'] = date( 'P' ); |
102 | - $data['ga_auth_mode'] = $auth_mode; |
|
102 | + $data['ga_auth_mode'] = $auth_mode; |
|
103 | 103 | |
104 | 104 | // Retrieve current plugin information |
105 | 105 | if ( ! function_exists( 'get_plugins' ) ) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | foreach ( $plugins as $key => $plugin ) { |
113 | 113 | if ( in_array( $plugin, $active_plugins ) ) { |
114 | 114 | // Remove active plugins from list so we can show active and inactive separately |
115 | - unset( $plugins[ $key ] ); |
|
115 | + unset( $plugins[$key] ); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
|
66 | + $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
|
67 | 67 | |
68 | 68 | if ( ! $authed ) { |
69 | 69 | wp_send_json_error(); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * If the authenticated website is found to be requiring EEA consent but does not have a cookie plugin installed. |
165 | 165 | */ |
166 | 166 | public function add_site_health_tests( $tests ) { |
167 | - $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
|
167 | + $authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed(); |
|
168 | 168 | |
169 | 169 | if ( ! $authed ) { |
170 | 170 | return $tests; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * Callback for EEA Compliance Check site health test. |
200 | 200 | */ |
201 | 201 | public function test_eea_compliance_checker() { |
202 | - $link = admin_url('admin.php?page=monsterinsights_settings#/tools/eea-compliance'); |
|
202 | + $link = admin_url( 'admin.php?page=monsterinsights_settings#/tools/eea-compliance' ); |
|
203 | 203 | |
204 | 204 | return array( |
205 | 205 | 'label' => __( 'Check EEA Compliance with MonsterInsights', 'google-analytics-for-wordpress' ), |
@@ -128,18 +128,18 @@ discard block |
||
128 | 128 | |
129 | 129 | $sitei = $this->get_sitei(); |
130 | 130 | |
131 | - $auth_request_args = array( |
|
132 | - 'tt' => $this->get_tt(), |
|
133 | - 'sitei' => $sitei, |
|
134 | - 'miversion' => MONSTERINSIGHTS_VERSION, |
|
135 | - 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
136 | - 'network' => is_network_admin() ? 'network' : 'site', |
|
137 | - 'siteurl' => is_network_admin() ? network_admin_url() : home_url(), |
|
138 | - 'return' => is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ), |
|
139 | - 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
|
140 | - ); |
|
141 | - |
|
142 | - $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
131 | + $auth_request_args = array( |
|
132 | + 'tt' => $this->get_tt(), |
|
133 | + 'sitei' => $sitei, |
|
134 | + 'miversion' => MONSTERINSIGHTS_VERSION, |
|
135 | + 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
136 | + 'network' => is_network_admin() ? 'network' : 'site', |
|
137 | + 'siteurl' => is_network_admin() ? network_admin_url() : home_url(), |
|
138 | + 'return' => is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ), |
|
139 | + 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
|
140 | + ); |
|
141 | + |
|
142 | + $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
143 | 143 | |
144 | 144 | $siteurl = add_query_arg($auth_request_args, $this->get_route( 'https://' . monsterinsights_get_api_url() . 'auth/new/{type}' ) ); |
145 | 145 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - $code_value = monsterinsights_is_valid_v4_id( $_REQUEST['v4'] ); // phpcs:ignore |
|
228 | + $code_value = monsterinsights_is_valid_v4_id( $_REQUEST['v4'] ); // phpcs:ignore |
|
229 | 229 | |
230 | 230 | if ( empty( $code_value ) ) { |
231 | 231 | return; |
@@ -323,20 +323,20 @@ discard block |
||
323 | 323 | wp_send_json_error( array( 'message' => $message ) ); |
324 | 324 | } |
325 | 325 | |
326 | - $auth_request_args = array( |
|
327 | - 'tt' => $this->get_tt(), |
|
328 | - 'sitei' => $this->get_sitei(), |
|
329 | - 'miversion' => MONSTERINSIGHTS_VERSION, |
|
330 | - 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
331 | - 'network' => is_network_admin() ? 'network' : 'site', |
|
332 | - 'siteurl' => is_network_admin() ? network_admin_url() : home_url(), |
|
333 | - 'key' => is_network_admin() ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(), |
|
334 | - 'token' => is_network_admin() ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token(), |
|
335 | - 'return' => is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ), |
|
336 | - 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
|
337 | - ); |
|
326 | + $auth_request_args = array( |
|
327 | + 'tt' => $this->get_tt(), |
|
328 | + 'sitei' => $this->get_sitei(), |
|
329 | + 'miversion' => MONSTERINSIGHTS_VERSION, |
|
330 | + 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
331 | + 'network' => is_network_admin() ? 'network' : 'site', |
|
332 | + 'siteurl' => is_network_admin() ? network_admin_url() : home_url(), |
|
333 | + 'key' => is_network_admin() ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key(), |
|
334 | + 'token' => is_network_admin() ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token(), |
|
335 | + 'return' => is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ), |
|
336 | + 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
|
337 | + ); |
|
338 | 338 | |
339 | - $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
339 | + $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
340 | 340 | |
341 | 341 | $siteurl = add_query_arg( $auth_request_args, $this->get_route( 'https://' . monsterinsights_get_api_url() . 'auth/reauth/{type}' ) ); |
342 | 342 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | // Make sure has required params |
370 | 370 | if ( |
371 | - empty( $_REQUEST['v4'] ) || |
|
371 | + empty( $_REQUEST['v4'] ) || |
|
372 | 372 | empty( $_REQUEST['miview'] ) || |
373 | 373 | empty( $_REQUEST['a'] ) || |
374 | 374 | empty( $_REQUEST['w'] ) || |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | - $code_value = monsterinsights_is_valid_v4_id( $_REQUEST['v4'] ); // phpcs:ignore |
|
380 | + $code_value = monsterinsights_is_valid_v4_id( $_REQUEST['v4'] ); // phpcs:ignore |
|
381 | 381 | |
382 | 382 | if ( empty( $code_value ) ) { |
383 | 383 | return; |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
140 | 140 | ); |
141 | 141 | |
142 | - $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
142 | + $auth_request_args = apply_filters( 'monsterinsights_auth_request_body', $auth_request_args ); |
|
143 | 143 | |
144 | - $siteurl = add_query_arg($auth_request_args, $this->get_route( 'https://' . monsterinsights_get_api_url() . 'auth/new/{type}' ) ); |
|
144 | + $siteurl = add_query_arg( $auth_request_args, $this->get_route( 'https://' . monsterinsights_get_api_url() . 'auth/new/{type}' ) ); |
|
145 | 145 | |
146 | 146 | if ( monsterinsights_is_pro_version() ) { |
147 | 147 | $key = is_network_admin() ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | foreach ( $reqd_args as $arg ) { |
175 | - if ( empty( $_REQUEST[ $arg ] ) ) { |
|
175 | + if ( empty( $_REQUEST[$arg] ) ) { |
|
176 | 176 | $this->send_missing_args_error( $arg ); |
177 | 177 | } |
178 | 178 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | wp_send_json_error( array( 'message' => $message ) ); |
289 | 289 | } |
290 | 290 | |
291 | - if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var($_REQUEST['isnetwork'], FILTER_VALIDATE_BOOLEAN) ) { |
|
291 | + if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var( $_REQUEST['isnetwork'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
292 | 292 | define( 'WP_NETWORK_ADMIN', true ); |
293 | 293 | } |
294 | 294 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/', |
337 | 337 | ); |
338 | 338 | |
339 | - $auth_request_args = apply_filters('monsterinsights_auth_request_body', $auth_request_args); |
|
339 | + $auth_request_args = apply_filters( 'monsterinsights_auth_request_body', $auth_request_args ); |
|
340 | 340 | |
341 | 341 | $siteurl = add_query_arg( $auth_request_args, $this->get_route( 'https://' . monsterinsights_get_api_url() . 'auth/reauth/{type}' ) ); |
342 | 342 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | wp_send_json_error( array( 'message' => $message ) ); |
442 | 442 | } |
443 | 443 | |
444 | - if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var($_REQUEST['isnetwork'], FILTER_VALIDATE_BOOL) ) { |
|
444 | + if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var( $_REQUEST['isnetwork'], FILTER_VALIDATE_BOOL ) ) { |
|
445 | 445 | define( 'WP_NETWORK_ADMIN', true ); |
446 | 446 | } |
447 | 447 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | 'token' => $creds['token'], |
514 | 514 | 'testurl' => 'https://' . monsterinsights_get_api_url() . 'test/' |
515 | 515 | ) ); |
516 | - $ret = $api->request(); |
|
516 | + $ret = $api->request(); |
|
517 | 517 | |
518 | 518 | $this->rotate_tt(); |
519 | 519 | if ( is_wp_error( $ret ) ) { |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | wp_send_json_error( array( 'message' => $message ) ); |
542 | 542 | } |
543 | 543 | |
544 | - if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var($_REQUEST['isnetwork'], FILTER_VALIDATE_BOOL) ) { |
|
544 | + if ( ! empty( $_REQUEST['isnetwork'] ) && filter_var( $_REQUEST['isnetwork'], FILTER_VALIDATE_BOOL ) ) { |
|
545 | 545 | define( 'WP_NETWORK_ADMIN', true ); |
546 | 546 | } |
547 | 547 | |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | : $auth->get_key(); |
769 | 769 | |
770 | 770 | $hashed_data = array( |
771 | - 'mp_token' => sanitize_text_field($_POST['mp_token']), |
|
771 | + 'mp_token' => sanitize_text_field( $_POST['mp_token'] ), |
|
772 | 772 | 'timestamp' => $timestamp, |
773 | 773 | ); |
774 | 774 |
@@ -95,7 +95,8 @@ discard block |
||
95 | 95 | wp_send_json_error( array( 'message' => $message ) ); |
96 | 96 | } |
97 | 97 | |
98 | - if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { // phpcs:ignore |
|
98 | + if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
|
99 | +// phpcs:ignore |
|
99 | 100 | define( 'WP_NETWORK_ADMIN', true ); |
100 | 101 | } |
101 | 102 | |
@@ -181,7 +182,8 @@ discard block |
||
181 | 182 | define( 'WP_NETWORK_ADMIN', true ); |
182 | 183 | } |
183 | 184 | |
184 | - if ( ! $this->validate_tt( $_REQUEST['tt'] ) ) { // phpcs:ignore |
|
185 | + if ( ! $this->validate_tt( $_REQUEST['tt'] ) ) { |
|
186 | +// phpcs:ignore |
|
185 | 187 | wp_send_json_error( |
186 | 188 | array( |
187 | 189 | 'error' => 'authenticate_invalid_tt', |
@@ -362,7 +364,8 @@ discard block |
||
362 | 364 | } |
363 | 365 | |
364 | 366 | // Invalid request |
365 | - if ( empty( $_REQUEST['tt'] ) || ! $this->validate_tt( $_REQUEST['tt'] ) ) { // phpcs:ignore |
|
367 | + if ( empty( $_REQUEST['tt'] ) || ! $this->validate_tt( $_REQUEST['tt'] ) ) { |
|
368 | +// phpcs:ignore |
|
366 | 369 | return; |
367 | 370 | } |
368 | 371 |
@@ -420,15 +420,15 @@ |
||
420 | 420 | |
421 | 421 | $params = $this->get_ga_report_range( $data ); |
422 | 422 | |
423 | - $format = 'https://analytics.google.com/analytics/web/#/%1$s/' . ( $is_real_time ? 'realtime' : 'reports' ) . '/%5$s?params=%3$s%4$s&r=%2$s'; |
|
424 | - |
|
425 | - if ( empty( $v4_name ) ) { |
|
426 | - $report_name = ''; |
|
427 | - } else { |
|
428 | - $report_name = $v4_name; |
|
429 | - } |
|
430 | - $extra_params = '&' . $v4_extra_params; |
|
431 | - $endpoint = $v4_endpoint; |
|
423 | + $format = 'https://analytics.google.com/analytics/web/#/%1$s/' . ( $is_real_time ? 'realtime' : 'reports' ) . '/%5$s?params=%3$s%4$s&r=%2$s'; |
|
424 | + |
|
425 | + if ( empty( $v4_name ) ) { |
|
426 | + $report_name = ''; |
|
427 | + } else { |
|
428 | + $report_name = $v4_name; |
|
429 | + } |
|
430 | + $extra_params = '&' . $v4_extra_params; |
|
431 | + $endpoint = $v4_endpoint; |
|
432 | 432 | |
433 | 433 | return sprintf( |
434 | 434 | $format, |
@@ -310,9 +310,9 @@ |
||
310 | 310 | // Success |
311 | 311 | |
312 | 312 | // Strip any HTML tags from API response |
313 | - $ret['data'] = json_encode($ret['data']); |
|
314 | - $ret['data'] = strip_tags($ret['data']); |
|
315 | - $ret['data'] = json_decode($ret['data'], true); |
|
313 | + $ret['data'] = json_encode( $ret['data'] ); |
|
314 | + $ret['data'] = strip_tags( $ret['data'] ); |
|
315 | + $ret['data'] = json_decode( $ret['data'], true ); |
|
316 | 316 | |
317 | 317 | $data = array( |
318 | 318 | 'expires' => time() + $expiration, |
@@ -77,7 +77,7 @@ |
||
77 | 77 | if ( ! empty( $data['data']['countries'] ) ) { |
78 | 78 | $country_names = monsterinsights_get_country_list( true ); |
79 | 79 | foreach ( $data['data']['countries'] as $key => $country ) { |
80 | - $data['data']['countries'][ $key ]['name'] = isset( $country_names[ $country['iso'] ] ) ? $country_names[ $country['iso'] ] : $country['iso']; |
|
80 | + $data['data']['countries'][$key]['name'] = isset( $country_names[$country['iso']] ) ? $country_names[$country['iso']] : $country['iso']; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |