Completed
Pull Request — master (#420)
by Valerio
05:57
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 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Email Actions
4
- *
5
- * @package     Give
6
- * @subpackage  Emails
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Email Actions
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Emails
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this 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 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Emails
4
- *
5
- * This class handles all emails sent through Give
6
- *
7
- * @package     Give
8
- * @subpackage  Classes/Emails
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.1.php GNU Public License
11
- * @since       1.0
12
- */
3
+		 * Emails
4
+		 *
5
+		 * This class handles all emails sent through Give
6
+		 *
7
+		 * @package     Give
8
+		 * @subpackage  Classes/Emails
9
+		 * @copyright   Copyright (c) 2015, WordImpress
10
+		 * @license     http://opensource.org/licenses/gpl-2.1.php GNU Public License
11
+		 * @since       1.0
12
+		 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this 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/emails/functions.php 1 patch
Spacing   +78 added lines, -78 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,39 +24,39 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return void
26 26
  */
27
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
27
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
28 28
 
29
-	$payment_data = give_get_payment_meta( $payment_id );
29
+	$payment_data = give_get_payment_meta($payment_id);
30 30
 
31
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
32
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
31
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
32
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
33 33
 
34
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
35
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
34
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
35
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
36 36
 
37
-	$to_email = give_get_payment_user_email( $payment_id );
37
+	$to_email = give_get_payment_user_email($payment_id);
38 38
 
39
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
40
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
41
-	$subject = give_do_email_tags( $subject, $payment_id );
39
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
40
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
41
+	$subject = give_do_email_tags($subject, $payment_id);
42 42
 
43
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
44
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
43
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
44
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
45 45
 
46 46
 	$emails = Give()->emails;
47 47
 
48
-	$emails->__set( 'from_name', $from_name );
49
-	$emails->__set( 'from_email', $from_email );
50
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
48
+	$emails->__set('from_name', $from_name);
49
+	$emails->__set('from_email', $from_email);
50
+	$emails->__set('heading', __('Donation Receipt', 'give'));
51 51
 
52 52
 
53
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
54
-	$emails->__set( 'headers', $headers );
53
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
54
+	$emails->__set('headers', $headers);
55 55
 
56
-	$emails->send( $to_email, $subject, $message, $attachments );
56
+	$emails->send($to_email, $subject, $message, $attachments);
57 57
 
58
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
59
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
58
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
59
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
60 60
 	}
61 61
 }
62 62
 
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
  */
70 70
 function give_email_test_donation_receipt() {
71 71
 
72
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
73
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
72
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
73
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
74 74
 
75
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
76
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
75
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
76
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
77 77
 
78
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
79
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
80
-	$subject = give_do_email_tags( $subject, 0 );
78
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
79
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
80
+	$subject = give_do_email_tags($subject, 0);
81 81
 
82
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
82
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
83 83
 
84
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ), 0 );
84
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()), 0);
85 85
 
86 86
 	$emails = Give()->emails;
87
-	$emails->__set( 'from_name', $from_name );
88
-	$emails->__set( 'from_email', $from_email );
89
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
87
+	$emails->__set('from_name', $from_name);
88
+	$emails->__set('from_email', $from_email);
89
+	$emails->__set('heading', __('Donation Receipt', 'give'));
90 90
 
91
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
92
-	$emails->__set( 'headers', $headers );
91
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
92
+	$emails->__set('headers', $headers);
93 93
 
94
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
94
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
95 95
 
96 96
 }
97 97
 
@@ -105,49 +105,49 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return void
107 107
  */
108
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
108
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
109 109
 
110
-	$payment_id = absint( $payment_id );
110
+	$payment_id = absint($payment_id);
111 111
 
