Passed
Push — master ( 8403c0...3ede7f )
by Chris
08:42
created
googleanalytics.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
 		}
371 371
 
372 372
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_DIR' ) ) {
373
-			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file )  );
373
+			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) );
374 374
 		}
375 375
 
376 376
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_URL' ) ) {
377
-			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file )  );
377
+			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) );
378 378
 		}
379 379
 	}
380 380
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		}
395 395
 
396 396
 		// Traditional WordPress plugin locale filter.
397
-		$mi_locale  = apply_filters( 'plugin_locale',  $mi_locale, 'google-analytics-for-wordpress' );
397
+		$mi_locale  = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' );
398 398
 		$mi_mofile  = sprintf( '%1$s-%2$s.mo', 'google-analytics-for-wordpress', $mi_locale );
399 399
 
400 400
 		// Look for wp-content/languages/google-analytics-for-wordpress/google-analytics-for-wordpress-{lang}_{country}.mo
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	public function monsterinsights_pro_notice() {
434 434
 		$url = admin_url( 'plugins.php' );
435 435
 		// Check for MS dashboard
436
-		if( is_network_admin() ) {
436
+		if ( is_network_admin() ) {
437 437
 			$url = network_admin_url( 'plugins.php' );
438 438
 		}
439 439
 		?>
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/options.php';
460 460
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/helpers.php';
461 461
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/deprecated.php';
462
-		$monsterinsights_settings  = monsterinsights_get_options();
462
+		$monsterinsights_settings = monsterinsights_get_options();
463 463
 	}
464 464
 
465 465
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return void
475 475
 	 */
476
-	public function load_licensing(){
476
+	public function load_licensing() {
477 477
 		if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
478 478
 			require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/license-compat.php';
479 479
 			self::$instance->license = new MonsterInsights_License_Compat();
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
  *
789 789
  * @return void
790 790
  */
791
-function monsterinsights_lite_call_install_and_upgrade(){
791
+function monsterinsights_lite_call_install_and_upgrade() {
792 792
 	add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' );
793 793
 }
794 794
 
Please login to merge, or discard this patch.
includes/compatibility-check.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -322,7 +322,7 @@
 block discarded – undo
322 322
 			$url = admin_url( 'plugins.php' );
323 323
 
324 324
 			// Check for MS dashboard
325
-			if( is_network_admin() ) {
325
+			if ( is_network_admin() ) {
326 326
 				$url = network_admin_url( 'plugins.php' );
327 327
 			}
328 328
 
Please login to merge, or discard this patch.
includes/measurement-protocol-v4.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 			}
67 67
 
68 68
 			if ( array_key_exists( $key, $args ) ) {
69
-				$out[ $key ] = $args[ $key ];
69
+				$out[$key] = $args[$key];
70 70
 			} else {
71
-				$out[ $key ] = $default;
71
+				$out[$key] = $default;
72 72
 			}
73 73
 		}
74 74
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 		if ( $this->is_debug ) {
89 89
 			foreach ( $body['events'] as $index => $event ) {
90
-				$body['events'][ $index ]['params']['debug_mode'] = true;
90
+				$body['events'][$index]['params']['debug_mode'] = true;
91 91
 			}
92 92
 		}
93 93
 
Please login to merge, or discard this patch.
includes/auth.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 final class MonsterInsights_Auth {
20 20
 
21
-	private $profile  = array();
21
+	private $profile = array();
22 22
 	private $network = array();
23 23
 
24 24
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			return $result;
64 64
 		}
65 65
 
66
-		return $this->get_connected_type() === $type && ! empty( $this->profile[ $type ] );
66
+		return $this->get_connected_type() === $type && ! empty( $this->profile[$type] );
67 67
 	}
68 68
 
69 69
 	public function is_network_authed( $type = false ) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			return $result;
74 74
 		}
75 75
 
76
-		return $this->get_connected_type() === $type && ! empty( $this->network[ $type ] );
76
+		return $this->get_connected_type() === $type && ! empty( $this->network[$type] );
77 77
 	}
78 78
 
79 79
 	public function get_analytics_profile( $force = false ) {
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 		}
97 97
 	}
98 98
 
