Passed
Push — master ( a9a27c...5b63cb )
by Chris
08:45
created
includes/auth.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
 			$is_dual_tracking_id_ua = monsterinsights_is_valid_ua( $id );
207 207
 
208 208
 			$is_valid_dual_tracking_id = ( $is_dual_tracking_id_ua && ( $is_manual_v4 || $is_authed_v4 ) ) ||
209
-			                             ( $is_dual_tracking_id_v4 && ( $is_manual_ua || $is_authed_ua ) );
209
+						     ( $is_dual_tracking_id_v4 && ( $is_manual_ua || $is_authed_ua ) );
210 210
 
211 211
 			if ( ! $is_valid_dual_tracking_id ) {
212 212
 				return false;
Please login to merge, or discard this 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.
Braces   +18 added lines, -16 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  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 101
 		$this->profile      = $data;
102 102
 
@@ -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 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'] ) ) {
@@ -425,51 +425,53 @@  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() {
453
+// also known as profileID
453 454
 		return ! empty( $this->profile['p'] ) ? $this->profile['p'] : '';
454 455
 	}
455 456
 
456
-	public function get_network_viewid(){ // also known as profileID
457
+	public function get_network_viewid() {
458
+// also known as profileID
457 459
 		return ! empty( $this->network['p'] ) ? $this->network['p'] : '';
458 460
 	}
459 461
 
460
-	public function get_key(){
462
+	public function get_key() {
461 463
 		return ! empty( $this->profile['key'] ) ? $this->profile['key'] : '';
462 464
 	}
463 465
 
464
-	public function get_network_key(){
466
+	public function get_network_key() {
465 467
 		return ! empty( $this->network['key'] ) ? $this->network['key'] : '';
466 468
 	}
467 469
 
468
-	public function get_token(){
470
+	public function get_token() {
469 471
 		return ! empty( $this->profile['token'] ) ? $this->profile['token'] : '';
470 472
 	}
471 473
 
472
-	public function get_network_token(){
474
+	public function get_network_token() {
473 475
 		return ! empty( $this->network['token'] ) ? $this->network['token'] : '';
474 476
 	}
475 477
 
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/api-auth.php 2 patches
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.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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,7 +77,7 @@  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' );
@@ -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;
@@ -254,7 +254,7 @@  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' );
@@ -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;
@@ -389,7 +389,7 @@  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' );
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
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,7 +444,7 @@  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' );
@@ -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() ) {
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
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 
61 61
 		foreach ( $defaults as $key => $default ) {
62 62
 			if ( array_key_exists( $key, $args ) ) {
63
-				$out[ $key ] = $args[ $key ];
63
+				$out[$key] = $args[$key];
64 64
 			} else {
65
-				$out[ $key ] = $default;
65
+				$out[$key] = $default;
66 66
 			}
67 67
 		}
68 68
 
@@ -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/admin/routes.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			return;
68 68
 		}
69 69
 
70
-		$site_license    = array(
70
+		$site_license = array(
71 71
 			'key'         => MonsterInsights()->license->get_site_license_key(),
72 72
 			'type'        => MonsterInsights()->license->get_site_license_type(),
73 73
 			'is_disabled' => MonsterInsights()->license->site_license_disabled(),
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 		// Array fields are needed even if empty.
135 135
 		$array_fields = array( 'view_reports', 'save_settings', 'ignore_users' );
136 136
 		foreach ( $array_fields as $array_field ) {
137
-			if ( ! isset( $options[ $array_field ] ) ) {
138
-				$options[ $array_field ] = array();
137
+			if ( ! isset( $options[$array_field] ) ) {
138
+				$options[$array_field] = array();
139 139
 			}
140 140
 		}
141 141
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 						}
266 266
 					}
267 267
 					if ( $empty ) {
268
-						unset( $value[ $key ] );
268
+						unset( $value[$key] );
269 269
 					}
270 270
 				}
271 271
 			}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 				} else {
316 316
 					$addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug );
317 317
 				}
318
-				$parsed_addons[ $addon->slug ] = $addon;
318
+				$parsed_addons[$addon->slug] = $addon;
319 319
 			}
320 320
 		}
321 321
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			'slug'      => 'wp-mail-smtp',
424 424
 		);
425 425
 		// SeedProd.