112
-	if ( empty( $payment_id ) ) {
112
+	if (empty($payment_id)) {
113 113
 		return;
114 114
 	}
115 115
 
116
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
116
+	if ( ! give_get_payment_by('id', $payment_id)) {
117 117
 		return;
118 118
 	}
119 119
 
120
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
121
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
120
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
121
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
122 122
 
123
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
124
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
123
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
124
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
125 125
 
126
-	$subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%1$s', 'give' ), $payment_id ) );
127
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
128
-	$subject = give_do_email_tags( $subject, $payment_id );
126
+	$subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%1$s', 'give'), $payment_id));
127
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
128
+	$subject = give_do_email_tags($subject, $payment_id);
129 129
 
130
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
131
-	$headers .= "Reply-To: " . $from_email . "\r\n";
130
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
131
+	$headers .= "Reply-To: ".$from_email."\r\n";
132 132
 	//$headers  .= "MIME-Version: 1.0\r\n";
133 133
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
134
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
134
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
135 135
 
136
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
136
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
137 137
 
138
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
138
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
139 139
 
140 140
 	$emails = Give()->emails;
141
-	$emails->__set( 'from_name', $from_name );
142
-	$emails->__set( 'from_email', $from_email );
143
-	$emails->__set( 'headers', $headers );
144
-	$emails->__set( 'heading', __( 'New Donation!', 'give' ) );
141
+	$emails->__set('from_name', $from_name);
142
+	$emails->__set('from_email', $from_email);
143
+	$emails->__set('headers', $headers);
144
+	$emails->__set('heading', __('New Donation!', 'give'));
145 145
 
146
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
146
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
147 147
 
148 148
 }
149 149
 
150
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
150
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
151 151
 
152 152
 /**
153 153
  * Retrieves the emails for which admin notifications are sent to (these can be
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 function give_get_admin_notice_emails() {
161 161
 	global $give_options;
162 162
 
163
-	$emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' );
164
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
163
+	$emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email');
164
+	$emails = array_map('trim', explode("\n", $emails));
165 165
 
166
-	return apply_filters( 'give_admin_notice_emails', $emails );
166
+	return apply_filters('give_admin_notice_emails', $emails);
167 167
 }
168 168
 
169 169
 /**
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return mixed
177 177
  */