99
-	public function set_analytics_profile( $data = array() ){
99
+	public function set_analytics_profile( $data = array() ) {
100 100
 		update_option( 'monsterinsights_site_profile', $data );
101
-		$this->profile      = $data;
101
+		$this->profile = $data;
102 102
 
103 103
 		// If this is the first time, save the date when they connected.
104 104
 		$over_time    = get_option( 'monsterinsights_over_time', array() );
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 	}
118 118
 
119
-	public function set_network_analytics_profile( $data = array() ){
119
+	public function set_network_analytics_profile( $data = array() ) {
120 120
 		update_site_option( 'monsterinsights_network_profile', $data );
121
-		$this->network      = $data;
121
+		$this->network = $data;
122 122
 	}
123 123
 
124
-	public function delete_analytics_profile( $migrate = true ){
124
+	public function delete_analytics_profile( $migrate = true ) {
125 125
 		if ( $migrate ) {
126 126
 			$newdata = array();
127 127
 			if ( isset( $this->profile['ua'] ) ) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 	}
140 140
 
141
-	public function delete_network_analytics_profile( $migrate = true ){
141
+	public function delete_network_analytics_profile( $migrate = true ) {
142 142
 		if ( $migrate ) {
143 143
 			$newdata = array();
144 144
 			if ( isset( $this->network['ua'] ) ) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 		do_action( 'monsterinsights_reports_delete_aggregate_data' );
176 176
 
177
-		$this->profile      = $data;
177
+		$this->profile = $data;
178 178
 		$this->set_analytics_profile( $data );
179 179
 	}
180 180
 
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 				$key = $is_authed_ua ? 'v4' : 'ua';
199 199
 			}
200 200
 
201
-			if ( $key && ! empty( $data[ $key ] ) ) {
202
-				unset( $data[ $key ] );
201
+			if ( $key && ! empty( $data[$key] ) ) {
202
+				unset( $data[$key] );
203 203
 			}
204 204
 		} else {
205 205
 			$is_dual_tracking_id_v4 = monsterinsights_is_valid_v4_id( $id );
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 				$key = $is_dual_tracking_id_v4 ? 'v4' : 'ua';
219 219
 			}
220 220
 
221
-			$data[ $key ] = $id;
221
+			$data[$key] = $id;
222 222
 		}
223 223
 
224 224
 		return $data;
225 225
 	}
226 226
 
227
-	public function set_dual_tracking_id ( $id = '' ) {
227
+	public function set_dual_tracking_id( $id = '' ) {
228 228
 		$data = empty( $this->profile ) ? array() : $this->profile;
229 229
 
230 230
 		$is_manual_ua = $this->is_manual( 'ua' );
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$this->set_analytics_profile( $prepared_data );
242 242
 	}
243 243
 
244
-	public function set_network_dual_tracking_id ( $id = '' ) {
244
+	public function set_network_dual_tracking_id( $id = '' ) {
245 245
 		$data = empty( $this->network ) ? array() : $this->network;
246 246
 
247 247
 		$is_manual_ua = $this->is_network_manual( 'ua' );
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 		if ( empty( $this->profile ) ) {
272 272
 			$data['manual_v4'] = $v4;
273 273
 		} else {
274
-			$data           = $this->profile;
274
+			$data = $this->profile;
275 275
 			$data['manual_v4'] = $v4;
276 276
 		}
277 277
 
278 278
 		do_action( 'monsterinsights_reports_delete_aggregate_data' );
279 279
 
280
-		$this->profile      = $data;
280
+		$this->profile = $data;
281 281
 		$this->set_analytics_profile( $data );
282 282
 	}
283 283
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		if ( empty( $this->network ) ) {
318 318
 			$data['manual_v4'] = $v4;
319 319
 		} else {
320
-			$data           = $this->network;
320
+			$data = $this->network;
321 321
 			$data['manual_v4'] = $v4;
322 322
 		}
323 323
 
@@ -425,51 +425,51 @@  discard block
 block discarded – undo
425 425
 		return ! empty( $this->network['v4'] ) ? monsterinsights_is_valid_v4_id( $this->network['v4'] ) : '';
426 426
 	}
427 427
 
428
-	public function get_viewname(){
428
+	public function get_viewname() {
429 429
 		return ! empty( $this->profile['viewname'] ) ? $this->profile['viewname'] : '';
430 430
 	}
431 431
 
432
-	public function get_network_viewname(){
432
+	public function get_network_viewname() {
433 433
 		return ! empty( $this->network['viewname'] ) ? $this->network['viewname'] : '';
434 434
 	}
435 435
 
436
-	public function get_accountid(){
436
+	public function get_accountid() {
437 437
 		return ! empty( $this->profile['a'] ) ? $this->profile['a'] : '';
438 438
 	}
439 439
 
440
-	public function get_network_accountid(){
440
+	public function get_network_accountid() {
441 441
 		return ! empty( $this->network['a'] ) ? $this->network['a'] : '';
442 442
 	}
443 443
 
444
-	public function get_propertyid(){
444
+	public function get_propertyid() {
445 445
 		return ! empty( $this->profile['w'] ) ? $this->profile['w'] : '';
446 446
 	}
447 447
 
448
-	public function get_network_propertyid(){
448
+	public function get_network_propertyid() {
449 449
 		return ! empty( $this->network['w'] ) ? $this->network['w'] : '';
450 450
 	}
451 451
 
452
-	public function get_viewid(){ // also known as profileID
452
+	public function get_viewid() { // also known as profileID
453 453
 		return ! empty( $this->profile['p'] ) ? $this->profile['p'] : '';
454 454
 	}
455 455
 
456
-	public function get_network_viewid(){ // also known as profileID
456
+	public function get_network_viewid() { // also known as profileID
457 457
 		return ! empty( $this->network['p'] ) ? $this->network['p'] : '';
458 458
 	}
459 459
 
460
-	public function get_key(){
460
+	public function get_key() {
461 461
 		return ! empty( $this->profile['key'] ) ? $this->profile['key'] : '';
462 462
 	}
463 463
 
464
-	public function get_network_key(){
464
+	public function get_network_key() {
465 465
 		return ! empty( $this->network['key'] ) ? $this->network['key'] : '';
466 466
 	}
467 467
 
468
-	public function get_token(){
468
+	public function get_token() {
469 469
 		return ! empty( $this->profile['token'] ) ? $this->profile['token'] : '';
470 470
 	}
471 471
 
472
-	public function get_network_token(){
472
+	public function get_network_token() {
473 473
 		return ! empty( $this->network['token'] ) ? $this->network['token'] : '';
474 474
 	}
475 475
 
Please login to merge, or discard this patch.
includes/helpers.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 		$user = new WP_User( $user_id );
33 33
 	}
34 34
 
35
-	$track_user  = true;
36
-	$roles     = monsterinsights_get_option( 'ignore_users', array() );
35
+	$track_user = true;
36
+	$roles = monsterinsights_get_option( 'ignore_users', array() );
37 37
 
38 38
 	if ( ! empty( $roles ) && is_array( $roles ) ) {
39 39
 		foreach ( $roles as $role ) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 
184 184
 function monsterinsights_generate_ga_client_id() {
185
-	return rand(100000000,999999999) . '.' . time();
185
+	return rand( 100000000, 999999999 ) . '.' . time();
186 186
 }
187 187
 
188 188
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		$stop = time();
203 203
 	}
204 204
 
205
-	$diff = (int) abs( $stop -  $start );
205
+	$diff = (int) abs( $stop - $start );
206 206
 	$hours = round( $diff / HOUR_IN_SECONDS );
207 207
 	return $hours;
208 208
 }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	$editable_roles = apply_filters( 'editable_roles', $all_roles );
261 261
 
262 262
 	foreach ( $editable_roles as $id => $name ) {
263
-		$roles[ $id ] = translate_user_role( $name['name'] );
263
+		$roles[$id] = translate_user_role( $name['name'] );
264 264
 	}
265 265
 
266 266
 	return $roles;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 	foreach ( $editable_roles as $id => $role ) {
288 288
 		if ( isset( $role['capabilities']['manage_options'] ) && $role['capabilities']['manage_options'] ) {
289
-			$roles[ $id ] = translate_user_role( $role['name'] );
289
+			$roles[$id] = translate_user_role( $role['name'] );
290 290
 		}
291 291
 	}
292 292
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 		}
334 334
 		if ( substr_count( $host, '.' ) > 1 ) {
335
-			$subdomains_to_check =  array( 'dev.', '*.staging.', 'beta.', 'test.' );
335
+			$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
336 336
 			foreach ( $subdomains_to_check as $subdomain ) {
337 337
 				$subdomain = str_replace( '.', '(.)', $subdomain );
338 338
 				$subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain );
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 
349 349
 // Set cookie to expire in 2 years
350 350
 function monsterinsights_get_cookie_expiration_date( $time ) {
351
-	return date('D, j F Y H:i:s', time() + $time );
351
+	return date( 'D, j F Y H:i:s', time() + $time );
352 352
 }
353 353
 
354 354
 function monsterinsights_string_ends_with( $string, $ending ) {
355
-	$strlen = strlen($string);
356
-	$endinglen = strlen($ending);
355
+	$strlen = strlen( $string );
356
+	$endinglen = strlen( $ending );
357 357
 	if ( $endinglen > $strlen ) {
358 358
 		return false;
359 359
 	}
360
-	return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0;
360
+	return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0;
361 361
 }
362 362
 
363 363
 function monsterinsights_string_starts_with( $string, $start ) {
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 	return $countries;
888 888
 }
889 889
 
890
-function monsterinsights_get_api_url(){
890
+function monsterinsights_get_api_url() {
891 891
 	return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' );
892 892
 }
893 893
 
894
-function monsterinsights_get_licensing_url(){
894
+function monsterinsights_get_licensing_url() {
895 895
 	return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' );
896 896
 }
897 897
 
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	}
936 936
 }
937 937
 
938
-if ( ! function_exists ( 'remove_class_filter' ) ) {
938
+if ( ! function_exists( 'remove_class_filter' ) ) {
939 939
 	/**
940 940
 	 * Remove Class Filter Without Access to Class Object
941 941
 	 *
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 	function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
957 957
 		global $wp_filter;
958 958
 		// Check that filter actually exists first
959
-		if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE;
959
+		if ( ! isset( $wp_filter[$tag] ) ) return FALSE;
960 960
 		/**
961 961
 		 * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer
962 962
 		 * a simple array, rather it is an object that implements the ArrayAccess interface.
@@ -965,33 +965,33 @@  discard block
 block discarded – undo
965 965
 		 *
966 966
 		 * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
967 967
 		 */
968
-		if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) {
969
-			$callbacks = &$wp_filter[ $tag ]->callbacks;
968
+		if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) {
969
+			$callbacks = &$wp_filter[$tag]->callbacks;
970 970
 		} else {
971
-			$callbacks = &$wp_filter[ $tag ];
971
+			$callbacks = &$wp_filter[$tag];
972 972
 		}
973 973
 		// Exit if there aren't any callbacks for specified priority
974
-		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE;
974
+		if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE;
975 975
 		// Loop through each filter for the specified priority, looking for our class & method
976
-		foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) {
976
+		foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) {
977 977
 			// Filter should always be an array - array( $this, 'method' ), if not goto next
978
-			if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue;
978
+			if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue;
979 979
 			// If first value in array is not an object, it can't be a class
980
-			if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue;
980
+			if ( ! is_object( $filter['function'][0] ) ) continue;
981 981
 			// Method doesn't match the one we're looking for, goto next
982
-			if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue;
982
+			if ( $filter['function'][1] !== $method_name ) continue;
983 983
 			// Method matched, now let's check the Class
984
-			if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) {
984
+			if ( get_class( $filter['function'][0] ) === $class_name ) {
985 985
 				// Now let's remove it from the array
986
-				unset( $callbacks[ $priority ][ $filter_id ] );
986
+				unset( $callbacks[$priority][$filter_id] );
987 987
 				// and if it was the only filter in that priority, unset that priority
988
-				if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] );
988
+				if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] );
989 989
 				// and if the only filter for that tag, set the tag to an empty array
990 990
 				if ( empty( $callbacks ) ) $callbacks = array();
991 991
 				// If using WordPress older than 4.7
992
-				if ( ! is_object( $wp_filter[ $tag ] ) ) {
992
+				if ( ! is_object( $wp_filter[$tag] ) ) {
993 993
 					// Remove this filter from merged_filters, which specifies if filters have been sorted
994
-					unset( $GLOBALS[ 'merged_filters' ][ $tag ] );
994
+					unset( $GLOBALS['merged_filters'][$tag] );
995 995
 				}
996 996
 				return TRUE;
997 997
 			}
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 	}
1001 1001
 } // End function exists
1002 1002
 
1003
-if ( ! function_exists ( 'remove_class_action' ) ) {
1003
+if ( ! function_exists( 'remove_class_action' ) ) {
1004 1004
 	/**
1005 1005
 	 * Remove Class Action Without Access to Class Object
1006 1006
 	 *
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		}
1071 1071
 
1072 1072
 		foreach ( $translations->entries as $msgid => $entry ) {
1073
-			$locale[ $msgid ] = $entry->translations;
1073
+			$locale[$msgid] = $entry->translations;
1074 1074
 		}
1075 1075
 
1076 1076
 		return $locale;
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 		$pattern = '/UA-[0-9-]+/';
1223 1223
 		if ( $type === 'ua' && isset( $options['ga-UID'] ) && preg_match( $pattern, $options['ga-UID'] ) ) {
1224
-			++ $count;
1224
+			++$count;
1225 1225
 		}
1226 1226
 	}
1227 1227
 
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 
1233 1233
 		$pattern = '/UA-[0-9-]+/';
1234 1234
 		if ( $type === 'ua' && ! empty( $code ) && preg_match( $pattern, $code ) ) {
1235
-			++ $count;
1235
+			++$count;
1236 1236
 		}
1237 1237
 	}
1238 1238
 
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 	$connected_type = MonsterInsights()->auth->get_connected_type();
1295 1295
 	if ( $type === $connected_type && strpos( $body, 'googletagmanager.com/gtag/js?id=' . $current_code ) !== false ) {
1296 1296
 		// In that case, we can safely deduct one from the total count
1297
-		-- $total_count;
1297
+		--$total_count;
1298 1298
 	}
1299 1299
 
1300 1300
 	if ( $total_count > $limit ) {
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	$response_code = wp_remote_retrieve_response_code( $request );
1337 1337
 
1338 1338
 	if ( in_array( $response_code, $accepted_http_codes, true ) ) {
1339
-		$body            = wp_remote_retrieve_body( $request );
1339
+		$body = wp_remote_retrieve_body( $request );
1340 1340
 
1341 1341
 		$errors = array_merge(
1342 1342
 			monsterinsights_detect_tracking_code_error( $body ),
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
  * @param string $url The url to which users get redirected.
1368 1368
  */
1369 1369
 function monsterinsights_custom_track_pretty_links_redirect( $url ) {
1370
-	if ( ! function_exists( 'monsterinsights_mp_track_event_call' ) && ! function_exists( 'monsterinsights_mp_collect_v4') ) {
1370
+	if ( ! function_exists( 'monsterinsights_mp_track_event_call' ) && ! function_exists( 'monsterinsights_mp_collect_v4' ) ) {
1371 1371
 		return;
1372 1372
 	}
1373 1373
 	// Try to determine if click originated on the same site.
@@ -1514,22 +1514,22 @@  discard block
 block discarded – undo
1514 1514
  *
1515 1515
  * @return trimed sentence
1516 1516
  */
1517
-function monsterinsights_trim_text( $text, $count ){
1518
-	$text 	= str_replace("  ", " ", $text);
1519
-	$string = explode(" ", $text);
1517
+function monsterinsights_trim_text( $text, $count ) {
1518
+	$text = str_replace( "  ", " ", $text );
1519
+	$string = explode( " ", $text );
1520 1520
 	$trimed = "";
1521 1521
 
1522 1522
 	for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter++ ) {
1523 1523
 		$trimed .= isset( $string[$wordCounter] ) ? $string[$wordCounter] : '';
1524 1524
 
1525
-		if ( $wordCounter < $count ){
1525
+		if ( $wordCounter < $count ) {
1526 1526
 			$trimed .= " ";
1527 1527
 		} else {
1528 1528
 			$trimed .= "...";
1529 1529
 		}
1530 1530
 	}
1531 1531
 
1532
-	$trimed = trim($trimed);
1532
+	$trimed = trim( $trimed );
1533 1533
 
1534 1534
 	return $trimed;
1535 1535
 }
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	$monsterinsights_reference = isset( $_GET['monsterinsights_reference'] ) ? $_GET['monsterinsights_reference'] : '';
1606 1606
 
1607 1607
 	if ( 'post-new.php' === $pagenow && 'pretty-link' === $post_type && 'url_builder' === $monsterinsights_reference ) {
1608
-		$onboard  = get_option( 'prli_onboard' );
1608
+		$onboard = get_option( 'prli_onboard' );
1609 1609
 
1610 1610
 		if ( $onboard == 'welcome' || $onboard == 'update' ) {
1611 1611
 			update_option( 'monsterinsights_backup_prli_onboard_value', $onboard );
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 	$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : '';
1626 1626
 
1627 1627
 	if ( 'edit.php' === $pagenow && 'pretty-link' === $post_type ) {
1628
-		$onboard   = get_option( 'monsterinsights_backup_prli_onboard_value' );
1628
+		$onboard = get_option( 'monsterinsights_backup_prli_onboard_value' );
1629 1629
 
1630 1630
 		if ( class_exists( 'PrliBaseController' ) && ( $onboard == 'welcome' || $onboard == 'update' ) ) {
1631 1631
 			update_option( 'prli_onboard', $onboard );
Please login to merge, or discard this patch.
includes/measurement-protocol.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 
23 23
 	$defaults = array(
24 24
 		't'  => 'event', // Required: Hit type
25
-		'ec' => '',      // Optional: Event category
26
-		'ea' => '', 	 // Optional: Event Action
27
-		'el' => '', 	 // Optional: Event Label
28
-		'ev' => null, 	 // Optional: Event Value
25
+		'ec' => '', // Optional: Event category
26
+		'ea' => '', // Optional: Event Action
27
+		'el' => '', // Optional: Event Label
28
+		'ev' => null, // Optional: Event Value
29 29
 	);
30 30
 
31
-	$body  = array_merge( $defaults , $args );
31
+	$body = array_merge( $defaults, $args );
32 32
 
33 33
 	// We want to get the user's IP address when possible
34
-	$ip     = '';
34
+	$ip = '';
35 35
 	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) && ! filter_var( $_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP ) === false ) {
36 36
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
37 37
 	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP ) === false ) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		'uip' => $ip,
80 80
 
81 81
 		// Optional: User Agent
82
-		'ua'  => ! empty( $user_agent ) ?  $user_agent : $_SERVER['HTTP_USER_AGENT'],
82
+		'ua'  => ! empty( $user_agent ) ? $user_agent : $_SERVER['HTTP_USER_AGENT'],
83 83
 
84 84
 		// Optional: Time of the event
85 85
 		'z'   => time(),
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	// Unset empty values to reduce request size
101 101
 	foreach ( $body as $key => $value ) {
102 102
 		if ( empty( $value ) ) {
103
-			unset( $body[ $key ] );
103
+			unset( $body[$key] );
104 104
 		}
105 105
 	}
106 106
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		'ev' => null,
152 152
 	);
153 153
 
154
-	$args         = wp_parse_args( $args, $default_args );
154
+	$args = wp_parse_args( $args, $default_args );
155 155
 
156 156
 	//$args = apply_filters( 'monsterinsights_mp_track_event_call', $args );
157 157
 
Please login to merge, or discard this patch.
includes/admin/admin.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 
29 29
     if ( $hook === 'monsterinsights_settings' ) {
30 30
         // If dashboards disabled, first settings page
31
-        add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page',  $menu_icon_inline, '100.00013467543' );
31
+        add_menu_page( __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', $menu_icon_inline, '100.00013467543' );
32 32
         $hook = 'monsterinsights_settings';
33 33
 
34 34
         add_submenu_page( $hook, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' );
35 35
     } else {
36 36
         // if dashboards enabled, first dashboard
37
-        add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page',  $menu_icon_inline, '100.00013467543' );
37
+        add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543' );
38 38
 
39 39
         add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' );
40 40
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     $menu_icon_inline = monsterinsights_get_inline_menu_icon();
122 122
     $hook = 'monsterinsights_network';
123 123
     $submenu_base = add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) );
124
-    add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page',  $menu_icon_inline, '100.00013467543' );
124
+    add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ) . MonsterInsights()->notifications->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543' );
125 125
 
126 126
     add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' );
127 127
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 function monsterinsights_add_admin_body_class_tools_page( $classes ) {
171 171
     $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
172 172
 
173
-    if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id  ) {
173
+    if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_tools' ) === false || 'insights_page_monsterinsights_tools' === $screen->id ) {
174 174
         return $classes;
175 175
     }
176 176
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function monsterinsights_add_admin_body_class_addons_page( $classes ) {
188 188
     $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
189
-    if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id  ) {
189
+    if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'monsterinsights_addons' ) === false || 'insights_page_monsterinsights_addons' === $screen->id ) {
190 190
         return $classes;
191 191
     }
192 192
 
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
  * @return array $links
203 203
  */
204 204
 function monsterinsights_add_action_links( $links ) {
205
-    $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="'. monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) .'">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>';
205
+    $docs = '<a title="' . esc_html__( 'MonsterInsights Knowledge Base', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_url( 'all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/" ) . '">' . esc_html__( 'Documentation', 'google-analytics-for-wordpress' ) . '</a>';
206 206
     array_unshift( $links, $docs );
207 207
 
208 208
     // If Lite, support goes to forum. If pro, it goes to our website
209 209
     if ( monsterinsights_is_pro_version() ) {
210
-        $support = '<a title="MonsterInsights Pro Support" href="'. monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
210
+        $support = '<a title="MonsterInsights Pro Support" href="' . monsterinsights_get_url( 'all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
211 211
         array_unshift( $links, $support );
212 212
     } else {
213
-        $support = '<a title="MonsterInsights Lite Support" href="'. monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
213
+        $support = '<a title="MonsterInsights Lite Support" href="' . monsterinsights_get_url( 'all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/" ) . '">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
214 214
         array_unshift( $links, $support );
215 215
     }
216 216
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 	// If lite, show a link where they can get pro from
226 226
 	if ( ! monsterinsights_is_pro_version() ) {
227
-		$get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="'. monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/" ) .'" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
227
+		$get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="' . monsterinsights_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/" ) . '" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
228 228
 		array_unshift( $links, $get_pro );
229 229
 	}
230 230
 
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
         $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' );
250 250
 
251 251
         if ( file_exists( $dir . $template . '.php' ) ) {
252
-            require_once(  $dir . $template . '.php' );
252
+            require_once( $dir . $template . '.php' );
253 253
             return true;
254 254
         }
255 255
     } else {
256 256
         $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' );
257 257
 
258 258
         if ( file_exists( $dir . $template . '.php' ) ) {
259
-            require_once(  $dir . $template . '.php' );
259
+            require_once( $dir . $template . '.php' );
260 260
             return true;
261 261
         }
262 262
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' );
265 265
 
266 266
     if ( file_exists( $dir . $template . '.php' ) ) {
267
-        require_once(  $dir . $template . '.php' );
267
+        require_once( $dir . $template . '.php' );
268 268
         return true;
269 269
     }
270 270
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) {
285 285
         $url  = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
286 286
         // Translators: Placeholders add a link to the wordpress.org repository.
287
-        $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' .  $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
287
+        $text = sprintf( esc_html__( 'Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
288 288
     }
289 289
     return $text;
290 290
 }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         $secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' );
326 326
         $urltwo    = $submenu_base . '#/about/getting-started';
327 327
         $message   = esc_html__( 'MonsterInsights, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' );
328
-        echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a>&nbsp;&nbsp;&nbsp;<a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>';
328
+        echo '<div class="notice notice-info"><p style="font-weight:700">' . $title . '</p><p>' . $message . '</p><p><a href="' . $urlone . '" class="button-primary">' . $primary . '</a>&nbsp;&nbsp;&nbsp;<a href="' . $urltwo . '" class="button-secondary">' . $secondary . '</a></p></div>';
329 329
         return;
330 330
     }
331 331
 
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
     if ( monsterinsights_is_pro_version() && empty( $key ) ) {
335 335
         $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
336 336
         // Translators: Adds a link to retrieve the license.
337
-        $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
338
-        echo '<div class="error"><p>'. $message.'</p></div>';
337
+        $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' );
338
+        echo '<div class="error"><p>' . $message . '</p></div>';
339 339
         return;
340 340
     }
341 341
 
342 342
     // 3. License key not valid/okay for pro
343 343
     if ( monsterinsights_is_pro_version() ) {
344 344
         $message = '';
345
-        if ( MonsterInsights()->license->get_site_license_key() ){
345
+        if ( MonsterInsights()->license->get_site_license_key() ) {
346 346
             if ( MonsterInsights()->license->site_license_expired() ) {
347 347
 	            // Translators: Adds a link to the license renewal.
348
-                $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
348
+                $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
349 349
             } else if ( MonsterInsights()->license->site_license_disabled() ) {
350 350
                 $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
351 351
             } else if ( MonsterInsights()->license->site_license_invalid() ) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         } else if ( MonsterInsights()->license->get_network_license_key() ) {
355 355
             if ( MonsterInsights()->license->network_license_expired() ) {
356 356
             	// Translators: Adds a link to renew license.
357
-                $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
357
+                $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
358 358
             } else if ( MonsterInsights()->license->network_license_disabled() ) {
359 359
                 $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
360 360
             } else if ( MonsterInsights()->license->network_license_invalid() ) {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
             }
363 363
         }
364 364
         if ( ! empty( $message ) ) {
365
-            echo '<div class="error"><p>'. $message.'</p></div>';
365
+            echo '<div class="error"><p>' . $message . '</p></div>';
366 366
             return;
367 367
         }
368 368
     }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	    }
390 390
 
391 391
 	    if ( $message ) {
392
-		    echo '<div class="error"><p>'. $message.'</p></div>';
392
+		    echo '<div class="error"><p>' . $message . '</p></div>';
393 393
 		    return;
394 394
 	    }
395 395
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
     //     }
443 443
     // }
444 444
 
445
-    $notices   = get_option( 'monsterinsights_notices' );
445
+    $notices = get_option( 'monsterinsights_notices' );
446 446
     if ( ! is_array( $notices ) ) {
447 447
         $notices = array();
448 448
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
     // 8. WooUpsell
490 490
     if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) {
491
-        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) {
491
+        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) {
492 492
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">';
493 493
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
494 494
                     echo '<p><strong>';
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                     echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
509 509
                     echo '</p>';
510 510
                     // Translators: Placeholders add a link to the MonsterInsights website.
511
-                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) .'">', ' &raquo;</a>' );
511
+                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="' . monsterinsights_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) . '">', ' &raquo;</a>' );
512 512
                     echo '</p>';
513 513
                 echo '</div><div class="monsterinsights-wooedd-upsell-right">';
514 514
                     echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
     // 9. EDDUpsell
523 523
     if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) {
524
-        if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) {
524
+        if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) {
525 525
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
526 526
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
527 527
                     echo '<p><strong>';
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                     echo '<p>';
541 541
                     echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
542 542
                     echo '</p>';
543
-                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="'. monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) .'">', ' &raquo;</a>' );
543
+                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="' . monsterinsights_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) . '">', ' &raquo;</a>' );
544 544
                     echo '</p>';
545 545
                 echo '</div><div class="monsterinsights-wooedd-upsell-right">';
546 546
                     echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
         $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
555 555
         $page = $page . '#/advanced';
556 556
         // Translators: Adds a link to the settings panel.
557
-        $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure.  %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
558
-        echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>'. $message.'</p></div>';
557
+        $message = sprintf( esc_html__( 'Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure.  %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' );
558
+        echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>';
559 559
         return;
560 560
     }
561 561
 }
@@ -618,10 +618,10 @@  discard block
 block discarded – undo
618 618
 			'Your Measurement Protocol API Secret is currently left blank, so you won\'t be able to use some of the tracking features with your GA4 property. %1$sPlease enter your Measurement Protocol API Secret here.%2$s',
619 619
 			'google-analytics-for-wordpress'
620 620
 		),
621
-		'<a href="' . esc_url( $page ). '">',
621
+		'<a href="' . esc_url( $page ) . '">',
622 622
 		'</a>'
623 623
 	);
624
-	echo '<div class="error"><p>'. $message.'</p></div>';
624
+	echo '<div class="error"><p>' . $message . '</p></div>';
625 625
 }
626 626
 
627 627
 add_action( 'admin_notices', 'monsterinsights_empty_measurement_protocol_token' );
Please login to merge, or discard this patch.
includes/admin/api-auth.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 	public function __construct() {
29 29
 
30 30
 		// Authentication Actions
31
-		add_action( 'wp_ajax_monsterinsights_maybe_authenticate',    array( $this, 'maybe_authenticate' ) );
32
-		add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate',  array( $this, 'maybe_reauthenticate' ) );
33
-		add_action( 'wp_ajax_monsterinsights_maybe_verify',          array( $this, 'maybe_verify' ) );
34
-		add_action( 'wp_ajax_monsterinsights_maybe_delete',          array( $this, 'maybe_delete' ) );
31
+		add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) );
32
+		add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) );
33
+		add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) );
34
+		add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) );
35 35
 
36
-		add_action( 'admin_init',          							 array( $this, 'authenticate_listener' ) );
37
-		add_action( 'admin_init',          							 array( $this, 'reauthenticate_listener' ) );
36
+		add_action( 'admin_init', array( $this, 'authenticate_listener' ) );
37
+		add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) );
38 38
 
39
-		add_action( 'wp_ajax_nopriv_monsterinsights_is_installed',    array( $this, 'is_installed' ) );
40
-		add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate',   array( $this, 'rauthenticate' ) );
39
+		add_action( 'wp_ajax_nopriv_monsterinsights_is_installed', array( $this, 'is_installed' ) );
40
+		add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate', array( $this, 'rauthenticate' ) );
41 41
 
42 42
 		add_filter( 'monsterinsights_maybe_authenticate_siteurl', array( $this, 'before_redirect' ) );
43 43
 
44 44
 		add_action( 'wp_ajax_nopriv_monsterinsights_push_mp_token', array( $this, 'handle_relay_mp_token_push' ) );
45 45
 	}
46 46
 
47
-	public function get_tt(){
47
+	public function get_tt() {
48 48
 		$tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' );
49 49
 		if ( empty( $tt ) ) {
50 50
 			// if TT is empty, generate a new one, save it and then return it
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 		return $tt;
55 55
 	}
56 56
 
57
-	public function rotate_tt(){
57
+	public function rotate_tt() {
58 58
 		$tt = $this->generate_tt();
59 59
 		is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt );
60 60
 	}
61 61
 
62
-	public function generate_tt(){
62
+	public function generate_tt() {
63 63
 		return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) );
64 64
 	}
65 65
 
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 		);
78 78
 	}
