Passed
Push — master ( 02fe7f...406f6c )
by
unknown
10:53
created
includes/admin/admin.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -467,26 +467,26 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 {
28 28
 	$hook             = monsterinsights_get_menu_hook();
29 29
 	$menu_icon_inline = monsterinsights_get_inline_menu_icon();
30
-	$new_indicator     = sprintf(
30
+	$new_indicator = sprintf(
31 31
 		'<span class="monsterinsights-menu-new-indicator">&nbsp;%s</span>',
32 32
 		__( 'NEW', 'google-analytics-for-wordpress' )
33 33
 	);
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
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,7 +73,7 @@  discard block
 block discarded – undo
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
     //  Site Notes
79 79
 	add_submenu_page( $hook, __( 'Site Notes:', 'google-analytics-for-wordpress' ), __( 'Site Notes', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/site-notes' );
@@ -102,113 +102,113 @@  discard block
 block discarded – undo
102 102
 		$seo_url = $submenu_base . '#/seo';
103 103
 	}
104 104
 	// then SEO
105
-	add_submenu_page($hook, __('SEO', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url);
105
+	add_submenu_page( $hook, __( 'SEO', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url );
106 106
 
107 107
 	// then tools
108
-	add_submenu_page($hook, __('Tools:', 'google-analytics-for-wordpress'), __('Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/tools');
108
+	add_submenu_page( $hook, __( 'Tools:', 'google-analytics-for-wordpress' ), __( 'Tools', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/tools' );
109 109
 
110 110
 	// then addons
111 111
 	$network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : '';
112
-	if (!monsterinsights_is_network_active() || (monsterinsights_is_network_active() && empty($network_key))) {
113
-		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');
112
+	if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) {
113
+		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' );
114 114
 	}
115 115
 
116 116
 	add_submenu_page(
117 117
 		$hook,
118
-		__('UserFeedback:', 'google-analytics-for-wordpress'),
119
-		__('UserFeedback', 'google-analytics-for-wordpress') . $new_indicator,
118
+		__( 'UserFeedback:', 'google-analytics-for-wordpress' ),
119
+		__( 'UserFeedback', 'google-analytics-for-wordpress' ) . $new_indicator,
120 120
 		'manage_options',
121 121
 		$submenu_base . '#/userfeedback'
122 122
 	);
123 123
 
124 124
 	// then About Us page.
125
-	add_submenu_page($hook, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about');
125
+	add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' );
126 126
 
127
-	if (!monsterinsights_is_pro_version() && !strstr(plugin_basename(__FILE__), 'dashboard-for')) {
127
+	if ( ! monsterinsights_is_pro_version() && ! strstr( plugin_basename( __FILE__ ), 'dashboard-for' ) ) {
128 128
 		// automated promotion
129
-		monsterinsights_automated_menu($hook);
129
+		monsterinsights_automated_menu( $hook );
130 130
 	}
131 131
 
132
-	add_submenu_page($hook, __('Growth Tools:', 'google-analytics-for-wordpress'), __('Growth Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/growth-tools');
132
+	add_submenu_page( $hook, __( 'Growth Tools:', 'google-analytics-for-wordpress' ), __( 'Growth Tools', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/growth-tools' );
133 133
 
134 134
 	// then Upgrade To Pro.
135
-	if (!monsterinsights_is_pro_version()) {
136
-		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/"));
135
+	if ( ! monsterinsights_is_pro_version() ) {
136
+		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/" ) );
137 137
 	}
138 138
 
139 139
 	if ( class_exists( 'WooCommerce' ) ) {
140 140
 		// Show the Payments submenu only when WooCommerce is active.
141 141
 		add_submenu_page(
142 142
 			$hook,
143
-			__('Payments:', 'google-analytics-for-wordpress'),
144
-			__('Payments', 'google-analytics-for-wordpress'),
143
+			__( 'Payments:', 'google-analytics-for-wordpress' ),
144
+			__( 'Payments', 'google-analytics-for-wordpress' ),
145 145
 			'manage_options',
146 146
 			$submenu_base . '#/payments'
147 147
 		);
148 148
 	}
149 149
 }
150 150
 
151
-add_action('admin_menu', 'monsterinsights_admin_menu');
151
+add_action( 'admin_menu', 'monsterinsights_admin_menu' );
152 152
 
153 153
 
154
-function monsterinsights_automated_menu($hook){
154
+function monsterinsights_automated_menu( $hook ) {
155 155
 	$display = false;
156 156
 
157
-	$now = apply_filters('monsterinsights_automated_promotion_date', wp_date('M d, Y h:i:s a'));
157
+	$now = apply_filters( 'monsterinsights_automated_promotion_date', wp_date( 'M d, Y h:i:s a' ) );
158 158
 	$conditions = [
159 159
 		[
160
-			'title' => __('Earth Day', 'google-analytics-for-wordpress'),
161
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 17, 2023')),
162
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 18, 2023')),
160
+			'title' => __( 'Earth Day', 'google-analytics-for-wordpress' ),
161
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Apr 17, 2023' ) ),
162
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Apr 18, 2023' ) ),
163 163
 			'utm_campaign' => 'lite-promo',
164 164
 			'utm_source' => 'liteplugin',
165 165
 			'utm_medium' => 'earth-day',
166 166
 		],
167 167
 		[
168
-			'title' => __('Cinco De Mayo!', 'google-analytics-for-wordpress'),
169
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('May 01, 2023')),
170
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('May 08, 2023')),
168
+			'title' => __( 'Cinco De Mayo!', 'google-analytics-for-wordpress' ),
169
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'May 01, 2023' ) ),
170
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'May 08, 2023' ) ),
171 171
 			'utm_campaign' => 'lite-promo',
172 172
 			'utm_source' => 'liteplugin',
173 173
 			'utm_medium' => 'cinco-de-mayo',
174 174
 		],
175 175
 		[
176
-			'title' => __('Upgrade to GA4', 'google-analytics-for-wordpress'),
177
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jun 01, 2023')),
178
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('July 01, 2023')),
176
+			'title' => __( 'Upgrade to GA4', 'google-analytics-for-wordpress' ),
177
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Jun 01, 2023' ) ),
178
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'July 01, 2023' ) ),
179 179
 			'utm_campaign' => 'lite-promo',
180 180
 			'utm_source' => 'liteplugin',
181 181
 			'utm_medium' => 'goodbye-ga3',
182 182
 		],
183 183
 		[
184
-			'title' => __('Summer Sale', 'google-analytics-for-wordpress'),
185
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jul 29, 2023')),
186
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('Aug 05, 2023')),
184
+			'title' => __( 'Summer Sale', 'google-analytics-for-wordpress' ),
185
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Jul 29, 2023' ) ),
186
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Aug 05, 2023' ) ),
187 187
 			'utm_campaign' => 'lite-promo',
188 188
 			'utm_source' => 'liteplugin',
189 189
 			'utm_medium' => 'dogdays',
190 190
 		],
191 191
 		[
192
-			'title' => __('Fortune Cookie Day', 'google-analytics-for-wordpress'),
193
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 12, 2023')),
194
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 13, 2023')),
192
+			'title' => __( 'Fortune Cookie Day', 'google-analytics-for-wordpress' ),
193
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Sep 12, 2023' ) ),
194
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Sep 13, 2023' ) ),
195 195
 			'utm_campaign' => 'lite-promo',
196 196
 			'utm_source' => 'liteplugin',
197 197
 			'utm_medium' => 'fortune-cookie',
198 198
 		],
199 199
 		[
200
-			'title' => __('Halloween Sale', 'google-analytics-for-wordpress'),
201
-			'start_time' => wp_date('M d, Y h:i:s a', strtotime('Oct 26, 2023')),
202
-			'end_time' => wp_date('M d, Y h:i:s a', strtotime('Nov 04, 2023')),
200
+			'title' => __( 'Halloween Sale', 'google-analytics-for-wordpress' ),
201
+			'start_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Oct 26, 2023' ) ),
202
+			'end_time' => wp_date( 'M d, Y h:i:s a', strtotime( 'Nov 04, 2023' ) ),
203 203
 			'utm_campaign' => 'lite-promo',
204 204
 			'utm_source' => 'liteplugin',
205 205
 			'utm_medium' => 'halloween',
206 206
 		],
207 207
 	];
208 208
 
209
-	foreach($conditions as $key => $condition){
210
-		if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])){
211
-			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/"));
209
+	foreach ( $conditions as $key => $condition ) {
210
+		if ( strtotime( $now ) >= strtotime( $condition['start_time'] ) && strtotime( $now ) <= strtotime( $condition['end_time'] ) ) {
211
+			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/" ) );
212 212
 			break;
213 213
 		}
214 214
 	}
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function monsterinsights_woocommerce_menu_item()
221 221
 {
222
-	if (class_exists('WooCommerce')) {
222
+	if ( class_exists( 'WooCommerce' ) ) {
223 223
 		// Add "Insights" sub menu item for WooCommerce Analytics menu
224
-		if (class_exists('MonsterInsights_eCommerce')) {
225
-			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);
224
+		if ( class_exists( 'MonsterInsights_eCommerce' ) ) {
225
+			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 );
226 226
 		} else {
227
-			$submenu_base = add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php'));
228
-			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);
227
+			$submenu_base = add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) );
228
+			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 );
229 229
 		}		