426
-		$parsed_addons['coming-soon']    = array(
426
+		$parsed_addons['coming-soon'] = array(
427 427
 			'active'    => defined( 'SEEDPROD_VERSION' ),
428 428
 			'icon'      => plugin_dir_url( MONSTERINSIGHTS_PLUGIN_FILE ) . 'assets/images/plugin-seedprod.png',
429 429
 			'title'     => 'SeedProd',
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			'settings'  => admin_url( 'admin.php?page=seedprod_lite' ),
435 435
 		);
436 436
 		// RafflePress
437
-		$parsed_addons['rafflepress']    = array(
437
+		$parsed_addons['rafflepress'] = array(
438 438
 			'active'    => function_exists( 'rafflepress_lite_activation' ),
439 439
 			'icon'      => plugin_dir_url( MONSTERINSIGHTS_PLUGIN_FILE ) . 'assets/images/pluign-rafflepress.png',
440 440
 			'title'     => 'RafflePress',
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		$installed       = false;
545 545
 		$plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug );
546 546
 
547
-		if ( isset( $installed_plugins[ $plugin_basename ] ) ) {
547
+		if ( isset( $installed_plugins[$plugin_basename] ) ) {
548 548
 			$installed = true;
549 549
 
550 550
 			if ( is_multisite() && is_network_admin() ) {
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 
560 560
 		$active_version = false;
561 561
 		if ( $active ) {
562
-			if ( ! empty( $installed_plugins[ $plugin_basename ]['Version'] ) ) {
563
-				$active_version = $installed_plugins[ $plugin_basename ]['Version'];
562
+			if ( ! empty( $installed_plugins[$plugin_basename]['Version'] ) ) {
563
+				$active_version = $installed_plugins[$plugin_basename]['Version'];
564 564
 			}
565 565
 		}
566 566
 
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
 		);
829 829
 
830 830
 		foreach ( $exclude as $e ) {
831
-			if ( ! empty( $new_settings[ $e ] ) ) {
832
-				unset( $new_settings[ $e ] );
831
+			if ( ! empty( $new_settings[$e] ) ) {
832
+				unset( $new_settings[$e] );
833 833
 			}
834 834
 		}
835 835
 
836 836
 		foreach ( $exclude as $e ) {
837
-			if ( ! empty( $settings[ $e ] ) ) {
838
-				$new_settings = $settings[ $e ];
837
+			if ( ! empty( $settings[$e] ) ) {
838
+				$new_settings = $settings[$e];
839 839
 			}
840 840
 		}
841 841
 
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 			),
996 996
 			admin_url( 'admin.php' )
997 997
 		);
998
-		$url    = esc_url( $url );
998
+		$url = esc_url( $url );
999 999
 
1000 1000
 		ob_start();
1001 1001
 		if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 			$homepage = get_option( 'page_on_front' );
1102 1102
 			if ( ! $homepage ) {
1103 1103
 				$array[] = array(
1104
-					'id'    => - 1,
1104
+					'id'    => -1,
1105 1105
 					'title' => __( 'Homepage', 'google-analytics-for-wordpress' ),
1106 1106
 				);
1107 1107
 			}
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 			if ( ! post_type_supports( $post_type->name, 'editor' ) || 'product' === $post_type->name ) {
1176 1176
 				continue;
1177 1177
 			}
1178
-			$post_types_parsed[ $post_type->name ] = $post_type->labels->singular_name;
1178
+			$post_types_parsed[$post_type->name] = $post_type->labels->singular_name;
1179 1179
 		}
1180 1180
 
1181 1181
 		$post_types_parsed = apply_filters( 'monsterinsights_vue_post_types_editor', $post_types_parsed );
@@ -1297,18 +1297,18 @@  discard block
 block discarded – undo
1297 1297
 			$value        = sanitize_text_field( wp_unslash( $_POST['value'] ) ); // Value of custom style like 12px or #fff.
1298 1298
 			$settings     = get_option( $settings_key, array() );
1299 1299
 
1300
-			if ( ! isset( $settings[ $type ] ) ) {
1301
-				$settings[ $type ] = array();
1300
+			if ( ! isset( $settings[$type] ) ) {
1301
+				$settings[$type] = array();
1302 1302
 			}
1303
-			if ( ! isset( $settings[ $type ][ $theme ] ) ) {
1304
-				$settings[ $type ][ $theme ] = array();
1303
+			if ( ! isset( $settings[$type][$theme] ) ) {
1304
+				$settings[$type][$theme] = array();
1305 1305
 			}
1306 1306
 
1307
-			if ( ! isset( $settings[ $type ][ $theme ][ $object ] ) ) {
1308
-				$settings[ $type ][ $theme ][ $object ] = array();
1307
+			if ( ! isset( $settings[$type][$theme][$object] ) ) {
1308
+				$settings[$type][$theme][$object] = array();
1309 1309
 			}
1310 1310
 
1311
-			$settings[ $type ][ $theme ][ $object ][ $key ] = $value;
1311
+			$settings[$type][$theme][$object][$key] = $value;
1312 1312
 
1313 1313
 			update_option( $settings_key, $settings );
1314 1314
 
Please login to merge, or discard this patch.
includes/frontend/tracking/class-tracking-analytics.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 		if ( $create && ! empty( $create ) && is_array( $create ) ) {
100 100
 			$create = json_encode( $create );
101
-			$create = str_replace( '"', "'",  $create );
102
-			$options['create'] = "'create', '" . esc_js( $ua_code ). "', '" . esc_js( $domain ) . "', " . $create;
101
+			$create = str_replace( '"', "'", $create );
102
+			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "', " . $create;
103 103
 		} else {
104 104
 			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "'";
105 105
 		}
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 <?php if ( ! $track_user ) {
207 207
 	if ( empty( $ua ) ) {
208 208
 		$reason = __( 'Note: MonsterInsights is not currently configured on this site. The site owner needs to authenticate with Google Analytics in the MonsterInsights settings panel.', 'google-analytics-for-wordpress' );
209
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
209
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
210 210
 	} else if ( current_user_can( 'monsterinsights_save_settings' ) ) {
211
-		$reason = __( 'Note: MonsterInsights does not track you as a logged-in site administrator to prevent site owners from accidentally skewing their own Google Analytics data.'. PHP_EOL . 'If you are testing Google Analytics code, please do so either logged out or in the private browsing/incognito mode of your web browser.', 'google-analytics-for-wordpress' );
212
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
211
+		$reason = __( 'Note: MonsterInsights does not track you as a logged-in site administrator to prevent site owners from accidentally skewing their own Google Analytics data.' . PHP_EOL . 'If you are testing Google Analytics code, please do so either logged out or in the private browsing/incognito mode of your web browser.', 'google-analytics-for-wordpress' );
212
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
213 213
 	} else {
214 214
 		$reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' );
215
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
215
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
216 216
 	}
217 217
 	echo $output;
218 218
 } ?>
219 219
 <?php if ( $ua ) { ?>
220
-<script<?php echo $attr_string;?>>
220
+<script<?php echo $attr_string; ?>>
221 221
     (window.gaDevIds=window.gaDevIds||[]).push("dZGIzZG");
222 222
 	var mi_version         = '<?php echo MONSTERINSIGHTS_VERSION; ?>';
223 223
 	var mi_track_user      = <?php echo ( $track_user ? 'true' : 'false' ); ?>;
224
-	var mi_no_track_reason = <?php echo ( $reason ? "'" . esc_js( $reason)  . "'": "''" ); ?>;
224
+	var mi_no_track_reason = <?php echo ( $reason ? "'" . esc_js( $reason ) . "'" : "''" ); ?>;
225 225
 	<?php do_action( 'monsterinsights_tracking_analytics_frontend_output_after_mi_track_user' ); ?>
226 226
 
227 227
 <?php if ( $this->should_do_optout() ) { ?>
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	?>
276 276
 	} else {
277 277
 <?php if ( $this->should_do_optout() ) { ?>
278
-		console.log( "<?php echo esc_js( $reason );?>" );
278
+		console.log( "<?php echo esc_js( $reason ); ?>" );
279 279
 		(function() {
280 280
 			/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
281 281
 			var noopfn = function() {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 				}
299 299
 				var f = arguments[len-1];
300 300
 				if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
301
-					console.log( '<?php echo esc_js( __("Not running function", "google-analytics-for-wordpress" ) );?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( __( "because you are not being tracked.", 'google-analytics-for-wordpress' ) );?> " + mi_no_track_reason );
301
+					console.log( '<?php echo esc_js( __( "Not running function", "google-analytics-for-wordpress" ) ); ?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( __( "because you are not being tracked.", 'google-analytics-for-wordpress' ) ); ?> " + mi_no_track_reason );
302 302
 					return;
303 303
 				}
304 304
 				try {
Please login to merge, or discard this patch.