Passed
Push — master ( 62e7b2...e64af5 )
by Chris
04:08
created
googleanalytics.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				self::$instance->notices          = new MonsterInsights_Notice_Admin();
229 229
 				self::$instance->license_actions  = new MonsterInsights_License_Actions();
230 230
 				self::$instance->reporting 	      = new MonsterInsights_Reporting();
231
-				self::$instance->api_auth    	  = new MonsterInsights_API_Auth();
231
+				self::$instance->api_auth = new MonsterInsights_API_Auth();
232 232
 				if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
233 233
 					self::$instance->require_updater();
234 234
 				} else {
@@ -352,19 +352,19 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 
354 354
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_DIR' ) ) {
355
-			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file )  );
355
+			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) );
356 356
 		}
357 357
 
358 358
 		if ( ! defined( 'GAWP_PATH' ) ) {
359
-			define( 'GAWP_PATH', MONSTERINSIGHTS_PLUGIN_DIR  );
359
+			define( 'GAWP_PATH', MONSTERINSIGHTS_PLUGIN_DIR );
360 360
 		}
361 361
 
362 362
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_URL' ) ) {
363
-			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file )  );
363
+			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) );
364 364
 		}
365 365
 
366 366
 		if ( ! defined( 'GAWP_URL' ) ) {
367
-			define( 'GAWP_URL', MONSTERINSIGHTS_PLUGIN_URL  );
367
+			define( 'GAWP_URL', MONSTERINSIGHTS_PLUGIN_URL );
368 368
 		}
369 369
 	}
370 370
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 
386 386
 		// Traditional WordPress plugin locale filter.
387
-		$mi_locale  = apply_filters( 'plugin_locale',  $mi_locale, 'google-analytics-for-wordpress' );
387
+		$mi_locale  = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' );
388 388
 		$mi_mofile  = sprintf( '%1$s-%2$s.mo', 'google-analytics-for-wordpress', $mi_locale );
389 389
 