230 230
 	}
231 231
 }
232
-add_action('admin_menu', 'monsterinsights_woocommerce_menu_item', 11);
232
+add_action( 'admin_menu', 'monsterinsights_woocommerce_menu_item', 11 );
233 233
 
234 234
 function monsterinsights_get_menu_hook()
235 235
 {
236
-	$dashboards_disabled = monsterinsights_get_option('dashboards_disabled', false);
237
-	if ($dashboards_disabled || (current_user_can('monsterinsights_save_settings') && !current_user_can('monsterinsights_view_dashboard'))) {
236
+	$dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false );
237
+	if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) {
238 238
 		return 'monsterinsights_settings';
239 239
 	} else {
240 240
 		return 'monsterinsights_reports';
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 
249 249
 	// First, let's see if this is an MS network enabled plugin. If it is, we should load the license
250 250
 	// menu page and the updater on the network panel
251
-	if (!function_exists('is_plugin_active_for_network')) {
252
-		require_once(ABSPATH . '/wp-admin/includes/plugin.php');
251
+	if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
252
+		require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
253 253
 	}
254 254
 
255
-	$plugin = plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE);
256
-	if (!is_plugin_active_for_network($plugin)) {
255
+	$plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE );
256
+	if ( ! is_plugin_active_for_network( $plugin ) ) {
257 257
 		return;
258 258
 	}
259 259
 
@@ -265,31 +265,31 @@  discard block
 block discarded – undo
265 265
 
266 266
 	$menu_icon_inline = monsterinsights_get_inline_menu_icon();
267 267
 	$hook             = 'monsterinsights_network';
268
-	$submenu_base     = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php'));
269
-	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');
268
+	$submenu_base     = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) );
269
+	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' );
270 270
 