178
-function give_admin_notices_disabled( $payment_id = 0 ) {
178
+function give_admin_notices_disabled($payment_id = 0) {
179 179
 	global $give_options;
180
-	$retval = isset( $give_options['disable_admin_notices'] );
180
+	$retval = isset($give_options['disable_admin_notices']);
181 181
 
182
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
182
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
183 183
 }
184 184
 
185 185
 /**
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 function give_get_default_donation_notification_email() {
194 194
 	global $give_options;
195 195
 
196
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
197
-	$default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n";
198
-	$default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n";
199
-	$default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n";
200
-	$default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n";
201
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}';
196
+	$default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
197
+	$default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n";
198
+	$default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n";
199
+	$default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n";
200
+	$default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n";
201
+	$default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}';
202 202
 
203
-	$message = ( isset( $give_options['donation_notification'] ) && ! empty( $give_options['donation_notification'] ) ) ? $give_options['donation_notification'] : $default_email_body;
203
+	$message = (isset($give_options['donation_notification']) && ! empty($give_options['donation_notification'])) ? $give_options['donation_notification'] : $default_email_body;
204 204
 
205 205
 	return $message;
206 206
 }
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @return array $email_names
216 216
  */
217
-function give_get_email_names( $user_info ) {
217
+function give_get_email_names($user_info) {
218 218
 	$email_names = array();
219
-	$user_info   = maybe_unserialize( $user_info );
219
+	$user_info   = maybe_unserialize($user_info);
220 220
 
221 221
 	$email_names['fullname'] = '';
222
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
223
-		$user_data               = get_userdata( $user_info['id'] );
222
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
223
+		$user_data               = get_userdata($user_info['id']);
224 224
 		$email_names['name']     = $user_info['first_name'];
225
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
225
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
226 226
 		$email_names['username'] = $user_data->user_login;
227
-	} elseif ( isset( $user_info['first_name'] ) ) {
227
+	} elseif (isset($user_info['first_name'])) {
228 228
 		$email_names['name']     = $user_info['first_name'];
229
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
229
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
230 230
 		$email_names['username'] = $user_info['first_name'];
231 231
 	} else {
232 232
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/emails/template.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Email Template
4
- *
5
- * @package     Give
6
- * @subpackage  Emails
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Email Template
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Emails
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -55,37 +55,37 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @return string $message Fully formatted message
57 57
  */
58
-function give_email_preview_template_tags( $message ) {
58
+function give_email_preview_template_tags($message) {
59 59
 	global $give_options;
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$notes = __( 'These are some sample notes added to a donation.', 'give' );
67
+	$notes = __('These are some sample notes added to a donation.', 'give');
68 68
 
69
-	$payment_id = rand( 1, 100 );
69
+	$payment_id = rand(1, 100);
70 70
 
71 71
 	$user = wp_get_current_user();
72 72
 
73
-	$message = str_replace( '{name}', $user->display_name, $message );
74
-	$message = str_replace( '{fullname}', $user->display_name, $message );
75
-	$message = str_replace( '{username}', $user->user_login, $message );
76
-	$message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message );
77
-	$message = str_replace( '{price}', $price, $message );
78
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
79
-	$message = str_replace( '{payment_method}', $gateway, $message );
80
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
81
-	$message = str_replace( '{product_notes}', $notes, $message );
82
-	$message = str_replace( '{payment_id}', $payment_id, $message );
83
-	$message = str_replace( '{receipt_link}', sprintf( __( '%1$sView it in your browser.%2$s', 'give' ), '<a href="' . esc_url( add_query_arg( array(
73
+	$message = str_replace('{name}', $user->display_name, $message);
74
+	$message = str_replace('{fullname}', $user->display_name, $message);
75
+	$message = str_replace('{username}', $user->user_login, $message);
76
+	$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
77
+	$message = str_replace('{price}', $price, $message);
78
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
79
+	$message = str_replace('{payment_method}', $gateway, $message);
80
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
81
+	$message = str_replace('{product_notes}', $notes, $message);
82
+	$message = str_replace('{payment_id}', $payment_id, $message);
83
+	$message = str_replace('{receipt_link}', sprintf(__('%1$sView it in your browser.%2$s', 'give'), '<a href="'.esc_url(add_query_arg(array(
84 84
 			'payment_key' => $receipt_id,
85 85
 			'give_action' => 'view_receipt'
86
-		), home_url() ) ) . '">', '</a>' ), $message );
86
+		), home_url())).'">', '</a>'), $message);
87 87
 
88
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
88
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
89 89
 }
90 90
 
91 91
 /**
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
  * @since  1.0
99 99
  * @return array|bool
100 100
  */
101
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
101
+add_filter('give_settings_emails', 'give_email_template_preview');
102 102
 
103
-function give_email_template_preview( $array ) {
103
+function give_email_template_preview($array) {
104 104
 
105
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
105
+	if ( ! current_user_can('manage_give_settings')) {
106 106
 		return false;
107 107
 	}
108 108
 	$custom_field = array(
109
-		'name' => __( 'Preview Email', 'give' ),
110
-		'desc' => __( 'Click the buttons to preview emails.', 'give' ),
109
+		'name' => __('Preview Email', 'give'),
110
+		'desc' => __('Click the buttons to preview emails.', 'give'),
111 111
 		'id'   => 'give_email_preview_buttons',
112 112
 		'type' => 'email_preview_buttons'
113 113
 	);
114
-	array_splice( $array, 5, 0, array( $custom_field ) );
114
+	array_splice($array, 5, 0, array($custom_field));
115 115
 
116 116
 	return $array; // splice in at position 3;
117 117
 }
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 function give_email_preview_buttons_callback() {
128 128
 	ob_start();
129 129
 	?>
130
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php _e( 'Donation Receipt Preview', 'give' ); ?> "><?php _e( 'Preview Donation Receipt', 'give' ); ?></a>
131
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
130
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php _e('Donation Receipt Preview', 'give'); ?> "><?php _e('Preview Donation Receipt', 'give'); ?></a>
131
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
132 132
 		'give_action'  => 'send_test_email',
133 133
 		'give-message' => 'sent-test-email'
134
-	) ), 'give-test-email' ); ?>" title="<?php _e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php _e( 'Send Test Email', 'give' ); ?></a>
134
+	)), 'give-test-email'); ?>" title="<?php _e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php _e('Send Test Email', 'give'); ?></a>
135 135
 	<?php