79 79
 
80
-	public function maybe_authenticate(){
80
+	public function maybe_authenticate() {
81 81
 
82 82
 		// Check nonce
83 83
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
84 84
 
85 85
 		// current user can authenticate
86 86
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
87
-			wp_send_json_error( array(	'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
87
+			wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
88 88
 		}
89 89
 
90 90
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 		// we do not have a current auth
103 103
 		if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) {
104
-			wp_send_json_error( array(	'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
104
+			wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
105 105
 		} else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) {
106
-			wp_send_json_error( array(	'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
106
+			wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
107 107
 		}
108 108
 
109 109
 		$sitei = $this->get_sitei();
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		wp_send_json_success();
174 174
 	}
175 175
 
176
-	public function authenticate_listener(){
176
+	public function authenticate_listener() {
177 177
 		// Make sure it's for us
178 178
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
179 179
 			return;
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 
192 192
 		// Make sure has required params
193 193
 		if (
194
-			empty( $_REQUEST['key'] )    ||
195
-			empty( $_REQUEST['token'] )  ||
194
+			empty( $_REQUEST['key'] ) ||
195
+			empty( $_REQUEST['token'] ) ||
196 196
 			empty( $_REQUEST['miview'] ) ||
197
-			empty( $_REQUEST['a'] )      ||
198
-			empty( $_REQUEST['w'] )      ||
199
-			empty( $_REQUEST['p'] )      ||
197
+			empty( $_REQUEST['a'] ) ||
198
+			empty( $_REQUEST['w'] ) ||
199
+			empty( $_REQUEST['p'] ) ||
200 200
 			( empty( $_REQUEST['ua'] ) && empty( $_REQUEST['v4'] ) )
201 201
 		) {
202 202
 			return;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			$profile['measurement_protocol_secret'] = sanitize_text_field( $_REQUEST['mp'] );
231 231
 		}
232 232
 
233
-		$profile[ $code_key ] = $code_value;
233
+		$profile[$code_key] = $code_value;
234 234
 
235 235
 		$worked = $this->verify_auth( $profile );
236 236
 		if ( ! $worked || is_wp_error( $worked ) ) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		$where = $this->is_network_admin() ? 'network' : 'site';
245 245
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
246 246
 
247
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
247
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
248 248
 		$url = add_query_arg( array(
249 249
 			 'mi_action' => 'auth',
250 250
 			 'success'   => 'true',
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		exit;
255 255
 	}
256 256
 
257
-	public function maybe_reauthenticate(){
257
+	public function maybe_reauthenticate() {
258 258
 
259 259
 		// Check nonce
260 260
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
261 261
 
262 262
 		// current user can authenticate
263 263
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
264
-			wp_send_json_error( array(	'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
264
+			wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
265 265
 		}
266 266
 
267 267
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
 		// we do have a current auth
280 280
 		if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
281
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
281
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
282 282
 		} else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
283
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
283
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
284 284
 		}
285 285
 
286 286
 		$siteurl = add_query_arg( array(
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		wp_send_json_success( array( 'redirect' => $siteurl ) );
307 307
 	}
308 308
 
309
-	public function reauthenticate_listener(){
309
+	public function reauthenticate_listener() {
310 310
 		// Make sure it's for us
311 311
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
312 312
 			return;
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			$profile['measurement_protocol_secret'] = sanitize_text_field( $_REQUEST['mp'] );
370 370
 		}
371 371
 
372
-		$profile[ $code_key ] = $code_value;
372
+		$profile[$code_key] = $code_value;
373 373
 
374 374
 		// Save Profile
375 375
 		$this->is_network_admin() ? MonsterInsights()->auth->set_network_analytics_profile( $profile ) : MonsterInsights()->auth->set_analytics_profile( $profile );
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		$where = $this->is_network_admin() ? 'network' : 'site';
379 379
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
380 380
 
381
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
381
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
382 382
 		$url = add_query_arg( array(
383 383
 			 'mi_action' => 'reauth',
384 384
 			 'success'   => 'true',
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
 		exit;
390 390
 	}
391 391
 
392
-	public function maybe_verify(){
392
+	public function maybe_verify() {
393 393
 
394 394
 		// Check nonce
395 395
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
396 396
 
397 397
 		// current user can verify
398 398
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
399
-			wp_send_json_error( array(	'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
399
+			wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
400 400
 		}
401 401
 
402 402
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 
406 406
 		// we have an auth to verify
407 407
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
408
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
408
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
409 409
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
410
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
410
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
411 411
 		}
412 412
 
413 413
 		if ( monsterinsights_is_pro_version() ) {
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 		}
419 419
 
420 420
 		$worked = $this->verify_auth();
421
-		if ( $worked && ! is_wp_error(  $worked ) ) {
421
+		if ( $worked && ! is_wp_error( $worked ) ) {
422 422
 			wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) );
423 423
 		} else {
424 424
 			wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) );
425 425
 		}
426 426
 	}
427 427
 
428
-	public function verify_auth( $credentials = array() ){
428
+	public function verify_auth( $credentials = array() ) {
429 429
 		$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) );
430 430
 
431 431
 		if ( empty( $creds['key'] ) ) {
@@ -444,14 +444,14 @@  discard block
 block discarded – undo
444 444
 		}
445 445
 	}
446 446
 
447
-	public function maybe_delete(){
447
+	public function maybe_delete() {
448 448
 
449 449
 		// Check nonce
450 450
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
451 451
 
452 452
 		// current user can delete
453 453
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
454
-			wp_send_json_error( array(	'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
454
+			wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
455 455
 		}
456 456
 
457 457
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 
461 461
 		// we have an auth to delete
462 462
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
463
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
463
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
464 464
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
465
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
465
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
466 466
 		}
467 467
 
468 468
 		if ( monsterinsights_is_pro_version() ) {
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		$force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true';
476 476
 
477 477
 		$worked = $this->delete_auth( $force );
478
-		if ( $worked && ! is_wp_error(  $worked ) ) {
478
+		if ( $worked && ! is_wp_error( $worked ) ) {
479 479
 			wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) );
480 480
 		} else {
481 481
 			if ( $force ) {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		}
487 487
 	}
488 488
 
489
-	public function delete_auth( $force = false ){
489
+	public function delete_auth( $force = false ) {
490 490
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
491 491
 			return false;
492 492
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 		// If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways
503 503
 		if ( is_network_admin() ) {
504 504
 			$siteurl = network_admin_url();
505
-			if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) {
505
+			if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) {
506 506
 				MonsterInsights()->auth->delete_network_analytics_profile( true );
507 507
 				return true;
508 508
 			}
509 509
 		} else {
510 510
 			$siteurl = site_url();
511
-			if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) {
511
+			if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) {
512 512
 				MonsterInsights()->auth->delete_analytics_profile( true );
513 513
 				return true;
514 514
 			}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 		// 	return $sitei;
586 586
 		// }
587 587
 
588
-		$auth_key        = defined( 'AUTH_KEY' )        ? AUTH_KEY 		  : '';
588
+		$auth_key        = defined( 'AUTH_KEY' ) ? AUTH_KEY 		  : '';
589 589
 		$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
590
-		$logged_in_key   = defined( 'LOGGED_IN_KEY' )   ? LOGGED_IN_KEY   : '';
590
+		$logged_in_key   = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY   : '';
591 591
 
592 592
 		$sitei = $auth_key . $secure_auth_key . $logged_in_key;
593
-		$sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei );
593
+		$sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei );
594 594
 		$sitei = sanitize_text_field( $sitei );
595 595
 		$sitei = trim( $sitei );
596
-		$sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei;
596
+		$sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei;
597 597
 		return $sitei;
598 598
 	}
599 599
 
Please login to merge, or discard this patch.