390 390
 		// Look for wp-content/languages/google-analytics-for-wordpress/google-analytics-for-wordpress-{lang}_{country}.mo
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	public function monsterinsights_wp_notice() {
442 442
 		$url = admin_url( 'plugins.php' );
443 443
 		// Check for MS dashboard
444
-		if( is_network_admin() ) {
444
+		if ( is_network_admin() ) {
445 445
 			$url = network_admin_url( 'plugins.php' );
446 446
 		}
447 447
 		?>
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	public function monsterinsights_pro_notice() {
463 463
 		$url = admin_url( 'plugins.php' );
464 464
 		// Check for MS dashboard
465
-		if( is_network_admin() ) {
465
+		if ( is_network_admin() ) {
466 466
 			$url = network_admin_url( 'plugins.php' );
467 467
 		}
468 468
 		?>
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/options.php';
489 489
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/helpers.php';
490 490
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/deprecated.php';
491
-		$monsterinsights_settings  = monsterinsights_get_options();
491
+		$monsterinsights_settings = monsterinsights_get_options();
492 492
 	}
493 493
 
494 494
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return void
504 504
 	 */
505
-	public function load_licensing(){
505
+	public function load_licensing() {
506 506
 		if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
507 507
 			require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php';
508 508
 			self::$instance->license = new MonsterInsights_License();
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 			$instance->api_auth->delete_auth();
681 681
 
682 682
 			// Delete data
683
-			$instance->reporting->delete_aggregate_data('site');
683
+			$instance->reporting->delete_aggregate_data( 'site' );
684 684
 
685 685
 			// Delete license
686 686
 			$instance->license->delete_site_license();
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		$instance->api_auth->uninstall_network_auth();
692 692
 
693 693
 		// Delete network data
694
-		$instance->reporting->delete_aggregate_data('network');
694
+		$instance->reporting->delete_aggregate_data( 'network' );
695 695
 
696 696
 		// Delete network license
697 697
 		$instance->license->delete_network_license();
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		$instance->api_auth->delete_auth();
701 701
 
702 702
 		// Delete data
703
-		$instance->reporting->delete_aggregate_data('site');
703
+		$instance->reporting->delete_aggregate_data( 'site' );
704 704
 
705 705
 		// Delete license
706 706
 		$instance->license->delete_site_license();
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
  *
796 796
  * @return void
797 797
  */
798
-function monsterinsights_lite_call_install_and_upgrade(){
798
+function monsterinsights_lite_call_install_and_upgrade() {
799 799
 	add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' );
800 800
 }
801 801
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return void
504 504
 	 */
505
-	public function load_licensing(){
505
+	public function load_licensing() {
506 506
 		if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
507 507
 			require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php';
508 508
 			self::$instance->license = new MonsterInsights_License();
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
  *
796 796
  * @return void
797 797
  */
798
-function monsterinsights_lite_call_install_and_upgrade(){
798
+function monsterinsights_lite_call_install_and_upgrade() {
799 799
 	add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' );
800 800
 }
801 801
 
Please login to merge, or discard this patch.
includes/admin/api-auth.php 2 patches
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  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
 
43
-	public function get_tt(){
43
+	public function get_tt() {
44 44
 		$tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' );
45 45
 		if ( empty( $tt ) ) {
46 46
 			// if TT is empty, generate a new one, save it and then return it
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 		return $tt;
51 51
 	}
52 52
 
53
-	public function rotate_tt(){
53
+	public function rotate_tt() {
54 54
 		$tt = $this->generate_tt();
55 55
 		is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt );
56 56
 	}
57 57
 
58
-	public function generate_tt(){
58
+	public function generate_tt() {
59 59
 		return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) );
60 60
 	}
61 61
 
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		);
74 74
 	}
75 75
 
76
-	public function maybe_authenticate(){
76
+	public function maybe_authenticate() {
77 77
 
78 78
 		// Check nonce
79 79
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
80 80
 
81 81
 		// current user can authenticate
82 82
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
83
-			wp_send_json_error( array(	'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
83
+			wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
84 84
 		}
85 85
 
86 86
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 		// Only for Pro users, require a license key to be entered first so we can link to things.
91 91
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
92 92
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
93
-			wp_send_json_error( array(	'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
93
+			wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
94 94
 		}
95 95
 
96 96
 		// we do not have a current auth
97 97
 		if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) {
98
-			wp_send_json_error( array(	'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
98
+			wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
99 99
 		} else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) {
100
-			wp_send_json_error( array(	'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
100
+			wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
101 101
 		}
102 102
 
103 103
 		$sitei = $this->get_sitei();
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		wp_send_json_success();
154 154
 	}
155 155
 
156
-	public function authenticate_listener(){
156
+	public function authenticate_listener() {
157 157
 		// Make sure it's for us
158 158
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
159 159
 			return;
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 
172 172
 		// Make sure has required params
173
-		if ( empty( $_REQUEST['key'] )      ||
174
-			 empty( $_REQUEST['token'] )    ||
175
-			 empty( $_REQUEST['ua'] )       ||
176
-			 empty( $_REQUEST['miview'] )   ||
177
-			 empty( $_REQUEST['a'] )        ||
178
-			 empty( $_REQUEST['w'] )        ||
173
+		if ( empty( $_REQUEST['key'] ) ||
174
+			 empty( $_REQUEST['token'] ) ||
175
+			 empty( $_REQUEST['ua'] ) ||
176
+			 empty( $_REQUEST['miview'] ) ||
177
+			 empty( $_REQUEST['a'] ) ||
178
+			 empty( $_REQUEST['w'] ) ||
179 179
 			 empty( $_REQUEST['p'] )
180 180
 		) {
181 181
 			return;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		$where = $this->is_network_admin() ? 'network' : 'site';
215 215
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
216 216
 
217
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
217
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
218 218
 		$url = add_query_arg( array(
219 219
 			 'mi_action' => 'auth',
220 220
 			 'success'   => 'true',
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
 		exit;
224 224
 	}
225 225
 
226
-	public function maybe_reauthenticate(){
226
+	public function maybe_reauthenticate() {
227 227
 
228 228
 		// Check nonce
229 229
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
230 230
 
231 231
 		// current user can authenticate
232 232
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
233
-			wp_send_json_error( array(	'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
233
+			wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
234 234
 		}
235 235
 
236 236
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 		// Only for Pro users, require a license key to be entered first so we can link to things.
241 241
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
242 242
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
243
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
243
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
244 244
 		}
245 245
 
246 246
 		// we do have a current auth
247 247
 		if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
248
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
248
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
249 249
 		} else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
250
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
250
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
251 251
 		}
252 252
 
253 253
 		$siteurl = add_query_arg( array(
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		wp_send_json_success( array( 'redirect' => $siteurl ) );
273 273
 	}
274 274
 
275
-	public function reauthenticate_listener(){
275
+	public function reauthenticate_listener() {
276 276
 		// Make sure it's for us
277 277
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
278 278
 			return;
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 
291 291
 		// Make sure has required params
292 292
 		if (
293
-			 empty( $_REQUEST['ua'] )       ||
294
-			 empty( $_REQUEST['miview'] )   ||
295
-			 empty( $_REQUEST['a'] )        ||
296
-			 empty( $_REQUEST['w'] )        ||
293
+			 empty( $_REQUEST['ua'] ) ||
294
+			 empty( $_REQUEST['miview'] ) ||
295
+			 empty( $_REQUEST['a'] ) ||
296
+			 empty( $_REQUEST['w'] ) ||
297 297
 			 empty( $_REQUEST['p'] )
298 298
 		) {
299 299
 			return;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		$where = $this->is_network_admin() ? 'network' : 'site';
334 334
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
335 335
 
336
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
336
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
337 337
 		$url = add_query_arg( array(
338 338
 			 'mi_action' => 'reauth',
339 339
 			 'success'   => 'true',
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 		exit;
343 343
 	}
344 344
 
345
-	public function maybe_verify(){
345
+	public function maybe_verify() {
346 346
 
347 347
 		// Check nonce
348 348
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
349 349
 
350 350
 		// current user can verify
351 351
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
352
-			wp_send_json_error( array(	'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
352
+			wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
353 353
 		}
354 354
 
355 355
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 
359 359
 		// we have an auth to verify
360 360
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
361
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
361
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
362 362
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
363
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
363
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
364 364
 		}
365 365
 
366 366
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
367 367
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
368
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
368
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
369 369
 		}
370 370
 
371 371
 		$worked = $this->verify_auth();
372
-		if ( $worked && ! is_wp_error(  $worked ) ) {
372
+		if ( $worked && ! is_wp_error( $worked ) ) {
373 373
 			wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) );
374 374
 		} else {
375 375
 			wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) );
376 376
 		}
377 377
 	}
378 378
 
379
-	public function verify_auth( $credentials = array() ){
379
+	public function verify_auth( $credentials = array() ) {
380 380
 		$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) );
381 381
 
382 382
 		if ( empty( $creds['key'] ) ) {
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
 		}
395 395
 	}
396 396
 
397
-	public function maybe_delete(){
397
+	public function maybe_delete() {
398 398
 
399 399
 		// Check nonce
400 400
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
401 401
 
402 402
 		// current user can delete
403 403
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
404
-			wp_send_json_error( array(	'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
404
+			wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
405 405
 		}
406 406
 
407 407
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -410,20 +410,20 @@  discard block
 block discarded – undo
410 410
 
411 411
 		// we have an auth to delete
412 412
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
413
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
413
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
414 414
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
415
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
415
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
416 416
 		}
417 417
 
418 418
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
419 419
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
420
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
420
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
421 421
 		}
422 422
 
423 423
 		$force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true';
424 424
 
425 425
 		$worked = $this->delete_auth( $force );
426
-		if ( $worked && ! is_wp_error(  $worked ) ) {
426
+		if ( $worked && ! is_wp_error( $worked ) ) {
427 427
 			wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) );
428 428
 		} else {
429 429
 			if ( $force ) {
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		}
435 435
 	}
436 436
 
437
-	public function delete_auth( $force = false ){
437
+	public function delete_auth( $force = false ) {
438 438
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
439 439
 			return false;
440 440
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
 		// If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways
451 451
 		if ( is_network_admin() ) {
452 452
 			$siteurl = network_admin_url();
453
-			if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) {
453
+			if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) {
454 454
 				MonsterInsights()->auth->delete_network_analytics_profile( true );
455 455
 				return true;
456 456
 			}
457 457
 		} else {
458 458
 			$siteurl = site_url();
459
-			if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) {
459
+			if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) {
460 460
 				MonsterInsights()->auth->delete_analytics_profile( true );
461 461
 				return true;
462 462
 			}
@@ -528,15 +528,15 @@  discard block
 block discarded – undo
528 528
 		// 	return $sitei;
529 529
 		// }
530 530
 
531
-		$auth_key        = defined( 'AUTH_KEY' )        ? AUTH_KEY 		  : '';
531
+		$auth_key        = defined( 'AUTH_KEY' ) ? AUTH_KEY 		  : '';
532 532
 		$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
533
-		$logged_in_key   = defined( 'LOGGED_IN_KEY' )   ? LOGGED_IN_KEY   : '';
533
+		$logged_in_key   = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY   : '';
534 534
 
535 535
 		$sitei = $auth_key . $secure_auth_key . $logged_in_key;
536
-		$sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei );
536
+		$sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei );
537 537
 		$sitei = sanitize_text_field( $sitei );
538 538
 		$sitei = trim( $sitei );
539
-		$sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei;
539
+		$sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei;
540 540
 		return $sitei;
541 541
 	}
542 542
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		add_action( 'wp_ajax_nopriv_monsterinsights_rauthenticate',   array( $this, 'rauthenticate' ) );
41 41
 	}
42 42
 
43
-	public function get_tt(){
43
+	public function get_tt() {
44 44
 		$tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' );
45 45
 		if ( empty( $tt ) ) {
46 46
 			// if TT is empty, generate a new one, save it and then return it
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 		return $tt;
51 51
 	}
52 52
 
53
-	public function rotate_tt(){
53
+	public function rotate_tt() {
54 54
 		$tt = $this->generate_tt();
55 55
 		is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt );
56 56
 	}
57 57
 
58
-	public function generate_tt(){
58
+	public function generate_tt() {
59 59
 		return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) );
60 60
 	}
61 61
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		);
74 74
 	}
75 75
 
76
-	public function maybe_authenticate(){
76
+	public function maybe_authenticate() {
77 77
 
78 78
 		// Check nonce
79 79
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		wp_send_json_success();
154 154
 	}
155 155
 
156
-	public function authenticate_listener(){
156
+	public function authenticate_listener() {
157 157
 		// Make sure it's for us
158 158
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
159 159
 			return;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		exit;
224 224
 	}
225 225
 
226
-	public function maybe_reauthenticate(){
226
+	public function maybe_reauthenticate() {
227 227
 
228 228
 		// Check nonce
229 229
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		wp_send_json_success( array( 'redirect' => $siteurl ) );
273 273
 	}
274 274
 
275
-	public function reauthenticate_listener(){
275
+	public function reauthenticate_listener() {
276 276
 		// Make sure it's for us
277 277
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
278 278
 			return;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		exit;
343 343
 	}
344 344
 
345
-	public function maybe_verify(){
345
+	public function maybe_verify() {
346 346
 
347 347
 		// Check nonce
348 348
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 	}
378 378
 
379
-	public function verify_auth( $credentials = array() ){
379
+	public function verify_auth( $credentials = array() ) {
380 380
 		$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) );
381 381
 
382 382
 		if ( empty( $creds['key'] ) ) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		}
395 395
 	}
396 396
 
397
-	public function maybe_delete(){
397
+	public function maybe_delete() {
398 398
 
399 399
 		// Check nonce
400 400
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		}
435 435
 	}
436 436
 
437
-	public function delete_auth( $force = false ){
437
+	public function delete_auth( $force = false ) {
438 438
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
439 439
 			return false;
440 440
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
Please login to merge, or discard this patch.