271
-	add_submenu_page($hook, __('Network Settings:', 'google-analytics-for-wordpress'), __('Network Settings', 'google-analytics-for-wordpress'), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page');
271
+	add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' );
272 272
 
273
-	add_submenu_page($hook, __('General Reports:', 'google-analytics-for-wordpress'), __('Reports', 'google-analytics-for-wordpress'), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page');
273
+	add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' );
274 274
 
275
-	if (function_exists('aioseo')) {
275
+	if ( function_exists( 'aioseo' ) ) {
276 276
 		$seo_url = monsterinsights_aioseo_dashboard_url();
277 277
 	} else {
278 278
 		$seo_url = $submenu_base . '#/seo';
279 279
 	}
280 280
 	// then seo
281
-	add_submenu_page($hook, __('SEO:', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url, 'monsterinsights_seo_page');
281
+	add_submenu_page( $hook, __( 'SEO:', 'google-analytics-for-wordpress' ), __( 'SEO', 'google-analytics-for-wordpress' ), 'manage_options', $seo_url, 'monsterinsights_seo_page' );
282 282
 
283 283
 	// then addons
284
-	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');
284
+	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' );
285 285
 
286
-	$submenu_base = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php'));
286
+	$submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) );
287 287
 
288 288
 	// Add About us page.
289
-	add_submenu_page($hook, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about');
289
+	add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' );
290 290
 }
291 291
 
292
-add_action('network_admin_menu', 'monsterinsights_network_admin_menu', 5);
292
+add_action( 'network_admin_menu', 'monsterinsights_network_admin_menu', 5 );
293 293
 
294 294
 /**
295 295
  * Adds one or more classes to the body tag in the dashboard.
@@ -298,17 +298,17 @@  discard block
 block discarded – undo
298 298
  *
299 299
  * @return String          Altered body classes.
300 300
  */
301
-function monsterinsights_add_admin_body_class($classes)
301
+function monsterinsights_add_admin_body_class( $classes )
302 302
 {
303
-	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
304
-	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) {
303
+	$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
304
+	if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
305 305
 		return $classes;
306 306
 	}
307 307
 
308 308
 	return "$classes monsterinsights_page ";
309 309
 }
310 310
 
311
-add_filter('admin_body_class', 'monsterinsights_add_admin_body_class', 10, 1);
311
+add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class', 10, 1 );
312 312
 
313 313
 /**
314 314
  * Adds one or more classes to the body tag in the dashboard.
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return String          Altered body classes.
319 319
  */
320
-function monsterinsights_add_admin_body_class_tools_page($classes)
320
+function monsterinsights_add_admin_body_class_tools_page( $classes )
321 321
 {
322
-	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
322
+	$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
323 323
 
324
-	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_tools') === false || 'insights_page_monsterinsights_tools' === $screen->id) {
324
+	if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) {
325 325
 		return $classes;
326 326
 	}
327 327
 
328 328
 	return "$classes insights_page_monsterinsights_tools ";
329 329
 }
330 330
 
331
-add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_tools_page', 10, 1);
331
+add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class_tools_page', 10, 1 );
332 332
 
333 333
 /**
334 334
  * Adds one or more classes to the body tag in the dashboard.
@@ -337,17 +337,17 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @return String          Altered body classes.
339 339
  */
340
-function monsterinsights_add_admin_body_class_addons_page($classes)
340
+function monsterinsights_add_admin_body_class_addons_page( $classes )
341 341
 {
342
-	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
343
-	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_addons') === false || 'insights_page_monsterinsights_addons' === $screen->id) {
342
+	$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
343
+	if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) {
344 344
 		return $classes;
345 345
 	}
346 346
 
347 347
 	return "$classes insights_page_monsterinsights_addons ";
348 348
 }
349 349
 
350
-add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_addons_page', 10, 1);
350
+add_filter( 'admin_body_class', 'monsterinsights_add_admin_body_class_addons_page', 10, 1 );
351 351
 
352 352
 /**
353 353
  * Add a link to the settings page to the plugins list
@@ -356,39 +356,39 @@  discard block
 block discarded – undo
356 356
  *
357 357
  * @return array $links
358 358
  */
