Completed
Push — master ( 92b4ca...04de2e )
by Matt
17:28
created
includes/class-give-template-loader.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	public function __construct() {
15 15
 
16
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
16
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
17 17
 
18 18
 
19 19
 		/**
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 		 * @see 3give_output_content_wrapper()
29 29
 		 * @see give_output_content_wrapper_end()
30 30
 		 */
31
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
32
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
31
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
32
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
33 33
 
34 34
 		/**
35 35
 		 * Entry Summary Classes
36 36
 		 */
37
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
37
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
38 38
 
39 39
 
40 40
 		/**
41 41
 		 * Sidebar
42 42
 		 */
43
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
43
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
44 44
 
45 45
 
46 46
 		/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		 *
49 49
 		 * @see give_template_single_title()
50 50
 		 */
51
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
52
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
51
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
52
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
53 53
 
54 54
 
55 55
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function give_set_single_summary_classes( $classes ) {
67
+	public function give_set_single_summary_classes($classes) {
68 68
 
69
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
69
+		$sidebar_option = give_get_option('disable_form_sidebar');
70 70
 
71 71
 		//Add full width class when feature image is disabled AND no widgets are present
72
-		if ( $sidebar_option == 'on' ) {
72
+		if ($sidebar_option == 'on') {
73 73
 			$classes .= ' give-full-width';
74 74
 		}
75 75
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 */
88 88
 	public function give_output_sidebar_option() {
89
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
89
+		$sidebar_option = give_get_option('disable_form_sidebar');
90 90
 		//Add full width class when feature image is disabled AND no widgets are present
91
-		if ( $sidebar_option !== 'on' ) {
92
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
93
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
94
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
95
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
91
+		if ($sidebar_option !== 'on') {
92
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
93
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
94
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
95
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
96 96
 		}
97 97
 
98 98
 	}
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return string
116 116
 	 */
117
-	public static function template_loader( $template ) {
118
-		$find = array( 'give.php' );
117
+	public static function template_loader($template) {
118
+		$find = array('give.php');
119 119
 		$file = '';
120 120
 
121
-		if ( is_single() && get_post_type() == 'give_forms' ) {
121
+		if (is_single() && get_post_type() == 'give_forms') {
122 122
 
123 123
 			$file   = 'single-give-form.php';
124 124
 			$find[] = $file;
125
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
125
+			$find[] = apply_filters('give_template_path', 'give/').$file;
126 126
 
127 127
 		}
128 128
 
129
-		if ( $file ) {
130
-			$template = locate_template( array_unique( $find ) );
131
-			if ( ! $template ) {
132
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
129
+		if ($file) {
130
+			$template = locate_template(array_unique($find));
131
+			if ( ! $template) {
132
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
133 133
 			}
134 134
 		}
135 135
 
Please login to merge, or discard this patch.
includes/country-functions.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_get_country() {
25 25
 	global $give_options;
26
-	$country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US';
26
+	$country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US';
27 27
 
28
-	return apply_filters( 'give_give_country', $country );
28
+	return apply_filters('give_give_country', $country);
29 29
 }
30 30
 
31 31
 /**
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function give_get_state() {
38 38
 	global $give_options;
39
-	$state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false;
39
+	$state = isset($give_options['base_state']) ? $give_options['base_state'] : false;
40 40
 
41
-	return apply_filters( 'give_give_state', $state );
41
+	return apply_filters('give_give_state', $state);
42 42
 }
43 43
 
44 44
 /**
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
  *
51 51
  * @return mixed|void  A list of states for the shop's base country
52 52
  */
53
-function give_get_states( $country = null ) {
53
+function give_get_states($country = null) {
54 54
 	global $give_options;
55 55
 
56
-	if ( empty( $country ) ) {
56
+	if (empty($country)) {
57 57
 		$country = give_get_country();
58 58
 	}
59 59
 
60
-	switch ( $country ) :
60
+	switch ($country) :
61 61
 
62 62
 		case 'US' :
63 63
 			$states = give_get_states_list();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	endswitch;
109 109
 
110
-	return apply_filters( 'give_give_states', $states );
110
+	return apply_filters('give_give_states', $states);
111 111
 }
112 112
 
113 113
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		'ZW' => 'Zimbabwe'
367 367
 	);
368 368
 
369
-	return apply_filters( 'give_countries', $countries );
369
+	return apply_filters('give_countries', $countries);
370 370
 }
371 371
 
372 372
 /**
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		'AP' => 'Armed Forces - Pacific'
448 448
 	);
449 449
 
450
-	return apply_filters( 'give_us_states', $states );
450
+	return apply_filters('give_us_states', $states);
451 451
 }
452 452
 
453 453
 /**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		'YT' => 'Yukon'
476 476
 	);
477 477
 
478
-	return apply_filters( 'give_canada_provinces', $provinces );
478
+	return apply_filters('give_canada_provinces', $provinces);
479 479
 }
480 480
 
481 481
 /**
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		'WA'  => 'Western Australia'
498 498
 	);
499 499
 
500
-	return apply_filters( 'give_australian_states', $states );
500
+	return apply_filters('give_australian_states', $states);
501 501
 }
502 502
 
503 503
 /**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		'TO' => 'Tocantins'
539 539
 	);
540 540
 
541
-	return apply_filters( 'give_brazil_states', $states );
541
+	return apply_filters('give_brazil_states', $states);
542 542
 }
543 543
 
544 544
 /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		'NEW TERRITORIES' => 'New Territories'
556 556
 	);
557 557
 
558
-	return apply_filters( 'give_hong_kong_states', $states );
558
+	return apply_filters('give_hong_kong_states', $states);
559 559
 }
560 560
 
561 561
 /**
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		'ZA' => 'Zala'
590 590
 	);
591 591
 
592
-	return apply_filters( 'give_hungary_states', $states );
592
+	return apply_filters('give_hungary_states', $states);
593 593
 }
594 594
 
595 595
 /**
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		'CN32' => 'Xinjiang / 新疆'
636 636
 	);
637 637
 
638
-	return apply_filters( 'give_chinese_states', $states );
638
+	return apply_filters('give_chinese_states', $states);
639 639
 }
640 640
 
641 641
 /**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		'WC' => 'West Coast'
665 665
 	);
666 666
 
667
-	return apply_filters( 'give_new_zealand_states', $states );
667
+	return apply_filters('give_new_zealand_states', $states);
668 668
 }
669 669
 
670 670
 /**
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		'PB' => 'Papua Barat'
713 713
 	);
714 714
 
715
-	return apply_filters( 'give_indonesia_states', $states );
715
+	return apply_filters('give_indonesia_states', $states);
716 716
 }
717 717
 
718 718
 /**
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		'PY' => 'Pondicherry (Puducherry)'
763 763
 	);
764 764
 
765
-	return apply_filters( 'give_indian_states', $states );
765
+	return apply_filters('give_indian_states', $states);
766 766
 }
767 767
 
768 768
 /**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		'PJY' => 'W.P. Putrajaya'
793 793
 	);
794 794
 
795
-	return apply_filters( 'give_malaysian_states', $states );
795
+	return apply_filters('give_malaysian_states', $states);
796 796
 }
797 797
 
798 798
 /**
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		'WC'  => 'Western Cape'
816 816
 	);
817 817
 
818
-	return apply_filters( 'give_south_african_states', $states );
818
+	return apply_filters('give_south_african_states', $states);
819 819
 }
820 820
 
821 821
 /**
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 		'TH-35' => 'Yasothon (ยโสธร)'
907 907
 	);
908 908
 
909
-	return apply_filters( 'give_thailand_states', $states );
909
+	return apply_filters('give_thailand_states', $states);
910 910
 }
911 911
 
912 912
 /**
@@ -918,59 +918,59 @@  discard block
 block discarded – undo
918 918
 function give_get_spain_states_list() {
919 919
 	$states = array(
920 920
 		''   => '',
921
-		'C'  => __( 'A Coruña', 'give' ),
922
-		'VI' => __( 'Araba', 'give' ),
923
-		'AB' => __( 'Albacete', 'give' ),
924
-		'A'  => __( 'Alicante', 'give' ),
925
-		'AL' => __( 'Almería', 'give' ),
926
-		'O'  => __( 'Asturias', 'give' ),
927
-		'AV' => __( 'Ávila', 'give' ),
928
-		'BA' => __( 'Badajoz', 'give' ),
929
-		'PM' => __( 'Baleares', 'give' ),
930
-		'B'  => __( 'Barcelona', 'give' ),
931
-		'BU' => __( 'Burgos', 'give' ),
932
-		'CC' => __( 'Cáceres', 'give' ),
933
-		'CA' => __( 'Cádiz', 'give' ),
934
-		'S'  => __( 'Cantabria', 'give' ),
935
-		'CS' => __( 'Castellón', 'give' ),
936
-		'CE' => __( 'Ceuta', 'give' ),
937
-		'CR' => __( 'Ciudad Real', 'give' ),
938
-		'CO' => __( 'Córdoba', 'give' ),
939
-		'CU' => __( 'Cuenca', 'give' ),
940
-		'GI' => __( 'Girona', 'give' ),
941
-		'GR' => __( 'Granada', 'give' ),
942
-		'GU' => __( 'Guadalajara', 'give' ),
943
-		'SS' => __( 'Gipuzkoa', 'give' ),
944
-		'H'  => __( 'Huelva', 'give' ),
945
-		'HU' => __( 'Huesca', 'give' ),
946
-		'J'  => __( 'Jaén', 'give' ),
947
-		'LO' => __( 'La Rioja', 'give' ),
948
-		'GC' => __( 'Las Palmas', 'give' ),
949
-		'LE' => __( 'León', 'give' ),
950
-		'L'  => __( 'Lleida', 'give' ),
951
-		'LU' => __( 'Lugo', 'give' ),
952
-		'M'  => __( 'Madrid', 'give' ),
953
-		'MA' => __( 'Málaga', 'give' ),
954
-		'ML' => __( 'Melilla', 'give' ),
955
-		'MU' => __( 'Murcia', 'give' ),
956
-		'NA' => __( 'Navarra', 'give' ),
957
-		'OR' => __( 'Ourense', 'give' ),
958
-		'P'  => __( 'Palencia', 'give' ),
959
-		'PO' => __( 'Pontevedra', 'give' ),
960
-		'SA' => __( 'Salamanca', 'give' ),
961
-		'TF' => __( 'Santa Cruz de Tenerife', 'give' ),
962
-		'SG' => __( 'Segovia', 'give' ),
963
-		'SE' => __( 'Sevilla', 'give' ),
964
-		'SO' => __( 'Soria', 'give' ),
965
-		'T'  => __( 'Tarragona', 'give' ),
966
-		'TE' => __( 'Teruel', 'give' ),
967
-		'TO' => __( 'Toledo', 'give' ),
968
-		'V'  => __( 'Valencia', 'give' ),
969
-		'VA' => __( 'Valladolid', 'give' ),
970
-		'BI' => __( 'Bizkaia', 'give' ),
971
-		'ZA' => __( 'Zamora', 'give' ),
972
-		'Z'  => __( 'Zaragoza', 'give' )
921
+		'C'  => __('A Coruña', 'give'),
922
+		'VI' => __('Araba', 'give'),
923
+		'AB' => __('Albacete', 'give'),
924
+		'A'  => __('Alicante', 'give'),
925
+		'AL' => __('Almería', 'give'),
926
+		'O'  => __('Asturias', 'give'),
927
+		'AV' => __('Ávila', 'give'),
928
+		'BA' => __('Badajoz', 'give'),
929
+		'PM' => __('Baleares', 'give'),
930
+		'B'  => __('Barcelona', 'give'),
931
+		'BU' => __('Burgos', 'give'),
932
+		'CC' => __('Cáceres', 'give'),
933
+		'CA' => __('Cádiz', 'give'),
934
+		'S'  => __('Cantabria', 'give'),
935
+		'CS' => __('Castellón', 'give'),
936
+		'CE' => __('Ceuta', 'give'),
937
+		'CR' => __('Ciudad Real', 'give'),
938
+		'CO' => __('Córdoba', 'give'),
939
+		'CU' => __('Cuenca', 'give'),
940
+		'GI' => __('Girona', 'give'),
941
+		'GR' => __('Granada', 'give'),
942
+		'GU' => __('Guadalajara', 'give'),
943
+		'SS' => __('Gipuzkoa', 'give'),
944
+		'H'  => __('Huelva', 'give'),
945
+		'HU' => __('Huesca', 'give'),
946
+		'J'  => __('Jaén', 'give'),
947
+		'LO' => __('La Rioja', 'give'),
948
+		'GC' => __('Las Palmas', 'give'),
949
+		'LE' => __('León', 'give'),
950
+		'L'  => __('Lleida', 'give'),
951
+		'LU' => __('Lugo', 'give'),
952
+		'M'  => __('Madrid', 'give'),
953
+		'MA' => __('Málaga', 'give'),
954
+		'ML' => __('Melilla', 'give'),
955
+		'MU' => __('Murcia', 'give'),
956
+		'NA' => __('Navarra', 'give'),
957
+		'OR' => __('Ourense', 'give'),
958
+		'P'  => __('Palencia', 'give'),
959
+		'PO' => __('Pontevedra', 'give'),
960
+		'SA' => __('Salamanca', 'give'),
961
+		'TF' => __('Santa Cruz de Tenerife', 'give'),
962
+		'SG' => __('Segovia', 'give'),
963
+		'SE' => __('Sevilla', 'give'),
964
+		'SO' => __('Soria', 'give'),
965
+		'T'  => __('Tarragona', 'give'),
966
+		'TE' => __('Teruel', 'give'),
967
+		'TO' => __('Toledo', 'give'),
968
+		'V'  => __('Valencia', 'give'),
969
+		'VA' => __('Valladolid', 'give'),
970
+		'BI' => __('Bizkaia', 'give'),
971
+		'ZA' => __('Zamora', 'give'),
972
+		'Z'  => __('Zaragoza', 'give')
973 973
 	);
974 974
 
975
-	return apply_filters( 'give_spain_states', $states );
975
+	return apply_filters('give_spain_states', $states);
976 976
 }
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a purchase receipt while editing a payment
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 );
36
+add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1);
37 37
 
38 38
 /**
39 39
  * Resend the Email Purchase Receipt. (This can be done from the Payment History page)
@@ -44,29 +44,29 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return void
46 46
  */
47
-function give_resend_donation_receipt( $data ) {
47
+function give_resend_donation_receipt($data) {
48 48
 
49
-	$purchase_id = absint( $data['purchase_id'] );
49
+	$purchase_id = absint($data['purchase_id']);
50 50
 
51
-	if ( empty( $purchase_id ) ) {
51
+	if (empty($purchase_id)) {
52 52
 		return;
53 53
 	}
54 54
 
55
-	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) {
56
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
55
+	if ( ! current_user_can('edit_give_payments', $purchase_id)) {
56
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
57 57
 	}
58 58
 
59
-	give_email_donation_receipt( $purchase_id, false );
59
+	give_email_donation_receipt($purchase_id, false);
60 60
 
61
-	wp_redirect( add_query_arg( array(
61
+	wp_redirect(add_query_arg(array(
62 62
 		'give-message' => 'email_sent',
63 63
 		'give-action'  => false,
64 64
 		'purchase_id'  => false
65
-	) ) );
65
+	)));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_email_links', 'give_resend_donation_receipt' );
69
+add_action('give_email_links', 'give_resend_donation_receipt');
70 70
 
71 71
 /**
72 72
  * Trigger the sending of a Test Email
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
  *
78 78
  * @return void
79 79
  */
80
-function give_send_test_email( $data ) {
81
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) {
80
+function give_send_test_email($data) {
81
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) {
82 82
 		return;
83 83
 	}
84 84
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	give_email_test_donation_receipt();
87 87
 
88 88
 	// Remove the test email query arg
89
-	wp_redirect( remove_query_arg( 'give_action' ) );
89
+	wp_redirect(remove_query_arg('give_action'));
90 90
 	exit;
91 91
 }
92 92
 
93
-add_action( 'give_send_test_email', 'give_send_test_email' );
93
+add_action('give_send_test_email', 'give_send_test_email');
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 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
 
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct() {
81 81
 
82
-		if ( 'none' === $this->get_template() ) {
82
+		if ('none' === $this->get_template()) {
83 83
 			$this->html = false;
84 84
 		}
85 85
 
86
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
87
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
86
+		add_action('give_email_send_before', array($this, 'send_before'));
87
+		add_action('give_email_send_after', array($this, 'send_after'));
88 88
 
89 89
 	}
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @since 1.0
95 95
 	 */
96
-	public function __set( $key, $value ) {
96
+	public function __set($key, $value) {
97 97
 		$this->$key = $value;
98 98
 	}
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @since 1.0
104 104
 	 */
105 105
 	public function get_from_name() {
106
-		if ( ! $this->from_name ) {
107
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
106
+		if ( ! $this->from_name) {
107
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
108 108
 		}
109 109
 
110
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
110
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 * @since 1.0
117 117
 	 */
118 118
 	public function get_from_address() {
119
-		if ( ! $this->from_address ) {
120
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
119
+		if ( ! $this->from_address) {
120
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
121 121
 		}
122 122
 
123
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
123
+		return apply_filters('give_email_from_address', $this->from_address, $this);
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_content_type() {
132
-		if ( ! $this->content_type && $this->html ) {
133
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
134
-		} else if ( ! $this->html ) {
132
+		if ( ! $this->content_type && $this->html) {
133
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
134
+		} else if ( ! $this->html) {
135 135
 			$this->content_type = 'text/plain';
136 136
 		}
137 137
 
138
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
138
+		return apply_filters('give_email_content_type', $this->content_type, $this);
139 139
 	}
140 140
 
141 141
 	/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 	 * @since 1.0
145 145
 	 */
146 146
 	public function get_headers() {
147
-		if ( ! $this->headers ) {
147
+		if ( ! $this->headers) {
148 148
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
149 149
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
150 150
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
151 151
 		}
152 152
 
153
-		return apply_filters( 'give_email_headers', $this->headers, $this );
153
+		return apply_filters('give_email_headers', $this->headers, $this);
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_templates() {
162 162
 		$templates = array(
163
-			'default' => __( 'Default Template', 'give' ),
164
-			'none'    => __( 'No template, plain text only', 'give' )
163
+			'default' => __('Default Template', 'give'),
164
+			'none'    => __('No template, plain text only', 'give')
165 165
 		);
166 166
 
167
-		return apply_filters( 'give_email_templates', $templates );
167
+		return apply_filters('give_email_templates', $templates);
168 168
 	}
169 169
 
170 170
 	/**
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 	 * @since 1.0
174 174
 	 */
175 175
 	public function get_template() {
176
-		if ( ! $this->template ) {
177
-			$this->template = give_get_option( 'email_template', 'default' );
176
+		if ( ! $this->template) {
177
+			$this->template = give_get_option('email_template', 'default');
178 178
 		}
179 179
 
180
-		return apply_filters( 'give_email_template', $this->template );
180
+		return apply_filters('give_email_template', $this->template);
181 181
 	}
182 182
 
183 183
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @since 1.0
187 187
 	 */
188 188
 	public function get_heading() {
189
-		return apply_filters( 'give_email_heading', $this->heading );
189
+		return apply_filters('give_email_heading', $this->heading);
190 190
 	}
191 191
 
192 192
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return mixed
198 198
 	 */
199
-	public function parse_tags( $content ) {
199
+	public function parse_tags($content) {
200 200
 
201 201
 		// The email tags are parsed during setup for purchase receipts and sale notifications
202 202
 		// Once tags are not restricted to payments, we'll expand this. @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues/2151
@@ -209,36 +209,36 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @since 1.0
211 211
 	 */
212
-	public function build_email( $message ) {
212
+	public function build_email($message) {
213 213
 
214
-		if ( false === $this->html ) {
215
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
214
+		if (false === $this->html) {
215
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
216 216
 		}
217 217
 
218
-		$message = $this->text_to_html( $message );
218
+		$message = $this->text_to_html($message);
219 219
 
220 220
 		ob_start();
221 221
 
222
-		give_get_template_part( 'emails/header', $this->get_template(), true );
222
+		give_get_template_part('emails/header', $this->get_template(), true);
223 223
 
224
-		do_action( 'give_email_header', $this );
224
+		do_action('give_email_header', $this);
225 225
 
226
-		if ( has_action( 'give_email_template_' . $this->get_template() ) ) {
227
-			do_action( 'give_email_template_' . $this->get_template() );
226
+		if (has_action('give_email_template_'.$this->get_template())) {
227
+			do_action('give_email_template_'.$this->get_template());
228 228
 		} else {
229
-			give_get_template_part( 'emails/body', $this->get_template(), true );
229
+			give_get_template_part('emails/body', $this->get_template(), true);
230 230
 		}
231 231
 
232
-		do_action( 'give_email_body', $this );
232
+		do_action('give_email_body', $this);
233 233
 
234
-		give_get_template_part( 'emails/footer', $this->get_template(), true );
234
+		give_get_template_part('emails/footer', $this->get_template(), true);
235 235
 
236
-		do_action( 'give_email_footer', $this );
236
+		do_action('give_email_footer', $this);
237 237
 
238 238
 		$body    = ob_get_clean();
239
-		$message = str_replace( '{email}', $message, $body );
239
+		$message = str_replace('{email}', $message, $body);
240 240
 
241
-		return apply_filters( 'give_email_message', $message, $this );
241
+		return apply_filters('give_email_message', $message, $this);
242 242
 	}
243 243
 
244 244
 	/**
@@ -251,26 +251,26 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return bool
253 253
 	 */
254
-	public function send( $to, $subject, $message, $attachments = '' ) {
254
+	public function send($to, $subject, $message, $attachments = '') {
255 255
 
256
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
257
-			_doing_it_wrong( __FUNCTION__, __( 'You cannot send email with Give_Emails until init/admin_init has been reached', 'give' ), null );
256
+		if ( ! did_action('init') && ! did_action('admin_init')) {
257
+			_doing_it_wrong(__FUNCTION__, __('You cannot send email with Give_Emails until init/admin_init has been reached', 'give'), null);
258 258
 
259 259
 			return false;
260 260
 		}
261 261
 
262
-		do_action( 'give_email_send_before', $this );
262
+		do_action('give_email_send_before', $this);
263 263
 
264
-		$subject = $this->parse_tags( $subject );
265
-		$message = $this->parse_tags( $message );
264
+		$subject = $this->parse_tags($subject);
265
+		$message = $this->parse_tags($message);
266 266
 
267
-		$message = $this->build_email( $message );
267
+		$message = $this->build_email($message);
268 268
 
269
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
269
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
270 270
 
271
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
271
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
272 272
 
273
-		do_action( 'give_email_send_after', $this );
273
+		do_action('give_email_send_after', $this);
274 274
 
275 275
 		return $sent;
276 276
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 * @since 1.0
283 283
 	 */
284 284
 	public function send_before() {
285
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
286
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
287
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
285
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
286
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
287
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
288 288
 	}
289 289
 
290 290
 	/**
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	 * @since 1.0
294 294
 	 */
295 295
 	public function send_after() {
296
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
297
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
298
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
296
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
297
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
298
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
299 299
 
300 300
 		// Reset heading to an empty string
301 301
 		$this->heading = '';
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @since 1.0
308 308
 	 */
309
-	public function text_to_html( $message ) {
309
+	public function text_to_html($message) {
310 310
 
311
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
312
-			$message = wpautop( $message );
311
+		if ('text/html' == $this->content_type || true === $this->html) {
312
+			$message = wpautop($message);
313 313
 		}
314 314
 
315 315
 		return $message;
Please login to merge, or discard this patch.
includes/error-tracking.php 2 patches
Spacing   +30 added lines, -30 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
 
@@ -29,33 +29,33 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @return void
31 31
  */
32
-function give_print_errors( $form_id ) {
32
+function give_print_errors($form_id) {
33 33
 
34 34
 	$errors = give_get_errors();
35 35
 
36
-	$request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0;
36
+	$request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0;
37 37
 
38 38
 	//Sanity checks first: Ensure that gateway returned errors display on the appropriate form
39
-	if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
39
+	if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( $errors ) {
44
-		$classes = apply_filters( 'give_error_class', array(
43
+	if ($errors) {
44
+		$classes = apply_filters('give_error_class', array(
45 45
 			'give_errors'
46
-		) );
47
-		echo '<div class="' . implode( ' ', $classes ) . '">';
46
+		));
47
+		echo '<div class="'.implode(' ', $classes).'">';
48 48
 		// Loop error codes and display errors
49
-		foreach ( $errors as $error_id => $error ) {
50
-			echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . __( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>';
49
+		foreach ($errors as $error_id => $error) {
50
+			echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.__('Error', 'give').'</strong>: '.$error.'</p></div>';
51 51
 		}
52 52
 		echo '</div>';
53 53
 		give_clear_errors();
54 54
 	}
55 55
 }
56 56
 
57
-add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' );
58
-add_action( 'give_ajax_checkout_errors', 'give_print_errors' );
57
+add_action('give_purchase_form_before_personal_info', 'give_print_errors');
58
+add_action('give_ajax_checkout_errors', 'give_print_errors');
59 59
 
60 60
 /**
61 61
  * Get Errors
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return mixed array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71
-	return Give()->session->get( 'give_errors' );
71
+	return Give()->session->get('give_errors');
72 72
 }
73 73
 
74 74
 /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return void
86 86
  */
87
-function give_set_error( $error_id, $error_message ) {
87
+function give_set_error($error_id, $error_message) {
88 88
 	$errors = give_get_errors();
89
-	if ( ! $errors ) {
89
+	if ( ! $errors) {
90 90
 		$errors = array();
91 91
 	}
92
-	$errors[ $error_id ] = $error_message;
93
-	Give()->session->set( 'give_errors', $errors );
92
+	$errors[$error_id] = $error_message;
93
+	Give()->session->set('give_errors', $errors);
94 94
 }
95 95
 
96 96
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return void
102 102
  */
103 103
 function give_clear_errors() {
104
-	Give()->session->set( 'give_errors', null );
104
+	Give()->session->set('give_errors', null);
105 105
 }
106 106
 
107 107
 /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_unset_error( $error_id ) {
117
+function give_unset_error($error_id) {
118 118
 	$errors = give_get_errors();
119
-	if ( $errors ) {
120
-		unset( $errors[ $error_id ] );
121
-		Give()->session->set( 'give_errors', $errors );
119
+	if ($errors) {
120
+		unset($errors[$error_id]);
121
+		Give()->session->set('give_errors', $errors);
122 122
 	}
123 123
 }
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * @return void
130 130
  */
131 131
 function _give_die_handler() {
132
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
132
+	if (defined('GIVE_UNIT_TESTS')) {
133 133
 		return '_give_die_handler';
134 134
 	} else {
135 135
 		die();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
  * @since  1.0
145 145
  * @return void
146 146
  */
147
-function give_die( $message = '', $title = '', $status = 400 ) {
148
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
149
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
150
-	wp_die( $message, $title, array( 'response' => $status ) );
147
+function give_die($message = '', $title = '', $status = 400) {
148
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
149
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
150
+	wp_die($message, $title, array('response' => $status));
151 151
 }
152 152
 
153 153
 /**
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return   string  $error
164 164
  */
165
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
166
-	$error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error  give_' . $error_id . '">' . $message . '</p></div>';
165
+function give_output_error($message, $echo = true, $error_id = 'warning') {
166
+	$error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error  give_'.$error_id.'">'.$message.'</p></div>';
167 167
 
168
-	if ( $echo ) {
168
+	if ($echo) {
169 169
 		echo $error;
170 170
 	} else {
171 171
 		return $error;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @since 1.0
67 67
  * @uses  Give_Session::get()
68
- * @return mixed array if errors are present, false if none found
68
+ * @return string array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71 71
 	return Give()->session->get( 'give_errors' );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  * Register die handler for give_die()
127 127
  *
128 128
  * @since  1.0
129
- * @return void
129
+ * @return string|null
130 130
  */
131 131
 function _give_die_handler() {
132 132
 	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +47 added lines, -47 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
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function __construct()
33 33
 	{
34
-		$this->self = get_class( $this );
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook )
55
+	public function admin_widget_scripts($hook)
56 56
 	{
57 57
 		// Directories of assets
58
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
59
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
60
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
58
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
59
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
60
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
61 61
 
62 62
 		// Use minified libraries if SCRIPT_DEBUG is turned off
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65 65
 		// Widget Script
66
-		if ( $hook == 'widgets.php' ) {
66
+		if ($hook == 'widgets.php') {
67 67
 
68
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
68
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
69 69
 
70
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
70
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
71 71
 
72
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
72
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
73 73
 		}
74 74
 	}
75 75
 
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 *                        before_widget, and after_widget.
81 81
 	 * @param array $instance The settings for the particular instance of the widget.
82 82
 	 */
83
-	public function widget( $args, $instance )
83
+	public function widget($args, $instance)
84 84
 	{
85
-		extract( $args );
85
+		extract($args);
86 86
 
87
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
88
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
87
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
88
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
89 89
 
90 90
 		echo $before_widget;
91 91
 
92
-		do_action( 'give_before_forms_widget' );
92
+		do_action('give_before_forms_widget');
93 93
 
94
-		echo $title ? $before_title . $title . $after_title : '';
94
+		echo $title ? $before_title.$title.$after_title : '';
95 95
 
96
-		give_get_donation_form( $instance );
96
+		give_get_donation_form($instance);
97 97
 
98 98
 		echo $after_widget;
99 99
 
100
-		do_action( 'give_after_forms_widget' );
100
+		do_action('give_after_forms_widget');
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public function form( $instance )
110
+	public function form($instance)
111 111
 	{
112 112
 		$defaults = array(
113 113
 			'title'        => '',
@@ -115,51 +115,51 @@  discard block
 block discarded – undo
115 115
 			'float_labels' => '',
116 116
 		);
117 117
 
118
-		$instance = wp_parse_args( (array) $instance, $defaults );
118
+		$instance = wp_parse_args((array) $instance, $defaults);
119 119
 
120
-		extract( $instance );
120
+		extract($instance);
121 121
 
122 122
 		// Query Give Forms
123 123
 
124 124
 		$args = array(
125 125
 			'post_type'      => 'give_forms',
126
-			'posts_per_page' => - 1,
126
+			'posts_per_page' => -1,
127 127
 			'post_status'    => 'publish',
128 128
 		);
129 129
 
130
-		$give_forms = get_posts( $args );
130
+		$give_forms = get_posts($args);
131 131
 
132 132
 		// Widget: Title
133 133
 
134 134
 		?><p>
135
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label>
136
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" /><br>
137
-			<small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
135
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label>
136
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>" /><br>
137
+			<small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small>
138 138
 		</p><?php
139 139
 
140 140
 		// Widget: Give Form
141 141
 
142 142
 		?><p>
143
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php printf( __( 'Give %s:', 'give' ), give_get_forms_label_singular() ); ?></label>
144
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
145
-				<option value="current"><?php _e( '— Select —', 'give' ); ?></option>
146
-				<?php foreach ( $give_forms as $give_form ) { ?>
147
-					<option <?php selected( absint( $id ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
143
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php printf(__('Give %s:', 'give'), give_get_forms_label_singular()); ?></label>
144
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
145
+				<option value="current"><?php _e('— Select —', 'give'); ?></option>
146
+				<?php foreach ($give_forms as $give_form) { ?>
147
+					<option <?php selected(absint($id), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
148 148
 				<?php } ?>
149 149
 			</select><br>
150
-			<small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
150
+			<small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small>
151 151
 		</p><?php
152 152
 
153 153
 		// Widget: Floating Labels
154 154
 
155 155
 		?><p>
156
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label>
157
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
158
-				<option value="" <?php selected( esc_attr( $float_labels ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option>
159
-				<option value="enabled" <?php selected( esc_attr( $float_labels ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option>
160
-				<option value="disabled" <?php selected( esc_attr( $float_labels ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option>
156
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label>
157
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
158
+				<option value="" <?php selected(esc_attr($float_labels), '') ?>>– <?php _e('Select', 'give'); ?> –</option>
159
+				<option value="enabled" <?php selected(esc_attr($float_labels), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option>
160
+				<option value="disabled" <?php selected(esc_attr($float_labels), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option>
161 161
 			</select><br>
162
-			<small><?php printf( __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ); ?></small>
162
+			<small><?php printf(__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")); ?></small>
163 163
 		</p><?php
164 164
 	}
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	function widget_init()
172 172
 	{
173
-		register_widget( $this->self );
173
+		register_widget($this->self);
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return array
183 183
 	 */
184
-	public function update( $new_instance, $old_instance )
184
+	public function update($new_instance, $old_instance)
185 185
 	{
186 186
 		$this->flush_widget_cache();
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function flush_widget_cache()
197 197
 	{
198
-		wp_cache_delete( $this->self, 'widget' );
198
+		wp_cache_delete($this->self, 'widget');
199 199
 	}
200 200
 }
201 201
 
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 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,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
  * @return void
38 38
  */
39 39
 function give_load_ajax_gateway() {
40
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
-		do_action( 'give_purchase_form', $_POST['give_form_id'] );
40
+	if (isset($_POST['give_payment_mode'])) {
41
+		do_action('give_purchase_form', $_POST['give_form_id']);
42 42
 		exit();
43 43
 	}
44 44
 }
45 45
 
46
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
47
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
46
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
47
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
48 48
 
49 49
 /**
50 50
  * Sets an error on checkout if no gateways are enabled
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 function give_no_gateway_error() {
56 56
 	$gateways = give_get_enabled_payment_gateways();
57 57
 
58
-	if ( empty( $gateways ) ) {
59
-		give_set_error( 'no_gateways', __( 'You must enable a payment gateway to use Give', 'give' ) );
58
+	if (empty($gateways)) {
59
+		give_set_error('no_gateways', __('You must enable a payment gateway to use Give', 'give'));
60 60
 	} else {
61
-		give_unset_error( 'no_gateways' );
61
+		give_unset_error('no_gateways');
62 62
 	}
63 63
 }
64 64
 
65
-add_action( 'init', 'give_no_gateway_error' );
66 65
\ No newline at end of file
66
+add_action('init', 'give_no_gateway_error');
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@
 block discarded – undo
97 97
 
98 98
 	//Single Form settings varies compared to the Global default settings
99 99
 	if ( ! empty( $form_default ) &&
100
-	     $form_id !== null &&
101
-	     $default !== $form_default &&
102
-	     $form_default !== 'global' &&
103
-	     give_is_gateway_active( $form_default )
100
+		 $form_id !== null &&
101
+		 $default !== $form_default &&
102
+		 $form_default !== 'global' &&
103
+		 give_is_gateway_active( $form_default )
104 104
 	) {
105 105
 		$default = $form_default;
106 106
 	}
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 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
 
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
29
-			'supports'       => array( 'buy_now' )
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29
+			'supports'       => array('buy_now')
30 30
 		),
31 31
 		'manual' => array(
32
-			'admin_label'    => __( 'Test Payment', 'give' ),
33
-			'checkout_label' => __( 'Test Payment', 'give' )
32
+			'admin_label'    => __('Test Payment', 'give'),
33
+			'checkout_label' => __('Test Payment', 'give')
34 34
 		),
35 35
 	);
36 36
 
37
-	return apply_filters( 'give_payment_gateways', $gateways );
37
+	return apply_filters('give_payment_gateways', $gateways);
38 38
 
39 39
 }
40 40
 
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 
50 50
 	$gateways = give_get_payment_gateways();
51 51
 
52
-	$enabled = isset( $_POST['gateways'] )
52
+	$enabled = isset($_POST['gateways'])
53 53
 		? $_POST['gateways']
54
-		: ( isset( $give_options['gateways'] ) ? $give_options['gateways'] : false );
54
+		: (isset($give_options['gateways']) ? $give_options['gateways'] : false);
55 55
 
56 56
 	$gateway_list = array();
57 57
 
58
-	foreach ( $gateways as $key => $gateway ) {
59
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
60
-			$gateway_list[ $key ] = $gateway;
58
+	foreach ($gateways as $key => $gateway) {
59
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
60
+			$gateway_list[$key] = $gateway;
61 61
 		}
62 62
 	}
63 63
 
64 64
 	// Set order of payment gateway in list.
65
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
65
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
66 66
 
67
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list );
67
+	return apply_filters('give_enabled_payment_gateways', $gateway_list);
68 68
 }
69 69
 
70 70
 /**
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @return boolean true if enabled, false otherwise
78 78
  */
79
-function give_is_gateway_active( $gateway ) {
79
+function give_is_gateway_active($gateway) {
80 80
 	$gateways = give_get_enabled_payment_gateways();
81 81
 
82
-	$ret = array_key_exists( $gateway, $gateways );
82
+	$ret = array_key_exists($gateway, $gateways);
83 83
 
84
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
84
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
85 85
 }
86 86
 
87 87
 /**
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
  *
95 95
  * @return string Gateway ID
96 96
  */
97
-function give_get_default_gateway( $form_id ) {
97
+function give_get_default_gateway($form_id) {
98 98
 
99 99
 	global $give_options;
100 100
 
101
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
102
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
101
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
102
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
103 103
 
104 104
 	//Single Form settings varies compared to the Global default settings
105
-	if ( ! empty( $form_default ) &&
105
+	if ( ! empty($form_default) &&
106 106
 	     $form_id !== null &&
107 107
 	     $default !== $form_default &&
108 108
 	     $form_default !== 'global' &&
109
-	     give_is_gateway_active( $form_default )
109
+	     give_is_gateway_active($form_default)
110 110
 	) {
111 111
 		$default = $form_default;
112 112
 	}
113 113
 
114
-	return apply_filters( 'give_default_gateway', $default );
114
+	return apply_filters('give_default_gateway', $default);
115 115
 }
116 116
 
117 117
 /**
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return string Gateway admin label
125 125
  */
126
-function give_get_gateway_admin_label( $gateway ) {
126
+function give_get_gateway_admin_label($gateway) {
127 127
 	$gateways = give_get_enabled_payment_gateways();
128
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
129
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
128
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
129
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
130 130
 
131
-	if ( $gateway == 'manual' && $payment ) {
132
-		if ( give_get_payment_amount( $payment ) == 0 ) {
133
-			$label = __( 'Test Donation', 'give' );
131
+	if ($gateway == 'manual' && $payment) {
132
+		if (give_get_payment_amount($payment) == 0) {
133
+			$label = __('Test Donation', 'give');
134 134
 		}
135 135
 	}
136 136
 
137
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
137
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
138 138
 }
139 139
 
140 140
 /**
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return string Checkout label for the gateway
148 148
  */
149
-function give_get_gateway_checkout_label( $gateway ) {
149
+function give_get_gateway_checkout_label($gateway) {
150 150
 	$gateways = give_get_enabled_payment_gateways();
151
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
151
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
152 152
 
153
-	if ( $gateway == 'manual' ) {
154
-		$label = __( 'Test Donation', 'give' );
153
+	if ($gateway == 'manual') {
154
+		$label = __('Test Donation', 'give');
155 155
 	}
156 156
 
157
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
157
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
158 158
 }
159 159
 
160 160
 /**
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @return array Options the gateway supports
168 168
  */
169
-function give_get_gateway_supports( $gateway ) {
169
+function give_get_gateway_supports($gateway) {
170 170
 	$gateways = give_get_enabled_payment_gateways();
171
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
171
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
172 172
 
173
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
173
+	return apply_filters('give_gateway_supports', $supports, $gateway);
174 174
 }
175 175
 
176 176
 /**
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return bool
184 184
  */
185
-function give_gateway_supports_buy_now( $gateway ) {
186
-	$supports = give_get_gateway_supports( $gateway );
187
-	$ret      = in_array( 'buy_now', $supports );
185
+function give_gateway_supports_buy_now($gateway) {
186
+	$supports = give_get_gateway_supports($gateway);
187
+	$ret      = in_array('buy_now', $supports);
188 188
 
189
-	return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway );
189
+	return apply_filters('give_gateway_supports_buy_now', $ret, $gateway);
190 190
 }
191 191
 
192 192
 /**
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
 	$gateways = give_get_enabled_payment_gateways();
200 200
 	$ret      = false;
201 201
 
202
-	if ( $gateways ) {
203
-		foreach ( $gateways as $gateway_id => $gateway ) {
204
-			if ( give_gateway_supports_buy_now( $gateway_id ) ) {
202
+	if ($gateways) {
203
+		foreach ($gateways as $gateway_id => $gateway) {
204
+			if (give_gateway_supports_buy_now($gateway_id)) {
205 205
 				$ret = true;
206 206
 				break;
207 207
 			}
208 208
 		}
209 209
 	}
210 210
 
211
-	return apply_filters( 'give_give_supports_buy_now', $ret );
211
+	return apply_filters('give_give_supports_buy_now', $ret);
212 212
 }
213 213
 
214 214
 /**
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return void
223 223
  */
224
-function give_send_to_gateway( $gateway, $payment_data ) {
224
+function give_send_to_gateway($gateway, $payment_data) {
225 225
 
226
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
226
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
227 227
 
228 228
 	// $gateway must match the ID used when registering the gateway
229
-	do_action( 'give_gateway_' . $gateway, $payment_data );
229
+	do_action('give_gateway_'.$gateway, $payment_data);
230 230
 }
231 231
 
232 232
 
@@ -243,32 +243,32 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return string $enabled_gateway The slug of the gateway
245 245
  */
246
-function give_get_chosen_gateway( $form_id ) {
246
+function give_get_chosen_gateway($form_id) {
247 247
 	$gateways        = give_get_enabled_payment_gateways();
248
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
249
-	if ( empty( $request_form_id ) ) {
250
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
248
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
249
+	if (empty($request_form_id)) {
250
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
251 251
 	}
252
-	$chosen          = give_get_default_gateway( $form_id );
252
+	$chosen          = give_get_default_gateway($form_id);
253 253
 	$enabled_gateway = '';
254 254
 
255 255
 	//Take into account request Form ID args
256
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
256
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
257 257
 		$chosen = $_REQUEST['payment-mode'];
258 258
 	}
259 259
 
260
-	if ( $chosen ) {
261
-		$enabled_gateway = urldecode( $chosen );
262
-	} else if ( count( $gateways ) >= 1 && ! $chosen ) {
263
-		foreach ( $gateways as $gateway_id => $gateway ):
260
+	if ($chosen) {
261
+		$enabled_gateway = urldecode($chosen);
262
+	} else if (count($gateways) >= 1 && ! $chosen) {
263
+		foreach ($gateways as $gateway_id => $gateway):
264 264
 			$enabled_gateway = $gateway_id;
265 265
 		endforeach;
266 266
 	} else {
267
-		$enabled_gateway = give_get_default_gateway( $form_id );
267
+		$enabled_gateway = give_get_default_gateway($form_id);
268 268
 	}
269 269
 
270 270
 
271
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
271
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
272 272
 }
273 273
 
274 274
 /**
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
  *
286 286
  * @return int ID of the new log entry
287 287
  */
288
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
289
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
288
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
289
+	return give_record_log($title, $message, $parent, 'gateway_error');
290 290
 }
291 291
 
292 292
 /**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  *
300 300
  * @return int
301 301
  */
302
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
302
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
303 303
 
304 304
 	$ret  = 0;
305 305
 	$args = array(
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 		'fields'      => 'ids'
312 312
 	);
313 313
 
314
-	$payments = new WP_Query( $args );
314
+	$payments = new WP_Query($args);
315 315
 
316
-	if ( $payments ) {
316
+	if ($payments) {
317 317
 		$ret = $payments->post_count;
318 318
 	}
319 319
 
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
  *
331 331
  * @return array $gateways All the available gateways
332 332
  */
333
-function give_get_ordered_payment_gateways( $gateways ) {
333
+function give_get_ordered_payment_gateways($gateways) {
334 334
 
335 335
 	//  Get gateways setting.
336
-	$gateways_setting = give_get_option( 'gateways' );
336
+	$gateways_setting = give_get_option('gateways');
337 337
 	
338 338
 	// Return from here if we do not have gateways setting.
339
-	if ( empty( $gateways_setting ) ) {
339
+	if (empty($gateways_setting)) {
340 340
 		return $gateways;
341 341
 	}
342 342
 
343 343
 	// Reverse array to order payment gateways.
344
-	$gateways_setting = array_reverse( $gateways_setting );
344
+	$gateways_setting = array_reverse($gateways_setting);
345 345
 
346 346
 	// Reorder gateways array
347
-	foreach ( $gateways_setting as $gateway_key => $value ) {
347
+	foreach ($gateways_setting as $gateway_key => $value) {
348 348
 
349
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
350
-		unset( $gateways[ $gateway_key ] );
351
-		$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
349
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
350
+		unset($gateways[$gateway_key]);
351
+		$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
352 352
 	}
353 353
 
354 354
 	/**
@@ -358,5 +358,5 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param array $gateways All the available gateways
360 360
 	 */
361
-	return apply_filters( 'give_payment_gateways_order', $gateways );
361
+	return apply_filters('give_payment_gateways_order', $gateways);
362 362
 }
Please login to merge, or discard this patch.
includes/login-register.php 1 patch
Spacing   +59 added lines, -59 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
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string Login form
27 27
  */
28
-function give_login_form( $redirect = '' ) {
28
+function give_login_form($redirect = '') {
29 29
 	global $give_options, $give_login_redirect;
30 30
 
31
-	if ( empty( $redirect ) ) {
31
+	if (empty($redirect)) {
32 32
 		$redirect = give_get_current_page_url();
33 33
 	}
34 34
 
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	ob_start();
38 38
 
39
-	give_get_template_part( 'shortcode', 'login' );
39
+	give_get_template_part('shortcode', 'login');
40 40
 
41
-	return apply_filters( 'give_login_form', ob_get_clean() );
41
+	return apply_filters('give_login_form', ob_get_clean());
42 42
 }
43 43
 
44 44
 /**
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return string Register form
54 54
  */
55
-function give_register_form( $redirect = '' ) {
55
+function give_register_form($redirect = '') {
56 56
 	global $give_options, $give_register_redirect;
57 57
 
58
-	if ( empty( $redirect ) ) {
58
+	if (empty($redirect)) {
59 59
 		$redirect = give_get_current_page_url();
60 60
 	}
61 61
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
 	ob_start();
65 65
 
66
-	if ( ! is_user_logged_in() ) {
67
-		give_get_template_part( 'shortcode', 'register' );
66
+	if ( ! is_user_logged_in()) {
67
+		give_get_template_part('shortcode', 'register');
68 68
 	}
69 69
 
70
-	return apply_filters( 'give_register_form', ob_get_clean() );
70
+	return apply_filters('give_register_form', ob_get_clean());
71 71
 }
72 72
 
73 73
 /**
@@ -79,34 +79,34 @@  discard block
 block discarded – undo
79 79
  *
80 80
  * @return void
81 81
  */
82
-function give_process_login_form( $data ) {
83
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
84
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
85
-		if ( ! $user_data ) {
86
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
82
+function give_process_login_form($data) {
83
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
84
+		$user_data = get_user_by('login', $data['give_user_login']);
85
+		if ( ! $user_data) {
86
+			$user_data = get_user_by('email', $data['give_user_login']);
87 87
 		}
88
-		if ( $user_data ) {
88
+		if ($user_data) {
89 89
 			$user_ID    = $user_data->ID;
90 90
 			$user_email = $user_data->user_email;
91
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
92
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
91
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
92
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
93 93
 			} else {
94
-				give_set_error( 'password_incorrect', __( 'The password you entered is incorrect', 'give' ) );
94
+				give_set_error('password_incorrect', __('The password you entered is incorrect', 'give'));
95 95
 			}
96 96
 		} else {
97
-			give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) );
97
+			give_set_error('username_incorrect', __('The username you entered does not exist', 'give'));
98 98
 		}
99 99
 		// Check for errors and redirect if none present
100 100
 		$errors = give_get_errors();
101
-		if ( ! $errors ) {
102
-			$redirect = apply_filters( 'give_login_redirect', $data['give_redirect'], $user_ID );
103
-			wp_redirect( $redirect );
101
+		if ( ! $errors) {
102
+			$redirect = apply_filters('give_login_redirect', $data['give_redirect'], $user_ID);
103
+			wp_redirect($redirect);
104 104
 			give_die();
105 105
 		}
106 106
 	}
107 107
 }
108 108
 
109
-add_action( 'give_user_login', 'give_process_login_form' );
109
+add_action('give_user_login', 'give_process_login_form');
110 110
 
111 111
 /**
112 112
  * Log User In
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
  *
120 120
  * @return void
121 121
  */
122
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
123
-	if ( $user_id < 1 ) {
122
+function give_log_user_in($user_id, $user_login, $user_pass) {
123
+	if ($user_id < 1) {
124 124
 		return;
125 125
 	}
126 126
 
127
-	wp_set_auth_cookie( $user_id );
128
-	wp_set_current_user( $user_id, $user_login );
129
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
130
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
127
+	wp_set_auth_cookie($user_id);
128
+	wp_set_current_user($user_id, $user_login);
129
+	do_action('wp_login', $user_login, get_userdata($user_id));
130
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
131 131
 }
132 132
 
133 133
 
@@ -140,70 +140,70 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_process_register_form( $data ) {
143
+function give_process_register_form($data) {
144 144
 
145
-	if ( is_user_logged_in() ) {
145
+	if (is_user_logged_in()) {
146 146
 		return;
147 147
 	}
148 148
 
149
-	if ( empty( $_POST['give_register_submit'] ) ) {
149
+	if (empty($_POST['give_register_submit'])) {
150 150
 		return;
151 151
 	}
152 152
 
153
-	do_action( 'give_pre_process_register_form' );
153
+	do_action('give_pre_process_register_form');
154 154
 
155
-	if ( empty( $data['give_user_login'] ) ) {
156
-		give_set_error( 'empty_username', __( 'Invalid username', 'give' ) );
155
+	if (empty($data['give_user_login'])) {
156
+		give_set_error('empty_username', __('Invalid username', 'give'));
157 157
 	}
158 158
 
159
-	if ( username_exists( $data['give_user_login'] ) ) {
160
-		give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) );
159
+	if (username_exists($data['give_user_login'])) {
160
+		give_set_error('username_unavailable', __('Username already taken', 'give'));
161 161
 	}
162 162
 
163
-	if ( ! validate_username( $data['give_user_login'] ) ) {
164
-		give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) );
163
+	if ( ! validate_username($data['give_user_login'])) {
164
+		give_set_error('username_invalid', __('Invalid username', 'give'));
165 165
 	}
166 166
 
167
-	if ( email_exists( $data['give_user_email'] ) ) {
168
-		give_set_error( 'email_unavailable', __( 'Email address already taken', 'give' ) );
167
+	if (email_exists($data['give_user_email'])) {
168
+		give_set_error('email_unavailable', __('Email address already taken', 'give'));
169 169
 	}
170 170
 
171
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
172
-		give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
171
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
172
+		give_set_error('email_invalid', __('Invalid email', 'give'));
173 173
 	}
174 174
 
175
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
176
-		give_set_error( 'payment_email_invalid', __( 'Invalid payment email', 'give' ) );
175
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
176
+		give_set_error('payment_email_invalid', __('Invalid payment email', 'give'));
177 177
 	}
178 178
 
179
-	if ( empty( $_POST['give_user_pass'] ) ) {
180
-		give_set_error( 'empty_password', __( 'Please enter a password', 'give' ) );
179
+	if (empty($_POST['give_user_pass'])) {
180
+		give_set_error('empty_password', __('Please enter a password', 'give'));
181 181
 	}
182 182
 
183
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
184
-		give_set_error( 'password_mismatch', __( 'Passwords do not match', 'give' ) );
183
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
184
+		give_set_error('password_mismatch', __('Passwords do not match', 'give'));
185 185
 	}
186 186
 
187
-	do_action( 'give_process_register_form' );
187
+	do_action('give_process_register_form');
188 188
 
189 189
 	// Check for errors and redirect if none present
190 190
 	$errors = give_get_errors();
191 191
 
192
-	if ( empty( $errors ) ) {
192
+	if (empty($errors)) {
193 193
 
194
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
194
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
195 195
 
196
-		give_register_and_login_new_user( array(
196
+		give_register_and_login_new_user(array(
197 197
 			'user_login'      => $data['give_user_login'],
198 198
 			'user_pass'       => $data['give_user_pass'],
199 199
 			'user_email'      => $data['give_user_email'],
200
-			'user_registered' => date( 'Y-m-d H:i:s' ),
201
-			'role'            => get_option( 'default_role' )
202
-		) );
200
+			'user_registered' => date('Y-m-d H:i:s'),
201
+			'role'            => get_option('default_role')
202
+		));
203 203
 
204
-		wp_redirect( $redirect );
204
+		wp_redirect($redirect);
205 205
 		give_die();
206 206
 	}
207 207
 }
208 208
 
209
-add_action( 'give_user_register', 'give_process_register_form' );
210 209
\ No newline at end of file
210
+add_action('give_user_register', 'give_process_register_form');
211 211
\ No newline at end of file
Please login to merge, or discard this patch.