136 136
 	echo ob_get_clean();
137 137
 }
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function give_display_email_template_preview() {
146 146
 
147
-	if ( empty( $_GET['give_action'] ) ) {
147
+	if (empty($_GET['give_action'])) {
148 148
 		return;
149 149
 	}
150 150
 
151
-	if ( 'preview_email' !== $_GET['give_action'] ) {
151
+	if ('preview_email' !== $_GET['give_action']) {
152 152
 		return;
153 153
 	}
154 154
 
155
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
155
+	if ( ! current_user_can('manage_give_settings')) {
156 156
 		return;
157 157
 	}
158 158
 
159
-	Give()->emails->heading = __( 'Donation Receipt', 'give' );
159
+	Give()->emails->heading = __('Donation Receipt', 'give');
160 160
 
161
-	echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) );
161
+	echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array())));
162 162
 
163 163
 	exit;
164 164
 
165 165
 }
166 166
 
167
-add_action( 'template_redirect', 'give_display_email_template_preview' );
167
+add_action('template_redirect', 'give_display_email_template_preview');
168 168
 
169 169
 /**
170 170
  * Email Template Body
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
  *
177 177
  * @return string $email_body Body of the email
178 178
  */
179
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
179
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
180 180
 	global $give_options;
181 181
 
182
-	$default_email_body = __( "Dear", "give" ) . " {name},\n\n";
183
-	$default_email_body .= __( "Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give" ) . "\n\n" . '{receipt_link}';
182
+	$default_email_body = __("Dear", "give")." {name},\n\n";
183
+	$default_email_body .= __("Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give")."\n\n".'{receipt_link}';
184 184
 	$default_email_body .= "\n\nSincerely,\n{sitename}";
185 185
 
186
-	$email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body;
186
+	$email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body;
187 187
 
188
-	$email_body = wpautop( $email );
188
+	$email_body = wpautop($email);
189 189
 
190
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
190
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
191 191
 
192
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
192
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
193 193
 }
194 194
 
195 195
 /**
@@ -202,37 +202,37 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string $email_body Body of the email
204 204
  */
205
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
205
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
206 206
 	global $give_options;
207 207
 
208
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
209
-	$email     = give_get_payment_user_email( $payment_id );
208
+	$user_info = maybe_unserialize($payment_data['user_info']);
209
+	$email     = give_get_payment_user_email($payment_id);
210 210
 
211
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
212
-		$user_data = get_userdata( $user_info['id'] );
211
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
212
+		$user_data = get_userdata($user_info['id']);
213 213
 		$name      = $user_data->display_name;
214
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
215
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
214
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
215
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
216 216
 	} else {
217 217
 		$name = $email;
218 218
 	}
219 219
 
220
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
220
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
221 221
 