359
-function monsterinsights_add_action_links($links)
359
+function monsterinsights_add_action_links( $links )
360 360
 {
361
-	$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>';
362
-	array_unshift($links, $docs);
361
+	$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>';
362
+	array_unshift( $links, $docs );
363 363
 
364 364
 	// If Lite, support goes to forum. If pro, it goes to our website
365
-	if (monsterinsights_is_pro_version()) {
366
-		$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>';
367
-		array_unshift($links, $support);
365
+	if ( monsterinsights_is_pro_version() ) {
366
+		$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>';
367
+		array_unshift( $links, $support );
368 368
 	} else {
369
-		$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>';
370
-		array_unshift($links, $support);
369
+		$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>';
370
+		array_unshift( $links, $support );
371 371
 	}
372 372
 
373
-	if (is_network_admin()) {
374
-		$settings_link = '<a href="' . esc_url(network_admin_url('admin.php?page=monsterinsights_network')) . '">' . esc_html__('Network Settings', 'google-analytics-for-wordpress') . '</a>';
373
+	if ( is_network_admin() ) {
374
+		$settings_link = '<a href="' . esc_url( network_admin_url( 'admin.php?page=monsterinsights_network' ) ) . '">' . esc_html__( 'Network Settings', 'google-analytics-for-wordpress' ) . '</a>';
375 375
 	} else {
376
-		$settings_link = '<a href="' . esc_url(admin_url('admin.php?page=monsterinsights_settings')) . '">' . esc_html__('Settings', 'google-analytics-for-wordpress') . '</a>';
376
+		$settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>';
377 377
 	}
378 378
 
379
-	array_unshift($links, $settings_link);
379
+	array_unshift( $links, $settings_link );
380 380
 
381 381
 	// If lite, show a link where they can get pro from
382
-	if (!monsterinsights_is_pro_version()) {
383
-		$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>';
384
-		array_unshift($links, $get_pro);
382
+	if ( ! monsterinsights_is_pro_version() ) {
383
+		$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>';
384
+		array_unshift( $links, $get_pro );
385 385
 	}
386 386
 
387 387
 	return $links;
388 388
 }
389 389
 
390
-add_filter('plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links');
391
-add_filter('network_admin_plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links');
390
+add_filter( 'plugin_action_links_' . plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ), 'monsterinsights_add_action_links' );
391
+add_filter( 'network_admin_plugin_action_links_' . plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ), 'monsterinsights_add_action_links' );
392 392
 
393 393
 /**
394 394
  * Loads a partial view for the Administration screen
@@ -402,31 +402,31 @@  discard block
 block discarded – undo
402 402
  * @since 6.0.0
403 403
  *
404 404
  */
405
-function monsterinsights_load_admin_partial($template, $data = array())
405
+function monsterinsights_load_admin_partial( $template, $data = array() )
406 406
 {
407 407
 
408
-	if (monsterinsights_is_pro_version()) {
409
-		$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'pro/includes/admin/partials');
408
+	if ( monsterinsights_is_pro_version() ) {
409
+		$dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' );
410 410
 
411
-		if (file_exists($dir . $template . '.php')) {
412
-			require_once($dir . $template . '.php');
411
+		if ( file_exists( $dir . $template . '.php' ) ) {
412
+			require_once( $dir . $template . '.php' );
413 413
 
414 414
 			return true;
415 415
 		}
416 416
 	} else {
417
-		$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'lite/includes/admin/partials');
417
+		$dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' );
418 418
 
419
-		if (file_exists($dir . $template . '.php')) {
420
-			require_once($dir . $template . '.php');
419
+		if ( file_exists( $dir . $template . '.php' ) ) {
420
+			require_once( $dir . $template . '.php' );
421 421
 
422 422
 			return true;
423 423
 		}
424 424
 	}
425 425
 
426
-	$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'includes/admin/partials');
426
+	$dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' );
427 427
 
428
-	if (file_exists($dir . $template . '.php')) {
429
-		require_once($dir . $template . '.php');
428
+	if ( file_exists( $dir . $template . '.php' ) ) {
429
+		require_once( $dir . $template . '.php' );
430 430
 
431 431
 		return true;
432 432
 	}
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
  * @return string
444 444
  * @since 6.0.0
445 445
  */
446
-function monsterinsights_admin_footer($text)
446
+function monsterinsights_admin_footer( $text )
447 447
 {
448 448
 	global $current_screen;
449 449
 	if (
@@ -453,18 +453,18 @@  discard block
 block discarded – undo
453 453
 	) {
454 454
 		$url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
455 455
 		// Translators: Placeholders add a link to the wordpress.org repository.
456
-		$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>');
456
+		$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>' );
457 457
 	}
458 458
 
459 459
 	return $text;
460 460
 }
461 461
 
462
-add_filter('admin_footer_text', 'monsterinsights_admin_footer', 1, 2);
462
+add_filter( 'admin_footer_text', 'monsterinsights_admin_footer', 1, 2 );
463 463
 
464 464
 function monsterinsights_admin_setup_notices()
465 465
 {
466 466
 	// Make sure they have the permissions to do something
467
-	if (!current_user_can('monsterinsights_save_settings')) {
467
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
468 468
 		return;
469 469
 	}
470 470
 
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
     //  0. UA sunset supported alert
484 484
     $profile = is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile() : MonsterInsights()->auth->get_analytics_profile();
485 485
 
486
-    if ( !empty($profile['ua']) && empty($profile['v4']) && !monsterinsights_is_own_admin_page() ) {
487
-        $title = __('Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress');
488
-        $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');
486
+    if ( ! empty( $profile['ua'] ) && empty( $profile['v4'] ) && ! monsterinsights_is_own_admin_page() ) {
487
+        $title = __( 'Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress' );
488
+        $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' );
489 489
 
490
-        $wizard_url     = admin_url('admin.php?page=monsterinsights-onboarding');
490
+        $wizard_url = admin_url( 'admin.php?page=monsterinsights-onboarding' );
491 491
 
492 492
         echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_ua_sunset">';
493 493
         echo '<p><strong>' . $title . '</strong></p>';
@@ -525,38 +525,38 @@  discard block
 block discarded – undo
525 525
 
526 526
 	// 2. License key not entered for pro
527 527
 	$key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : '';
528
-	if (monsterinsights_is_pro_version() && empty($key)) {
529
-		$page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
528
+	if ( monsterinsights_is_pro_version() && empty( $key ) ) {
529
+		$page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
530 530
 		// Translators: Adds a link to retrieve the license.
531
-		$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>');
531
+		$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>' );
532 532
 		echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
533 533
 
534 534
 		return;
535 535
 	}
536 536
 
537 537
 	// 3. License key not valid/okay for pro
538
-	if (monsterinsights_is_pro_version()) {
538
+	if ( monsterinsights_is_pro_version() ) {
539 539
 		$message = '';
540
-		if (MonsterInsights()->license->get_site_license_key()) {
541
-			if (MonsterInsights()->license->site_license_expired()) {
540
+		if ( MonsterInsights()->license->get_site_license_key() ) {
541
+			if ( MonsterInsights()->license->site_license_expired() ) {
542 542
 				// Translators: Adds a link to the license renewal.
543
-				$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>');
544
-			} else if (MonsterInsights()->license->site_license_disabled()) {
545
-				$message = esc_html__('Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress');
546
-			} else if (MonsterInsights()->license->site_license_invalid()) {
547
-				$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');
543
+				$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>' );
544
+			} else if ( MonsterInsights()->license->site_license_disabled() ) {
545
+				$message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
546
+			} else if ( MonsterInsights()->license->site_license_invalid() ) {
547
+				$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' );
548 548
 			}
549
-		} else if (MonsterInsights()->license->get_network_license_key()) {
550
-			if (MonsterInsights()->license->network_license_expired()) {
549
+		} else if ( MonsterInsights()->license->get_network_license_key() ) {
550
+			if ( MonsterInsights()->license->network_license_expired() ) {
551 551
 				// Translators: Adds a link to renew license.
552
-				$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>');
553
-			} else if (MonsterInsights()->license->network_license_disabled()) {
554
-				$message = esc_html__('Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress');
555
-			} else if (MonsterInsights()->license->network_license_invalid()) {
556
-				$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');
552
+				$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>' );
553
+			} else if ( MonsterInsights()->license->network_license_disabled() ) {
554
+				$message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
555
+			} else if ( MonsterInsights()->license->network_license_invalid() ) {
556
+				$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' );
557 557
 			}
558 558
 		}
559
-		if (!empty($message)) {
559
+		if ( ! empty( $message ) ) {
560 560
 			echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
561 561
 
562 562
 			return;
@@ -564,28 +564,28 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	// 4. Notices for PHP/WP version deprecations
567
-	if (current_user_can('update_core')) {
567
+	if ( current_user_can( 'update_core' ) ) {
568 568
 		global $wp_version;
569 569
 
570
-		$compatible_php_version = apply_filters('monsterinsights_compatible_php_version', false);
571
-		$compatible_wp_version  = apply_filters('monsterinsights_compatible_wp_version', false);
570
+		$compatible_php_version = apply_filters( 'monsterinsights_compatible_php_version', false );
571
+		$compatible_wp_version  = apply_filters( 'monsterinsights_compatible_wp_version', false );
572 572
 
573
-		$url = monsterinsights_get_url('global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/');
573
+		$url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' );
574 574
 
575 575
 		$message = false;
576
-		if (version_compare(phpversion(), $compatible_php_version['required'], '<')) {
576
+		if ( version_compare( phpversion(), $compatible_php_version['required'], '<' ) ) {
577 577
 			// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
578
-			$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>');
579
-		} else if (version_compare(phpversion(), $compatible_php_version['warning'], '<')) {
578
+			$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>' );
579
+		} else if ( version_compare( phpversion(), $compatible_php_version['warning'], '<' ) ) {
580 580
 			// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
581
-			$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>');
582
-		} else if (version_compare(phpversion(), $compatible_php_version['recommended'], '<')) {
581
+			$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>' );
582
+		} else if ( version_compare( phpversion(), $compatible_php_version['recommended'], '<' ) ) {
583 583
 			// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
584
-			$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>');
584
+			$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>' );
585 585
 		}
586 586
 
587
-		if ($message) {
588
-			echo '<div class="error"><p>' . wp_kses($message, [
587
+		if ( $message ) {
588
+			echo '<div class="error"><p>' . wp_kses( $message, [
589 589
 				'br' => array(),
590 590
 				'b' => array(),
591 591
 				'strong' => array(),
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 					'target' => array(),
596 596
 					'title' => array(),
597 597
 				),
598
-			]) . '</p></div>';
598
+			] ) . '</p></div>';
599 599
 			return;
600 600
 		}
601 601
 
@@ -649,26 +649,26 @@  discard block
 block discarded – undo
649 649
 	//     }
650 650
 	// }
651 651
 
652
-	$notices = get_option('monsterinsights_notices');
653
-	if (!is_array($notices)) {
652
+	$notices = get_option( 'monsterinsights_notices' );
653
+	if ( ! is_array( $notices ) ) {
654 654
 		$notices = array();
655 655
 	}
656 656
 
657 657
 	// 6. Authenticate, not manual
658 658
 	$authed  = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed();
659
-	$url     = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
659
+	$url     = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
660 660
 	$tracking_code = monsterinsights_get_v4_id_to_output();
661 661
 	// Translators: Placeholders add links to the settings panel.
662
-	$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>');
663
-	$migrated    = monsterinsights_get_option('gadwp_migrated', 0);
664
-	if ($migrated > 0) {
665
-		$url = admin_url('admin.php?page=monsterinsights-getting-started&monsterinsights-migration=1');
662
+	$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>' );
663
+	$migrated    = monsterinsights_get_option( 'gadwp_migrated', 0 );
664
+	if ( $migrated > 0 ) {
665
+		$url = admin_url( 'admin.php?page=monsterinsights-getting-started&monsterinsights-migration=1' );
666 666
 		// Translators: Placeholders add links to the settings panel.
667
-		$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');
668
-		$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>');
667
+		$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' );
668
+		$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>' );
669 669
 	}
670 670
 
671
-	if (empty($authed) && !isset($notices['monsterinsights_auth_not_manual']) && !empty($tracking_code)) {
671
+	if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) && ! empty( $tracking_code ) ) {
672 672
 		echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
673 673
 		echo '<p>';
674 674
 		echo $manual_text; // phpcs:ignore
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 	// }
695 695
 
696 696
 	// 8. WooUpsell
697
-	if (!monsterinsights_is_pro_version() && class_exists('WooCommerce') && $is_plugins_page) {
698
-		if (!isset($notices['monsterinsights_woocommerce_tracking_available'])) {
697
+	if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) && $is_plugins_page ) {
698
+		if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) {
699 699
 			$woo_notice_template = '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">
700 700
 				%1$s
701 701
 				<div class="monsterinsights-wooedd-upsell-left">
@@ -711,28 +711,28 @@  discard block
 block discarded – undo
711 711
 
712 712
 			$woo_notice_button = sprintf(
713 713
 				// Translators: Placeholders add a link to the MonsterInsights website.
714
-				esc_html__('%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress'),
715
-				'<a class="button button-primary button-hero" target="_blank" href="' . esc_url(monsterinsights_get_upgrade_link('admin-notices', 'woocommerce-upgrade')) . '">',
714
+				esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ),
715
+				'<a class="button button-primary button-hero" target="_blank" href="' . esc_url( monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) ) . '">',
716 716
 				' &raquo;</a>'
717 717
 			);
718 718
 
719 719
 			$woo_notice_offer = sprintf(
720 720
 				'<div class="monsterinsights-wooedd-upsell-offer">%1$s</div>',
721
-				__('Save <span>50%</span> Off MonsterInsights Pro', 'google-analytics-for-wordpress')
721
+				__( 'Save <span>50%</span> Off MonsterInsights Pro', 'google-analytics-for-wordpress' )
722 722
 			);
723 723
 
724
-			$woo_notice_bg = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/monsterinsights-woo-edd-upsell.svg';
725
-			$woo_notice_offer_icon = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-offer-icon.svg';
724
+			$woo_notice_bg = esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/monsterinsights-woo-edd-upsell.svg';
725
+			$woo_notice_offer_icon = esc_url( trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) ) . 'assets/images/upsell/woo-offer-icon.svg';
726 726
 			$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>";
727 727
 
728 728
 			echo sprintf(
729 729
 				$woo_notice_template,
730 730
 				$woo_notice_style,
731
-				__('Add eCommerce Analytics to your WooCommerce Store', 'google-analytics-for-wordpress'),
732
-				__('Unlock all of our advanced eCommerce features specifically designed to help your store make more money..', 'google-analytics-for-wordpress'),
733
-				__('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'),
734
-				__('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'),
735
-				__('Start making better data-driven decisions today!', 'google-analytics-for-wordpress'),
731
+				__( 'Add eCommerce Analytics to your WooCommerce Store', 'google-analytics-for-wordpress' ),
732
+				__( 'Unlock all of our advanced eCommerce features specifically designed to help your store make more money..', 'google-analytics-for-wordpress' ),
733
+				__( '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' ),
734
+				__( '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' ),
735
+				__( 'Start making better data-driven decisions today!', 'google-analytics-for-wordpress' ),
736 736
 				$woo_notice_offer,
737 737
 				$woo_notice_button
738 738
 			);
@@ -741,30 +741,30 @@  discard block
 block discarded – undo
741 741
 	}
742 742
 
743 743
 	// 9. EDDUpsell
744
-	if (!monsterinsights_is_pro_version() && class_exists('Easy_Digital_Downloads') && $is_plugins_page) {
745
-		if (!isset($notices['monsterinsights_edd_tracking_available'])) {
744
+	if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) && $is_plugins_page ) {
745
+		if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) {
746 746
 			echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
747 747
 			echo '<div class="monsterinsights-wooedd-upsell-left">';
748 748
 			echo '<p><strong>';
749
-			echo esc_html('Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress');
749
+			echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' );
750 750
 			echo '</strong></p>';
751
-			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">';
751
+			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">';
752 752
 			echo '<p>';
753
-			echo esc_html('MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress');
753
+			echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' );
754 754
 			echo '</p>';
755 755
 			echo '<p>';
756
-			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');
756
+			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' );
757 757
 			echo '</p>';
758 758
 			echo '<p>';
759
-			echo esc_html('Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress');
759
+			echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' );
760 760
 			echo '</p>';
761 761
 			echo '<p>';
762
-			echo esc_html('Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress');
762
+			echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
763 763
 			echo '</p>';
764
-			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')) . '">', ' &raquo;</a>');
764
+			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' ) ) . '">', ' &raquo;</a>' );
765 765
 			echo '</p>';
766 766
 			echo '</div><div class="monsterinsights-wooedd-upsell-right">';
767
-			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">';
767
+			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">';
768 768
 			echo '</div>';
769 769
 			echo '</div>';
770 770
 
@@ -773,32 +773,32 @@  discard block
 block discarded – undo
773 773
 	}
774 774
 
775 775
 
776
-	if (isset($notices['monsterinsights_cross_domains_extracted']) && false === $notices['monsterinsights_cross_domains_extracted']) {
777
-		$page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
776
+	if ( isset( $notices['monsterinsights_cross_domains_extracted'] ) && false === $notices['monsterinsights_cross_domains_extracted'] ) {
777
+		$page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
778 778
 		$page = $page . '#/advanced';
779 779
 		// Translators: Adds a link to the settings panel.
780
-		$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>');
780
+		$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>' );
781 781
 		echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; // phpcs:ignore
782 782
 
783 783
 		return;
784 784
 	}
785 785
 }
786 786
 
787
-add_action('admin_notices', 'monsterinsights_admin_setup_notices');
788
-add_action('network_admin_notices', 'monsterinsights_admin_setup_notices');
787
+add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' );
788
+add_action( 'network_admin_notices', 'monsterinsights_admin_setup_notices' );
789 789
 
790 790
 
791 791
 // AM Notices
792
-function monsterinsights_am_notice_optout($super_admin)
792
+function monsterinsights_am_notice_optout( $super_admin )
793 793
 {
794
-	if (monsterinsights_get_option('hide_am_notices', false) || monsterinsights_get_option('network_hide_am_notices', false)) {
794
+	if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) {
795 795
 		return false;
796 796
 	}
797 797
 
798 798
 	return $super_admin;
799 799
 }
800 800
 
801
-add_filter("am_notifications_display", 'monsterinsights_am_notice_optout', 10, 1);
801
+add_filter( "am_notifications_display", 'monsterinsights_am_notice_optout', 10, 1 );
802 802
 
803 803
 /**
804 804
  * Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers.
@@ -827,20 +827,20 @@  discard block
 block discarded – undo
827 827
 <?php
828 828
 }
829 829
 
830
-add_action('admin_head', 'monsterinsights_admin_menu_inline_styles', 300);
830
+add_action( 'admin_head', 'monsterinsights_admin_menu_inline_styles', 300 );
831 831
 
832 832
 /**
833 833
  * Display notice in admin when measurement protocol is left blank
834 834
  */
835 835
 function monsterinsights_empty_measurement_protocol_token()
836 836
 {
837
-	if (!class_exists('MonsterInsights_eCommerce') && !class_exists('MonsterInsights_Forms')) {
837
+	if ( ! class_exists( 'MonsterInsights_eCommerce' ) && ! class_exists( 'MonsterInsights_Forms' ) ) {
838 838
 		return;
839 839
 	}
840 840
 
841 841
 	$page = is_network_admin()
842
-		? network_admin_url('admin.php?page=monsterinsights_network')
843
-		: admin_url('admin.php?page=monsterinsights_settings');
842
+		? network_admin_url( 'admin.php?page=monsterinsights_network' )
843
+		: admin_url( 'admin.php?page=monsterinsights_settings' );
844 844
 
845 845
 	$api_secret = is_network_admin()
846 846
 		? MonsterInsights()->auth->get_network_measurement_protocol_secret()
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 
849 849
 	$current_code = monsterinsights_get_v4_id_to_output();
850 850
 
851
-	if (empty($current_code) || !empty($api_secret)) {
851
+	if ( empty( $current_code ) || ! empty( $api_secret ) ) {
852 852
 		return;
853 853
 	}
854 854
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 			'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.',
859 859
 			'google-analytics-for-wordpress'
860 860
 		),
861
-		'<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/') . '">',
861
+		'<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/' ) . '">',
862 862
 		'</a>'
863 863
 	);
864 864
 	echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
Please login to merge, or discard this patch.
Braces   +17 added lines, -31 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
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
 	$new_indicator     = sprintf(
@@ -151,7 +150,7 @@  discard block
 block discarded – undo
151 150
 add_action('admin_menu', 'monsterinsights_admin_menu');
152 151
 
153 152
 
154
-function monsterinsights_automated_menu($hook){
153
+function monsterinsights_automated_menu($hook) {
155 154
 	$display = false;
156 155
 
157 156
 	$now = apply_filters('monsterinsights_automated_promotion_date', wp_date('M d, Y h:i:s a'));
@@ -206,8 +205,8 @@  discard block
 block discarded – undo
206 205
 		],
207 206
 	];
208 207
 
209
-	foreach($conditions as $key => $condition){
210
-		if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])){
208
+	foreach($conditions as $key => $condition) {
209
+		if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])) {
211 210
 			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/"));
212 211
 			break;
213 212
 		}
@@ -217,8 +216,7 @@  discard block
 block discarded – undo
217 216
 /**
218 217
  * Add this separately so all the Woo menu items are loaded and the position parameter works correctly.
219 218
  */
220
-function monsterinsights_woocommerce_menu_item()
221
-{
219
+function monsterinsights_woocommerce_menu_item() {
222 220
 	if (class_exists('WooCommerce')) {
223 221
 		// Add "Insights" sub menu item for WooCommerce Analytics menu
224 222
 		if (class_exists('MonsterInsights_eCommerce')) {
@@ -231,8 +229,7 @@  discard block
 block discarded – undo
231 229
 }
232 230
 add_action('admin_menu', 'monsterinsights_woocommerce_menu_item', 11);
233 231
 
234
-function monsterinsights_get_menu_hook()
235
-{
232
+function monsterinsights_get_menu_hook() {
236 233
 	$dashboards_disabled = monsterinsights_get_option('dashboards_disabled', false);
237 234
 	if ($dashboards_disabled || (current_user_can('monsterinsights_save_settings') && !current_user_can('monsterinsights_view_dashboard'))) {
238 235
 		return 'monsterinsights_settings';
@@ -241,8 +238,7 @@  discard block
 block discarded – undo
241 238
 	}
242 239
 }
243 240
 
244
-function monsterinsights_network_admin_menu()
245
-{
241
+function monsterinsights_network_admin_menu() {
246 242
 	// Get the base class object.
247 243
 	$base = MonsterInsights();
248 244
 
@@ -298,8 +294,7 @@  discard block
 block discarded – undo
298 294
  *
299 295
  * @return String          Altered body classes.
300 296
  */
301
-function monsterinsights_add_admin_body_class($classes)
302
-{
297
+function monsterinsights_add_admin_body_class($classes) {
303 298
 	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
304 299
 	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) {
305 300
 		return $classes;
@@ -317,8 +312,7 @@  discard block
 block discarded – undo
317 312
  *
318 313
  * @return String          Altered body classes.
319 314
  */
320
-function monsterinsights_add_admin_body_class_tools_page($classes)
321
-{
315
+function monsterinsights_add_admin_body_class_tools_page($classes) {
322 316
 	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
323 317
 
324 318
 	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_tools') === false || 'insights_page_monsterinsights_tools' === $screen->id) {
@@ -337,8 +331,7 @@  discard block
 block discarded – undo
337 331
  *
338 332
  * @return String          Altered body classes.
339 333
  */
340
-function monsterinsights_add_admin_body_class_addons_page($classes)
341
-{
334
+function monsterinsights_add_admin_body_class_addons_page($classes) {
342 335
 	$screen = function_exists('get_current_screen') ? get_current_screen() : false;
343 336
 	if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_addons') === false || 'insights_page_monsterinsights_addons' === $screen->id) {
344 337
 		return $classes;
@@ -356,8 +349,7 @@  discard block
 block discarded – undo
356 349
  *
357 350
  * @return array $links
358 351
  */
359
-function monsterinsights_add_action_links($links)
360
-{
352
+function monsterinsights_add_action_links($links) {
361 353
 	$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>';
362 354
 	array_unshift($links, $docs);
363 355
 
@@ -402,8 +394,7 @@  discard block
 block discarded – undo
402 394
  * @since 6.0.0
403 395
  *
404 396
  */
405
-function monsterinsights_load_admin_partial($template, $data = array())
406
-{
397
+function monsterinsights_load_admin_partial($template, $data = array()) {
407 398
 
408 399
 	if (monsterinsights_is_pro_version()) {
409 400
 		$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'pro/includes/admin/partials');
@@ -443,8 +434,7 @@  discard block
 block discarded – undo
443 434
  * @return string
444 435
  * @since 6.0.0
445 436
  */
446
-function monsterinsights_admin_footer($text)
447
-{
437
+function monsterinsights_admin_footer($text) {
448 438
 	global $current_screen;
449 439
 	if (
450 440
 		! empty( $current_screen->id )
@@ -461,8 +451,7 @@  discard block
 block discarded – undo
461 451
 
462 452
 add_filter('admin_footer_text', 'monsterinsights_admin_footer', 1, 2);
463 453
 
464
-function monsterinsights_admin_setup_notices()
465
-{
454
+function monsterinsights_admin_setup_notices() {
466 455
 	// Make sure they have the permissions to do something
467 456
 	if (!current_user_can('monsterinsights_save_settings')) {
468 457
 		return;
@@ -789,8 +778,7 @@  discard block
 block discarded – undo
789 778
 
790 779
 
791 780
 // AM Notices
792
-function monsterinsights_am_notice_optout($super_admin)
793
-{
781
+function monsterinsights_am_notice_optout($super_admin) {
794 782
 	if (monsterinsights_get_option('hide_am_notices', false) || monsterinsights_get_option('network_hide_am_notices', false)) {
795 783
 		return false;
796 784
 	}
@@ -803,8 +791,7 @@  discard block
 block discarded – undo
803 791
 /**
804 792
  * Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers.
805 793
  */
806
-function monsterinsights_admin_menu_inline_styles()
807
-{
794
+function monsterinsights_admin_menu_inline_styles() {
808 795
 ?>
809 796
 	<style>
810 797
 		#toplevel_page_monsterinsights_reports .wp-menu-image img,
@@ -832,8 +819,7 @@  discard block
 block discarded – undo
832 819
 /**
833 820
  * Display notice in admin when measurement protocol is left blank
834 821
  */
835
-function monsterinsights_empty_measurement_protocol_token()
836
-{
822
+function monsterinsights_empty_measurement_protocol_token() {
837 823
 	if (!class_exists('MonsterInsights_eCommerce') && !class_exists('MonsterInsights_Forms')) {
838 824
 		return;
839 825
 	}
Please login to merge, or discard this patch.
includes/admin/exclude-page-metabox.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'
Please login to merge, or discard this patch.
includes/admin/ajax.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -332,20 +332,20 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 );
Please login to merge, or discard this patch.
includes/admin/tracking.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/eea-compliance.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' ),
Please login to merge, or discard this patch.
includes/admin/api-auth.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/reports/abstract-report.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -420,15 +420,15 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -310,9 +310,9 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
includes/admin/reports/site-insights.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/reports/overview.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
 		if ( ! empty( $data['data']['countries'] ) ) {
48 48
 			$country_names = monsterinsights_get_country_list( true );
49 49
 			foreach ( $data['data']['countries'] as $key => $country ) {
50
-				$data['data']['countries'][ $key ]['name'] = isset( $country_names[ $country['iso'] ] ) ? $country_names[ $country['iso'] ] : $country['iso'];
50
+				$data['data']['countries'][$key]['name'] = isset( $country_names[$country['iso']] ) ? $country_names[$country['iso']] : $country['iso'];
51 51
 			}
52 52
 		}
53 53
 
54 54
 		// Escape urls for the top pages report.
55 55
 		if ( ! empty( $data['data']['toppages'] ) ) {
56 56
 			foreach ( $data['data']['toppages'] as $key => $page ) {
57
-				$title = $data['data']['toppages'][ $key ]['title'];
58
-				$url   = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][ $key ]['hostname'] );
57
+				$title = $data['data']['toppages'][$key]['title'];
58
+				$url   = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][$key]['hostname'] );
59 59
 
60
-				$data['data']['toppages'][ $key ]['hostname'] = $url;
60
+				$data['data']['toppages'][$key]['hostname'] = $url;
61 61
 			}
62 62
 		}
63 63
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 
109 109
 			// Generate random chart data.
110 110
 			for ( $i = 0; $i < $data['data']['overviewgraph']['count']; $i++ ) {
111
-				$data['data']['overviewgraph']['sessions']['datapoints'][ $i ] = wp_rand(1, 5);
112
-				$data['data']['overviewgraph']['pageviews']['datapoints'][ $i ] = wp_rand(1, 5);
111
+				$data['data']['overviewgraph']['sessions']['datapoints'][$i] = wp_rand( 1, 5 );
112
+				$data['data']['overviewgraph']['pageviews']['datapoints'][$i] = wp_rand( 1, 5 );
113 113
 			}
114 114
 
115 115
 		}
Please login to merge, or discard this patch.