Test Failed
Push — master ( f098b0...602e9b )
by Devin
10:54 queued 05:19
created
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +472 added lines, -472 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,70 +25,70 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if ( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 
91
-		case version_compare( $give_version, '2.0.2', '<' ) :
91
+		case version_compare($give_version, '2.0.2', '<') :
92 92
 			// Remove 2.0.1 update to rerun on 2.0.2
93 93
 			$completed_upgrades = give_get_completed_upgrades();
94 94
 			$v201_updates       = array(
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
 				'v201_logs_upgrades',
99 99
 			);
100 100
 
101
-			foreach ( $v201_updates as $v201_update ) {
102
-				if ( in_array( $v201_update, $completed_upgrades ) ) {
103
-					unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] );
101
+			foreach ($v201_updates as $v201_update) {
102
+				if (in_array($v201_update, $completed_upgrades)) {
103
+					unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]);
104 104
 				}
105 105
 			}
106 106
 
107
-			update_option( 'give_completed_upgrades', $completed_upgrades );
107
+			update_option('give_completed_upgrades', $completed_upgrades);
108 108
 
109 109
 			// Do nothing on fresh install.
110
-			if ( ! doing_action( 'give_upgrades' ) ) {
110
+			if ( ! doing_action('give_upgrades')) {
111 111
 				give_v201_create_tables();
112
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
112
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
113 113
 				Give_Updates::$background_updater->dispatch();
114 114
 			}
115 115
 
116 116
 			$did_upgrade = true;
117 117
 
118
-		case version_compare( $give_version, '2.0.3', '<' ) :
118
+		case version_compare($give_version, '2.0.3', '<') :
119 119
 			give_v203_upgrades();
120 120
 			$did_upgrade = true;
121 121
 	}
122 122
 
123
-	if ( $did_upgrade ) {
124
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
123
+	if ($did_upgrade) {
124
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
125 125
 	}
126 126
 }
127 127
 
128
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
129
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
128
+add_action('admin_init', 'give_do_automatic_upgrades');
129
+add_action('give_upgrades', 'give_do_automatic_upgrades');
130 130
 
131 131
 /**
132 132
  * Display Upgrade Notices.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_show_upgrade_notices( $give_updates ) {
143
+function give_show_upgrade_notices($give_updates) {
144 144
 	// v1.3.2 Upgrades
145 145
 	$give_updates->register(
146 146
 		array(
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 	);
207 207
 
208 208
 	// v1.8.17 Upgrades for donations.
209
-	$give_updates->register( array(
209
+	$give_updates->register(array(
210 210
 		'id'       => 'v1817_update_donation_iranian_currency_code',
211 211
 		'version'  => '1.8.17',
212 212
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
213
-	) );
213
+	));
214 214
 
215 215
 	// v1.8.17 Upgrades for cleanup of user roles.
216
-	$give_updates->register( array(
216
+	$give_updates->register(array(
217 217
 		'id'       => 'v1817_cleanup_user_roles',
218 218
 		'version'  => '1.8.17',
219 219
 		'callback' => 'give_v1817_cleanup_user_roles',
220
-	) );
220
+	));
221 221
 
222 222
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
223
-	$give_updates->register( array(
223
+	$give_updates->register(array(
224 224
 		'id'       => 'v1818_assign_custom_amount_set_donation',
225 225
 		'version'  => '1.8.18',
226 226
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
227
-	) );
227
+	));
228 228
 
229 229
 	// v1.8.18 Cleanup the Give Worker Role Caps.
230
-	$give_updates->register( array(
230
+	$give_updates->register(array(
231 231
 		'id'       => 'v1818_give_worker_role_cleanup',
232 232
 		'version'  => '1.8.18',
233 233
 		'callback' => 'give_v1818_give_worker_role_cleanup',
234
-	) );
234
+	));
235 235
 
236 236
 	// v2.0.0 Upgrades
237 237
 	$give_updates->register(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'id'       => 'v20_move_metadata_into_new_table',
286 286
 			'version'  => '2.0.0',
287 287
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
288
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
288
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
289 289
 		)
290 290
 	);
291 291
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			'id'       => 'v201_move_metadata_into_new_table',
332 332
 			'version'  => '2.0.1',
333 333
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
334
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
334
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
335 335
 		)
336 336
 	);
337 337
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	);
347 347
 }
348 348
 
349
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
349
+add_action('give_register_updates', 'give_show_upgrade_notices');
350 350
 
351 351
 /**
352 352
  * Triggers all upgrade functions
@@ -358,29 +358,29 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function give_trigger_upgrades() {
360 360
 
361
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
362
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
361
+	if ( ! current_user_can('manage_give_settings')) {
362
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
363 363
 			'response' => 403,
364
-		) );
364
+		));
365 365
 	}
366 366
 
367
-	$give_version = get_option( 'give_version' );
367
+	$give_version = get_option('give_version');
368 368
 
369
-	if ( ! $give_version ) {
369
+	if ( ! $give_version) {
370 370
 		// 1.0 is the first version to use this option so we must add it.
371 371
 		$give_version = '1.0';
372
-		add_option( 'give_version', $give_version );
372
+		add_option('give_version', $give_version);
373 373
 	}
374 374
 
375
-	update_option( 'give_version', GIVE_VERSION );
376
-	delete_option( 'give_doing_upgrade' );
375
+	update_option('give_version', GIVE_VERSION);
376
+	delete_option('give_doing_upgrade');
377 377
 
378
-	if ( DOING_AJAX ) {
379
-		die( 'complete' );
378
+	if (DOING_AJAX) {
379
+		die('complete');
380 380
 	} // End if().
381 381
 }
382 382
 
383
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
383
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
384 384
 
385 385
 
386 386
 /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 
399 399
 	// UPDATE DB METAKEYS.
400 400
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
401
-	$query = $wpdb->query( $sql );
401
+	$query = $wpdb->query($sql);
402 402
 
403 403
 	$give_updates->percentage = 100;
404
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
404
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
405 405
 }
406 406
 
407 407
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 	$where  .= "AND ( p.post_status = 'abandoned' )";
426 426
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
427 427
 
428
-	$sql            = $select . $join . $where;
429
-	$found_payments = $wpdb->get_col( $sql );
428
+	$sql            = $select.$join.$where;
429
+	$found_payments = $wpdb->get_col($sql);
430 430
 
431
-	foreach ( $found_payments as $payment ) {
431
+	foreach ($found_payments as $payment) {
432 432
 
433 433
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
434
-		$modified_time = get_post_modified_time( 'U', false, $payment );
434
+		$modified_time = get_post_modified_time('U', false, $payment);
435 435
 
436 436
 		// 1450124863 =  12/10/2015 20:42:25.
437
-		if ( $modified_time >= 1450124863 ) {
437
+		if ($modified_time >= 1450124863) {
438 438
 
439
-			give_update_payment_status( $payment, 'pending' );
439
+			give_update_payment_status($payment, 'pending');
440 440
 
441 441
 		}
442 442
 	}
443 443
 
444 444
 	$give_updates->percentage = 100;
445
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
445
+	give_set_upgrade_complete('upgrade_give_offline_status');
446 446
 }
447 447
 
448 448
 
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function give_v152_cleanup_users() {
457 457
 
458
-	$give_version = get_option( 'give_version' );
458
+	$give_version = get_option('give_version');
459 459
 
460
-	if ( ! $give_version ) {
460
+	if ( ! $give_version) {
461 461
 		// 1.0 is the first version to use this option so we must add it.
462 462
 		$give_version = '1.0';
463 463
 	}
464 464
 
465
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
465
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
466 466
 
467 467
 	// v1.5.2 Upgrades
468
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
468
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
469 469
 
470 470
 		// Delete all caps with "ss".
471 471
 		// Also delete all unused "campaign" roles.
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 		);
513 513
 
514 514
 		global $wp_roles;
515
-		foreach ( $delete_caps as $cap ) {
516
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
517
-				$wp_roles->remove_cap( $role, $cap );
515
+		foreach ($delete_caps as $cap) {
516
+			foreach (array_keys($wp_roles->roles) as $role) {
517
+				$wp_roles->remove_cap($role, $cap);
518 518
 			}
519 519
 		}
520 520
 
@@ -524,15 +524,15 @@  discard block
 block discarded – undo
524 524
 		$roles->add_caps();
525 525
 
526 526
 		// The Update Ran.
527
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
528
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
529
-		delete_option( 'give_doing_upgrade' );
527
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
528
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
529
+		delete_option('give_doing_upgrade');
530 530
 
531 531
 	}// End if().
532 532
 
533 533
 }
534 534
 
535
-add_action( 'admin_init', 'give_v152_cleanup_users' );
535
+add_action('admin_init', 'give_v152_cleanup_users');
536 536
 
537 537
 /**
538 538
  * 1.6 Upgrade routine to create the customer meta table.
@@ -575,53 +575,53 @@  discard block
 block discarded – undo
575 575
 
576 576
 	// Get addons license key.
577 577
 	$addons = array();
578
-	foreach ( $give_options as $key => $value ) {
579
-		if ( false !== strpos( $key, '_license_key' ) ) {
580
-			$addons[ $key ] = $value;
578
+	foreach ($give_options as $key => $value) {
579
+		if (false !== strpos($key, '_license_key')) {
580
+			$addons[$key] = $value;
581 581
 		}
582 582
 	}
583 583
 
584 584
 	// Bailout: We do not have any addon license data to upgrade.
585
-	if ( empty( $addons ) ) {
585
+	if (empty($addons)) {
586 586
 		return false;
587 587
 	}
588 588
 
589
-	foreach ( $addons as $key => $addon_license ) {
589
+	foreach ($addons as $key => $addon_license) {
590 590
 
591 591
 		// Get addon shortname.
592
-		$shortname = str_replace( '_license_key', '', $key );
592
+		$shortname = str_replace('_license_key', '', $key);
593 593
 
594 594
 		// Addon license option name.
595
-		$addon_license_option_name = $shortname . '_license_active';
595
+		$addon_license_option_name = $shortname.'_license_active';
596 596
 
597 597
 		// bailout if license is empty.
598
-		if ( empty( $addon_license ) ) {
599
-			delete_option( $addon_license_option_name );
598
+		if (empty($addon_license)) {
599
+			delete_option($addon_license_option_name);
600 600
 			continue;
601 601
 		}
602 602
 
603 603
 		// Get addon name.
604 604
 		$addon_name       = array();
605
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
606
-		foreach ( $addon_name_parts as $name_part ) {
605
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
606
+		foreach ($addon_name_parts as $name_part) {
607 607
 
608 608
 			// Fix addon name
609
-			switch ( $name_part ) {
609
+			switch ($name_part) {
610 610
 				case 'authorizenet' :
611 611
 					$name_part = 'authorize.net';
612 612
 					break;
613 613
 			}
614 614
 
615
-			$addon_name[] = ucfirst( $name_part );
615
+			$addon_name[] = ucfirst($name_part);
616 616
 		}
617 617
 
618
-		$addon_name = implode( ' ', $addon_name );
618
+		$addon_name = implode(' ', $addon_name);
619 619
 
620 620
 		// Data to send to the API.
621 621
 		$api_params = array(
622 622
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
623 623
 			'license'    => $addon_license,
624
-			'item_name'  => urlencode( $addon_name ),
624
+			'item_name'  => urlencode($addon_name),
625 625
 			'url'        => home_url(),
626 626
 		);
627 627
 
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 		);
637 637
 
638 638
 		// Make sure there are no errors.
639
-		if ( is_wp_error( $response ) ) {
640
-			delete_option( $addon_license_option_name );
639
+		if (is_wp_error($response)) {
640
+			delete_option($addon_license_option_name);
641 641
 			continue;
642 642
 		}
643 643
 
644 644
 		// Tell WordPress to look for updates.
645
-		set_site_transient( 'update_plugins', null );
645
+		set_site_transient('update_plugins', null);
646 646
 
647 647
 		// Decode license data.
648
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
649
-		update_option( $addon_license_option_name, $license_data );
648
+		$license_data = json_decode(wp_remote_retrieve_body($response));
649
+		update_option($addon_license_option_name, $license_data);
650 650
 	}// End foreach().
651 651
 }
652 652
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	);
677 677
 
678 678
 	global $wp_roles;
679
-	foreach ( $delete_caps as $cap ) {
680
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
681
-			$wp_roles->remove_cap( $role, $cap );
679
+	foreach ($delete_caps as $cap) {
680
+		foreach (array_keys($wp_roles->roles) as $role) {
681
+			$wp_roles->remove_cap($role, $cap);
682 682
 		}
683 683
 	}
684 684
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 function give_v18_upgrades_core_setting() {
713 713
 	// Core settings which changes from checkbox to radio.
714 714
 	$core_setting_names = array_merge(
715
-		array_keys( give_v18_renamed_core_settings() ),
715
+		array_keys(give_v18_renamed_core_settings()),
716 716
 		array(
717 717
 			'uninstall_on_delete',
718 718
 			'scripts_footer',
@@ -724,48 +724,48 @@  discard block
 block discarded – undo
724 724
 	);
725 725
 
726 726
 	// Bailout: If not any setting define.
727
-	if ( $give_settings = get_option( 'give_settings' ) ) {
727
+	if ($give_settings = get_option('give_settings')) {
728 728
 
729 729
 		$setting_changed = false;
730 730
 
731 731
 		// Loop: check each setting field.
732
-		foreach ( $core_setting_names as $setting_name ) {
732
+		foreach ($core_setting_names as $setting_name) {
733 733
 			// New setting name.
734
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
734
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
735 735
 
736 736
 			// Continue: If setting already set.
737 737
 			if (
738
-				array_key_exists( $new_setting_name, $give_settings )
739
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
738
+				array_key_exists($new_setting_name, $give_settings)
739
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
740 740
 			) {
741 741
 				continue;
742 742
 			}
743 743
 
744 744
 			// Set checkbox value to radio value.
745
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
745
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
746 746
 
747 747
 			// @see https://github.com/WordImpress/Give/issues/1063.
748
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
748
+			if (false !== strpos($setting_name, 'disable_')) {
749 749
 
750
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
751
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
750
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
751
+			} elseif (false !== strpos($setting_name, 'enable_')) {
752 752
 
753
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
753
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
754 754
 			}
755 755
 
756 756
 			// Tell bot to update core setting to db.
757
-			if ( ! $setting_changed ) {
757
+			if ( ! $setting_changed) {
758 758
 				$setting_changed = true;
759 759
 			}
760 760
 		}
761 761
 
762 762
 		// Update setting only if they changed.
763
-		if ( $setting_changed ) {
764
-			update_option( 'give_settings', $give_settings );
763
+		if ($setting_changed) {
764
+			update_option('give_settings', $give_settings);
765 765
 		}
766 766
 	}// End if().
767 767
 
768
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
768
+	give_set_upgrade_complete('v18_upgrades_core_setting');
769 769
 }
770 770
 
771 771
 /**
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	$give_updates = Give_Updates::get_instance();
780 780
 
781 781
 	// form query
782
-	$forms = new WP_Query( array(
782
+	$forms = new WP_Query(array(
783 783
 			'paged'          => $give_updates->step,
784 784
 			'status'         => 'any',
785 785
 			'order'          => 'ASC',
@@ -788,41 +788,41 @@  discard block
 block discarded – undo
788 788
 		)
789 789
 	);
790 790
 
791
-	if ( $forms->have_posts() ) {
792
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
791
+	if ($forms->have_posts()) {
792
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
793 793
 
794
-		while ( $forms->have_posts() ) {
794
+		while ($forms->have_posts()) {
795 795
 			$forms->the_post();
796 796
 
797 797
 			// Form content.
798 798
 			// Note in version 1.8 display content setting split into display content and content placement setting.
799 799
 			// You can delete _give_content_option in future.
800
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
801
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
802
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
803
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
800
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
801
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
802
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
803
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
804 804
 
805
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
806
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
805
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
806
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
807 807
 			}
808 808
 
809 809
 			// "Disable" Guest Donation. Checkbox.
810 810
 			// See: https://github.com/WordImpress/Give/issues/1470.
811
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
812
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
813
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
811
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
812
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
813
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
814 814
 
815 815
 			// Offline Donations.
816 816
 			// See: https://github.com/WordImpress/Give/issues/1579.
817
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
818
-			if ( 'no' === $offline_donation ) {
817
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
818
+			if ('no' === $offline_donation) {
819 819
 				$offline_donation_newval = 'global';
820
-			} elseif ( 'yes' === $offline_donation ) {
820
+			} elseif ('yes' === $offline_donation) {
821 821
 				$offline_donation_newval = 'enabled';
822 822
 			} else {
823 823
 				$offline_donation_newval = 'disabled';
824 824
 			}
825
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
825
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
826 826
 
827 827
 			// Convert yes/no setting field to enabled/disabled.
828 828
 			$form_radio_settings = array(
@@ -842,15 +842,15 @@  discard block
 block discarded – undo
842 842
 				'_give_offline_donation_enable_billing_fields_single',
843 843
 			);
844 844
 
845
-			foreach ( $form_radio_settings as $meta_key ) {
845
+			foreach ($form_radio_settings as $meta_key) {
846 846
 				// Get value.
847
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
847
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
848 848
 
849 849
 				// Convert meta value only if it is in yes/no/none.
850
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
850
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
851 851
 
852
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
853
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
852
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
853
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
854 854
 				}
855 855
 			}
856 856
 		}// End while().
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 	} else {
861 861
 		// No more forms found, finish up.
862
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
862
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
863 863
 	}
864 864
 }
865 865
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				'%_transient_give_stats_%',
927 927
 				'give_cache%',
928 928
 				'%_transient_give_add_ons_feed%',
929
-				'%_transient__give_ajax_works' .
929
+				'%_transient__give_ajax_works'.
930 930
 				'%_transient_give_total_api_keys%',
931 931
 				'%_transient_give_i18n_give_promo_hide%',
932 932
 				'%_transient_give_contributors%',
@@ -953,24 +953,24 @@  discard block
 block discarded – undo
953 953
 		ARRAY_A
954 954
 	);
955 955
 
956
-	if ( ! empty( $user_apikey_options ) ) {
957
-		foreach ( $user_apikey_options as $user ) {
958
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
959
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
960
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
956
+	if ( ! empty($user_apikey_options)) {
957
+		foreach ($user_apikey_options as $user) {
958
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
959
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
960
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
961 961
 		}
962 962
 	}
963 963
 
964
-	if ( ! empty( $cached_options ) ) {
965
-		foreach ( $cached_options as $option ) {
966
-			switch ( true ) {
967
-				case ( false !== strpos( $option, 'transient' ) ):
968
-					$option = str_replace( '_transient_', '', $option );
969
-					delete_transient( $option );
964
+	if ( ! empty($cached_options)) {
965
+		foreach ($cached_options as $option) {
966
+			switch (true) {
967
+				case (false !== strpos($option, 'transient')):
968
+					$option = str_replace('_transient_', '', $option);
969
+					delete_transient($option);
970 970
 					break;
971 971
 
972 972
 				default:
973
-					delete_option( $option );
973
+					delete_option($option);
974 974
 			}
975 975
 		}
976 976
 	}
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 	global $wp_roles;
989 989
 
990 990
 	// Get the role object.
991
-	$give_worker = get_role( 'give_worker' );
991
+	$give_worker = get_role('give_worker');
992 992
 
993 993
 	// A list of capabilities to add for give workers.
994 994
 	$caps_to_add = array(
@@ -996,9 +996,9 @@  discard block
 block discarded – undo
996 996
 		'edit_pages',
997 997
 	);
998 998
 
999
-	foreach ( $caps_to_add as $cap ) {
999
+	foreach ($caps_to_add as $cap) {
1000 1000
 		// Add the capability.
1001
-		$give_worker->add_cap( $cap );
1001
+		$give_worker->add_cap($cap);
1002 1002
 	}
1003 1003
 
1004 1004
 }
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	$give_updates = Give_Updates::get_instance();
1016 1016
 
1017 1017
 	// form query.
1018
-	$donation_forms = new WP_Query( array(
1018
+	$donation_forms = new WP_Query(array(
1019 1019
 			'paged'          => $give_updates->step,
1020 1020
 			'status'         => 'any',
1021 1021
 			'order'          => 'ASC',
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
 		)
1025 1025
 	);
1026 1026
 
1027
-	if ( $donation_forms->have_posts() ) {
1028
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1027
+	if ($donation_forms->have_posts()) {
1028
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1029 1029
 
1030
-		while ( $donation_forms->have_posts() ) {
1030
+		while ($donation_forms->have_posts()) {
1031 1031
 			$donation_forms->the_post();
1032 1032
 			$form_id = get_the_ID();
1033 1033
 
@@ -1035,41 +1035,41 @@  discard block
 block discarded – undo
1035 1035
 			update_post_meta(
1036 1036
 				$form_id,
1037 1037
 				'_give_set_price',
1038
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1038
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1039 1039
 			);
1040 1040
 
1041 1041
 			// Remove formatting from _give_custom_amount_minimum.
1042 1042
 			update_post_meta(
1043 1043
 				$form_id,
1044 1044
 				'_give_custom_amount_minimum',
1045
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1045
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1046 1046
 			);
1047 1047
 
1048 1048
 			// Bailout.
1049
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1049
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1050 1050
 				continue;
1051 1051
 			}
1052 1052
 
1053
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1053
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1054 1054
 
1055
-			if ( ! empty( $donation_levels ) ) {
1055
+			if ( ! empty($donation_levels)) {
1056 1056
 
1057
-				foreach ( $donation_levels as $index => $donation_level ) {
1058
-					if ( isset( $donation_level['_give_amount'] ) ) {
1059
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1057
+				foreach ($donation_levels as $index => $donation_level) {
1058
+					if (isset($donation_level['_give_amount'])) {
1059
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1060 1060
 					}
1061 1061
 				}
1062 1062
 
1063
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1063
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1064 1064
 
1065
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1065
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1066 1066
 
1067
-				$min_amount = min( $donation_levels_amounts );
1068
-				$max_amount = max( $donation_levels_amounts );
1067
+				$min_amount = min($donation_levels_amounts);
1068
+				$max_amount = max($donation_levels_amounts);
1069 1069
 
1070 1070
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1071
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1072
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1071
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1072
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1073 1073
 			}
1074 1074
 
1075 1075
 		}
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		wp_reset_postdata();
1079 1079
 	} else {
1080 1080
 		// The Update Ran.
1081
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1081
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1082 1082
 	}
1083 1083
 
1084 1084
 }
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
  */