222
-	$default_email_body = __( 'Hello', 'give' ) . "\n\n" . __( 'A donation has been made', 'give' ) . ".\n\n";
223
-	$default_email_body .= sprintf( __( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n";
222
+	$default_email_body = __('Hello', 'give')."\n\n".__('A donation has been made', 'give').".\n\n";
223
+	$default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n";
224 224
 
225
-	$default_email_body .= __( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
226
-	$default_email_body .= __( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
227
-	$default_email_body .= __( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n";
225
+	$default_email_body .= __('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
226
+	$default_email_body .= __('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
227
+	$default_email_body .= __('Payment Method: ', 'give')." ".$gateway."\n\n";
228 228
 
229
-	$default_email_body .= __( 'Thank you', 'give' );
229
+	$default_email_body .= __('Thank you', 'give');
230 230
 
231
-	$email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body;
231
+	$email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body;
232 232
 
233
-	$email_body = give_do_email_tags( $email, $payment_id );
233
+	$email_body = give_do_email_tags($email, $payment_id);
234 234
 
235
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
235
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
236 236
 }
237 237
 
238 238
 /**
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
  * @since  1.0
246 246
  */
247 247
 function give_render_receipt_in_browser() {
248
-	if ( ! isset( $_GET['payment_key'] ) ) {
249
-		wp_die( __( 'Missing donation key.', 'give' ), __( 'Error', 'give' ) );
248
+	if ( ! isset($_GET['payment_key'])) {
249
+		wp_die(__('Missing donation key.', 'give'), __('Error', 'give'));
250 250
 	}
251 251
 
252
-	$key = urlencode( $_GET['payment_key'] );
252
+	$key = urlencode($_GET['payment_key']);
253 253
 
254 254
 	ob_start();
255 255
 	//Disallows caching of the page
256
-	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
256
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
257 257
 	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
258 258
 	header("Cache-Control: post-check=0, pre-check=0", false);
259 259
 	header("Pragma: no-cache"); // HTTP/1.0
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	<!DOCTYPE html>
263 263
 	<html lang="en">
264 264
 		<head>
265
-			<title><?php _e( 'Donation Receipt', 'give' ); ?></title>
265
+			<title><?php _e('Donation Receipt', 'give'); ?></title>
266 266
 			<meta charset="utf-8" />
267 267
 
268 268
 			<!-- Further disallowing of caching of this page -->
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 
277 277
 			<?php wp_head(); ?>
278 278
 		</head>
279
-		<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
279
+		<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
280 280
 
281 281
 			<div id="give_receipt_wrapper">
282
-				<?php do_action( 'give_render_receipt_in_browser_before' ); ?>
283
-				<?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?>
284
-				<?php do_action( 'give_render_receipt_in_browser_after' ); ?>
282
+				<?php do_action('give_render_receipt_in_browser_before'); ?>
283
+				<?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?>
284
+				<?php do_action('give_render_receipt_in_browser_after'); ?>
285 285
 			</div>
286 286
 
287 287
 			<?php wp_footer(); ?>
@@ -292,4 +292,4 @@  discard block
 block discarded – undo
292 292
 	die();
293 293
 }
294 294
 
295
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
295
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
Please login to merge, or discard this patch.
includes/error-tracking.php 1 patch
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.
includes/formatting.php 2 patches
Spacing   +65 added lines, -65 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,37 +25,37 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string $amount Newly sanitized amount
27 27
  */
28
-function give_sanitize_amount( $amount ) {
28
+function give_sanitize_amount($amount) {
29 29
 	$is_negative   = false;
30
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
31
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
30
+	$thousands_sep = give_get_option('thousands_separator', ',');
31
+	$decimal_sep   = give_get_option('decimal_separator', '.');
32 32
 
33 33
 	// Sanitize the amount
34
-	if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
35
-		if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
36
-			$amount = str_replace( $thousands_sep, '', $amount );
37
-		} elseif ( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
38
-			$amount = str_replace( '.', '', $amount );
34
+	if ($decimal_sep == ',' && false !== ($found = strpos($amount, $decimal_sep))) {
35
+		if (($thousands_sep == '.' || $thousands_sep == ' ') && false !== ($found = strpos($amount, $thousands_sep))) {
36
+			$amount = str_replace($thousands_sep, '', $amount);
37
+		} elseif (empty($thousands_sep) && false !== ($found = strpos($amount, '.'))) {
38
+			$amount = str_replace('.', '', $amount);
39 39
 		}
40 40
 
41
-		$amount = str_replace( $decimal_sep, '.', $amount );
42
-	} elseif ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
43
-		$amount = str_replace( $thousands_sep, '', $amount );
41
+		$amount = str_replace($decimal_sep, '.', $amount);
42
+	} elseif ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
43
+		$amount = str_replace($thousands_sep, '', $amount);
44 44
 	}
45 45
 
46
-	if ( $amount < 0 ) {
46
+	if ($amount < 0) {
47 47
 		$is_negative = true;
48 48
 	}
49 49
 
50
-	$amount   = preg_replace( '/[^0-9\.]/', '', $amount );
51
-	$decimals = apply_filters( 'give_sanitize_amount_decimals', 2, $amount );
52
-	$amount   = number_format( (double) $amount, $decimals, '.', '' );
50
+	$amount   = preg_replace('/[^0-9\.]/', '', $amount);
51
+	$decimals = apply_filters('give_sanitize_amount_decimals', 2, $amount);
52
+	$amount   = number_format((double) $amount, $decimals, '.', '');
53 53
 
54
-	if ( $is_negative ) {
54
+	if ($is_negative) {
55 55
 		$amount *= - 1;
56 56
 	}
57 57
 
58
-	return apply_filters( 'give_sanitize_amount', $amount );
58
+	return apply_filters('give_sanitize_amount', $amount);
59 59
 }
60 60
 
61 61
 /**
@@ -68,47 +68,47 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string $amount Newly formatted amount or Price Not Available
70 70
  */
71
-function give_format_amount( $amount, $decimals = true ) {
71
+function give_format_amount($amount, $decimals = true) {
72 72
 
73
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
74
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
73
+	$thousands_sep = give_get_option('thousands_separator', ',');
74
+	$decimal_sep   = give_get_option('decimal_separator', '.');
75 75
 
76 76
 	// Format the amount
77
-	if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
78
-		$whole  = substr( $amount, 0, $sep_found );
79
-		$part   = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
80
-		$amount = $whole . '.' . $part;
77
+	if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
78
+		$whole  = substr($amount, 0, $sep_found);
79
+		$part   = substr($amount, $sep_found + 1, (strlen($amount) - 1));
80
+		$amount = $whole.'.'.$part;
81 81
 	}
82 82
 
83 83
 	// Strip , from the amount (if set as the thousands separator)
84
-	if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
85
-		$amount = str_replace( ',', '', $amount );
84
+	if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
85
+		$amount = str_replace(',', '', $amount);
86 86
 	}
87 87
 
88 88
 	// Strip . from the amount (if set as the thousands separator) AND , set to decimal separator
89
-	if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
90
-		$amount      = explode( '.', $amount );
91
-		$array_count = count( $amount );
92
-		if ( $decimals == true ) {
93
-			unset( $amount[ $array_count - 1 ] );
89
+	if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
90
+		$amount      = explode('.', $amount);
91
+		$array_count = count($amount);
92
+		if ($decimals == true) {
93
+			unset($amount[$array_count - 1]);
94 94
 		}
95
-		$amount = implode( '', $amount );
95
+		$amount = implode('', $amount);
96 96
 	}
97 97
 
98 98
 	// Strip ' ' from the amount (if set as the thousands separator)
99
-	if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
100
-		$amount = str_replace( ' ', '', $amount );
99
+	if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
100
+		$amount = str_replace(' ', '', $amount);
101 101
 	}
102 102
 
103
-	if ( empty( $amount ) ) {
103
+	if (empty($amount)) {
104 104
 		$amount = 0;
105 105
 	}
106 106
 
107
-	$decimals = apply_filters( 'give_format_amount_decimals', $decimals ? 2 : 0, $amount );
107
+	$decimals = apply_filters('give_format_amount_decimals', $decimals ? 2 : 0, $amount);
108 108
 
109
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
109
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
110 110
 
111
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
111
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
112 112
 }
113 113
 
114 114
 /**
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
  * @param $field_args
120 120
  * @param $field
121 121
  */
122
-function give_format_admin_multilevel_amount( $field_args, $field ) {
122
+function give_format_admin_multilevel_amount($field_args, $field) {
123 123
 
124
-	if ( empty( $field->value ) ) {
124
+	if (empty($field->value)) {
125 125
 		return false;
126 126
 	}
127 127
 
128
-	$field->value = give_format_amount( $field->value );
128
+	$field->value = give_format_amount($field->value);
129 129
 
130 130
 }
131 131
 
@@ -138,25 +138,25 @@  discard block
 block discarded – undo
138 138
  *
139 139
  * @return array $currency Currencies displayed correctly
140 140
  */
141
-function give_currency_filter( $price = '', $currency = '' ) {
142
-	if ( empty( $currency ) ) {
141
+function give_currency_filter($price = '', $currency = '') {
142
+	if (empty($currency)) {
143 143
 
144 144
 		$currency = give_get_currency();
145 145
 
146 146
 	}
147 147
 
148
-	$position = give_get_option( 'currency_position', 'before' );
148
+	$position = give_get_option('currency_position', 'before');
149 149
 
150 150
 	$negative = $price < 0;
151 151
 
152
-	if ( $negative ) {
153
-		$price = substr( $price, 1 ); // Remove proceeding "-" -
152
+	if ($negative) {
153
+		$price = substr($price, 1); // Remove proceeding "-" -
154 154
 	}
155 155
 
156
-	$symbol = give_currency_symbol( $currency );
156
+	$symbol = give_currency_symbol($currency);
157 157
 
158
-	if ( $position == 'before' ):
159
-		switch ( $currency ):
158
+	if ($position == 'before'):
159
+		switch ($currency):
160 160
 			case "GBP" :
161 161
 			case "BRL" :
162 162
 			case "EUR" :
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
 			case "NZD" :
169 169
 			case "SGD" :
170 170
 			case "JPY" :
171
-				$formatted = $symbol . $price;
171
+				$formatted = $symbol.$price;
172 172
 				break;
173 173
 			case "NOK" :
174
-				$formatted = $symbol . ' ' . $price;
174
+				$formatted = $symbol.' '.$price;
175 175
 				break;
176 176
 			default :
177
-				$formatted = $currency . ' ' . $price;
177
+				$formatted = $currency.' '.$price;
178 178
 				break;
179 179
 		endswitch;
180
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price );
180
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price);
181 181
 	else :
182
-		switch ( $currency ) :
182
+		switch ($currency) :
183 183
 			case "GBP" :
184 184
 			case "BRL" :
185 185
 			case "EUR" :
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
 			case "MXN" :
191 191
 			case "SGD" :
192 192
 			case "JPY" :
193
-				$formatted = $price . $symbol;
193
+				$formatted = $price.$symbol;
194 194
 				break;
195 195
 			default :
196
-				$formatted = $price . ' ' . $currency;
196
+				$formatted = $price.' '.$currency;
197 197
 				break;
198 198
 		endswitch;
199
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price );
199
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price);
200 200
 	endif;
201 201
 
202
-	if ( $negative ) {
202
+	if ($negative) {
203 203
 		// Prepend the mins sign before the currency sign
204
-		$formatted = '-' . $formatted;
204
+		$formatted = '-'.$formatted;
205 205
 	}
206 206
 
207 207
 	return $formatted;
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
  *
217 217
  * @return int $decimals
218 218
  */
219
-function give_currency_decimal_filter( $decimals = 2 ) {
219
+function give_currency_decimal_filter($decimals = 2) {
220 220
 
221 221
 	$currency = give_get_currency();
222 222
 
223
-	switch ( $currency ) {
223
+	switch ($currency) {
224 224
 		case 'RIAL' :
225 225
 		case 'JPY' :
226 226
 		case 'TWD' :
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 			break;
231 231
 	}
232 232
 
233
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
233
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
234 234
 }
235 235
 
236
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
237
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
238 236
\ No newline at end of file
237
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
238
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
239 239
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,8 +142,10 @@
 block discarded – undo
142 142
 
143 143
 	if ( is_front_page() ) :
144 144
 		$page_url = home_url();
145
-	else :
145
+	else {
146
+		:
146 147
 		$page_url = 'http';
148
+	}
147 149
 
148 150
 		if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
149 151
 			$page_url .= "s";
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.