1129 1129
 function give_v20_upgrades() {
1130 1130
 	// Update cache setting.
1131
-	give_update_option( 'cache', 'enabled' );
1131
+	give_update_option('cache', 'enabled');
1132 1132
 
1133 1133
 	// Upgrade email settings.
1134 1134
 	give_v20_upgrades_email_setting();
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	$all_setting = give_get_settings();
1148 1148
 
1149 1149
 	// Bailout on fresh install.
1150
-	if ( empty( $all_setting ) ) {
1150
+	if (empty($all_setting)) {
1151 1151
 		return;
1152 1152
 	}
1153 1153
 
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 		'admin_notices'                 => 'new-donation_notification',
1167 1167
 	);
1168 1168
 
1169
-	foreach ( $settings as $old_setting => $new_setting ) {
1169
+	foreach ($settings as $old_setting => $new_setting) {
1170 1170
 		// Do not update already modified
1171
-		if ( ! is_array( $new_setting ) ) {
1172
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1171
+		if ( ! is_array($new_setting)) {
1172
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1173 1173
 				continue;
1174 1174
 			}
1175 1175
 		}
1176 1176
 
1177
-		switch ( $old_setting ) {
1177
+		switch ($old_setting) {
1178 1178
 			case 'admin_notices':
1179
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1179
+				$notification_status = give_get_option($old_setting, 'enabled');
1180 1180
 
1181
-				give_update_option( $new_setting, $notification_status );
1181
+				give_update_option($new_setting, $notification_status);
1182 1182
 
1183 1183
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1184 1184
 				// give_delete_option( $old_setting );
@@ -1189,19 +1189,19 @@  discard block
 block discarded – undo
1189 1189
 			case 'admin_notice_emails':
1190 1190
 				$recipients = give_get_admin_notice_emails();
1191 1191
 
1192
-				foreach ( $new_setting as $setting ) {
1192
+				foreach ($new_setting as $setting) {
1193 1193
 					// bailout if setting already exist.
1194
-					if ( array_key_exists( $setting, $all_setting ) ) {
1194
+					if (array_key_exists($setting, $all_setting)) {
1195 1195
 						continue;
1196 1196
 					}
1197 1197
 
1198
-					give_update_option( $setting, $recipients );
1198
+					give_update_option($setting, $recipients);
1199 1199
 				}
1200 1200
 				break;
1201 1201
 
1202 1202
 			default:
1203
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1204
-				give_delete_option( $old_setting );
1203
+				give_update_option($new_setting, give_get_option($old_setting));
1204
+				give_delete_option($old_setting);
1205 1205
 		}
1206 1206
 	}
1207 1207
 }
@@ -1218,22 +1218,22 @@  discard block
 block discarded – undo
1218 1218
 	$give_settings        = give_get_settings();
1219 1219
 	$give_setting_updated = false;
1220 1220
 
1221
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1221
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1222 1222
 		$give_settings['number_decimals']   = 0;
1223 1223
 		$give_settings['decimal_separator'] = '';
1224 1224
 		$give_setting_updated               = true;
1225 1225
 
1226
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1226
+	} elseif (empty($give_settings['decimal_separator'])) {
1227 1227
 		$give_settings['number_decimals'] = 0;
1228 1228
 		$give_setting_updated             = true;
1229 1229
 
1230
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1230
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1231 1231
 		$give_settings['number_decimals'] = 5;
1232 1232
 		$give_setting_updated             = true;
1233 1233
 	}
1234 1234
 
1235
-	if ( $give_setting_updated ) {
1236
-		update_option( 'give_settings', $give_settings );
1235
+	if ($give_setting_updated) {
1236
+		update_option('give_settings', $give_settings);
1237 1237
 	}
1238 1238
 }
1239 1239
 
@@ -1252,69 +1252,69 @@  discard block
 block discarded – undo
1252 1252
 	$give_updates = Give_Updates::get_instance();
1253 1253
 
1254 1254
 	// form query.
1255
-	$donation_forms = new WP_Query( array(
1255
+	$donation_forms = new WP_Query(array(
1256 1256
 			'paged'          => $give_updates->step,
1257 1257
 			'status'         => 'any',
1258 1258
 			'order'          => 'ASC',
1259
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1259
+			'post_type'      => array('give_forms', 'give_payment'),
1260 1260
 			'posts_per_page' => 20,
1261 1261
 		)
1262 1262
 	);
1263
-	if ( $donation_forms->have_posts() ) {
1264
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1263
+	if ($donation_forms->have_posts()) {
1264
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1265 1265
 
1266
-		while ( $donation_forms->have_posts() ) {
1266
+		while ($donation_forms->have_posts()) {
1267 1267
 			$donation_forms->the_post();
1268 1268
 			global $post;
1269 1269
 
1270
-			$meta = get_post_meta( $post->ID );
1270
+			$meta = get_post_meta($post->ID);
1271 1271
 
1272
-			switch ( $post->post_type ) {
1272
+			switch ($post->post_type) {
1273 1273
 				case 'give_forms':
1274 1274
 					// _give_set_price.
1275
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1276
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1275
+					if ( ! empty($meta['_give_set_price'][0])) {
1276
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1277 1277
 					}
1278 1278
 
1279 1279
 					// _give_custom_amount_minimum.
1280
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1281
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1280
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1281
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1282 1282
 					}
1283 1283
 
1284 1284
 					// _give_levels_minimum_amount.
1285
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1286
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1285
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1286
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1287 1287
 					}
1288 1288
 
1289 1289
 					// _give_levels_maximum_amount.
1290
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1291
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1290
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1291
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1292 1292
 					}
1293 1293
 
1294 1294
 					// _give_set_goal.
1295
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1296
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1295
+					if ( ! empty($meta['_give_set_goal'][0])) {
1296
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1297 1297
 					}
1298 1298
 
1299 1299
 					// _give_form_earnings.
1300
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1301
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1300
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1301
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1302 1302
 					}
1303 1303
 
1304 1304
 					// _give_custom_amount_minimum.
1305
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1306
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1305
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1306
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1307 1307
 
1308
-						foreach ( $donation_levels as $index => $level ) {
1309
-							if ( empty( $level['_give_amount'] ) ) {
1308
+						foreach ($donation_levels as $index => $level) {
1309
+							if (empty($level['_give_amount'])) {
1310 1310
 								continue;
1311 1311
 							}
1312 1312
 
1313
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1313
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1314 1314
 						}
1315 1315
 
1316 1316
 						$meta['_give_donation_levels'] = $donation_levels;
1317
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1317
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1318 1318
 					}
1319 1319
 
1320 1320
 
@@ -1322,8 +1322,8 @@  discard block
 block discarded – undo
1322 1322
 
1323 1323
 				case 'give_payment':
1324 1324
 					// _give_payment_total.
1325
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1326
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1325
+					if ( ! empty($meta['_give_payment_total'][0])) {
1326
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1327 1327
 					}
1328 1328
 
1329 1329
 					break;
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		wp_reset_postdata();
1335 1335
 	} else {
1336 1336
 		// The Update Ran.
1337
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1337
+		give_set_upgrade_complete('v1812_update_amount_values');
1338 1338
 	}
1339 1339
 }
1340 1340
 
@@ -1353,22 +1353,22 @@  discard block
 block discarded – undo
1353 1353
 	$give_updates = Give_Updates::get_instance();
1354 1354
 
1355 1355
 	// form query.
1356
-	$donors = Give()->donors->get_donors( array(
1356
+	$donors = Give()->donors->get_donors(array(
1357 1357
 			'number' => 20,
1358
-			'offset' => $give_updates->get_offset( 20 ),
1358
+			'offset' => $give_updates->get_offset(20),
1359 1359
 		)
1360 1360
 	);
1361 1361
 
1362
-	if ( ! empty( $donors ) ) {
1363
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1362
+	if ( ! empty($donors)) {
1363
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1364 1364
 
1365 1365
 		/* @var Object $donor */
1366
-		foreach ( $donors as $donor ) {
1367
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1366
+		foreach ($donors as $donor) {
1367
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1368 1368
 		}
1369 1369
 	} else {
1370 1370
 		// The Update Ran.
1371
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1371
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1372 1372
 	}
1373 1373
 }
1374 1374
 
@@ -1382,25 +1382,25 @@  discard block
 block discarded – undo
1382 1382
 	$give_updates = Give_Updates::get_instance();
1383 1383
 
1384 1384
 	// Fetch all the existing donors.
1385
-	$donors = Give()->donors->get_donors( array(
1385
+	$donors = Give()->donors->get_donors(array(
1386 1386
 			'number' => 20,
1387
-			'offset' => $give_updates->get_offset( 20 ),
1387
+			'offset' => $give_updates->get_offset(20),
1388 1388
 		)
1389 1389
 	);
1390 1390
 
1391
-	if ( ! empty( $donors ) ) {
1392
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1391
+	if ( ! empty($donors)) {
1392
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1393 1393
 
1394 1394
 		/* @var Object $donor */
1395
-		foreach ( $donors as $donor ) {
1395
+		foreach ($donors as $donor) {
1396 1396
 			$user_id = $donor->user_id;
1397 1397
 
1398 1398
 			// Proceed, if donor is attached with user.
1399
-			if ( $user_id ) {
1400
-				$user = get_userdata( $user_id );
1399
+			if ($user_id) {
1400
+				$user = get_userdata($user_id);
1401 1401
 
1402 1402
 				// Update user role, if user has subscriber role.
1403
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1403
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1404 1404
 					wp_update_user(
1405 1405
 						array(
1406 1406
 							'ID'   => $user_id,
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		}
1413 1413
 	} else {
1414 1414
 		// The Update Ran.
1415
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1415
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1416 1416
 	}
1417 1417
 }
1418 1418
 
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
  */
1425 1425
 function give_v1813_upgrades() {
1426 1426
 	// Update admin setting.
1427
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1427
+	give_update_option('donor_default_user_role', 'give_donor');
1428 1428
 
1429 1429
 	// Update Give roles.
1430 1430
 	$roles = new Give_Roles();
@@ -1442,33 +1442,33 @@  discard block
 block discarded – undo
1442 1442
 	$give_updates = Give_Updates::get_instance();
1443 1443
 
1444 1444
 	// form query.
1445
-	$payments = new WP_Query( array(
1445
+	$payments = new WP_Query(array(
1446 1446
 			'paged'          => $give_updates->step,
1447 1447
 			'status'         => 'any',
1448 1448
 			'order'          => 'ASC',
1449
-			'post_type'      => array( 'give_payment' ),
1449
+			'post_type'      => array('give_payment'),
1450 1450
 			'posts_per_page' => 100,
1451 1451
 		)
1452 1452
 	);
1453 1453
 
1454
-	if ( $payments->have_posts() ) {
1455
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1454
+	if ($payments->have_posts()) {
1455
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1456 1456
 
1457
-		while ( $payments->have_posts() ) {
1457
+		while ($payments->have_posts()) {
1458 1458
 			$payments->the_post();
1459 1459
 
1460
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1460
+			$payment_meta = give_get_payment_meta(get_the_ID());
1461 1461
 
1462
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1462
+			if ('RIAL' === $payment_meta['currency']) {
1463 1463
 				$payment_meta['currency'] = 'IRR';
1464
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1464
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1465 1465
 			}
1466 1466
 
1467 1467
 		}
1468 1468
 
1469 1469
 	} else {
1470 1470
 		// The Update Ran.
1471
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1471
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1472 1472
 	}
1473 1473
 }
1474 1474
 
@@ -1481,9 +1481,9 @@  discard block
 block discarded – undo
1481 1481
 function give_v1817_upgrades() {
1482 1482
 	$give_settings = give_get_settings();
1483 1483
 
1484
-	if ( 'RIAL' === $give_settings['currency'] ) {
1484
+	if ('RIAL' === $give_settings['currency']) {
1485 1485
 		$give_settings['currency'] = 'IRR';
1486
-		update_option( 'give_settings', $give_settings );
1486
+		update_option('give_settings', $give_settings);
1487 1487
 	}
1488 1488
 }
1489 1489
 
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 
1497 1497
 	global $wp_roles;
1498 1498
 
1499
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1499
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1500 1500
 		return;
1501 1501
 	}
1502 1502
 
@@ -1520,15 +1520,15 @@  discard block
 block discarded – undo
1520 1520
 		),
1521 1521
 	);
1522 1522
 
1523
-	foreach ( $add_caps as $role => $caps ) {
1524
-		foreach ( $caps as $cap ) {
1525
-			$wp_roles->add_cap( $role, $cap );
1523
+	foreach ($add_caps as $role => $caps) {
1524
+		foreach ($caps as $cap) {
1525
+			$wp_roles->add_cap($role, $cap);
1526 1526
 		}
1527 1527
 	}
1528 1528
 
1529
-	foreach ( $remove_caps as $role => $caps ) {
1530
-		foreach ( $caps as $cap ) {
1531
-			$wp_roles->remove_cap( $role, $cap );
1529
+	foreach ($remove_caps as $role => $caps) {
1530
+		foreach ($caps as $cap) {
1531
+			$wp_roles->remove_cap($role, $cap);
1532 1532
 		}
1533 1533
 	}
1534 1534
 
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
 	$roles->add_roles();
1553 1553
 	$roles->add_caps();
1554 1554
 
1555
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1555
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1556 1556
 }
1557 1557
 
1558 1558
 /**
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
 function give_v1818_upgrades() {
1564 1564
 
1565 1565
 	// Remove email_access_installed from give_settings.
1566
-	give_delete_option( 'email_access_installed' );
1566
+	give_delete_option('email_access_installed');
1567 1567
 }
1568 1568
 
1569 1569
 /**
@@ -1576,23 +1576,23 @@  discard block
 block discarded – undo
1576 1576
 	/* @var Give_Updates $give_updates */
1577 1577
 	$give_updates = Give_Updates::get_instance();
1578 1578
 
1579
-	$donations = new WP_Query( array(
1579
+	$donations = new WP_Query(array(
1580 1580
 			'paged'          => $give_updates->step,
1581 1581
 			'status'         => 'any',
1582 1582
 			'order'          => 'ASC',
1583
-			'post_type'      => array( 'give_payment' ),
1583
+			'post_type'      => array('give_payment'),
1584 1584
 			'posts_per_page' => 100,
1585 1585
 		)
1586 1586
 	);
1587 1587
 
1588
-	if ( $donations->have_posts() ) {
1589
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1588
+	if ($donations->have_posts()) {
1589
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1590 1590
 
1591
-		while ( $donations->have_posts() ) {
1591
+		while ($donations->have_posts()) {
1592 1592
 			$donations->the_post();
1593 1593
 
1594
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1595
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1594
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1595
+			$donation_meta = give_get_payment_meta(get_the_ID());
1596 1596
 
1597 1597
 			// Update Donation meta with price_id set as custom, only if it is:
1598 1598
 			// 1. Donation Type = Set Donation.
@@ -1601,19 +1601,19 @@  discard block
 block discarded – undo
1601 1601
 			if (
1602 1602
 				$form->ID &&
1603 1603
 				$form->is_set_type_donation_form() &&
1604
-				( 'custom' !== $donation_meta['price_id'] ) &&
1605
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1604
+				('custom' !== $donation_meta['price_id']) &&
1605
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1606 1606
 			) {
1607 1607
 				$donation_meta['price_id'] = 'custom';
1608
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1609
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1608
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1609
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1610 1610
 			}
1611 1611
 		}
1612 1612
 
1613 1613
 		wp_reset_postdata();
1614 1614
 	} else {
1615 1615
 		// Update Ran Successfully.
1616
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1616
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1617 1617
 	}
1618 1618
 }
1619 1619
 
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
 	global $wp_roles;
1633 1633
 
1634
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1634
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1635 1635
 		return;
1636 1636
 	}
1637 1637
 
@@ -1649,9 +1649,9 @@  discard block
 block discarded – undo
1649 1649
 		),
1650 1650
 	);
1651 1651
 
1652
-	foreach ( $remove_caps as $role => $caps ) {
1653
-		foreach ( $caps as $cap ) {
1654
-			$wp_roles->remove_cap( $role, $cap );
1652
+	foreach ($remove_caps as $role => $caps) {
1653
+		foreach ($caps as $cap) {
1654
+			$wp_roles->remove_cap($role, $cap);
1655 1655
 		}
1656 1656
 	}
1657 1657
 
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 	$roles->add_roles();
1663 1663
 	$roles->add_caps();
1664 1664
 
1665
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1665
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1666 1666
 }
1667 1667
 
1668 1668
 /**
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	$give_updates = Give_Updates::get_instance();
1677 1677
 
1678 1678
 	// form query
1679
-	$forms = new WP_Query( array(
1679
+	$forms = new WP_Query(array(
1680 1680
 			'paged'          => $give_updates->step,
1681 1681
 			'status'         => 'any',
1682 1682
 			'order'          => 'ASC',
@@ -1685,22 +1685,22 @@  discard block
 block discarded – undo
1685 1685
 		)
1686 1686
 	);
1687 1687
 
1688
-	if ( $forms->have_posts() ) {
1689
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1688
+	if ($forms->have_posts()) {
1689
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1690 1690
 
1691
-		while ( $forms->have_posts() ) {
1691
+		while ($forms->have_posts()) {
1692 1692
 			$forms->the_post();
1693 1693
 			global $post;
1694 1694
 
1695 1695
 			// Update offline instruction email notification status.
1696
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1697
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1696
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1697
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1698 1698
 				'enabled',
1699 1699
 				'global',
1700
-			) )
1700
+			))
1701 1701
 				? $offline_instruction_notification_status
1702 1702
 				: 'global';
1703
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1703
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1704 1704
 
1705 1705
 			// Update offline instruction email message.
1706 1706
 			update_post_meta(
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
 		wp_reset_postdata();
1733 1733
 	} else {
1734 1734
 		// No more forms found, finish up.
1735
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1735
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1736 1736
 	}
1737 1737
 }
1738 1738
 
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
 	$give_updates = Give_Updates::get_instance();
1750 1750
 
1751 1751
 	// form query
1752
-	$forms = new WP_Query( array(
1752
+	$forms = new WP_Query(array(
1753 1753
 			'paged'          => $give_updates->step,
1754 1754
 			'status'         => 'any',
1755 1755
 			'order'          => 'ASC',
@@ -1758,19 +1758,19 @@  discard block
 block discarded – undo
1758 1758
 		)
1759 1759
 	);
1760 1760
 
1761
-	if ( $forms->have_posts() ) {
1762
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1761
+	if ($forms->have_posts()) {
1762
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1763 1763
 
1764
-		while ( $forms->have_posts() ) {
1764
+		while ($forms->have_posts()) {
1765 1765
 			$forms->the_post();
1766 1766
 			global $post;
1767 1767
 
1768 1768
 			// Split _give_payment_meta meta.
1769 1769
 			// @todo Remove _give_payment_meta after releases 2.0
1770
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1770
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1771 1771
 
1772
-			if ( ! empty( $payment_meta ) ) {
1773
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1772
+			if ( ! empty($payment_meta)) {
1773
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1774 1774
 			}
1775 1775
 
1776 1776
 			$deprecated_meta_keys = array(
@@ -1779,9 +1779,9 @@  discard block
 block discarded – undo
1779 1779
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1780 1780
 			);
1781 1781
 
1782
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1782
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1783 1783
 				// Do not add new meta key if already exist.
1784
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1784
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1785 1785
 					continue;
1786 1786
 				}
1787 1787
 
@@ -1790,25 +1790,25 @@  discard block
 block discarded – undo
1790 1790
 					array(
1791 1791
 						'post_id'    => $post->ID,
1792 1792
 						'meta_key'   => $new_meta_key,
1793
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1793
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1794 1794
 					)
1795 1795
 				);
1796 1796
 			}
1797 1797
 
1798 1798
 			// Bailout
1799
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1799
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1800 1800
 				/* @var Give_Donor $donor */
1801
-				$donor = new Give_Donor( $donor_id );
1801
+				$donor = new Give_Donor($donor_id);
1802 1802
 
1803
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1804
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1805
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1806
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1807
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1808
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1803
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1804
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1805
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1806
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1807
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1808
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1809 1809
 
1810 1810
 				// Save address.
1811
-				$donor->add_address( 'billing[]', $address );
1811
+				$donor->add_address('billing[]', $address);
1812 1812
 			}
1813 1813
 
1814 1814
 		}// End while().
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1820 1820
 
1821 1821
 		// No more forms found, finish up.
1822
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1822
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1823 1823
 	}
1824 1824
 }
1825 1825
 
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
 	$give_updates = Give_Updates::get_instance();
1836 1836
 
1837 1837
 	// form query
1838
-	$forms = new WP_Query( array(
1838
+	$forms = new WP_Query(array(
1839 1839
 			'paged'          => $give_updates->step,
1840 1840
 			'order'          => 'DESC',
1841 1841
 			'post_type'      => 'give_log',
@@ -1844,20 +1844,20 @@  discard block
 block discarded – undo
1844 1844
 		)
1845 1845
 	);
1846 1846
 
1847
-	if ( $forms->have_posts() ) {
1848
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1847
+	if ($forms->have_posts()) {
1848
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1849 1849
 
1850
-		while ( $forms->have_posts() ) {
1850
+		while ($forms->have_posts()) {
1851 1851
 			$forms->the_post();
1852 1852
 			global $post;
1853 1853
 
1854
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1854
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1855 1855
 				continue;
1856 1856
 			}
1857 1857
 
1858
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1859
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1860
-			$term_name = ! empty( $term ) ? $term->slug : '';
1858
+			$term      = get_the_terms($post->ID, 'give_log_type');
1859
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1860
+			$term_name = ! empty($term) ? $term->slug : '';
1861 1861
 
1862 1862
 			$log_data = array(
1863 1863
 				'ID'           => $post->ID,
@@ -1870,29 +1870,29 @@  discard block
 block discarded – undo
1870 1870
 			);
1871 1871
 			$log_meta = array();
1872 1872
 
1873
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1874
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1875
-					switch ( $meta_key ) {
1873
+			if ($old_log_meta = get_post_meta($post->ID)) {
1874
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1875
+					switch ($meta_key) {
1876 1876
 						case '_give_log_payment_id':
1877
-							$log_data['log_parent']        = current( $meta_value );
1877
+							$log_data['log_parent']        = current($meta_value);
1878 1878
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1879 1879
 							break;
1880 1880
 
1881 1881
 						default:
1882
-							$log_meta[ $meta_key ] = current( $meta_value );
1882
+							$log_meta[$meta_key] = current($meta_value);
1883 1883
 					}
1884 1884
 				}
1885 1885
 			}
1886 1886
 
1887
-			if ( 'api_request' === $term_name ) {
1887
+			if ('api_request' === $term_name) {
1888 1888
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1889 1889
 			}
1890 1890
 
1891
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1891
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1892 1892
 
1893
-			if ( ! empty( $log_meta ) ) {
1894
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1895
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1893
+			if ( ! empty($log_meta)) {
1894
+				foreach ($log_meta as $meta_key => $meta_value) {
1895
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1896 1896
 				}
1897 1897
 			}
1898 1898
 
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 		Give()->logs->delete_cache();
1935 1935
 
1936 1936
 		// No more forms found, finish up.
1937
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1937
+		give_set_upgrade_complete('v20_logs_upgrades');
1938 1938
 	}
1939 1939
 }
1940 1940
 
@@ -1950,19 +1950,19 @@  discard block
 block discarded – undo
1950 1950
 	$give_updates = Give_Updates::get_instance();
1951 1951
 
1952 1952
 	// form query
1953
-	$payments = new WP_Query( array(
1953
+	$payments = new WP_Query(array(
1954 1954
 			'paged'          => $give_updates->step,
1955 1955
 			'status'         => 'any',
1956 1956
 			'order'          => 'ASC',
1957
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1957
+			'post_type'      => array('give_forms', 'give_payment'),
1958 1958
 			'posts_per_page' => 100,
1959 1959
 		)
1960 1960
 	);
1961 1961
 
1962
-	if ( $payments->have_posts() ) {
1963
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1962
+	if ($payments->have_posts()) {
1963
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1964 1964
 
1965
-		while ( $payments->have_posts() ) {
1965
+		while ($payments->have_posts()) {
1966 1966
 			$payments->the_post();
1967 1967
 			global $post;
1968 1968
 
@@ -1974,19 +1974,19 @@  discard block
 block discarded – undo
1974 1974
 				ARRAY_A
1975 1975
 			);
1976 1976
 
1977
-			if ( ! empty( $meta_data ) ) {
1978
-				foreach ( $meta_data as $index => $data ) {
1977
+			if ( ! empty($meta_data)) {
1978
+				foreach ($meta_data as $index => $data) {
1979 1979
 					// Check for duplicate meta values.
1980
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1980
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
1981 1981
 						continue;
1982 1982
 					}
1983 1983
 
1984
-					switch ( $post->post_type ) {
1984
+					switch ($post->post_type) {
1985 1985
 						case 'give_forms':
1986 1986
 							$data['form_id'] = $data['post_id'];
1987
-							unset( $data['post_id'] );
1987
+							unset($data['post_id']);
1988 1988
 
1989
-							Give()->form_meta->insert( $data );
1989
+							Give()->form_meta->insert($data);
1990 1990
 							// @todo: delete form meta from post meta table after releases 2.0.
1991 1991
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
1992 1992
 
@@ -1994,9 +1994,9 @@  discard block
 block discarded – undo
1994 1994
 
1995 1995
 						case 'give_payment':
1996 1996
 							$data['payment_id'] = $data['post_id'];
1997
-							unset( $data['post_id'] );
1997
+							unset($data['post_id']);
1998 1998
 
1999
-							Give()->payment_meta->insert( $data );
1999
+							Give()->payment_meta->insert($data);
2000 2000
 
2001 2001
 							// @todo: delete donation meta from post meta table after releases 2.0.
2002 2002
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 		wp_reset_postdata();
2012 2012
 	} else {
2013 2013
 		// No more forms found, finish up.
2014
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2014
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2015 2015
 	}
2016 2016
 
2017 2017
 }
@@ -2027,44 +2027,44 @@  discard block
 block discarded – undo
2027 2027
 	/* @var Give_Updates $give_updates */
2028 2028
 	$give_updates = Give_Updates::get_instance();
2029 2029
 
2030
-	$donors = Give()->donors->get_donors( array(
2030
+	$donors = Give()->donors->get_donors(array(
2031 2031
 		'paged'  => $give_updates->step,
2032 2032
 		'number' => 100,
2033
-	) );
2033
+	));
2034 2034
 
2035
-	if ( $donors ) {
2036
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2035
+	if ($donors) {
2036
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2037 2037
 		// Loop through Donors
2038
-		foreach ( $donors as $donor ) {
2038
+		foreach ($donors as $donor) {
2039 2039
 
2040
-			$donor_name       = explode( ' ', $donor->name, 2 );
2041
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2042
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2040
+			$donor_name       = explode(' ', $donor->name, 2);
2041
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2042
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2043 2043
 
2044 2044
 			// If first name meta of donor is not created, then create it.
2045
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2046
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2045
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2046
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2047 2047
 			}
2048 2048
 
2049 2049
 			// If last name meta of donor is not created, then create it.
2050
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2051
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2050
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2051
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2052 2052
 			}
2053 2053
 
2054 2054
 			// If Donor is connected with WP User then update user meta.
2055
-			if ( $donor->user_id ) {
2056
-				if ( isset( $donor_name[0] ) ) {
2057
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2055
+			if ($donor->user_id) {
2056
+				if (isset($donor_name[0])) {
2057
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2058 2058
 				}
2059
-				if ( isset( $donor_name[1] ) ) {
2060
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2059
+				if (isset($donor_name[1])) {
2060
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2061 2061
 				}
2062 2062
 			}
2063 2063
 		}
2064 2064
 
2065 2065
 	} else {
2066 2066
 		// The Update Ran.
2067
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2067
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2068 2068
 	}
2069 2069
 
2070 2070
 }
@@ -2093,15 +2093,15 @@  discard block
 block discarded – undo
2093 2093
 
2094 2094
 	$users = $user_query->get_results();
2095 2095
 
2096
-	if ( $users ) {
2097
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2096
+	if ($users) {
2097
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2098 2098
 
2099 2099
 		// Loop through Donors
2100
-		foreach ( $users as $user ) {
2100
+		foreach ($users as $user) {
2101 2101
 			/* @var Give_Donor $donor */
2102
-			$donor = new Give_Donor( $user->ID, true );
2102
+			$donor = new Give_Donor($user->ID, true);
2103 2103
 
2104
-			if ( ! $donor->id ) {
2104
+			if ( ! $donor->id) {
2105 2105
 				continue;
2106 2106
 			}
2107 2107
 
@@ -2117,10 +2117,10 @@  discard block
 block discarded – undo
2117 2117
 				)
2118 2118
 			);
2119 2119
 
2120
-			if ( ! empty( $address ) ) {
2121
-				$address = maybe_unserialize( $address );
2122
-				$donor->add_address( 'personal', $address );
2123
-				$donor->add_address( 'billing[]', $address );
2120
+			if ( ! empty($address)) {
2121
+				$address = maybe_unserialize($address);
2122
+				$donor->add_address('personal', $address);
2123
+				$donor->add_address('billing[]', $address);
2124 2124
 
2125 2125
 
2126 2126
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
 	} else {
2132 2132
 		// The Update Ran.
2133
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2133
+		give_set_upgrade_complete('v20_upgrades_user_address');
2134 2134
 	}
2135 2135
 
2136 2136
 }
@@ -2154,15 +2154,15 @@  discard block
 block discarded – undo
2154 2154
 	);
2155 2155
 
2156 2156
 	// Alter customer table
2157
-	foreach ( $tables as $old_table => $new_table ) {
2157
+	foreach ($tables as $old_table => $new_table) {
2158 2158
 		if (
2159
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2160
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2159
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2160
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2161 2161
 		) {
2162
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2162
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2163 2163
 
2164
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2165
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2164
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2165
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2166 2166
 			}
2167 2167
 		}
2168 2168
 	}
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
 	$give_updates->percentage = 100;
2171 2171
 
2172 2172
 	// No more forms found, finish up.
2173
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2173
+	give_set_upgrade_complete('v20_rename_donor_tables');
2174 2174
 
2175 2175
 	// Re initiate donor classes.
2176 2176
 	Give()->donors     = new Give_DB_Donors();
@@ -2188,19 +2188,19 @@  discard block
 block discarded – undo
2188 2188
 function give_v201_create_tables() {
2189 2189
 	global $wpdb;
2190 2190
 
2191
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2191
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2192 2192
 		Give()->payment_meta->create_table();
2193 2193
 	}
2194 2194
 
2195
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2195
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2196 2196
 		Give()->form_meta->create_table();
2197 2197
 	}
2198 2198
 
2199
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2199
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2200 2200
 		Give()->logs->log_db->create_table();
2201 2201
 	}
2202 2202
 
2203
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2203
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2204 2204
 		Give()->logs->logmeta_db->create_table();
2205 2205
 	}
2206 2206
 }
@@ -2225,31 +2225,31 @@  discard block
 block discarded – undo
2225 2225
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2226 2226
 			)
2227 2227
 			AND $wpdb->posts.post_type = 'give_payment'
2228
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2228
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2229 2229
 			ORDER BY $wpdb->posts.post_date ASC 
2230 2230
 			LIMIT 100
2231
-			OFFSET " . $give_updates->get_offset( 100 )
2231
+			OFFSET ".$give_updates->get_offset(100)
2232 2232
 	);
2233 2233
 
2234
-	if ( ! empty( $payments ) ) {
2235
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2234
+	if ( ! empty($payments)) {
2235
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2236 2236
 
2237
-		foreach ( $payments as $payment_id ) {
2238
-			$post = get_post( $payment_id );
2239
-			setup_postdata( $post );
2237
+		foreach ($payments as $payment_id) {
2238
+			$post = get_post($payment_id);
2239
+			setup_postdata($post);
2240 2240
 
2241 2241
 			// Do not add new meta keys if already refactored.
2242
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2242
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2243 2243
 				continue;
2244 2244
 			}
2245 2245
 
2246 2246
 
2247 2247
 			// Split _give_payment_meta meta.
2248 2248
 			// @todo Remove _give_payment_meta after releases 2.0
2249
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2249
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2250 2250
 
2251
-			if ( ! empty( $payment_meta ) ) {
2252
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2251
+			if ( ! empty($payment_meta)) {
2252
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2253 2253
 			}
2254 2254
 
2255 2255
 			$deprecated_meta_keys = array(
@@ -2258,9 +2258,9 @@  discard block
 block discarded – undo
2258 2258
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2259 2259
 			);
2260 2260
 
2261
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2261
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2262 2262
 				// Do not add new meta key if already exist.
2263
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2263
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2264 2264
 					continue;
2265 2265
 				}
2266 2266
 
@@ -2269,25 +2269,25 @@  discard block
 block discarded – undo
2269 2269
 					array(
2270 2270
 						'post_id'    => $post->ID,
2271 2271
 						'meta_key'   => $new_meta_key,
2272
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2272
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2273 2273
 					)
2274 2274
 				);
2275 2275
 			}
2276 2276
 
2277 2277
 			// Bailout
2278
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2278
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2279 2279
 				/* @var Give_Donor $donor */
2280
-				$donor = new Give_Donor( $donor_id );
2280
+				$donor = new Give_Donor($donor_id);
2281 2281
 
2282
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2283
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2284
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2285
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2286
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2287
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2282
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2283
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2284
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2285
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2286
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2287
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2288 2288
 
2289 2289
 				// Save address.
2290
-				$donor->add_address( 'billing[]', $address );
2290
+				$donor->add_address('billing[]', $address);
2291 2291
 			}
2292 2292
 
2293 2293
 		}// End while().
@@ -2298,7 +2298,7 @@  discard block
 block discarded – undo
2298 2298
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2299 2299
 
2300 2300
 		// No more forms found, finish up.
2301
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2301
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2302 2302
 	}
2303 2303
 }
2304 2304
 
@@ -2318,21 +2318,21 @@  discard block
 block discarded – undo
2318 2318
 			SELECT ID FROM $wpdb->posts 
2319 2319
 			WHERE 1=1
2320 2320
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2321
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2321
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2322 2322
 			ORDER BY $wpdb->posts.post_date ASC 
2323 2323
 			LIMIT 100
2324
-			OFFSET " . $give_updates->get_offset( 100 )
2324
+			OFFSET ".$give_updates->get_offset(100)
2325 2325
 	);
2326 2326
 
2327
-	if ( ! empty( $payments ) ) {
2328
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2327
+	if ( ! empty($payments)) {
2328
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2329 2329
 			'give_forms',
2330 2330
 			'give_payment',
2331
-		) ), $give_updates->step * 100 );
2331
+		)), $give_updates->step * 100);
2332 2332
 
2333
-		foreach ( $payments as $payment_id ) {
2334
-			$post = get_post( $payment_id );
2335
-			setup_postdata( $post );
2333
+		foreach ($payments as $payment_id) {
2334
+			$post = get_post($payment_id);
2335
+			setup_postdata($post);
2336 2336
 
2337 2337
 			$meta_data = $wpdb->get_results(
2338 2338
 				$wpdb->prepare(
@@ -2342,19 +2342,19 @@  discard block
 block discarded – undo
2342 2342
 				ARRAY_A
2343 2343
 			);
2344 2344
 
2345
-			if ( ! empty( $meta_data ) ) {
2346
-				foreach ( $meta_data as $index => $data ) {
2345
+			if ( ! empty($meta_data)) {
2346
+				foreach ($meta_data as $index => $data) {
2347 2347
 					// Check for duplicate meta values.
2348
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2348
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2349 2349
 						continue;
2350 2350
 					}
2351 2351
 
2352
-					switch ( $post->post_type ) {
2352
+					switch ($post->post_type) {
2353 2353
 						case 'give_forms':
2354 2354
 							$data['form_id'] = $data['post_id'];
2355
-							unset( $data['post_id'] );
2355
+							unset($data['post_id']);
2356 2356
 
2357
-							Give()->form_meta->insert( $data );
2357
+							Give()->form_meta->insert($data);
2358 2358
 							// @todo: delete form meta from post meta table after releases 2.0.
2359 2359
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2360 2360
 
@@ -2362,9 +2362,9 @@  discard block
 block discarded – undo
2362 2362
 
2363 2363
 						case 'give_payment':
2364 2364
 							$data['payment_id'] = $data['post_id'];
2365
-							unset( $data['post_id'] );
2365
+							unset($data['post_id']);
2366 2366
 
2367
-							Give()->payment_meta->insert( $data );
2367
+							Give()->payment_meta->insert($data);
2368 2368
 
2369 2369
 							// @todo: delete donation meta from post meta table after releases 2.0.
2370 2370
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
 		wp_reset_postdata();
2380 2380
 	} else {
2381 2381
 		// No more forms found, finish up.
2382
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2382
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2383 2383
 	}
2384 2384
 
2385 2385
 }
@@ -2400,26 +2400,26 @@  discard block
 block discarded – undo
2400 2400
 			SELECT ID FROM $wpdb->posts 
2401 2401
 			WHERE 1=1
2402 2402
 			AND $wpdb->posts.post_type = 'give_log'
2403
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2403
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2404 2404
 			ORDER BY $wpdb->posts.post_date ASC 
2405 2405
 			LIMIT 100
2406
-			OFFSET " . $give_updates->get_offset( 100 )
2406
+			OFFSET ".$give_updates->get_offset(100)
2407 2407
 	);
2408 2408
 
2409
-	if ( ! empty( $logs ) ) {
2410
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2409
+	if ( ! empty($logs)) {
2410
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2411 2411
 
2412
-		foreach ( $logs as $log_id ) {
2413
-			$post = get_post( $log_id );
2414
-			setup_postdata( $post );
2412
+		foreach ($logs as $log_id) {
2413
+			$post = get_post($log_id);
2414
+			setup_postdata($post);
2415 2415
 
2416
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2416
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2417 2417
 				continue;
2418 2418
 			}
2419 2419
 
2420
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2421
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2422
-			$term_name = ! empty( $term ) ? $term->slug : '';
2420
+			$term      = get_the_terms($post->ID, 'give_log_type');
2421
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2422
+			$term_name = ! empty($term) ? $term->slug : '';
2423 2423
 
2424 2424
 			$log_data = array(
2425 2425
 				'ID'           => $post->ID,
@@ -2432,29 +2432,29 @@  discard block
 block discarded – undo
2432 2432
 			);
2433 2433
 			$log_meta = array();
2434 2434
 
2435
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2436
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2437
-					switch ( $meta_key ) {
2435
+			if ($old_log_meta = get_post_meta($post->ID)) {
2436
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2437
+					switch ($meta_key) {
2438 2438
 						case '_give_log_payment_id':
2439
-							$log_data['log_parent']        = current( $meta_value );
2439
+							$log_data['log_parent']        = current($meta_value);
2440 2440
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2441 2441
 							break;
2442 2442
 
2443 2443
 						default:
2444
-							$log_meta[ $meta_key ] = current( $meta_value );
2444
+							$log_meta[$meta_key] = current($meta_value);
2445 2445
 					}
2446 2446
 				}
2447 2447
 			}
2448 2448
 
2449
-			if ( 'api_request' === $term_name ) {
2449
+			if ('api_request' === $term_name) {
2450 2450
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2451 2451
 			}
2452 2452
 
2453
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2453
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2454 2454
 
2455
-			if ( ! empty( $log_meta ) ) {
2456
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2457
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2455
+			if ( ! empty($log_meta)) {
2456
+				foreach ($log_meta as $meta_key => $meta_value) {
2457
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2458 2458
 				}
2459 2459
 			}
2460 2460
 
@@ -2467,7 +2467,7 @@  discard block
 block discarded – undo
2467 2467
 		Give()->logs->delete_cache();
2468 2468
 
2469 2469
 		// No more forms found, finish up.
2470
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2470
+		give_set_upgrade_complete('v201_logs_upgrades');
2471 2471
 	}
2472 2472
 }
2473 2473
 
@@ -2482,51 +2482,51 @@  discard block
 block discarded – undo
2482 2482
 	global $wpdb;
2483 2483
 	give_v201_create_tables();
2484 2484
 
2485
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2486
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2487
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2485
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2486
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2487
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2488 2488
 		$donor_data = array();
2489 2489
 
2490
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2491
-			foreach ( $missing_donors as $donor_id ) {
2490
+		if ($missing_donors = array_diff($customers, $donors)) {
2491
+			foreach ($missing_donors as $donor_id) {
2492 2492
 				$donor_data[] = array(
2493
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2494
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2493
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2494
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2495 2495
 
2496 2496
 				);
2497 2497
 			}
2498 2498
 		}
2499 2499
 
2500
-		if ( ! empty( $donor_data ) ) {
2500
+		if ( ! empty($donor_data)) {
2501 2501
 			$donor_table_name      = Give()->donors->table_name;
2502 2502
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2503 2503
 
2504 2504
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2505 2505
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2506 2506
 
2507
-			foreach ( $donor_data as $donor ) {
2507
+			foreach ($donor_data as $donor) {
2508 2508
 				$donor['info'][0] = (array) $donor['info'][0];
2509 2509
 
2510 2510
 				// Prevent duplicate meta id issue.
2511
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2511
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2512 2512
 					continue;
2513 2513
 				}
2514 2514
 
2515
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2515
+				$donor_id = Give()->donors->add($donor['info'][0]);
2516 2516
 
2517
-				if ( ! empty( $donor['meta'] ) ) {
2518
-					foreach ( $donor['meta'] as $donor_meta ) {
2517
+				if ( ! empty($donor['meta'])) {
2518
+					foreach ($donor['meta'] as $donor_meta) {
2519 2519
 						$donor_meta = (array) $donor_meta;
2520 2520
 
2521 2521
 						// Prevent duplicate meta id issue.
2522
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2523
-							unset( $donor_meta['meta_id'] );
2522
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2523
+							unset($donor_meta['meta_id']);
2524 2524
 						}
2525 2525
 
2526 2526
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2527
-						unset( $donor_meta['customer_id'] );
2527
+						unset($donor_meta['customer_id']);
2528 2528
 
2529
-						Give()->donor_meta->insert( $donor_meta );
2529
+						Give()->donor_meta->insert($donor_meta);
2530 2530
 					}
2531 2531
 				}
2532 2532
 
@@ -2545,35 +2545,35 @@  discard block
 block discarded – undo
2545 2545
 					)
2546 2546
 				);
2547 2547
 
2548
-				$donor = new Give_Donor( $donor_id );
2548
+				$donor = new Give_Donor($donor_id);
2549 2549
 
2550
-				if ( ! empty( $address ) ) {
2551
-					$address = maybe_unserialize( $address );
2552
-					$donor->add_address( 'personal', $address );
2553
-					$donor->add_address( 'billing[]', $address );
2550
+				if ( ! empty($address)) {
2551
+					$address = maybe_unserialize($address);
2552
+					$donor->add_address('personal', $address);
2553
+					$donor->add_address('billing[]', $address);
2554 2554
 				}
2555 2555
 
2556
-				$donor_name       = explode( ' ', $donor->name, 2 );
2557
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2558
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2556
+				$donor_name       = explode(' ', $donor->name, 2);
2557
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2558
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2559 2559
 
2560 2560
 				// If first name meta of donor is not created, then create it.
2561
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2562
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2561
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2562
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2563 2563
 				}
2564 2564
 
2565 2565
 				// If last name meta of donor is not created, then create it.
2566
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2567
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2566
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2567
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2568 2568
 				}
2569 2569
 
2570 2570
 				// If Donor is connected with WP User then update user meta.
2571
-				if ( $donor->user_id ) {
2572
-					if ( isset( $donor_name[0] ) ) {
2573
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2571
+				if ($donor->user_id) {
2572
+					if (isset($donor_name[0])) {
2573
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2574 2574
 					}
2575
-					if ( isset( $donor_name[1] ) ) {
2576
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2575
+					if (isset($donor_name[1])) {
2576
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2577 2577
 					}
2578 2578
 				}
2579 2579
 			}
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 	}
2585 2585
 
2586 2586
 	Give_Updates::get_instance()->percentage = 100;
2587
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2587
+	give_set_upgrade_complete('v201_add_missing_donors');
2588 2588
 }
2589 2589
 
2590 2590
 
@@ -2597,14 +2597,14 @@  discard block
 block discarded – undo
2597 2597
 	global $wpdb;
2598 2598
 
2599 2599
 	// Do not auto load option.
2600
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2600
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2601 2601
 
2602 2602
 	// Remove from cache.
2603 2603
 	$all_options = wp_load_alloptions();
2604 2604
 
2605
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2606
-		unset( $all_options['give_completed_upgrades'] );
2607
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2605
+	if (isset($all_options['give_completed_upgrades'])) {
2606
+		unset($all_options['give_completed_upgrades']);
2607
+		wp_cache_set('alloptions', $all_options, 'options');
2608 2608
 	}
2609 2609
 
2610 2610
 }
2611 2611
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats(); ?>
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date_i18n( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date_i18n(_x('F j, Y', 'dashboard widget', 'give')); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					__( 'Happy %s!', 'give' ),
55
-					date_i18n( 'l', current_time( 'timestamp' ) )
54
+					__('Happy %s!', 'give'),
55
+					date_i18n('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59 59
 			<p class="give-dashboard-today-earnings"><?php
60
-				$earnings_today = $stats->get_earnings( 0, 'today', false );
61
-				echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) );
60
+				$earnings_today = $stats->get_earnings(0, 'today', false);
61
+				echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false)));
62 62
 			?></p>
63 63
 
64 64
 			<p class="give-donations-today"><?php
65
-				$donations_today = $stats->get_sales( 0, 'today', false );
65
+				$donations_today = $stats->get_sales(0, 'today', false);
66 66
 				printf(
67 67
 					/* translators: %s: daily donation count */
68
-					__( '%s donations today', 'give' ),
69
-					give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) )
68
+					__('%s donations today', 'give'),
69
+					give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false))
70 70
 				);
71 71
 			?></p>
72 72
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 		<table class="give-table-stats">
77 77
 			<thead style="display: none;">
78 78
 			<tr>
79
-				<th><?php _e( 'This Week', 'give' ); ?></th>
80
-				<th><?php _e( 'This Month', 'give' ); ?></th>
81
-				<th><?php _e( 'Past 30 Days', 'give' ); ?></th>
79
+				<th><?php _e('This Week', 'give'); ?></th>
80
+				<th><?php _e('This Month', 'give'); ?></th>
81
+				<th><?php _e('Past 30 Days', 'give'); ?></th>
82 82
 			</tr>
83 83
 			</thead>
84 84
 			<tbody>
85 85
 			<tr id="give-table-stats-tr-1">
86 86
 				<td>
87
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p>
87
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p>
88 88
 
89
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p>
89
+					<p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p>
90 90
 				</td>
91 91
 				<td>
92
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p>
92
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p>
93 93
 
94
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p>
94
+					<p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p>
95 95
 				</td>
96 96
 			</tr>
97 97
 			<tr id="give-table-stats-tr-2">
98 98
 				<td>
99
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p>
99
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p>
100 100
 
101
-					<p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p>
101
+					<p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p>
102 102
 				</td>
103 103
 				<td>
104
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year' ), array( 'sanitize' => false ) ) ) ?></p>
104
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year'), array('sanitize' => false))) ?></p>
105 105
 
106
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Year', 'give' ); ?></p>
106
+					<p class="give-dashboard-stat-total-label"><?php _e('This Year', 'give'); ?></p>
107 107
 				</td>
108 108
 			</tr>
109 109
 			</tbody>
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return array
125 125
  */
126
-function give_dashboard_at_a_glance_widget( $items ) {
126
+function give_dashboard_at_a_glance_widget($items) {
127 127
 
128
-	$num_posts = wp_count_posts( 'give_forms' );
128
+	$num_posts = wp_count_posts('give_forms');
129 129
 
130
-	if ( $num_posts && $num_posts->publish ) {
130
+	if ($num_posts && $num_posts->publish) {
131 131
 
132 132
 		$text = sprintf(
133 133
 			/* translators: %s: number of posts published */
134
-			_n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ),
134
+			_n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'),
135 135
 			$num_posts->publish
136 136
 		);
137 137
 
138
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
138
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
139 139
 
140
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
140
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
141 141
 			$text = sprintf(
142 142
 				'<a class="give-forms-count" href="%1$s">%2$s</a>',
143
-				admin_url( 'edit.php?post_type=give_forms' ),
143
+				admin_url('edit.php?post_type=give_forms'),
144 144
 				$text
145 145
 			);
146 146
 		} else {
@@ -156,4 +156,4 @@  discard block
 block discarded – undo
156 156
 	return $items;
157 157
 }
158 158
 
159
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
159
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		give_ignore_user_abort();
43 43
 
44 44
 		nocache_headers();
45
-		header( 'Content-Type: application/json; charset=utf-8' );
46
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
47
-		header( 'Expires: 0' );
45
+		header('Content-Type: application/json; charset=utf-8');
46
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
47
+		header('Expires: 0');
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 	 * @since 1.8.17
55 55
 	 */
56 56
 	public function json_core_settings_export() {
57
-		$settings_excludes = isset( $_POST['settings_export_excludes'] ) ? give_clean( $_POST['settings_export_excludes'] ) : array();
58
-		$give_settings     = get_option( 'give_settings' );
57
+		$settings_excludes = isset($_POST['settings_export_excludes']) ? give_clean($_POST['settings_export_excludes']) : array();
58
+		$give_settings     = get_option('give_settings');
59 59
 
60
-		if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) {
61
-			foreach ( $settings_excludes as $key => $value ) {
62
-				if ( give_is_setting_enabled( $value ) ) {
63
-					unset( $give_settings[ $key ] );
60
+		if (is_array($settings_excludes) && ! empty($settings_excludes)) {
61
+			foreach ($settings_excludes as $key => $value) {
62
+				if (give_is_setting_enabled($value)) {
63
+					unset($give_settings[$key]);
64 64
 				}
65 65
 			}
66 66
 		}
67 67
 
68
-		echo wp_json_encode( $give_settings );
68
+		echo wp_json_encode($give_settings);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @since  1.8.17
76 76
 	 */
77 77
 	public function export() {
78
-		if ( ! $this->can_export() ) {
79
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
78
+		if ( ! $this->can_export()) {
79
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
80 80
 		}
81 81
 
82 82
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-exports.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.0
20 20
 				 */
21
-				do_action( 'give_tools_tab_export_content_top' );
21
+				do_action('give_tools_tab_export_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat export-options-table give-table striped">
25 25
 					<thead>
26 26
 						<tr>
27
-							<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
28
-							<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
27
+							<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
28
+							<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
29 29
 						</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,42 +38,42 @@  discard block
 block discarded – undo
38 38
 						 *
39 39
 						 * @since 1.0
40 40
 						 */
41
-						do_action( 'give_tools_tab_export_table_top' );
41
+						do_action('give_tools_tab_export_table_top');
42 42
 						?>
43 43
 						<tr class="give-export-pdf-sales-earnings">
44 44
 							<td scope="row" class="row-title">
45 45
 								<h3>
46
-									<span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span>
46
+									<span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span>
47 47
 								</h3>
48
-								<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
48
+								<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
49 49
 							</td>
50 50
 							<td>
51
-								<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>">
52
-									<?php esc_html_e( 'Generate PDF', 'give' ); ?>
51
+								<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>">
52
+									<?php esc_html_e('Generate PDF', 'give'); ?>
53 53
 								</a>
54 54
 							</td>
55 55
 						</tr>
56 56
 						<tr class="give-export-sales-earnings">
57 57
 							<td scope="row" class="row-title">
58 58
 								<h3>
59
-									<span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span>
59
+									<span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span>
60 60
 								</h3>
61
-								<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
61
+								<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
62 62
 							</td>
63 63
 							<td>
64 64
 								<form method="post">
65 65
 									<?php
66 66
 									printf(
67 67
 									/* translators: 1: start date dropdown 2: end date dropdown */
68
-										esc_html__( '%1$s to %2$s', 'give' ),
69
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
70
-										Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' )
68
+										esc_html__('%1$s to %2$s', 'give'),
69
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
70
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
71 71
 									);
72 72
 									?>
73 73
 									<input type="hidden" name="give-action"
74 74
 										   value="earnings_export"/>
75 75
 									<input type="submit"
76
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
76
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
77 77
 										   class="button-secondary"/>
78 78
 								</form>
79 79
 							</td>
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 						<tr class="give-export-payment-history">
82 82
 							<td scope="row" class="row-title">
83 83
 								<h3>
84
-									<span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span>
84
+									<span><?php esc_html_e('Export Donation History', 'give'); ?></span>
85 85
 								</h3>
86
-								<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
86
+								<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
87 87
 							</td>
88 88
 							<td>
89 89
 								<form id="give-export-payments"
90 90
 									  class="give-export-form" method="post">
91 91
 									<?php
92
-									echo Give()->html->date_field( array(
92
+									echo Give()->html->date_field(array(
93 93
 										'id'          => 'give-payment-export-start',
94 94
 										'name'        => 'start',
95
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
96
-									) );
95
+										'placeholder' => esc_attr__('Start date', 'give'),
96
+									));
97 97
 
98
-									echo Give()->html->date_field( array(
98
+									echo Give()->html->date_field(array(
99 99
 										'id'          => 'give-payment-export-end',
100 100
 										'name'        => 'end',
101
-										'placeholder' => esc_attr__( 'End date', 'give' ),
102
-									) );
101
+										'placeholder' => esc_attr__('End date', 'give'),
102
+									));
103 103
 									?>
104 104
 									<select name="status">
105
-										<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
105
+										<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
106 106
 										<?php
107 107
 										$statuses = give_get_payment_statuses();
108
-										foreach ( $statuses as $status => $label ) {
109
-											echo '<option value="' . $status . '">' . $label . '</option>';
108
+										foreach ($statuses as $status => $label) {
109
+											echo '<option value="'.$status.'">'.$label.'</option>';
110 110
 										}
111 111
 										?>
112 112
 									</select>
113 113
 									<?php
114
-									if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
114
+									if (give_is_setting_enabled(give_get_option('categories'))) {
115 115
 										echo Give()->html->category_dropdown(
116 116
 											'give_forms_categories[]',
117 117
 											0,
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 												'multiple'        => true,
122 122
 												'selected'        => array(),
123 123
 												'show_option_all' => false,
124
-												'placeholder'     => __( 'Choose one or more from categories', 'give' ),
124
+												'placeholder'     => __('Choose one or more from categories', 'give'),
125 125
 											)
126 126
 										);
127 127
 									}
128 128
 
129
-									if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
129
+									if (give_is_setting_enabled(give_get_option('tags'))) {
130 130
 										echo Give()->html->tags_dropdown(
131 131
 											'give_forms_tags[]',
132 132
 											0,
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 												'multiple'        => true,
137 137
 												'selected'        => array(),
138 138
 												'show_option_all' => false,
139
-												'placeholder'     => __( 'Choose one or more from tags', 'give' ),
139
+												'placeholder'     => __('Choose one or more from tags', 'give'),
140 140
 											)
141 141
 										);
142 142
 									}
143 143
 
144
-									wp_nonce_field( 'give_ajax_export', 'give_ajax_export' );
144
+									wp_nonce_field('give_ajax_export', 'give_ajax_export');
145 145
 									?>
146 146
 									<input type="hidden" name="give-export-class"
147 147
 										   value="Give_Batch_Payments_Export"/>
148 148
 									<span>
149 149
 									<input type="submit"
150
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
150
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
151 151
 										   class="button-secondary"/>
152 152
 									<span class="spinner"></span>
153 153
 								</span>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 						<tr class="give-export-donors">
158 158
 							<td scope="row" class="row-title">
159 159
 								<h3>
160
-									<span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span>
160
+									<span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span>
161 161
 								</h3>
162
-								<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
162
+								<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
163 163
 							</td>
164 164
 							<td>
165 165
 								<form method="post" id="give_donor_export"
@@ -167,93 +167,93 @@  discard block
 block discarded – undo
167 167
 
168 168
 									<?php
169 169
 									// Start Date form field for donors
170
-									echo Give()->html->date_field( array(
170
+									echo Give()->html->date_field(array(
171 171
 										'id'          => 'give_donor_export_start_date',
172 172
 										'name'        => 'donor_export_start_date',
173
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
174
-									) );
173
+										'placeholder' => esc_attr__('Start date', 'give'),
174
+									));
175 175
 
176 176
 									// End Date form field for donors
177
-									echo Give()->html->date_field( array(
177
+									echo Give()->html->date_field(array(
178 178
 										'id'          => 'give_donor_export_end_date',
179 179
 										'name'        => 'donor_export_end_date',
180
-										'placeholder' => esc_attr__( 'End date', 'give' ),
181
-									) );
180
+										'placeholder' => esc_attr__('End date', 'give'),
181
+									));
182 182
 
183 183
 									// Donation forms dropdown for donors export
184
-									echo Give()->html->forms_dropdown( array(
184
+									echo Give()->html->forms_dropdown(array(
185 185
 										'name'   => 'forms',
186 186
 										'id'     => 'give_donor_export_form',
187 187
 										'chosen' => true,
188
-									) );
188
+									));
189 189
 									?>
190
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
190
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
191 191
 
192 192
 								<div id="export-donor-options-wrap"
193 193
 								     class="give-clearfix">
194
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
194
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
195 195
 									<ul id="give-export-option-ul">
196 196
 										<li>
197 197
 											<label for="give-export-fullname">
198 198
 												<input type="checkbox" checked
199 199
 												       name="give_export_option[full_name]"
200
-												       id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
200
+												       id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
201 201
 											</label>
202 202
 										</li>
203 203
 										<li>
204 204
 											<label for="give-export-email">
205 205
 												<input type="checkbox" checked
206 206
 												       name="give_export_option[email]"
207
-												       id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
207
+												       id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
208 208
 											</label>
209 209
 										</li>
210 210
 										<li>
211 211
 											<label for="give-export-address">
212 212
 												<input type="checkbox" checked
213 213
 												       name="give_export_option[address]"
214
-												       id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
214
+												       id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
215 215
 											</label>
216 216
 										</li>
217 217
 										<li>
218 218
 											<label for="give-export-userid">
219 219
 												<input type="checkbox" checked
220 220
 												       name="give_export_option[userid]"
221
-												       id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
221
+												       id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
222 222
 											</label>
223 223
 										</li>
224 224
 										<li>
225 225
 											<label for="give-export-donation-form">
226 226
 												<input type="checkbox" checked
227 227
 												       name="give_export_option[donation_form]"
228
-												       id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?>
228
+												       id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?>
229 229
 											</label>
230 230
 										</li>
231 231
 										<li>
232 232
 											<label for="give-export-first-donation-date">
233 233
 												<input type="checkbox" checked
234 234
 												       name="give_export_option[date_first_donated]"
235
-												       id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
235
+												       id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
236 236
 											</label>
237 237
 										</li>
238 238
 										<li>
239 239
 											<label for="give-export-donation-number">
240 240
 												<input type="checkbox" checked
241 241
 												       name="give_export_option[donations]"
242
-												       id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
242
+												       id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
243 243
 											</label>
244 244
 										</li>
245 245
 										<li>
246 246
 											<label for="give-export-donation-sum">
247 247
 												<input type="checkbox" checked
248 248
 												       name="give_export_option[donation_sum]"
249
-												       id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
249
+												       id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
250 250
 											</label>
251 251
 										</li>
252 252
 									</ul>
253 253
 								</div>
254
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
254
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
255 255
 								<input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/>
256
-								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/>
256
+								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/>
257 257
 							</form>
258 258
 						</td>
259 259
 					</tr>
@@ -261,32 +261,32 @@  discard block
 block discarded – undo
261 261
 					<tr class="give-export-core-settings">
262 262
 						<td scope="row" class="row-title">
263 263
 							<h3>
264
-								<span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span>
264
+								<span><?php esc_html_e('Export Give Settings', 'give'); ?></span>
265 265
 							</h3>
266
-							<p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p>
266
+							<p><?php esc_html_e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p>
267 267
 						</td>
268 268
 						<td>
269 269
 							<form method="post">
270 270
 								<?php
271
-								$export_excludes = apply_filters( 'settings_export_excludes', array() );
272
-								if ( ! empty( $export_excludes ) ) {
271
+								$export_excludes = apply_filters('settings_export_excludes', array());
272
+								if ( ! empty($export_excludes)) {
273 273
 								?>
274
-									<i class="settings-excludes-title"><?php echo __( 'Checked options from the list will not be exported.', 'give' ); ?></i>
274
+									<i class="settings-excludes-title"><?php echo __('Checked options from the list will not be exported.', 'give'); ?></i>
275 275
 									<ul class="settings-excludes-list">
276
-									<?php foreach ( $export_excludes as $option_key => $option_label ) { ?>
276
+									<?php foreach ($export_excludes as $option_key => $option_label) { ?>
277 277
 										<li>
278 278
 											<label for="settings_export_excludes[<?php echo $option_key?>]">
279 279
 												<input
280 280
 													type="checkbox" checked
281 281
 													name="settings_export_excludes[<?php echo $option_key?>]"
282
-													id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html( $option_label ); ?>
282
+													id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html($option_label); ?>
283 283
 											</label>
284 284
 										</li>
285 285
 									<?php } ?>
286 286
 									</ul>
287 287
 								<?php } ?>
288 288
 								<input type="hidden" name="give-action" value="core_settings_export"/>
289
-								<input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/>
289
+								<input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" class="button-secondary"/>
290 290
 							</form>
291 291
 						</td>
292 292
 					</tr>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 					 *
300 300
 					 * @since 1.0
301 301
 					 */
302
-					do_action( 'give_tools_tab_export_table_bottom' );
302
+					do_action('give_tools_tab_export_table_bottom');
303 303
 					?>
304 304
 					</tbody>
305 305
 				</table>
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 				 *
311 311
 				 * @since 1.0
312 312
 				 */
313
-				do_action( 'give_tools_tab_export_content_bottom' );
313
+				do_action('give_tools_tab_export_content_bottom');
314 314
 				?>
315 315
 
316 316
 			</div>
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  int|bool $_id   Post id. Default is false.
338 338
 	 * @param  array    $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => __( 'New Donation Form', 'give' ),
431
+			'post_title'  => __('New Donation Form', 'give'),
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495 495
 			$this->price = give_maybe_sanitize_amount(
496 496
 				give_get_meta(
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 				)
501 501
 			);
502 502
 
503
-			if ( ! $this->price ) {
503
+			if ( ! $this->price) {
504 504
 				$this->price = 0;
505 505
 			}
506 506
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,17 +527,17 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true);
533 533
 
534
-			if ( ! $this->is_custom_price_mode() ) {
534
+			if ( ! $this->is_custom_price_mode()) {
535 535
 				$this->minimum_price = 0;
536 536
 			}
537 537
 
538 538
 		}
539 539
 
540
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
540
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
541 541
 	}
542 542
 
543 543
 	/**
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public function get_prices() {
552 552
 
553
-		if ( ! isset( $this->prices ) ) {
553
+		if ( ! isset($this->prices)) {
554 554
 
555
-			$this->prices = give_get_meta( $this->ID, '_give_donation_levels', true );
555
+			$this->prices = give_get_meta($this->ID, '_give_donation_levels', true);
556 556
 
557 557
 		}
558 558
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		 * @param array      $prices The array of mulit-level prices.
565 565
 		 * @param int|string $ID     The ID of the form.
566 566
 		 */
567
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
567
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
568 568
 
569 569
 	}
570 570
 
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	 *
579 579
 	 * @return array|null
580 580
 	 */
581
-	public function get_level_info( $price_id ) {
581
+	public function get_level_info($price_id) {
582 582
 		$level_info = array();
583 583
 
584 584
 		// Bailout.
585
-		if ( 'multi' !== $this->get_type() ) {
585
+		if ('multi' !== $this->get_type()) {
586 586
 			return null;
587
-		} elseif ( ! ( $levels = $this->get_prices() ) ) {
587
+		} elseif ( ! ($levels = $this->get_prices())) {
588 588
 			return $level_info;
589 589
 		}
590 590
 
591
-		foreach ( $levels as $level ) {
592
-			if( $price_id === $level['_give_id']['level_id'] ) {
591
+		foreach ($levels as $level) {
592
+			if ($price_id === $level['_give_id']['level_id']) {
593 593
 				$level_info = $level;
594 594
 				break;
595 595
 			}
@@ -609,21 +609,21 @@  discard block
 block discarded – undo
609 609
 	 */
610 610
 	public function get_goal() {
611 611
 
612
-		if ( ! isset( $this->goal ) ) {
612
+		if ( ! isset($this->goal)) {
613 613
 
614
-			if ( 'donation' === give_get_form_goal_format( $this->ID ) ) {
615
-				$this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true );
614
+			if ('donation' === give_get_form_goal_format($this->ID)) {
615
+				$this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true);
616 616
 			} else {
617
-				$this->goal = give_get_meta( $this->ID, '_give_set_goal', true );
617
+				$this->goal = give_get_meta($this->ID, '_give_set_goal', true);
618 618
 			}
619 619
 
620
-			if ( ! $this->goal ) {
620
+			if ( ! $this->goal) {
621 621
 				$this->goal = 0;
622 622
 			}
623 623
 
624 624
 		}
625 625
 
626
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
626
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
627 627
 
628 628
 	}
629 629
 
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
 	 */
638 638
 	public function is_single_price_mode() {
639 639
 
640
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
640
+		$option = give_get_meta($this->ID, '_give_price_option', true);
641 641
 		$ret    = 0;
642 642
 
643
-		if ( empty( $option ) || $option === 'set' ) {
643
+		if (empty($option) || $option === 'set') {
644 644
 			$ret = 1;
645 645
 		}
646 646
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 		 * @param bool       $ret Is donation form in single price mode?
653 653
 		 * @param int|string $ID The ID of the donation form.
654 654
 		 */
655
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
655
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
656 656
 
657 657
 	}
658 658
 
@@ -666,10 +666,10 @@  discard block
 block discarded – undo
666 666
 	 */
667 667
 	public function is_custom_price_mode() {
668 668
 
669
-		$option = give_get_meta( $this->ID, '_give_custom_amount', true );
669
+		$option = give_get_meta($this->ID, '_give_custom_amount', true);
670 670
 		$ret    = 0;
671 671
 
672
-		if ( give_is_setting_enabled( $option ) ) {
672
+		if (give_is_setting_enabled($option)) {
673 673
 			$ret = 1;
674 674
 		}
675 675
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		 * @param bool       $ret Is donation form in custom price mode?
682 682
 		 * @param int|string $ID  The ID of the donation form.
683 683
 		 */
684
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
684
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
685 685
 
686 686
 	}
687 687
 
@@ -695,20 +695,20 @@  discard block
 block discarded – undo
695 695
 	 *
696 696
 	 * @return bool
697 697
 	 */
698
-	public function is_custom_price( $amount ) {
698
+	public function is_custom_price($amount) {
699 699
 		$result = false;
700
-		$amount = give_maybe_sanitize_amount( $amount );
700
+		$amount = give_maybe_sanitize_amount($amount);
701 701
 
702
-		if ( $this->is_custom_price_mode() ) {
702
+		if ($this->is_custom_price_mode()) {
703 703
 
704
-			if ( 'set' === $this->get_type() ) {
705
-				if ( $amount !== $this->get_price() ) {
704
+			if ('set' === $this->get_type()) {
705
+				if ($amount !== $this->get_price()) {
706 706
 					$result = true;
707 707
 				}
708 708
 
709
-			} elseif ( 'multi' === $this->get_type() ) {
710
-				$level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) );
711
-				$result        = ! in_array( $amount, $level_amounts );
709
+			} elseif ('multi' === $this->get_type()) {
710
+				$level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount'));
711
+				$result        = ! in_array($amount, $level_amounts);
712 712
 			}
713 713
 		}
714 714
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		 *
722 722
 		 * @since 1.8.18
723 723
 		 */
724
-		return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID );
724
+		return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID);
725 725
 	}
726 726
 
727 727
 	/**
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 	 */
737 737
 	public function has_variable_prices() {
738 738
 
739
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
739
+		$option = give_get_meta($this->ID, '_give_price_option', true);
740 740
 		$ret    = 0;
741 741
 
742
-		if ( $option === 'multi' ) {
742
+		if ($option === 'multi') {
743 743
 			$ret = 1;
744 744
 		}
745 745
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		 * @param bool       $ret Does donation form have variable prices?
750 750
 		 * @param int|string $ID  The ID of the donation form.
751 751
 		 */
752
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
752
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
753 753
 
754 754
 	}
755 755
 
@@ -763,17 +763,17 @@  discard block
 block discarded – undo
763 763
 	 */
764 764
 	public function get_type() {
765 765
 
766
-		if ( ! isset( $this->type ) ) {
766
+		if ( ! isset($this->type)) {
767 767
 
768
-			$this->type = give_get_meta( $this->ID, '_give_price_option', true );
768
+			$this->type = give_get_meta($this->ID, '_give_price_option', true);
769 769
 
770
-			if ( empty( $this->type ) ) {
770
+			if (empty($this->type)) {
771 771
 				$this->type = 'set';
772 772
 			}
773 773
 
774 774
 		}
775 775
 
776
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
776
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
777 777
 
778 778
 	}
779 779
 
@@ -789,23 +789,23 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @return string
791 791
 	 */
792
-	public function get_form_classes( $args ) {
792
+	public function get_form_classes($args) {
793 793
 
794
-		$float_labels_option = give_is_float_labels_enabled( $args )
794
+		$float_labels_option = give_is_float_labels_enabled($args)
795 795
 			? 'float-labels-enabled'
796 796
 			: '';
797 797
 
798
-		$form_classes_array = apply_filters( 'give_form_classes', array(
798
+		$form_classes_array = apply_filters('give_form_classes', array(
799 799
 			'give-form',
800
-			'give-form-' . $this->ID,
801
-			'give-form-type-' . $this->get_type(),
800
+			'give-form-'.$this->ID,
801
+			'give-form-type-'.$this->get_type(),
802 802
 			$float_labels_option,
803
-		), $this->ID, $args );
803
+		), $this->ID, $args);
804 804
 
805 805
 		// Remove empty class names.
806
-		$form_classes_array = array_filter( $form_classes_array );
806
+		$form_classes_array = array_filter($form_classes_array);
807 807
 
808
-		return implode( ' ', $form_classes_array );
808
+		return implode(' ', $form_classes_array);
809 809
 
810 810
 	}
811 811
 
@@ -820,22 +820,22 @@  discard block
 block discarded – undo
820 820
 	 *
821 821
 	 * @return string
822 822
 	 */
823
-	public function get_form_wrap_classes( $args ) {
823
+	public function get_form_wrap_classes($args) {
824 824
 		$custom_class = array(
825 825
 			'give-form-wrap',
826 826
 		);
827 827
 
828
-		if ( $this->is_close_donation_form() ) {
828
+		if ($this->is_close_donation_form()) {
829 829
 			$custom_class[] = 'give-form-closed';
830
-		} else{
831
-			$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
830
+		} else {
831
+			$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
832 832
 				? $args['display_style']
833
-				: give_get_meta( $this->ID, '_give_payment_display', true );
833
+				: give_get_meta($this->ID, '_give_payment_display', true);
834 834
 
835 835
 			$custom_class[] = "give-display-{$display_option}";
836 836
 
837 837
 			// If admin want to show only button for form then user inbuilt modal functionality.
838
-			if ( 'button' === $display_option ) {
838
+			if ('button' === $display_option) {
839 839
 				$custom_class[] = 'give-display-button-only';
840 840
 			}
841 841
 		}
@@ -846,10 +846,10 @@  discard block
 block discarded – undo
846 846
 		 *
847 847
 		 * @since 1.0
848 848
 		 */
849
-		$form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args );
849
+		$form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args);
850 850
 
851 851
 
852
-		return implode( ' ', $form_wrap_classes_array );
852
+		return implode(' ', $form_wrap_classes_array);
853 853
 
854 854
 	}
855 855
 
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	public function is_set_type_donation_form() {
865 865
 		$form_type = $this->get_type();
866 866
 
867
-		return ( 'set' === $form_type ? true : false );
867
+		return ('set' === $form_type ? true : false);
868 868
 	}
869 869
 
870 870
 	/**
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	public function is_multi_type_donation_form() {
879 879
 		$form_type = $this->get_type();
880 880
 
881
-		return ( 'multi' === $form_type ? true : false );
881
+		return ('multi' === $form_type ? true : false);
882 882
 
883 883
 	}
884 884
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 	 */
893 893
 	public function get_sales() {
894 894
 
895
-		if ( ! isset( $this->sales ) ) {
895
+		if ( ! isset($this->sales)) {
896 896
 
897
-			if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) {
898
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
897
+			if ('' == give_get_meta($this->ID, '_give_form_sales', true)) {
898
+				add_post_meta($this->ID, '_give_form_sales', 0);
899 899
 			} // End if
900 900
 
901
-			$this->sales = give_get_meta( $this->ID, '_give_form_sales', true );
901
+			$this->sales = give_get_meta($this->ID, '_give_form_sales', true);
902 902
 
903
-			if ( $this->sales < 0 ) {
903
+			if ($this->sales < 0) {
904 904
 				// Never let sales be less than zero.
905 905
 				$this->sales = 0;
906 906
 			}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 *
922 922
 	 * @return int|false     New number of total sales.
923 923
 	 */
924
-	public function increase_sales( $quantity = 1 ) {
924
+	public function increase_sales($quantity = 1) {
925 925
 
926
-		$sales       = give_get_form_sales_stats( $this->ID );
927
-		$quantity    = absint( $quantity );
926
+		$sales       = give_get_form_sales_stats($this->ID);
927
+		$quantity    = absint($quantity);
928 928
 		$total_sales = $sales + $quantity;
929 929
 
930
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
930
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
931 931
 
932 932
 			$this->sales = $total_sales;
933 933
 
@@ -948,17 +948,17 @@  discard block
 block discarded – undo
948 948
 	 *
949 949
 	 * @return int|false     New number of total sales.
950 950
 	 */
951
-	public function decrease_sales( $quantity = 1 ) {
951
+	public function decrease_sales($quantity = 1) {
952 952
 
953
-		$sales = give_get_form_sales_stats( $this->ID );
953
+		$sales = give_get_form_sales_stats($this->ID);
954 954
 
955 955
 		// Only decrease if not already zero
956
-		if ( $sales > 0 ) {
956
+		if ($sales > 0) {
957 957
 
958
-			$quantity    = absint( $quantity );
958
+			$quantity    = absint($quantity);
959 959
 			$total_sales = $sales - $quantity;
960 960
 
961
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
961
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
962 962
 
963 963
 				$this->sales = $sales;
964 964
 
@@ -982,15 +982,15 @@  discard block
 block discarded – undo
982 982
 	 */
983 983
 	public function get_earnings() {
984 984
 
985
-		if ( ! isset( $this->earnings ) ) {
985
+		if ( ! isset($this->earnings)) {
986 986
 
987
-			if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) {
988
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
987
+			if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) {
988
+				add_post_meta($this->ID, '_give_form_earnings', 0);
989 989
 			}
990 990
 
991
-			$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true );
991
+			$this->earnings = give_get_meta($this->ID, '_give_form_earnings', true);
992 992
 
993
-			if ( $this->earnings < 0 ) {
993
+			if ($this->earnings < 0) {
994 994
 				// Never let earnings be less than zero
995 995
 				$this->earnings = 0;
996 996
 			}
@@ -1011,12 +1011,12 @@  discard block
 block discarded – undo
1011 1011
 	 *
1012 1012
 	 * @return float|false
1013 1013
 	 */
1014
-	public function increase_earnings( $amount = 0 ) {
1014
+	public function increase_earnings($amount = 0) {
1015 1015
 
1016
-		$earnings   = give_get_form_earnings_stats( $this->ID );
1016
+		$earnings   = give_get_form_earnings_stats($this->ID);
1017 1017
 		$new_amount = $earnings + (float) $amount;
1018 1018
 
1019
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1019
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
1020 1020
 
1021 1021
 			$this->earnings = $new_amount;
1022 1022
 
@@ -1038,16 +1038,16 @@  discard block
 block discarded – undo
1038 1038
 	 *
1039 1039
 	 * @return float|false
1040 1040
 	 */
1041
-	public function decrease_earnings( $amount ) {
1041
+	public function decrease_earnings($amount) {
1042 1042
 
1043
-		$earnings = give_get_form_earnings_stats( $this->ID );
1043
+		$earnings = give_get_form_earnings_stats($this->ID);
1044 1044
 
1045
-		if ( $earnings > 0 ) {
1045
+		if ($earnings > 0) {
1046 1046
 			// Only decrease if greater than zero
1047 1047
 			$new_amount = $earnings - (float) $amount;
1048 1048
 
1049 1049
 
1050
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1050
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
1051 1051
 
1052 1052
 				$this->earnings = $new_amount;
1053 1053
 
@@ -1071,22 +1071,22 @@  discard block
 block discarded – undo
1071 1071
 	 *
1072 1072
 	 * @return bool
1073 1073
 	 */
1074
-	public function is_free( $price_id = false ) {
1074
+	public function is_free($price_id = false) {
1075 1075
 
1076 1076
 		$is_free          = false;
1077
-		$variable_pricing = give_has_variable_prices( $this->ID );
1077
+		$variable_pricing = give_has_variable_prices($this->ID);
1078 1078
 
1079
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1080
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1081
-		} elseif ( ! $variable_pricing ) {
1082
-			$price = give_get_meta( $this->ID, '_give_set_price', true );
1079
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1080
+			$price = give_get_price_option_amount($this->ID, $price_id);
1081
+		} elseif ( ! $variable_pricing) {
1082
+			$price = give_get_meta($this->ID, '_give_set_price', true);
1083 1083
 		}
1084 1084
 
1085
-		if ( isset( $price ) && (float) $price == 0 ) {
1085
+		if (isset($price) && (float) $price == 0) {
1086 1086
 			$is_free = true;
1087 1087
 		}
1088 1088
 
1089
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1089
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1090 1090
 
1091 1091
 	}
1092 1092
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	public function is_close_donation_form() {
1107 1107
 
1108
-		$goal_format = give_get_form_goal_format( $this->ID );
1108
+		$goal_format = give_get_form_goal_format($this->ID);
1109 1109
 
1110 1110
 		/**
1111 1111
 		 * Filter the close form result.
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 		$is_close_form = apply_filters(
1116 1116
 			'give_is_close_donation_form',
1117 1117
 			(
1118
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) &&
1119
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) &&
1120
-				( 'donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings() )
1118
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) &&
1119
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) &&
1120
+				('donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings())
1121 1121
 			),
1122 1122
 			$this->ID
1123 1123
 		);
@@ -1136,17 +1136,17 @@  discard block
 block discarded – undo
1136 1136
 	 *
1137 1137
 	 * @return bool                            The result of the update query.
1138 1138
 	 */
1139
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1139
+	private function update_meta($meta_key = '', $meta_value = '') {
1140 1140
 
1141 1141
 		/* @var WPDB $wpdb */
1142 1142
 		global $wpdb;
1143 1143
 
1144 1144
 		// Bailout.
1145
-		if ( empty( $meta_key ) ) {
1145
+		if (empty($meta_key)) {
1146 1146
 			return false;
1147 1147
 		}
1148 1148
 
1149
-		if ( give_update_meta( $this->ID, $meta_key, $meta_value  ) ) {
1149
+		if (give_update_meta($this->ID, $meta_key, $meta_value)) {
1150 1150
 			return true;
1151 1151
 		}
1152 1152
 
Please login to merge, or discard this patch.
includes/class-notices.php 1 patch
Spacing   +107 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.8.9
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 );
57
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
56
+		add_action('admin_notices', array($this, 'render_admin_notices'), 999);
57
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
58 58
 
59
-		add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 );
60
-		add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 );
61
-		add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) );
59
+		add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999);
60
+		add_action('give_pre_form', array($this, 'render_frontend_notices'), 11);
61
+		add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices'));
62 62
 
63 63
 		/**
64 64
 		 * Backward compatibility for deprecated params.
65 65
 		 *
66 66
 		 * @since 1.8.14
67 67
 		 */
68
-		add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) );
69
-		add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) );
70
-		add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) );
68
+		add_filter('give_register_notice_args', array($this, 'bc_deprecated_params'));
69
+		add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params'));
70
+		add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public function bc_deprecated_params( $args ) {
83
+	public function bc_deprecated_params($args) {
84 84
 		/**
85 85
 		 *  Param: auto_dismissible
86 86
 		 *  deprecated in 1.8.14
87 87
 		 *
88 88
 		 *  Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto
89 89
 		 */
90
-		if ( isset( $args['auto_dismissible'] ) ) {
91
-			if ( ! empty( $args['auto_dismissible'] ) ) {
90
+		if (isset($args['auto_dismissible'])) {
91
+			if ( ! empty($args['auto_dismissible'])) {
92 92
 				$args['dismissible'] = 'auto';
93 93
 			}
94 94
 			// unset auto_dismissible as it has been deprecated.
95
-			unset( $args['auto_dismissible'] );
95
+			unset($args['auto_dismissible']);
96 96
 		}
97 97
 
98 98
 		return $args;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function register_notice( $notice_args ) {
111
+	public function register_notice($notice_args) {
112 112
 		// Bailout.
113
-		if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) {
113
+		if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -159,39 +159,39 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @since 1.8.14
161 161
 		 */
162
-		$notice_args = apply_filters( 'give_register_notice_args', $notice_args );
162
+		$notice_args = apply_filters('give_register_notice_args', $notice_args);
163 163
 
164 164
 		// Set extra dismiss links if any.
165
-		if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) {
165
+		if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) {
166 166
 
167
-			preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link );
167
+			preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link);
168 168
 
169
-			if ( ! empty( $extra_notice_dismiss_link ) ) {
170
-				$extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 );
171
-				foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) {
169
+			if ( ! empty($extra_notice_dismiss_link)) {
170
+				$extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3);
171
+				foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) {
172 172
 					// Create array og key ==> value by parsing query string created after renaming data attributes.
173
-					$data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array(
173
+					$data_attribute_query_str = str_replace(array('data-', '-', '"'), array(
174 174
 						'',
175 175
 						'_',
176 176
 						'',
177
-					), implode( '&', $extra_notice_dismiss_link ) );
177
+					), implode('&', $extra_notice_dismiss_link));
178 178
 
179
-					$notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str );
179
+					$notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str);
180 180
 				}
181 181
 			}
182 182
 		}
183 183
 
184 184
 
185
-		self::$notices[ $notice_args['id'] ] = $notice_args;
185
+		self::$notices[$notice_args['id']] = $notice_args;
186 186
 
187 187
 		// Auto set show param if not already set.
188
-		if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) {
189
-			self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true;
188
+		if ( ! isset(self::$notices[$notice_args['id']]['show'])) {
189
+			self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true;
190 190
 		}
191 191
 
192 192
 		// Auto set time interval for shortly.
193
-		if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) {
194
-			self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS;
193
+		if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) {
194
+			self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS;
195 195
 		}
196 196
 
197 197
 		return true;
@@ -205,51 +205,51 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function render_admin_notices() {
207 207
 		// Bailout.
208
-		if ( empty( self::$notices ) ) {
208
+		if (empty(self::$notices)) {
209 209
 			return;
210 210
 		}
211 211
 
212 212
 		$output = '';
213 213
 
214
-		foreach ( self::$notices as $notice_id => $notice ) {
214
+		foreach (self::$notices as $notice_id => $notice) {
215 215
 			// Check flag set to true to show notice.
216
-			if ( ! $notice['show'] ) {
216
+			if ( ! $notice['show']) {
217 217
 				continue;
218 218
 			}
219 219
 
220 220
 
221 221
 			// Render custom html.
222
-			if( ! empty( $notice['description_html'] ) ) {
222
+			if ( ! empty($notice['description_html'])) {
223 223
 				$output .= "{$notice['description_html']} \n";
224 224
 				continue;
225 225
 			}
226 226
 
227 227
 			// Check if notice dismissible or not.
228
-			if ( ! self::$has_auto_dismissible_notice ) {
229
-				self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] );
228
+			if ( ! self::$has_auto_dismissible_notice) {
229
+				self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']);
230 230
 			}
231 231
 
232 232
 			// Check if notice dismissible or not.
233
-			if ( ! self::$has_dismiss_interval_notice ) {
233
+			if ( ! self::$has_dismiss_interval_notice) {
234 234
 				self::$has_dismiss_interval_notice = $notice['dismiss_interval'];
235 235
 			}
236 236
 
237
-			$css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] );
237
+			$css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']);
238 238
 
239
-			$css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}";
240
-			$output    .= sprintf(
241
-				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n",
239
+			$css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}";
240
+			$output .= sprintf(
241
+				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n",
242 242
 				$css_id,
243 243
 				$css_class,
244
-				give_clean( $notice['dismissible'] ),
244
+				give_clean($notice['dismissible']),
245 245
 				$notice['dismissible_type'],
246 246
 				$notice['dismiss_interval'],
247 247
 				$notice['id'],
248
-				empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ),
248
+				empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"),
249 249
 				$notice['dismiss_interval_time']
250 250
 			);
251 251
 
252
-			$output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" );
252
+			$output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>");
253 253
 			$output .= "</div> \n";
254 254
 		}
255 255
 
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param int $form_id
269 269
 	 */
270
-	public function render_frontend_notices( $form_id = 0 ) {
270
+	public function render_frontend_notices($form_id = 0) {
271 271
 		$errors = give_get_errors();
272 272
 
273
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0;
273
+		$request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0;
274 274
 
275 275
 		// Sanity checks first: Ensure that gateway returned errors display on the appropriate form.
276
-		if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
276
+		if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
277 277
 			return;
278 278
 		}
279 279
 
280
-		if ( $errors ) {
281
-			self::print_frontend_errors( $errors );
280
+		if ($errors) {
281
+			self::print_frontend_errors($errors);
282 282
 
283 283
 			give_clear_errors();
284 284
 		}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @access private
292 292
 	 */
293 293
 	private function print_js() {
294
-		if ( self::$has_auto_dismissible_notice ) :
294
+		if (self::$has_auto_dismissible_notice) :
295 295
 			?>
296 296
 			<script>
297 297
 				jQuery(document).ready(function () {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			<?php
308 308
 		endif;
309 309
 
310
-		if ( self::$has_dismiss_interval_notice ) :
310
+		if (self::$has_dismiss_interval_notice) :
311 311
 			?>
312 312
 			<script>
313 313
 				jQuery(document).ready(function () {
@@ -386,36 +386,36 @@  discard block
 block discarded – undo
386 386
 	 * @access public
387 387
 	 */
388 388
 	public function dismiss_notices() {
389
-		$_post     = give_clean( $_POST );
390
-		$notice_id = esc_attr( $_post['notice_id'] );
389
+		$_post     = give_clean($_POST);
390
+		$notice_id = esc_attr($_post['notice_id']);
391 391
 
392 392
 		// Bailout.
393 393
 		if (
394
-			empty( $notice_id ) ||
395
-			empty( $_post['dismissible_type'] ) ||
396
-			empty( $_post['dismiss_interval'] ) ||
397
-			! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' )
394
+			empty($notice_id) ||
395
+			empty($_post['dismissible_type']) ||
396
+			empty($_post['dismiss_interval']) ||
397
+			! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce')
398 398
 		) {
399 399
 			wp_send_json_error();
400 400
 		}
401 401
 
402
-		$notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] );
403
-		if ( 'user' === $_post['dismissible_type'] ) {
402
+		$notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']);
403
+		if ('user' === $_post['dismissible_type']) {
404 404
 			$current_user = wp_get_current_user();
405
-			$notice_key   = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID );
405
+			$notice_key   = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID);
406 406
 		}
407 407
 
408
-		$notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null;
408
+		$notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null;
409 409
 
410 410
 		// Save option to hide notice.
411
-		Give_Cache::set( $notice_key, true, $notice_dismiss_time, true );
411
+		Give_Cache::set($notice_key, true, $notice_dismiss_time, true);
412 412
 
413 413
 		/**
414 414
 		 * Fire the action when notice dismissed
415 415
 		 *
416 416
 		 * @since 2.0
417 417
 		 */
418
-		do_action( 'give_dismiss_notices', $_post );
418
+		do_action('give_dismiss_notices', $_post);
419 419
 
420 420
 		wp_send_json_success();
421 421
 	}
@@ -433,18 +433,18 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @return string
435 435
 	 */
436
-	public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) {
436
+	public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) {
437 437
 		$notice_key = "_give_notice_{$notice_id}";
438 438
 
439
-		if ( ! empty( $dismiss_interval ) ) {
439
+		if ( ! empty($dismiss_interval)) {
440 440
 			$notice_key .= "_{$dismiss_interval}";
441 441
 		}
442 442
 
443
-		if ( $user_id ) {
443
+		if ($user_id) {
444 444
 			$notice_key .= "_{$user_id}";
445 445
 		}
446 446
 
447
-		$notice_key = sanitize_key( $notice_key );
447
+		$notice_key = sanitize_key($notice_key);
448 448
 
449 449
 		return $notice_key;
450 450
 	}
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return string
459 459
 	 */
460
-	public function get_dismiss_link( $notice_args ) {
460
+	public function get_dismiss_link($notice_args) {
461 461
 		$notice_args = wp_parse_args(
462 462
 			$notice_args,
463 463
 			array(
464
-				'title'                 => __( 'Click here', 'give' ),
464
+				'title'                 => __('Click here', 'give'),
465 465
 				'dismissible_type'      => '',
466 466
 				'dismiss_interval'      => '',
467 467
 				'dismiss_interval_time' => null,
@@ -488,31 +488,31 @@  discard block
 block discarded – undo
488 488
 	 *
489 489
 	 * @return bool|null
490 490
 	 */
491
-	public function is_notice_dismissed( $notice ) {
492
-		$notice_key          = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] );
491
+	public function is_notice_dismissed($notice) {
492
+		$notice_key          = $this->get_notice_key($notice['id'], $notice['dismiss_interval']);
493 493
 		$is_notice_dismissed = false;
494 494
 
495
-		if ( 'user' === $notice['dismissible_type'] ) {
495
+		if ('user' === $notice['dismissible_type']) {
496 496
 			$current_user = wp_get_current_user();
497
-			$notice_key   = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID );
497
+			$notice_key   = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID);
498 498
 		}
499 499
 
500
-		$notice_data = Give_Cache::get( $notice_key, true );
500
+		$notice_data = Give_Cache::get($notice_key, true);
501 501
 
502 502
 		// Find notice dismiss link status if notice has extra dismissible links.
503
-		if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) {
503
+		if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) {
504 504
 
505
-			foreach ( $notice['extra_links'] as $extra_link ) {
506
-				$new_notice_data = wp_parse_args( $extra_link, $notice );
507
-				unset( $new_notice_data['extra_links'] );
505
+			foreach ($notice['extra_links'] as $extra_link) {
506
+				$new_notice_data = wp_parse_args($extra_link, $notice);
507
+				unset($new_notice_data['extra_links']);
508 508
 
509
-				if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) {
509
+				if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) {
510 510
 					return $is_notice_dismissed;
511 511
 				}
512 512
 			}
513 513
 		}
514 514
 
515
-		$is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data );
515
+		$is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data);
516 516
 
517 517
 		return $is_notice_dismissed;
518 518
 	}
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @param array $errors
528 528
 	 */
529
-	public static function print_frontend_errors( $errors ) {
529
+	public static function print_frontend_errors($errors) {
530 530
 		// Bailout.
531
-		if ( ! $errors ) {
531
+		if ( ! $errors) {
532 532
 			return;
533 533
 		}
534 534
 
@@ -543,37 +543,37 @@  discard block
 block discarded – undo
543 543
 		);
544 544
 
545 545
 		// Note: we will remove give_errors class in future.
546
-		$classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) );
546
+		$classes = apply_filters('give_error_class', array('give_notices', 'give_errors'));
547 547
 
548
-		echo sprintf( '<div class="%s">', implode( ' ', $classes ) );
548
+		echo sprintf('<div class="%s">', implode(' ', $classes));
549 549
 
550 550
 		// Loop error codes and display errors.
551
-		foreach ( $errors as $error_id => $error ) {
551
+		foreach ($errors as $error_id => $error) {
552 552
 			// Backward compatibility v<1.8.11
553
-			if ( is_string( $error ) ) {
553
+			if (is_string($error)) {
554 554
 				$error = array(
555 555
 					'message'     => $error,
556 556
 					'notice_args' => array(),
557 557
 				);
558 558
 			}
559 559
 
560
-			$notice_args = wp_parse_args( $error['notice_args'], $default_notice_args );
560
+			$notice_args = wp_parse_args($error['notice_args'], $default_notice_args);
561 561
 
562 562
 			/**
563 563
 			 * Filter to modify Frontend Errors args before errors is display.
564 564
 			 *
565 565
 			 * @since 1.8.14
566 566
 			 */
567
-			$notice_args = apply_filters( 'give_frontend_errors_args', $notice_args );
567
+			$notice_args = apply_filters('give_frontend_errors_args', $notice_args);
568 568
 
569 569
 			echo sprintf(
570 570
 				'<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d">
571 571
 						<p><strong>%4$s</strong>: %5$s</p>
572 572
 					</div>',
573 573
 				$error_id,
574
-				give_clean( $notice_args['dismissible'] ),
575
-				absint( $notice_args['dismiss_interval'] ),
576
-				esc_html__( 'Error', 'give' ),
574
+				give_clean($notice_args['dismissible']),
575
+				absint($notice_args['dismiss_interval']),
576
+				esc_html__('Error', 'give'),
577 577
 				$error['message']
578 578
 			);
579 579
 		}
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 *
596 596
 	 * @return  string
597 597
 	 */
598
-	public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) {
599
-		if ( empty( $message ) ) {
598
+	public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) {
599
+		if (empty($message)) {
600 600
 			return '';
601 601
 		}
602 602
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			'dismiss_interval' => 5000,
612 612
 		);
613 613
 
614
-		$notice_args = wp_parse_args( $notice_args, $default_notice_args );
614
+		$notice_args = wp_parse_args($notice_args, $default_notice_args);
615 615
 
616 616
 		// Notice dismissible must be true for dismiss type.
617 617
 		$notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type'];
@@ -621,15 +621,14 @@  discard block
 block discarded – undo
621 621
 		 *
622 622
 		 * @since 1.8.14
623 623
 		 */
624
-		$notice_args = apply_filters( 'give_frontend_notice_args', $notice_args );
624
+		$notice_args = apply_filters('give_frontend_notice_args', $notice_args);
625 625
 
626 626
 		$close_icon = 'manual' === $notice_args['dismiss_type'] ?
627 627
 			sprintf(
628 628
 				'<img class="notice-dismiss give-notice-close" src="%s" />',
629
-				esc_url( GIVE_PLUGIN_URL . 'assets/images/svg/close.svg' )
629
+				esc_url(GIVE_PLUGIN_URL.'assets/images/svg/close.svg')
630 630
 
631
-			) :
632
-			'';
631
+			) : '';
633 632
 
634 633
 		// Note: we will remove give_errors class in future.
635 634
 		$error = sprintf(
@@ -640,15 +639,15 @@  discard block
 block discarded – undo
640 639
 						%6$s
641 640
 					</div>',
642 641
 			$notice_type,
643
-			give_clean( $notice_args['dismissible'] ),
644
-			absint( $notice_args['dismiss_interval'] ),
645
-			give_clean( $notice_args['dismiss_type'] ),
642
+			give_clean($notice_args['dismissible']),
643
+			absint($notice_args['dismiss_interval']),
644
+			give_clean($notice_args['dismiss_type']),
646 645
 			$message,
647 646
 			$close_icon
648 647
 
649 648
 		);
650 649
 
651
-		if ( ! $echo ) {
650
+		if ( ! $echo) {
652 651
 			return $error;
653 652
 		}
654 653
 
@@ -668,24 +667,24 @@  discard block
 block discarded – undo
668 667
 	 *
669 668
 	 * @return string
670 669
 	 */
671
-	public function print_admin_notices( $notice_args = array() ) {
670
+	public function print_admin_notices($notice_args = array()) {
672 671
 		// Bailout.
673
-		if ( empty( $notice_args['description'] ) ) {
672
+		if (empty($notice_args['description'])) {
674 673
 			return '';
675 674
 		}
676 675
 
677
-		$defaults    = array(
676
+		$defaults = array(
678 677
 			'id'          => '',
679 678
 			'echo'        => true,
680 679
 			'notice_type' => 'warning',
681 680
 			'dismissible' => true,
682 681
 		);
683
-		$notice_args = wp_parse_args( $notice_args, $defaults );
682
+		$notice_args = wp_parse_args($notice_args, $defaults);
684 683
 
685 684
 		$output    = '';
686
-		$css_id    = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' );
685
+		$css_id    = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-');
687 686
 		$css_class = "notice-{$notice_args['notice_type']} give-notice notice inline";
688
-		$css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : '';
687
+		$css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : '';
689 688
 		$output    .= sprintf(
690 689
 			'<div id="%1$s" class="%2$s"><p>%3$s</p></div>',
691 690
 			$css_id,
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
 			$notice_args['description']
694 693
 		);
695 694
 
696
-		if ( ! $notice_args['echo'] ) {
695
+		if ( ! $notice_args['echo']) {
697 696
 			return $output;
698 697
 		}
699 698
 
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278 278
 
279
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
279
+			add_action('plugins_loaded', array($this, 'init'), 0);
280 280
 
281 281
 			// Set up localization on init Hook.
282
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
282
+			add_action('init', array($this, 'load_textdomain'), 0);
283 283
 		}
284 284
 
285 285
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			 *
295 295
 			 * @since 1.8.9
296 296
 			 */
297
-			do_action( 'before_give_init' );
297
+			do_action('before_give_init');
298 298
 
299 299
 			$this->roles              = new Give_Roles();
300 300
 			$this->api                = new Give_API();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			 *
322 322
 			 * @since 1.8.7
323 323
 			 */
324
-			do_action( 'give_init', $this );
324
+			do_action('give_init', $this);
325 325
 
326 326
 		}
327 327
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 */
339 339
 		public function __clone() {
340 340
 			// Cloning instances of the class is forbidden.
341
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
341
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
342 342
 		}
343 343
 
344 344
 		/**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		 */
352 352
 		public function __wakeup() {
353 353
 			// Unserializing instances of the class is forbidden.
354
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
354
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
355 355
 		}
356 356
 
357 357
 		/**
@@ -365,33 +365,33 @@  discard block
 block discarded – undo
365 365
 		private function setup_constants() {
366 366
 
367 367
 			// Plugin version
368
-			if ( ! defined( 'GIVE_VERSION' ) ) {
369
-				define( 'GIVE_VERSION', '2.0.6' );
368
+			if ( ! defined('GIVE_VERSION')) {
369
+				define('GIVE_VERSION', '2.0.6');
370 370
 			}
371 371
 
372 372
 			// Plugin Root File
373
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
374
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
373
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
374
+				define('GIVE_PLUGIN_FILE', __FILE__);
375 375
 			}
376 376
 
377 377
 			// Plugin Folder Path
378
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
379
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
378
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
379
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
380 380
 			}
381 381
 
382 382
 			// Plugin Folder URL
383
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
384
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
383
+			if ( ! defined('GIVE_PLUGIN_URL')) {
384
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
385 385
 			}
386 386
 
387 387
 			// Plugin Basename aka: "give/give.php"
388
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
389
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
388
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
389
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
390 390
 			}
391 391
 
392 392
 			// Make sure CAL_GREGORIAN is defined
393
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
394
-				define( 'CAL_GREGORIAN', 1 );
393
+			if ( ! defined('CAL_GREGORIAN')) {
394
+				define('CAL_GREGORIAN', 1);
395 395
 			}
396 396
 		}
397 397
 
@@ -409,152 +409,152 @@  discard block
 block discarded – undo
409 409
 			/**
410 410
 			 * Load libraries.
411 411
 			 */
412
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
413
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
412
+			if ( ! class_exists('WP_Async_Request')) {
413
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
414 414
 			}
415 415
 
416
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
417
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
416
+			if ( ! class_exists('WP_Background_Process')) {
417
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
418 418
 			}
419 419
 
420 420
 			/**
421 421
 			 * Load plugin files
422 422
 			 */
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
424
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
424
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
425 425
 			$give_options = give_get_settings();
426 426
 
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
439
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
440
-
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
456
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
457
-
458
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
478
-
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
485
-
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
490
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
491
-
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
498
-
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
501
-
502
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
503
-
504
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
505
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
439
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
440
+
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
456
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
457
+
458
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
478
+
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
485
+
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
490
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
491
+
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
498
+
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
501
+
502
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
503
+
504
+			if (defined('WP_CLI') && WP_CLI) {
505
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
506 506
 			}
507 507
 
508
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
509
-
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
520
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
521
-
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
523
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
524
-
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
527
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
528
-
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
531
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
532
-
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
536
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
537
-
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
540
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
541
-
542
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
543
-
544
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
545
-
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
554
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
508
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
509
+
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
520
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
521
+
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
523
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
524
+
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
527
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
528
+
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
531
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
532
+
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
536
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
537
+
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
540
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
541
+
542
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
543
+
544
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
545
+
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
554
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
555 555
 			}// End if().
556 556
 
557
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
557
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
558 558
 
559 559
 		}
560 560
 
@@ -569,16 +569,16 @@  discard block
 block discarded – undo
569 569
 		public function load_textdomain() {
570 570
 
571 571
 			// Set filter for Give's languages directory
572
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
573
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
572
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
573
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
574 574
 
575 575
 			// Traditional WordPress plugin locale filter.
576
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
577
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
576
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
577
+			$locale = apply_filters('plugin_locale', $locale, 'give');
578 578
 
579
-			unload_textdomain( 'give' );
580
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
581
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
579
+			unload_textdomain('give');
580
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
581
+			load_plugin_textdomain('give', false, $give_lang_dir);
582 582
 
583 583
 		}
584 584
 
@@ -591,17 +591,17 @@  discard block
 block discarded – undo
591 591
 		 */
592 592
 		public function minmum_phpversion_notice() {
593 593
 			// Bailout.
594
-			if ( ! is_admin() ) {
594
+			if ( ! is_admin()) {
595 595
 				return;
596 596
 			}
597 597
 
598
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
599
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
600
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
601
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
602
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
603
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
604
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
598
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
599
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
600
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
601
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
602
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
603
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
604
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
605 605
 
606 606
 			echo sprintf(
607 607
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.