Completed
Push — master ( df3d2e...fddba9 )
by Devin
37:02 queued 16:58
created
includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -56,32 +56,32 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$args = array(
58 58
 			'number'  => $this->per_step,
59
-			'offset'  => $this->per_step * ( $this->step - 1 ),
59
+			'offset'  => $this->per_step * ($this->step - 1),
60 60
 			'orderby' => 'id',
61 61
 			'order'   => 'DESC',
62 62
 		);
63 63
 
64
-		$customers = Give()->customers->get_customers( $args );
64
+		$customers = Give()->customers->get_customers($args);
65 65
 
66
-		if ( $customers ) {
66
+		if ($customers) {
67 67
 
68
-			$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
68
+			$allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
69 69
 
70
-			foreach ( $customers as $customer ) {
70
+			foreach ($customers as $customer) {
71 71
 
72
-				$attached_payment_ids = explode( ',', $customer->payment_ids );
72
+				$attached_payment_ids = explode(',', $customer->payment_ids);
73 73
 
74 74
 				$attached_args = array(
75 75
 					'post__in' => $attached_payment_ids,
76
-					'number'   => - 1,
76
+					'number'   => -1,
77 77
 					'status'   => $allowed_payment_status,
78 78
 				);
79 79
 
80
-				$attached_payments = (array) give_get_payments( $attached_args );
80
+				$attached_payments = (array) give_get_payments($attached_args);
81 81
 
82 82
 				$unattached_args = array(
83 83
 					'post__not_in' => $attached_payment_ids,
84
-					'number'       => - 1,
84
+					'number'       => -1,
85 85
 					'status'       => $allowed_payment_status,
86 86
 					'meta_query'   => array(
87 87
 						array(
@@ -92,29 +92,29 @@  discard block
 block discarded – undo
92 92
 					),
93 93
 				);
94 94
 
95
-				$unattached_payments = give_get_payments( $unattached_args );
95
+				$unattached_payments = give_get_payments($unattached_args);
96 96
 
97
-				$payments = array_merge( $attached_payments, $unattached_payments );
97
+				$payments = array_merge($attached_payments, $unattached_payments);
98 98
 
99 99
 				$purchase_value = 0.00;
100 100
 				$purchase_count = 0;
101 101
 				$payment_ids    = array();
102 102
 
103
-				if ( $payments ) {
103
+				if ($payments) {
104 104
 
105
-					foreach ( $payments as $payment ) {
105
+					foreach ($payments as $payment) {
106 106
 
107 107
 						$should_process_payment = 'publish' == $payment->post_status || 'revoked' == $payment->post_status ? true : false;
108
-						$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
108
+						$should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
109 109
 
110
-						if ( true === $should_process_payment ) {
110
+						if (true === $should_process_payment) {
111 111
 
112
-							if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) {
113
-								$purchase_value += give_get_payment_amount( $payment->ID );
112
+							if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) {
113
+								$purchase_value += give_get_payment_amount($payment->ID);
114 114
 							}
115 115
 
116
-							if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
117
-								$purchase_count ++;
116
+							if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
117
+								$purchase_count++;
118 118
 							}
119 119
 
120 120
 						}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 				}
126 126
 
127
-				$payment_ids = implode( ',', $payment_ids );
127
+				$payment_ids = implode(',', $payment_ids);
128 128
 
129 129
 				$customer_update_data = array(
130 130
 					'purchase_count' => $purchase_count,
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 					'payment_ids'    => $payment_ids,
133 133
 				);
134 134
 
135
-				$customer_instance = new Give_Customer( $customer->id );
136
-				$customer_instance->update( $customer_update_data );
135
+				$customer_instance = new Give_Customer($customer->id);
136
+				$customer_instance->update($customer_update_data);
137 137
 
138 138
 			}
139 139
 
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
 	public function get_percentage_complete() {
154 154
 
155 155
 		$args = array(
156
-			'number'  => - 1,
156
+			'number'  => -1,
157 157
 			'orderby' => 'id',
158 158
 			'order'   => 'DESC',
159 159
 		);
160 160
 
161
-		$customers = Give()->customers->get_customers( $args );
162
-		$total     = count( $customers );
161
+		$customers = Give()->customers->get_customers($args);
162
+		$total     = count($customers);
163 163
 
164 164
 		$percentage = 100;
165 165
 
166
-		if ( $total > 0 ) {
167
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
166
+		if ($total > 0) {
167
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
168 168
 		}
169 169
 
170
-		if ( $percentage > 100 ) {
170
+		if ($percentage > 100) {
171 171
 			$percentage = 100;
172 172
 		}
173 173
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param array $request The Form Data passed into the batch processing
183 183
 	 */
184
-	public function set_properties( $request ) {
184
+	public function set_properties($request) {
185 185
 	}
186 186
 
187 187
 	/**
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function process_step() {
194 194
 
195
-		if ( ! $this->can_export() ) {
196
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
195
+		if ( ! $this->can_export()) {
196
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
197 197
 		}
198 198
 
199 199
 		$had_data = $this->get_data();
200 200
 
201
-		if ( $had_data ) {
201
+		if ($had_data) {
202 202
 			$this->done = false;
203 203
 
204 204
 			return true;
205 205
 		} else {
206 206
 			$this->done    = true;
207
-			$this->message = __( 'Donor stats successfully recounted.', 'give' );
207
+			$this->message = __('Donor stats successfully recounted.', 'give');
208 208
 
209 209
 			return false;
210 210
 		}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * Headers
215 215
 	 */
216 216
 	public function headers() {
217
-		ignore_user_abort( true );
217
+		ignore_user_abort(true);
218 218
 
219
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-			set_time_limit( 0 );
219
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+			set_time_limit(0);
221 221
 		}
222 222
 	}
223 223
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
includes/admin/reporting/tools/tools-actions.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @since  1.5
20 20
  */
21 21
 function give_register_batch_recount_store_earnings_tool() {
22
-	add_action( 'give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1 );
22
+	add_action('give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1);
23 23
 }
24 24
 
25
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10 );
25
+add_action('give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10);
26 26
 
27 27
 /**
28 28
  * Loads the tools batch processing class for recounting store earnings
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return void
35 35
  */
36
-function give_include_recount_income_tool_batch_processor( $class ) {
36
+function give_include_recount_income_tool_batch_processor($class) {
37 37
 
38
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php';
38
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php';
39 39
 
40
-	if ( 'Give_Tools_Recount_Income' === $class && file_exists( $file_path ) ) {
40
+	if ('Give_Tools_Recount_Income' === $class && file_exists($file_path)) {
41 41
 		require_once $file_path;
42 42
 	}
43 43
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
  * @since  1.5
50 50
  */
51 51
 function give_register_batch_recount_form_tool() {
52
-	add_action( 'give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1 );
52
+	add_action('give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1);
53 53
 }
54 54
 
55
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10 );
55
+add_action('give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10);
56 56
 
57 57
 /**
58 58
  * Loads the tools batch processing class for recounting download stats
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
  *
64 64
  * @return void
65 65
  */
66
-function give_include_recount_form_tool_batch_processor( $class ) {
66
+function give_include_recount_form_tool_batch_processor($class) {
67 67
 
68
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
68
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
69 69
 
70
-	if ( 'Give_Tools_Recount_Form_Stats' === $class && file_exists( $file_path ) ) {
70
+	if ('Give_Tools_Recount_Form_Stats' === $class && file_exists($file_path)) {
71 71
 		require_once $file_path;
72 72
 	}
73 73
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
  * @since  1.5
79 79
  */
80 80
 function give_register_batch_recount_all_tool() {
81
-	add_action( 'give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1 );
81
+	add_action('give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1);
82 82
 }
83 83
 
84
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10 );
84
+add_action('give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10);
85 85
 
86 86
 /**
87 87
  * Loads the tools batch processing class for recounting all stats
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return void
94 94
  */
95
-function give_include_recount_all_tool_batch_processor( $class ) {
96
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
-	if ( 'Give_Tools_Recount_All_Stats' === $class && file_exists( $file_path ) ) {
95
+function give_include_recount_all_tool_batch_processor($class) {
96
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
+	if ('Give_Tools_Recount_All_Stats' === $class && file_exists($file_path)) {
98 98
 		require_once $file_path;
99 99
 	}
100 100
 
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
  * @since  1.5
107 107
  */
108 108
 function give_register_batch_reset_tool() {
109
-	add_action( 'give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1 );
109
+	add_action('give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1);
110 110
 }
111 111
 
112
-add_action( 'give_register_batch_exporter', 'give_register_batch_reset_tool', 10 );
112
+add_action('give_register_batch_exporter', 'give_register_batch_reset_tool', 10);
113 113
 
114 114
 /**
115 115
  * Loads the tools batch processing class for resetting store and product earnings
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return void
122 122
  */
123
-function give_include_reset_tool_batch_processor( $class ) {
123
+function give_include_reset_tool_batch_processor($class) {
124 124
 
125
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
125
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
126 126
 
127
-	if ( 'Give_Tools_Reset_Stats' === $class && file_exists( $file_path ) ) {
127
+	if ('Give_Tools_Reset_Stats' === $class && file_exists($file_path)) {
128 128
 		require_once $file_path;
129 129
 	}
130 130
 
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  * @since  1.5
136 136
  */
137 137
 function give_register_batch_customer_recount_tool() {
138
-	add_action( 'give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1 );
138
+	add_action('give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1);
139 139
 }
140 140
 
141
-add_action( 'give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10 );
141
+add_action('give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10);
142 142
 
143 143
 /**
144 144
  * Loads the tools batch processing class for resetting all customer stats
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
  *
150 150
  * @return void
151 151
  */
152
-function give_include_customer_recount_tool_batch_processor( $class ) {
152
+function give_include_customer_recount_tool_batch_processor($class) {
153 153
 
154
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
154
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
155 155
 
156
-	if ( 'Give_Tools_Recount_Customer_Stats' === $class && file_exists( $file_path ) ) {
156
+	if ('Give_Tools_Recount_Customer_Stats' === $class && file_exists($file_path)) {
157 157
 		require_once $file_path;
158 158
 	}
159 159
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  * @since  1.5
165 165
  */
166 166
 function give_register_batch_delete_test_transactions_tool() {
167
-	add_action( 'give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1 );
167
+	add_action('give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1);
168 168
 }
169 169
 
170
-add_action( 'give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10 );
170
+add_action('give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10);
171 171
 
172 172
 /**
173 173
  * Loads the tools batch processing class for resetting all customer stats
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return void
180 180
  */
181
-function give_include_delete_test_transactions_batch_processor( $class ) {
181
+function give_include_delete_test_transactions_batch_processor($class) {
182 182
 
183
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
183
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
184 184
 
185
-	if ( 'Give_Tools_Delete_Test_Transactions' === $class && file_exists( $file_path ) ) {
185
+	if ('Give_Tools_Delete_Test_Transactions' === $class && file_exists($file_path)) {
186 186
 		require_once $file_path;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . __( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99 99
 			'title'            => give_get_forms_label_singular(),
100
-			'sales'            => __( 'Donations', 'give' ),
101
-			'earnings'         => __( 'Income', 'give' ),
102
-			'average_sales'    => __( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => __( 'Monthly Average Income', 'give' ),
104
-			'details'          => __( 'Detailed Report', 'give' )
100
+			'sales'            => __('Donations', 'give'),
101
+			'earnings'         => __('Income', 'give'),
102
+			'average_sales'    => __('Monthly Average Donations', 'give'),
103
+			'average_earnings' => __('Monthly Average Income', 'give'),
104
+			'details'          => __('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 		// These aren't really bulk actions but this outputs the markup in the right place
175 175
 		give_report_views();
176 176
 	}
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param string $which
185 185
 	 */
186
-	protected function display_tablenav( $which ) {
186
+	protected function display_tablenav($which) {
187 187
 
188
-		if ( 'top' == $which ) {
189
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
188
+		if ('top' == $which) {
189
+			wp_nonce_field('bulk-'.$this->_args['plural']);
190 190
 		}
191 191
 		?>
192
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
192
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
193 193
 
194
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donation Forms Report', 'give' ); ?></span></h3>
194
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Donation Forms Report', 'give'); ?></span></h3>
195 195
 
196 196
 			<div class="alignright tablenav-right">
197 197
 				<div class="actions bulkactions">
198
-					<?php $this->bulk_actions( $which ); ?>
198
+					<?php $this->bulk_actions($which); ?>
199 199
 				</div>
200 200
 				<?php
201
-				$this->extra_tablenav( $which );
202
-				$this->pagination( $which );
201
+				$this->extra_tablenav($which);
202
+				$this->pagination($which);
203 203
 				?>
204 204
 			</div>
205 205
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function category_filter() {
221 221
 
222
-		$categories = get_terms( 'form_category' );
223
-		if ( $categories && ! is_wp_error( $categories ) ) {
224
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
222
+		$categories = get_terms('form_category');
223
+		if ($categories && ! is_wp_error($categories)) {
224
+			echo Give()->html->category_dropdown('category', $this->get_category());
225 225
 		}
226 226
 	}
227 227
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function query() {
237 237
 
238
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
239
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
238
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
239
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
240 240
 		$category = $this->get_category();
241 241
 
242 242
 		$args = array(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			'suppress_filters' => true
250 250
 		);
251 251
 
252
-		if ( ! empty( $category ) ) {
252
+		if ( ! empty($category)) {
253 253
 			$args['tax_query'] = array(
254 254
 				array(
255 255
 					'taxonomy' => 'form_category',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		}
260 260
 
261
-		switch ( $orderby ) :
261
+		switch ($orderby) :
262 262
 			case 'title' :
263 263
 				$args['orderby'] = 'title';
264 264
 				break;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				break;
275 275
 		endswitch;
276 276
 
277
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
277
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
278 278
 
279
-		$this->products = new WP_Query( $args );
279
+		$this->products = new WP_Query($args);
280 280
 
281 281
 	}
282 282
 
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$give_forms = $this->products->posts;
294 294
 
295
-		if ( $give_forms ) {
296
-			foreach ( $give_forms as $form ) {
295
+		if ($give_forms) {
296
+			foreach ($give_forms as $form) {
297 297
 				$reports_data[] = array(
298 298
 					'ID'               => $form,
299
-					'title'            => get_the_title( $form ),
300
-					'sales'            => give_get_form_sales_stats( $form ),
301
-					'earnings'         => give_get_form_earnings_stats( $form ),
302
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
303
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
299
+					'title'            => get_the_title($form),
300
+					'sales'            => give_get_form_sales_stats($form),
301
+					'earnings'         => give_get_form_earnings_stats($form),
302
+					'average_sales'    => give_get_average_monthly_form_sales($form),
303
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
304 304
 				);
305 305
 			}
306 306
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$sortable = $this->get_sortable_columns();
330 330
 
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 
333 333
 		$data = $this->reports_data();
334 334
 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->items = $data;
338 338
 
339
-		$this->set_pagination_args( array(
339
+		$this->set_pagination_args(array(
340 340
 				'total_items' => $total_items,
341 341
 				'per_page'    => $this->per_page,
342
-				'total_pages' => ceil( $total_items / $this->per_page )
342
+				'total_pages' => ceil($total_items / $this->per_page)
343 343
 			)
344 344
 		);
345 345
 	}
Please login to merge, or discard this patch.
includes/class-give-db.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 } // Exit if accessed directly
15 15
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 * @since   1.0
81 81
 	 * @return  object
82 82
 	 */
83
-	public function get( $row_id ) {
83
+	public function get($row_id) {
84 84
 		global $wpdb;
85 85
 
86
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
86
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @since   1.0
94 94
 	 * @return  object
95 95
 	 */
96
-	public function get_by( $column, $row_id ) {
96
+	public function get_by($column, $row_id) {
97 97
 		global $wpdb;
98
-		$column = esc_sql( $column );
99
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
98
+		$column = esc_sql($column);
99
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 * @since   1.0
107 107
 	 * @return  string
108 108
 	 */
109
-	public function get_column( $column, $row_id ) {
109
+	public function get_column($column, $row_id) {
110 110
 		global $wpdb;
111
-		$column = esc_sql( $column );
112
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
111
+		$column = esc_sql($column);
112
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @since   1.0
120 120
 	 * @return  string
121 121
 	 */
122
-	public function get_column_by( $column, $column_where, $column_value ) {
122
+	public function get_column_by($column, $column_where, $column_value) {
123 123
 		global $wpdb;
124
-		$column_where = esc_sql( $column_where );
125
-		$column       = esc_sql( $column );
126
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
124
+		$column_where = esc_sql($column_where);
125
+		$column       = esc_sql($column);
126
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,30 +133,30 @@  discard block
 block discarded – undo
133 133
 	 * @since   1.0
134 134
 	 * @return  int
135 135
 	 */
136
-	public function insert( $data, $type = '' ) {
136
+	public function insert($data, $type = '') {
137 137
 		global $wpdb;
138 138
 
139 139
 		// Set default values
140
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
140
+		$data = wp_parse_args($data, $this->get_column_defaults());
141 141
 
142
-		do_action( 'give_pre_insert_' . $type, $data );
142
+		do_action('give_pre_insert_'.$type, $data);
143 143
 
144 144
 		// Initialise column format array
145 145
 		$column_formats = $this->get_columns();
146 146
 
147 147
 		// Force fields to lower case
148
-		$data = array_change_key_case( $data );
148
+		$data = array_change_key_case($data);
149 149
 
150 150
 		// White list columns
151
-		$data = array_intersect_key( $data, $column_formats );
151
+		$data = array_intersect_key($data, $column_formats);
152 152
 
153 153
 		// Reorder $column_formats to match the order of columns given in $data
154
-		$data_keys      = array_keys( $data );
155
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
154
+		$data_keys      = array_keys($data);
155
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
156 156
 
157
-		$wpdb->insert( $this->table_name, $data, $column_formats );
157
+		$wpdb->insert($this->table_name, $data, $column_formats);
158 158
 
159
-		do_action( 'give_post_insert_' . $type, $wpdb->insert_id, $data );
159
+		do_action('give_post_insert_'.$type, $wpdb->insert_id, $data);
160 160
 
161 161
 		return $wpdb->insert_id;
162 162
 	}
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
 	 * @since   1.0
169 169
 	 * @return  bool
170 170
 	 */
171
-	public function update( $row_id, $data = array(), $where = '' ) {
171
+	public function update($row_id, $data = array(), $where = '') {
172 172
 
173 173
 		global $wpdb;
174 174
 
175 175
 		// Row ID must be positive integer
176
-		$row_id = absint( $row_id );
176
+		$row_id = absint($row_id);
177 177
 
178
-		if ( empty( $row_id ) ) {
178
+		if (empty($row_id)) {
179 179
 			return false;
180 180
 		}
181 181
 
182
-		if ( empty( $where ) ) {
182
+		if (empty($where)) {
183 183
 			$where = $this->primary_key;
184 184
 		}
185 185
 
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 		$column_formats = $this->get_columns();
188 188
 
189 189
 		// Force fields to lower case
190
-		$data = array_change_key_case( $data );
190
+		$data = array_change_key_case($data);
191 191
 
192 192
 		// White list columns
193
-		$data = array_intersect_key( $data, $column_formats );
193
+		$data = array_intersect_key($data, $column_formats);
194 194
 
195 195
 		// Reorder $column_formats to match the order of columns given in $data
196
-		$data_keys      = array_keys( $data );
197
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
196
+		$data_keys      = array_keys($data);
197
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
198 198
 
199
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
199
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
200 200
 			return false;
201 201
 		}
202 202
 
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
 	 * @since   1.0
211 211
 	 * @return  bool
212 212
 	 */
213
-	public function delete( $row_id = 0 ) {
213
+	public function delete($row_id = 0) {
214 214
 
215 215
 		global $wpdb;
216 216
 
217 217
 		// Row ID must be positive integer
218
-		$row_id = absint( $row_id );
218
+		$row_id = absint($row_id);
219 219
 
220
-		if ( empty( $row_id ) ) {
220
+		if (empty($row_id)) {
221 221
 			return false;
222 222
 		}
223 223
 
224
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
224
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
225 225
 			return false;
226 226
 		}
227 227
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 * @param  string $table The table name
236 236
 	 * @return bool          If the table name exists
237 237
 	 */
238
-	public function table_exists( $table ) {
238
+	public function table_exists($table) {
239 239
 		global $wpdb;
240
-		$table = sanitize_text_field( $table );
240
+		$table = sanitize_text_field($table);
241 241
 
242
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
242
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
243 243
 	}
244 244
 
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -50,50 +50,50 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 
52 52
 	// https://gist.github.com/justinph/5197810
53
-	function validate_gravatar( $id_or_email ) {
53
+	function validate_gravatar($id_or_email) {
54 54
 		//id or email code borrowed from wp-includes/pluggable.php
55 55
 		$email = '';
56
-		if ( is_numeric( $id_or_email ) ) {
56
+		if (is_numeric($id_or_email)) {
57 57
 			$id   = (int) $id_or_email;
58
-			$user = get_userdata( $id );
59
-			if ( $user ) {
58
+			$user = get_userdata($id);
59
+			if ($user) {
60 60
 				$email = $user->user_email;
61 61
 			}
62
-		} elseif ( is_object( $id_or_email ) ) {
62
+		} elseif (is_object($id_or_email)) {
63 63
 			// No avatar for pingbacks or trackbacks
64
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
65
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
64
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
65
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
66 66
 				return false;
67 67
 			}
68 68
 
69
-			if ( ! empty( $id_or_email->user_id ) ) {
69
+			if ( ! empty($id_or_email->user_id)) {
70 70
 				$id   = (int) $id_or_email->user_id;
71
-				$user = get_userdata( $id );
72
-				if ( $user ) {
71
+				$user = get_userdata($id);
72
+				if ($user) {
73 73
 					$email = $user->user_email;
74 74
 				}
75
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
75
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
76 76
 				$email = $id_or_email->comment_author_email;
77 77
 			}
78 78
 		} else {
79 79
 			$email = $id_or_email;
80 80
 		}
81 81
 
82
-		$hashkey = md5( strtolower( trim( $email ) ) );
83
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
82
+		$hashkey = md5(strtolower(trim($email)));
83
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
84 84
 
85
-		$data = wp_cache_get( $hashkey );
86
-		if ( false === $data ) {
87
-			$response = wp_remote_head( $uri );
88
-			if ( is_wp_error( $response ) ) {
85
+		$data = wp_cache_get($hashkey);
86
+		if (false === $data) {
87
+			$response = wp_remote_head($uri);
88
+			if (is_wp_error($response)) {
89 89
 				$data = 'not200';
90 90
 			} else {
91 91
 				$data = $response['response']['code'];
92 92
 			}
93
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
93
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
94 94
 
95 95
 		}
96
-		if ( $data == '200' ) {
96
+		if ($data == '200') {
97 97
 			return true;
98 98
 		} else {
99 99
 			return false;
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param int $form_id
110 110
 	 */
111
-	function get_log_ids( $form_id = '' ) {
111
+	function get_log_ids($form_id = '') {
112 112
 
113 113
 		// get Give_Logging class
114 114
 		global $give_logs;
115 115
 
116 116
 		// get log for this form
117
-		$logs = $give_logs->get_logs( $form_id );
117
+		$logs = $give_logs->get_logs($form_id);
118 118
 
119
-		if ( $logs ) {
119
+		if ($logs) {
120 120
 			// make an array with all the donor IDs
121
-			foreach ( $logs as $log ) {
121
+			foreach ($logs as $log) {
122 122
 				$log_ids[] = $log->ID;
123 123
 			}
124 124
 
@@ -135,49 +135,49 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @since 1.0
137 137
 	 */
138
-	function get_payment_ids( $form_id = '' ) {
138
+	function get_payment_ids($form_id = '') {
139 139
 
140 140
 		global $give_options;
141 141
 
142
-		$log_ids = $this->get_log_ids( $form_id );
142
+		$log_ids = $this->get_log_ids($form_id);
143 143
 
144
-		if ( $log_ids ) {
144
+		if ($log_ids) {
145 145
 
146 146
 			$payment_ids = array();
147 147
 
148
-			foreach ( $log_ids as $id ) {
148
+			foreach ($log_ids as $id) {
149 149
 				// get the payment ID for each corresponding log ID
150
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
150
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
151 151
 			}
152 152
 
153 153
 			// remove donors who have purchased more than once so we can have unique avatars
154 154
 			$unique_emails = array();
155 155
 
156
-			foreach ( $payment_ids as $key => $id ) {
156
+			foreach ($payment_ids as $key => $id) {
157 157
 
158
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
158
+				$email = get_post_meta($id, '_give_payment_user_email', true);
159 159
 
160
-				if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) {
161
-					if ( ! $this->validate_gravatar( $email ) ) {
160
+				if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) {
161
+					if ( ! $this->validate_gravatar($email)) {
162 162
 						continue;
163 163
 					}
164 164
 				}
165 165
 
166
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
166
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
167 167
 
168 168
 			}
169 169
 
170 170
 			// strip duplicate emails
171
-			$unique_emails = array_unique( $unique_emails );
171
+			$unique_emails = array_unique($unique_emails);
172 172
 
173 173
 			// convert the unique IDs back into simple array
174
-			foreach ( $unique_emails as $id => $email ) {
174
+			foreach ($unique_emails as $id => $email) {
175 175
 				$unique_ids[] = $id;
176 176
 			}
177 177
 
178 178
 			// randomize the payment IDs if enabled
179
-			if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) {
180
-				shuffle( $unique_ids );
179
+			if (isset($give_options['give_donators_gravatars_random_gravatars'])) {
180
+				shuffle($unique_ids);
181 181
 			}
182 182
 
183 183
 			// return our unique IDs
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @since 1.0
195 195
 	 */
196
-	function gravatars( $form_id = false, $title = '' ) {
196
+	function gravatars($form_id = false, $title = '') {
197 197
 
198 198
 		// unique $payment_ids 
199
-		$payment_ids = $this->get_payment_ids( $form_id );
199
+		$payment_ids = $this->get_payment_ids($form_id);
200 200
 
201 201
 		//			var_dump( $payment_ids );
202 202
 		//			 var_dump( $this->get_log_ids( get_the_ID() ) );
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 		global $give_options;
205 205
 
206 206
 		// return if no ID
207
-		if ( ! $form_id ) {
207
+		if ( ! $form_id) {
208 208
 			return;
209 209
 		}
210 210
 
211 211
 		// minimum amount of purchases before showing gravatars
212 212
 		// if the number of items in array is not greater or equal to the number specified, then exit
213
-		if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) {
214
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) {
213
+		if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) {
214
+			if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) {
215 215
 				return;
216 216
 			}
217 217
 		}
@@ -222,51 +222,51 @@  discard block
 block discarded – undo
222 222
 		echo '<div id="give-purchase-gravatars">';
223 223
 
224 224
 
225
-		if ( isset ( $title ) ) {
225
+		if (isset ($title)) {
226 226
 
227
-			if ( $title ) {
228
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
229
-			} elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) {
230
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' );
227
+			if ($title) {
228
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
229
+			} elseif (isset($give_options['give_donators_gravatars_heading'])) {
230
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>');
231 231
 			}
232 232
 
233 233
 		}
234 234
 		echo '<ul class="give-purchase-gravatars-list">';
235 235
 		$i = 0;
236 236
 
237
-		if ( $payment_ids ) {
238
-			foreach ( $payment_ids as $id ) {
237
+		if ($payment_ids) {
238
+			foreach ($payment_ids as $id) {
239 239
 
240 240
 				// Give saves a blank option even when the control is turned off, hence the extra check
241
-				if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) {
241
+				if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) {
242 242
 					continue;
243 243
 				}
244 244
 
245 245
 				// get the payment meta
246
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
246
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
247 247
 
248 248
 				// unserialize the payment meta
249
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
249
+				$user_info = maybe_unserialize($payment_meta['user_info']);
250 250
 
251 251
 				// get donor's first name
252 252
 				$name = $user_info['first_name'];
253 253
 
254 254
 				// get donor's email
255
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
255
+				$email = get_post_meta($id, '_give_payment_user_email', true);
256 256
 
257 257
 				// set gravatar size and provide filter
258
-				$size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : '';
258
+				$size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : '';
259 259
 
260 260
 				// default image
261
-				$default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false );
261
+				$default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false);
262 262
 
263 263
 				// assemble output
264 264
 				$output .= '<li>';
265 265
 
266
-				$output .= get_avatar( $email, $size, $default_image, $name );
266
+				$output .= get_avatar($email, $size, $default_image, $name);
267 267
 				$output .= '</li>';
268 268
 
269
-				$i ++;
269
+				$i++;
270 270
 
271 271
 			} // end foreach
272 272
 		}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		echo '</ul>';
276 276
 		echo '</div>';
277 277
 
278
-		return apply_filters( 'give_donators_gravatars', ob_get_clean() );
278
+		return apply_filters('give_donators_gravatars', ob_get_clean());
279 279
 	}
280 280
 
281 281
 	/**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @since 1.0
285 285
 	 */
286 286
 	function register_widget() {
287
-		register_widget( 'Give_Donators_Gravatars_Widget' );
287
+		register_widget('Give_Donators_Gravatars_Widget');
288 288
 	}
289 289
 
290 290
 	/**
@@ -293,19 +293,19 @@  discard block
 block discarded – undo
293 293
 	 * @since 1.0
294 294
 	 * @todo  set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
295 295
 	 */
296
-	function shortcode( $atts, $content = null ) {
296
+	function shortcode($atts, $content = null) {
297 297
 
298
-		$atts = shortcode_atts( array(
298
+		$atts = shortcode_atts(array(
299 299
 			'id'    => '',
300 300
 			'title' => ''
301
-		), $atts, 'give_donators_gravatars' );
301
+		), $atts, 'give_donators_gravatars');
302 302
 
303 303
 		// if no ID is passed on single give_forms pages, get the correct ID
304
-		if ( is_singular( 'give_forms' ) ) {
304
+		if (is_singular('give_forms')) {
305 305
 			$id = get_the_ID();
306 306
 		}
307 307
 
308
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
308
+		$content = $this->gravatars($atts['id'], $atts['title']);
309 309
 
310 310
 		return $content;
311 311
 
@@ -316,56 +316,56 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @since 1.0
318 318
 	 */
319
-	function settings( $settings ) {
319
+	function settings($settings) {
320 320
 
321 321
 		$give_gravatar_settings = array(
322 322
 			array(
323
-				'name' => __( 'Donator Gravatars', 'give' ),
323
+				'name' => __('Donator Gravatars', 'give'),
324 324
 				'desc' => '<hr>',
325 325
 				'id'   => 'give_title',
326 326
 				'type' => 'give_title'
327 327
 			),
328 328
 			array(
329
-				'name' => __( 'Heading', 'give' ),
330
-				'desc' => __( 'The heading to display above the Gravatars', 'give' ),
329
+				'name' => __('Heading', 'give'),
330
+				'desc' => __('The heading to display above the Gravatars', 'give'),
331 331
 				'type' => 'text',
332 332
 				'id'   => 'give_donators_gravatars_heading'
333 333
 			),
334 334
 			array(
335
-				'name'    => __( 'Gravatar Size', 'give' ),
336
-				'desc'    => __( 'The size of each Gravatar in pixels (512px maximum)', 'give' ),
335
+				'name'    => __('Gravatar Size', 'give'),
336
+				'desc'    => __('The size of each Gravatar in pixels (512px maximum)', 'give'),
337 337
 				'type'    => 'text_small',
338 338
 				'id'      => 'give_donators_gravatars_gravatar_size',
339 339
 				'default' => '64'
340 340
 			),
341 341
 			array(
342
-				'name' => __( 'Minimum Unique Purchases Required', 'give' ),
343
-				'desc' => sprintf( __( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
342
+				'name' => __('Minimum Unique Purchases Required', 'give'),
343
+				'desc' => sprintf(__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
344 344
 				'type' => 'text_small',
345 345
 				'id'   => 'give_donators_gravatars_min_purchases_required',
346 346
 			),
347 347
 			array(
348
-				'name'    => __( 'Maximum Gravatars To Show', 'give' ),
349
-				'desc'    => __( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
348
+				'name'    => __('Maximum Gravatars To Show', 'give'),
349
+				'desc'    => __('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
350 350
 				'type'    => 'text',
351 351
 				'id'      => 'give_donators_gravatars_maximum_number',
352 352
 				'default' => '20',
353 353
 			),
354 354
 			array(
355
-				'name' => __( 'Gravatar Visibility', 'give' ),
356
-				'desc' => __( 'Only show donators with a Gravatar account', 'give' ),
355
+				'name' => __('Gravatar Visibility', 'give'),
356
+				'desc' => __('Only show donators with a Gravatar account', 'give'),
357 357
 				'id'   => 'give_donators_gravatars_has_gravatar_account',
358 358
 				'type' => 'checkbox',
359 359
 			),
360 360
 			array(
361
-				'name' => __( 'Randomize Gravatars', 'give' ),
362
-				'desc' => __( 'Randomize the Gravatars', 'give' ),
361
+				'name' => __('Randomize Gravatars', 'give'),
362
+				'desc' => __('Randomize the Gravatars', 'give'),
363 363
 				'id'   => 'give_donators_gravatars_random_gravatars',
364 364
 				'type' => 'checkbox',
365 365
 			),
366 366
 		);
367 367
 
368
-		return array_merge( $settings, $give_gravatar_settings );
368
+		return array_merge($settings, $give_gravatar_settings);
369 369
 	}
370 370
 
371 371
 }
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	function give_donators_gravatars_widget() {
385 385
 
386
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
386
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
387 387
 
388 388
 		// widget settings
389 389
 		$widget_ops = array(
390 390
 			'classname'   => 'give-donators-gravatars',
391
-			'description' => sprintf( __( 'Displays gravatars of people who have donated using your your %s. Will only show on the single %s page.', 'give' ), $give_label_singular, $give_label_singular )
391
+			'description' => sprintf(__('Displays gravatars of people who have donated using your your %s. Will only show on the single %s page.', 'give'), $give_label_singular, $give_label_singular)
392 392
 		);
393 393
 
394 394
 		// widget control settings
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 		// create the widget
402 402
 		$this->WP_Widget(
403 403
 			'give_donators_gravatars_widget',
404
-			__( 'Give Donators Gravatars', 'give' ),
404
+			__('Give Donators Gravatars', 'give'),
405 405
 			$widget_ops,
406 406
 			$control_ops
407 407
 		);
@@ -412,29 +412,29 @@  discard block
 block discarded – undo
412 412
 	/*
413 413
 	 * Outputs the content of the widget
414 414
 	 */
415
-	function widget( $args, $instance ) {
415
+	function widget($args, $instance) {
416 416
 		global $give_options;
417 417
 
418
-		extract( $args );
418
+		extract($args);
419 419
 
420
-		if ( ! is_singular( 'give_forms' ) ) {
420
+		if ( ! is_singular('give_forms')) {
421 421
 			return;
422 422
 		}
423 423
 
424 424
 		// Variables from widget settings
425
-		$title = apply_filters( 'widget_title', $instance['title'] );
425
+		$title = apply_filters('widget_title', $instance['title']);
426 426
 
427 427
 		// Used by themes. Opens the widget
428 428
 		echo $before_widget;
429 429
 
430 430
 		// Display the widget title
431
-		if ( $title ) {
432
-			echo $before_title . $title . $after_title;
431
+		if ($title) {
432
+			echo $before_title.$title.$after_title;
433 433
 		}
434 434
 
435 435
 		$gravatars = new Give_Donators_Gravatars();
436 436
 
437
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
437
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
438 438
 
439 439
 		// Used by themes. Closes the widget
440 440
 		echo $after_widget;
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	/*
445 445
 	 * Update function. Processes widget options to be saved
446 446
 	 */
447
-	function update( $new_instance, $old_instance ) {
447
+	function update($new_instance, $old_instance) {
448 448
 
449 449
 		$instance = $old_instance;
450 450
 
451
-		$instance['title'] = strip_tags( $new_instance['title'] );
451
+		$instance['title'] = strip_tags($new_instance['title']);
452 452
 
453 453
 		return $instance;
454 454
 
@@ -457,19 +457,19 @@  discard block
 block discarded – undo
457 457
 	/*
458 458
 	 * Form function. Displays the actual form on the widget page
459 459
 	 */
460
-	function form( $instance ) {
460
+	function form($instance) {
461 461
 
462 462
 		// Set up some default widget settings.
463 463
 		$defaults = array(
464 464
 			'title' => '',
465 465
 		);
466 466
 
467
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
467
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
468 468
 
469 469
 		<!-- Title -->
470 470
 		<p>
471
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ) ?></label>
472
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
471
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give') ?></label>
472
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
473 473
 		</p>
474 474
 
475 475
 
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Purchase
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( __( 'Nonce verification has failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(__('Nonce verification has failed', 'give'), __('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id = intval( $purchase_data['post_data']['give-form-id'] );
41
+	$form_id = intval($purchase_data['post_data']['give-form-id']);
42 42
 
43 43
 	// Collect payment data
44 44
 	$payment_data = array(
@@ -56,59 +56,59 @@  discard block
 block discarded – undo
56 56
 	);
57 57
 
58 58
 	// Record the pending payment
59
-	$payment = give_insert_payment( $payment_data );
59
+	$payment = give_insert_payment($payment_data);
60 60
 
61 61
 	// Check payment
62
-	if ( ! $payment ) {
62
+	if ( ! $payment) {
63 63
 		// Record the error
64
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( __( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment );
64
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf(__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'), json_encode($payment_data)), $payment);
65 65
 		// Problems? send back
66
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
66
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
67 67
 	} else {
68 68
 		// Only send to PayPal if the pending payment is created successfully
69
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
69
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
70 70
 
71 71
 		// Get the success url
72
-		$return_url = add_query_arg( array(
72
+		$return_url = add_query_arg(array(
73 73
 			'payment-confirmation' => 'paypal',
74 74
 			'payment-id'           => $payment
75 75
 
76
-		), get_permalink( give_get_option( 'success_page' ) ) );
76
+		), get_permalink(give_get_option('success_page')));
77 77
 
78 78
 		// Get the PayPal redirect uri
79
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
79
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
80 80
 
81 81
 		//Item name - pass level name if variable priced
82 82
 		$item_name = $purchase_data['post_data']['give-form-title'];
83 83
 
84 84
 		//Verify has variable prices
85
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
85
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
86 86
 
87
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
87
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
88 88
 
89
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
89
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']);
90 90
 
91 91
 			//Donation given doesn't match selected level (must be a custom amount)
92
-			if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) {
93
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
92
+			if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) {
93
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
94 94
 				//user custom amount text if any, fallback to default if not
95
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' ) );
95
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give'));
96 96
 
97 97
 			} //Is there any donation level text?
98
-			elseif ( ! empty( $item_price_level_text ) ) {
99
-				$item_name .= ' - ' . $item_price_level_text;
98
+			elseif ( ! empty($item_price_level_text)) {
99
+				$item_name .= ' - '.$item_price_level_text;
100 100
 			}
101 101
 
102 102
 		} //Single donation: Custom Amount
103
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) {
104
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) {
104
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 			//user custom amount text if any, fallback to default if not
106
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' ) );
106
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give'));
107 107
 		}
108 108
 
109 109
 		// Setup PayPal arguments
110 110
 		$paypal_args = array(
111
-			'business'      => give_get_option( 'paypal_email', false ),
111
+			'business'      => give_get_option('paypal_email', false),
112 112
 			'email'         => $purchase_data['user_email'],
113 113
 			'invoice'       => $purchase_data['purchase_key'],
114 114
 			'amount'        => $purchase_data['price'],
@@ -119,25 +119,25 @@  discard block
 block discarded – undo
119 119
 			'shipping'      => '0',
120 120
 			'no_note'       => '1',
121 121
 			'currency_code' => give_get_currency(),
122
-			'charset'       => get_bloginfo( 'charset' ),
122
+			'charset'       => get_bloginfo('charset'),
123 123
 			'custom'        => $payment,
124 124
 			'rm'            => '2',
125 125
 			'return'        => $return_url,
126
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ),
126
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment),
127 127
 			'notify_url'    => $listener_url,
128 128
 			'page_style'    => give_get_paypal_page_style(),
129
-			'cbt'           => get_bloginfo( 'name' ),
129
+			'cbt'           => get_bloginfo('name'),
130 130
 			'bn'            => 'givewp_SP'
131 131
 		);
132 132
 
133
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
133
+		if ( ! empty($purchase_data['user_info']['address'])) {
134 134
 			$paypal_args['address1'] = $purchase_data['user_info']['address']['line1'];
135 135
 			$paypal_args['address2'] = $purchase_data['user_info']['address']['line2'];
136 136
 			$paypal_args['city']     = $purchase_data['user_info']['address']['city'];
137 137
 			$paypal_args['country']  = $purchase_data['user_info']['address']['country'];
138 138
 		}
139 139
 
140
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
140
+		if (give_get_option('paypal_button_type') === 'standard') {
141 141
 			$paypal_extra_args = array(
142 142
 				'cmd' => '_xclick',
143 143
 			);
@@ -147,23 +147,23 @@  discard block
 block discarded – undo
147 147
 			);
148 148
 		}
149 149
 
150
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
151
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
150
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
151
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
152 152
 
153 153
 		// Build query
154
-		$paypal_redirect .= http_build_query( $paypal_args );
154
+		$paypal_redirect .= http_build_query($paypal_args);
155 155
 
156 156
 		// Fix for some sites that encode the entities
157
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
157
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
158 158
 
159 159
 		// Redirect to PayPal
160
-		wp_redirect( $paypal_redirect );
160
+		wp_redirect($paypal_redirect);
161 161
 		exit;
162 162
 	}
163 163
 
164 164
 }
165 165
 
166
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
166
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
167 167
 
168 168
 /**
169 169
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function give_listen_for_paypal_ipn() {
175 175
 	// Regular PayPal IPN
176
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
177
-		do_action( 'give_verify_paypal_ipn' );
176
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
177
+		do_action('give_verify_paypal_ipn');
178 178
 	}
179 179
 }
180 180
 
181
-add_action( 'init', 'give_listen_for_paypal_ipn' );
181
+add_action('init', 'give_listen_for_paypal_ipn');
182 182
 
183 183
 /**
184 184
  * Process PayPal IPN
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 function give_process_paypal_ipn() {
190 190
 
191 191
 	// Check the request method is POST
192
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
192
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
193 193
 		return;
194 194
 	}
195 195
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 	$post_data = '';
198 198
 
199 199
 	// Fallback just in case post_max_size is lower than needed
200
-	if ( ini_get( 'allow_url_fopen' ) ) {
201
-		$post_data = file_get_contents( 'php://input' );
200
+	if (ini_get('allow_url_fopen')) {
201
+		$post_data = file_get_contents('php://input');
202 202
 	} else {
203 203
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
204
-		ini_set( 'post_max_size', '12M' );
204
+		ini_set('post_max_size', '12M');
205 205
 	}
206 206
 	// Start the encoded data collection with notification command
207 207
 	$encoded_data = 'cmd=_notify-validate';
@@ -210,40 +210,40 @@  discard block
 block discarded – undo
210 210
 	$arg_separator = give_get_php_arg_separator_output();
211 211
 
212 212
 	// Verify there is a post_data
213
-	if ( $post_data || strlen( $post_data ) > 0 ) {
213
+	if ($post_data || strlen($post_data) > 0) {
214 214
 		// Append the data
215
-		$encoded_data .= $arg_separator . $post_data;
215
+		$encoded_data .= $arg_separator.$post_data;
216 216
 	} else {
217 217
 		// Check if POST is empty
218
-		if ( empty( $_POST ) ) {
218
+		if (empty($_POST)) {
219 219
 			// Nothing to do
220 220
 			return;
221 221
 		} else {
222 222
 			// Loop through each POST
223
-			foreach ( $_POST as $key => $value ) {
223
+			foreach ($_POST as $key => $value) {
224 224
 				// Encode the value and append the data
225
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
225
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
226 226
 			}
227 227
 		}
228 228
 	}
229 229
 
230 230
 	// Convert collected post data to an array
231
-	parse_str( $encoded_data, $encoded_data_array );
231
+	parse_str($encoded_data, $encoded_data_array);
232 232
 
233
-	foreach ( $encoded_data_array as $key => $value ) {
233
+	foreach ($encoded_data_array as $key => $value) {
234 234
 
235
-		if ( false !== strpos( $key, 'amp;' ) ) {
236
-			$new_key = str_replace( '&amp;', '&', $key );
237
-			$new_key = str_replace( 'amp;', '&' , $new_key );
235
+		if (false !== strpos($key, 'amp;')) {
236
+			$new_key = str_replace('&amp;', '&', $key);
237
+			$new_key = str_replace('amp;', '&', $new_key);
238 238
 
239
-			unset( $encoded_data_array[ $key ] );
240
-			$encoded_data_array[ $new_key ] = $value;
239
+			unset($encoded_data_array[$key]);
240
+			$encoded_data_array[$new_key] = $value;
241 241
 		}
242 242
 
243 243
 	}
244 244
 	
245 245
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure
246
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
246
+	if ( ! give_get_option('disable_paypal_verification')) {
247 247
 
248 248
 		$remote_post_vars = array(
249 249
 			'method'      => 'POST',
@@ -263,22 +263,22 @@  discard block
 block discarded – undo
263 263
 		);
264 264
 
265 265
 		// Validate the IPN
266
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
266
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
267 267
 
268
-		if ( is_wp_error( $api_response ) ) {
269
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
268
+		if (is_wp_error($api_response)) {
269
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response)));
270 270
 			return; // Something went wrong
271 271
 		}
272 272
 
273
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
274
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
273
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
274
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response)));
275 275
 			return; // Response not okay
276 276
 		}
277 277
 
278 278
 	}
279 279
 
280 280
 	// Check if $post_data_array has been populated
281
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
281
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
282 282
 		return;
283 283
 	}
284 284
 
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
 		'payment_status' => ''
288 288
 	);
289 289
 
290
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
290
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
291 291
 
292
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
292
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
293 293
 
294
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
294
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
295 295
 		// Allow PayPal IPN types to be processed separately
296
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
296
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
297 297
 	} else {
298 298
 		// Fallback to web accept just in case the txn_type isn't present
299
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
299
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
300 300
 	}
301 301
 	exit;
302 302
 }
303 303
 
304
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
304
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
305 305
 
306 306
 /**
307 307
  * Process web accept (one time) payment IPNs
@@ -312,185 +312,185 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @return void
314 314
  */
315
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
315
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
316 316
 
317
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) {
317
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
318 318
 		return;
319 319
 	}
320 320
 
321
-	if ( empty( $payment_id ) ) {
321
+	if (empty($payment_id)) {
322 322
 		return;
323 323
 	}
324 324
 
325 325
 	// Collect payment details
326
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
326
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
327 327
 	$paypal_amount  = $data['mc_gross'];
328
-	$payment_status = strtolower( $data['payment_status'] );
329
-	$currency_code  = strtolower( $data['mc_currency'] );
330
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
331
-	$payment_meta   = give_get_payment_meta( $payment_id );
328
+	$payment_status = strtolower($data['payment_status']);
329
+	$currency_code  = strtolower($data['mc_currency']);
330
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
331
+	$payment_meta   = give_get_payment_meta($payment_id);
332 332
 
333 333
 
334
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
334
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
335 335
 		return; // this isn't a PayPal standard IPN
336 336
 	}
337 337
 
338 338
 	// Verify payment recipient
339
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
339
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
340 340
 
341
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
342
-		give_update_payment_status( $payment_id, 'failed' );
343
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
341
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
342
+		give_update_payment_status($payment_id, 'failed');
343
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
344 344
 
345 345
 		return;
346 346
 	}
347 347
 
348 348
 	// Verify payment currency
349
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
349
+	if ($currency_code != strtolower($payment_meta['currency'])) {
350 350
 
351
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
352
-		give_update_payment_status( $payment_id, 'failed' );
353
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
351
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
352
+		give_update_payment_status($payment_id, 'failed');
353
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
354 354
 
355 355
 		return;
356 356
 	}
357 357
 
358
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
358
+	if ( ! give_get_payment_user_email($payment_id)) {
359 359
 
360 360
 		// No email associated with purchase, so store from PayPal
361
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
361
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
362 362
 
363 363
 		// Setup and store the donors's details
364 364
 		$address            = array();
365
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
366
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
367
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
368
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
369
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
365
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
366
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
367
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
368
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
369
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
370 370
 
371 371
 		$user_info = array(
372 372
 			'id'         => '-1',
373
-			'email'      => sanitize_text_field( $data['payer_email'] ),
374
-			'first_name' => sanitize_text_field( $data['first_name'] ),
375
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
373
+			'email'      => sanitize_text_field($data['payer_email']),
374
+			'first_name' => sanitize_text_field($data['first_name']),
375
+			'last_name'  => sanitize_text_field($data['last_name']),
376 376
 			'discount'   => '',
377 377
 			'address'    => $address
378 378
 		);
379 379
 
380 380
 		$payment_meta['user_info'] = $user_info;
381
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
381
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
382 382
 	}
383 383
 
384
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
384
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
385 385
 
386 386
 		// Process a refund
387
-		give_process_paypal_refund( $data, $payment_id );
387
+		give_process_paypal_refund($data, $payment_id);
388 388
 
389 389
 	} else {
390 390
 
391
-		if ( get_post_status( $payment_id ) == 'publish' ) {
391
+		if (get_post_status($payment_id) == 'publish') {
392 392
 			return; // Only complete payments once
393 393
 		}
394 394
 
395 395
 		// Retrieve the total purchase amount (before PayPal)
396
-		$payment_amount = give_get_payment_amount( $payment_id );
396
+		$payment_amount = give_get_payment_amount($payment_id);
397 397
 
398
-		if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
398
+		if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
399 399
 			// The prices don't match
400
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
401
-			give_update_payment_status( $payment_id, 'failed' );
402
-			give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
400
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
401
+			give_update_payment_status($payment_id, 'failed');
402
+			give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
403 403
 
404 404
 			return;
405 405
 		}
406
-		if ( $purchase_key != give_get_payment_key( $payment_id ) ) {
406
+		if ($purchase_key != give_get_payment_key($payment_id)) {
407 407
 			// Purchase keys don't match
408
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( __( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
409
-			give_update_payment_status( $payment_id, 'failed' );
410
-			give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
408
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
409
+			give_update_payment_status($payment_id, 'failed');
410
+			give_insert_payment_note($payment_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
411 411
 
412 412
 			return;
413 413
 		}
414 414
 
415
-		if ( $payment_status == 'completed' || give_is_test_mode() ) {
416
-			give_insert_payment_note( $payment_id, sprintf( __( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
417
-			give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
418
-			give_update_payment_status( $payment_id, 'publish' );
419
-		} else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
415
+		if ($payment_status == 'completed' || give_is_test_mode()) {
416
+			give_insert_payment_note($payment_id, sprintf(__('PayPal Transaction ID: %s', 'give'), $data['txn_id']));
417
+			give_set_payment_transaction_id($payment_id, $data['txn_id']);
418
+			give_update_payment_status($payment_id, 'publish');
419
+		} else if ('pending' == $payment_status && isset($data['pending_reason'])) {
420 420
 
421 421
 			// Look for possible pending reasons, such as an echeck
422 422
 
423 423
 			$note = '';
424 424
 
425
-			switch ( strtolower( $data['pending_reason'] ) ) {
425
+			switch (strtolower($data['pending_reason'])) {
426 426
 
427 427
 				case 'echeck' :
428 428
 
429
-					$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days', 'give' );
429
+					$note = __('Payment made via eCheck and will clear automatically in 5-8 days', 'give');
430 430
 
431 431
 					break;
432 432
 
433 433
 				case 'address' :
434 434
 
435
-					$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal', 'give' );
435
+					$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal', 'give');
436 436
 
437 437
 					break;
438 438
 
439 439
 				case 'intl' :
440 440
 
441
-					$note = __( 'Payment must be accepted manually through PayPal due to international account regulations', 'give' );
441
+					$note = __('Payment must be accepted manually through PayPal due to international account regulations', 'give');
442 442
 
443 443
 					break;
444 444
 
445 445
 				case 'multi-currency' :
446 446
 
447
-					$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal', 'give' );
447
+					$note = __('Payment received in non-shop currency and must be accepted manually through PayPal', 'give');
448 448
 
449 449
 					break;
450 450
 
451 451
 				case 'paymentreview' :
452 452
 				case 'regulatory_review' :
453 453
 
454
-					$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'give' );
454
+					$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'give');
455 455
 
456 456
 					break;
457 457
 
458 458
 				case 'unilateral' :
459 459
 
460
-					$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
460
+					$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
461 461
 
462 462
 					break;
463 463
 
464 464
 				case 'upgrade' :
465 465
 
466
-					$note = __( 'PayPal account must be upgraded before this payment can be accepted', 'give' );
466
+					$note = __('PayPal account must be upgraded before this payment can be accepted', 'give');
467 467
 
468 468
 					break;
469 469
 
470 470
 				case 'verify' :
471 471
 
472
-					$note = __( 'PayPal account is not verified. Verify account in order to accept this payment', 'give' );
472
+					$note = __('PayPal account is not verified. Verify account in order to accept this payment', 'give');
473 473
 
474 474
 					break;
475 475
 
476 476
 				case 'other' :
477 477
 
478
-					$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance', 'give' );
478
+					$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance', 'give');
479 479
 
480 480
 					break;
481 481
 
482 482
 			}
483 483
 
484
-			if ( ! empty( $note ) ) {
484
+			if ( ! empty($note)) {
485 485
 
486
-				give_insert_payment_note( $payment_id, $note );
486
+				give_insert_payment_note($payment_id, $note);
487 487
 
488 488
 			}
489 489
 		}
490 490
 	}
491 491
 }
492 492
 
493
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
493
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
494 494
 
495 495
 /**
496 496
  * Process PayPal IPN Refunds
@@ -501,32 +501,32 @@  discard block
 block discarded – undo
501 501
  *
502 502
  * @return void
503 503
  */
504
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
504
+function give_process_paypal_refund($data, $payment_id = 0) {
505 505
 
506 506
 	// Collect payment details
507 507
 
508
-	if ( empty( $payment_id ) ) {
508
+	if (empty($payment_id)) {
509 509
 		return;
510 510
 	}
511 511
 
512
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
512
+	if (get_post_status($payment_id) == 'refunded') {
513 513
 		return; // Only refund payments once
514 514
 	}
515 515
 
516
-	$payment_amount = give_get_payment_amount( $payment_id );
516
+	$payment_amount = give_get_payment_amount($payment_id);
517 517
 	$refund_amount  = $data['payment_gross'] * - 1;
518 518
 
519
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
519
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
520 520
 
521
-		give_insert_payment_note( $payment_id, sprintf( __( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
521
+		give_insert_payment_note($payment_id, sprintf(__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id']));
522 522
 
523 523
 		return; // This is a partial refund
524 524
 
525 525
 	}
526 526
 
527
-	give_insert_payment_note( $payment_id, sprintf( __( 'PayPal Payment #%s Refunded for reason: %s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
528
-	give_insert_payment_note( $payment_id, sprintf( __( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
529
-	give_update_payment_status( $payment_id, 'refunded' );
527
+	give_insert_payment_note($payment_id, sprintf(__('PayPal Payment #%s Refunded for reason: %s', 'give'), $data['parent_txn_id'], $data['reason_code']));
528
+	give_insert_payment_note($payment_id, sprintf(__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id']));
529
+	give_update_payment_status($payment_id, 'refunded');
530 530
 }
531 531
 
532 532
 /**
@@ -538,24 +538,24 @@  discard block
 block discarded – undo
538 538
  *
539 539
  * @return string
540 540
  */
541
-function give_get_paypal_redirect( $ssl_check = false ) {
541
+function give_get_paypal_redirect($ssl_check = false) {
542 542
 
543
-	if ( is_ssl() || ! $ssl_check ) {
543
+	if (is_ssl() || ! $ssl_check) {
544 544
 		$protocal = 'https://';
545 545
 	} else {
546 546
 		$protocal = 'http://';
547 547
 	}
548 548
 
549 549
 	// Check the current payment mode
550
-	if ( give_is_test_mode() ) {
550
+	if (give_is_test_mode()) {
551 551
 		// Test mode
552
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
552
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
553 553
 	} else {
554 554
 		// Live mode
555
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
555
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
556 556
 	}
557 557
 
558
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
558
+	return apply_filters('give_paypal_uri', $paypal_uri);
559 559
 }
560 560
 
561 561
 /**
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
  * @return string
566 566
  */
567 567
 function give_get_paypal_page_style() {
568
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
569
-	return apply_filters( 'give_paypal_page_style', $page_style );
568
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
569
+	return apply_filters('give_paypal_page_style', $page_style);
570 570
 }
571 571
 
572 572
 /**
@@ -581,27 +581,27 @@  discard block
 block discarded – undo
581 581
  * @return string
582 582
  *
583 583
  */
584
-function give_paypal_success_page_content( $content ) {
584
+function give_paypal_success_page_content($content) {
585 585
 
586
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
586
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
587 587
 		return $content;
588 588
 	}
589 589
 
590
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
590
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
591 591
 
592
-	if ( ! $payment_id ) {
592
+	if ( ! $payment_id) {
593 593
 		$session    = give_get_purchase_session();
594
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
594
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
595 595
 	}
596 596
 
597
-	$payment = get_post( $payment_id );
597
+	$payment = get_post($payment_id);
598 598
 
599
-	if ( $payment && 'pending' == $payment->post_status ) {
599
+	if ($payment && 'pending' == $payment->post_status) {
600 600
 
601 601
 		// Payment is still pending so show processing indicator to fix the Race Condition
602 602
 		ob_start();
603 603
 
604
-		give_get_template_part( 'payment', 'processing' );
604
+		give_get_template_part('payment', 'processing');
605 605
 
606 606
 		$content = ob_get_clean();
607 607
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 
612 612
 }
613 613
 
614
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
614
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
615 615
 
616 616
 /**
617 617
  * Given a Payment ID, extract the transaction ID
@@ -622,22 +622,22 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return string                   Transaction ID
624 624
  */
625
-function give_paypal_get_payment_transaction_id( $payment_id ) {
625
+function give_paypal_get_payment_transaction_id($payment_id) {
626 626
 
627 627
 	$transaction_id = '';
628
-	$notes          = give_get_payment_notes( $payment_id );
628
+	$notes          = give_get_payment_notes($payment_id);
629 629
 
630
-	foreach ( $notes as $note ) {
631
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
630
+	foreach ($notes as $note) {
631
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
632 632
 			$transaction_id = $match[1];
633 633
 			continue;
634 634
 		}
635 635
 	}
636 636
 
637
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
637
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
638 638
 }
639 639
 
640
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
640
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
641 641
 
642 642
 /**
643 643
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
  *
650 650
  * @return string                 A link to the PayPal transaction details
651 651
  */
652
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
652
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
653 653
 
654 654
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
655
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
655
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
656 656
 
657
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
657
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
658 658
 
659 659
 }
660 660
 
661
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
661
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the purchase data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( __( 'Nonce verification has failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(__('Nonce verification has failed', 'give'), __('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => $purchase_data['post_data']['give-price-id'],
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( __( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment );
61
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf(__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), json_encode($payment_data)), $payment);
62 62
 		// If errors are present, send the user back to the purchase page so they can be corrected
63
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
63
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
64 64
 	}
65 65
 }
66 66
 
67
-add_action( 'give_gateway_manual', 'give_manual_payment' );
67
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +128 added lines, -128 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
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return string $output Give forms dropdown
35 35
 	 */
36
-	public function forms_dropdown( $args = array() ) {
36
+	public function forms_dropdown($args = array()) {
37 37
 
38 38
 		$defaults = array(
39 39
 			'name'        => 'forms',
@@ -43,43 +43,43 @@  discard block
 block discarded – undo
43 43
 			'selected'    => 0,
44 44
 			'chosen'      => false,
45 45
 			'number'      => 30,
46
-			'placeholder' => sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() )
46
+			'placeholder' => sprintf(__('Select a %s', 'give'), give_get_forms_label_singular())
47 47
 		);
48 48
 
49
-		$args = wp_parse_args( $args, $defaults );
49
+		$args = wp_parse_args($args, $defaults);
50 50
 
51
-		$forms = get_posts( array(
51
+		$forms = get_posts(array(
52 52
 			'post_type'      => 'give_forms',
53 53
 			'orderby'        => 'title',
54 54
 			'order'          => 'ASC',
55 55
 			'posts_per_page' => $args['number']
56
-		) );
56
+		));
57 57
 
58 58
 		$options = array();
59 59
 
60
-		if ( $forms ) {
61
-			$options[0] = sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() );
62
-			foreach ( $forms as $form ) {
63
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
60
+		if ($forms) {
61
+			$options[0] = sprintf(__('Select a %s', 'give'), give_get_forms_label_singular());
62
+			foreach ($forms as $form) {
63
+				$options[absint($form->ID)] = esc_html($form->post_title);
64 64
 			}
65 65
 		} else {
66
-			$options[0] = __( 'No Give Forms Found', 'give' );
66
+			$options[0] = __('No Give Forms Found', 'give');
67 67
 		}
68 68
 
69 69
 		// This ensures that any selected forms are included in the drop down
70
-		if ( is_array( $args['selected'] ) ) {
71
-			foreach ( $args['selected'] as $item ) {
72
-				if ( ! in_array( $item, $options ) ) {
73
-					$options[ $item ] = get_the_title( $item );
70
+		if (is_array($args['selected'])) {
71
+			foreach ($args['selected'] as $item) {
72
+				if ( ! in_array($item, $options)) {
73
+					$options[$item] = get_the_title($item);
74 74
 				}
75 75
 			}
76
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
77
-			if ( ! in_array( $args['selected'], $options ) ) {
78
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
76
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
77
+			if ( ! in_array($args['selected'], $options)) {
78
+				$options[$args['selected']] = get_the_title($args['selected']);
79 79
 			}
80 80
 		}
81 81
 
82
-		$output = $this->select( array(
82
+		$output = $this->select(array(
83 83
 			'name'             => $args['name'],
84 84
 			'selected'         => $args['selected'],
85 85
 			'id'               => $args['id'],
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			'placeholder'      => $args['placeholder'],
91 91
 			'show_option_all'  => false,
92 92
 			'show_option_none' => false
93
-		) );
93
+		));
94 94
 
95 95
 		return $output;
96 96
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string $output Donor dropdown
107 107
 	 */
108
-	public function donor_dropdown( $args = array() ) {
108
+	public function donor_dropdown($args = array()) {
109 109
 
110 110
 		$defaults = array(
111 111
 			'name'        => 'customers',
@@ -114,38 +114,38 @@  discard block
 block discarded – undo
114 114
 			'multiple'    => false,
115 115
 			'selected'    => 0,
116 116
 			'chosen'      => true,
117
-			'placeholder' => __( 'Select a Donor', 'give' ),
117
+			'placeholder' => __('Select a Donor', 'give'),
118 118
 			'number'      => 30
119 119
 		);
120 120
 
121
-		$args = wp_parse_args( $args, $defaults );
121
+		$args = wp_parse_args($args, $defaults);
122 122
 
123
-		$customers = Give()->customers->get_customers( array(
123
+		$customers = Give()->customers->get_customers(array(
124 124
 			'number' => $args['number']
125
-		) );
125
+		));
126 126
 
127 127
 		$options = array();
128 128
 
129
-		if ( $customers ) {
130
-			$options[0] = __( 'No donor attached', 'give' );
131
-			foreach ( $customers as $customer ) {
132
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
129
+		if ($customers) {
130
+			$options[0] = __('No donor attached', 'give');
131
+			foreach ($customers as $customer) {
132
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
133 133
 			}
134 134
 		} else {
135
-			$options[0] = __( 'No donors found', 'give' );
135
+			$options[0] = __('No donors found', 'give');
136 136
 		}
137 137
 
138
-		if ( ! empty( $args['selected'] ) ) {
138
+		if ( ! empty($args['selected'])) {
139 139
 
140 140
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed
141 141
 
142
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
142
+			if ( ! array_key_exists($args['selected'], $options)) {
143 143
 
144
-				$customer = new Give_Customer( $args['selected'] );
144
+				$customer = new Give_Customer($args['selected']);
145 145
 
146
-				if ( $customer ) {
146
+				if ($customer) {
147 147
 
148
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
148
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
149 149
 
150 150
 				}
151 151
 
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 
154 154
 		}
155 155
 
156
-		$output = $this->select( array(
156
+		$output = $this->select(array(
157 157
 			'name'             => $args['name'],
158 158
 			'selected'         => $args['selected'],
159 159
 			'id'               => $args['id'],
160
-			'class'            => $args['class'] . ' give-customer-select',
160
+			'class'            => $args['class'].' give-customer-select',
161 161
 			'options'          => $options,
162 162
 			'multiple'         => $args['multiple'],
163 163
 			'chosen'           => $args['chosen'],
164 164
 			'show_option_all'  => false,
165 165
 			'show_option_none' => false
166
-		) );
166
+		));
167 167
 
168 168
 		return $output;
169 169
 	}
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string $output Category dropdown
182 182
 	 */
183
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
184
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
183
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
184
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
185 185
 		$options    = array();
186 186
 
187
-		foreach ( $categories as $category ) {
188
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
187
+		foreach ($categories as $category) {
188
+			$options[absint($category->term_id)] = esc_html($category->name);
189 189
 		}
190 190
 
191
-		$output = $this->select( array(
191
+		$output = $this->select(array(
192 192
 			'name'             => $name,
193 193
 			'selected'         => $selected,
194 194
 			'options'          => $options,
195
-			'show_option_all'  => __( 'All Categories', 'give' ),
195
+			'show_option_all'  => __('All Categories', 'give'),
196 196
 			'show_option_none' => false
197
-		) );
197
+		));
198 198
 
199 199
 		return $output;
200 200
 	}
@@ -212,25 +212,25 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return string $output Year dropdown
214 214
 	 */
215
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
216
-		$current    = date( 'Y' );
217
-		$start_year = $current - absint( $years_before );
218
-		$end_year   = $current + absint( $years_after );
219
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
215
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
216
+		$current    = date('Y');
217
+		$start_year = $current - absint($years_before);
218
+		$end_year   = $current + absint($years_after);
219
+		$selected   = empty($selected) ? date('Y') : $selected;
220 220
 		$options    = array();
221 221
 
222
-		while ( $start_year <= $end_year ) {
223
-			$options[ absint( $start_year ) ] = $start_year;
224
-			$start_year ++;
222
+		while ($start_year <= $end_year) {
223
+			$options[absint($start_year)] = $start_year;
224
+			$start_year++;
225 225
 		}
226 226
 
227
-		$output = $this->select( array(
227
+		$output = $this->select(array(
228 228
 			'name'             => $name,
229 229
 			'selected'         => $selected,
230 230
 			'options'          => $options,
231 231
 			'show_option_all'  => false,
232 232
 			'show_option_none' => false
233
-		) );
233
+		));
234 234
 
235 235
 		return $output;
236 236
 	}
@@ -247,23 +247,23 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @return string $output Month dropdown
249 249
 	 */
250
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
250
+	public function month_dropdown($name = 'month', $selected = 0) {
251 251
 		$month    = 1;
252 252
 		$options  = array();
253
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
253
+		$selected = empty($selected) ? date('n') : $selected;
254 254
 
255
-		while ( $month <= 12 ) {
256
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
257
-			$month ++;
255
+		while ($month <= 12) {
256
+			$options[absint($month)] = give_month_num_to_name($month);
257
+			$month++;
258 258
 		}
259 259
 
260
-		$output = $this->select( array(
260
+		$output = $this->select(array(
261 261
 			'name'             => $name,
262 262
 			'selected'         => $selected,
263 263
 			'options'          => $options,
264 264
 			'show_option_all'  => false,
265 265
 			'show_option_none' => false
266
-		) );
266
+		));
267 267
 
268 268
 		return $output;
269 269
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @return string
279 279
 	 */
280
-	public function select( $args = array() ) {
280
+	public function select($args = array()) {
281 281
 		$defaults = array(
282 282
 			'options'          => array(),
283 283
 			'name'             => null,
@@ -287,60 +287,60 @@  discard block
 block discarded – undo
287 287
 			'chosen'           => false,
288 288
 			'placeholder'      => null,
289 289
 			'multiple'         => false,
290
-			'show_option_all'  => _x( 'All', 'all dropdown items', 'give' ),
291
-			'show_option_none' => _x( 'None', 'no dropdown items', 'give' )
290
+			'show_option_all'  => _x('All', 'all dropdown items', 'give'),
291
+			'show_option_none' => _x('None', 'no dropdown items', 'give')
292 292
 		);
293 293
 
294
-		$args = wp_parse_args( $args, $defaults );
294
+		$args = wp_parse_args($args, $defaults);
295 295
 
296 296
 
297
-		if ( $args['multiple'] ) {
297
+		if ($args['multiple']) {
298 298
 			$multiple = ' MULTIPLE';
299 299
 		} else {
300 300
 			$multiple = '';
301 301
 		}
302 302
 
303
-		if ( $args['chosen'] ) {
303
+		if ($args['chosen']) {
304 304
 			$args['class'] .= ' give-select-chosen';
305 305
 		}
306 306
 
307
-		if ( $args['placeholder'] ) {
307
+		if ($args['placeholder']) {
308 308
 			$placeholder = $args['placeholder'];
309 309
 		} else {
310 310
 			$placeholder = '';
311 311
 		}
312 312
 
313
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">';
313
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">';
314 314
 
315
-		if ( $args['show_option_all'] ) {
316
-			if ( $args['multiple'] ) {
317
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
315
+		if ($args['show_option_all']) {
316
+			if ($args['multiple']) {
317
+				$selected = selected(true, in_array(0, $args['selected']), false);
318 318
 			} else {
319
-				$selected = selected( $args['selected'], 0, false );
319
+				$selected = selected($args['selected'], 0, false);
320 320
 			}
321
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
321
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
322 322
 		}
323 323
 
324
-		if ( ! empty( $args['options'] ) ) {
324
+		if ( ! empty($args['options'])) {
325 325
 
326
-			if ( $args['show_option_none'] ) {
327
-				if ( $args['multiple'] ) {
328
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
326
+			if ($args['show_option_none']) {
327
+				if ($args['multiple']) {
328
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
329 329
 				} else {
330
-					$selected = selected( $args['selected'], - 1, false );
330
+					$selected = selected($args['selected'], - 1, false);
331 331
 				}
332
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
332
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
333 333
 			}
334 334
 
335
-			foreach ( $args['options'] as $key => $option ) {
335
+			foreach ($args['options'] as $key => $option) {
336 336
 
337
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
338
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
337
+				if ($args['multiple'] && is_array($args['selected'])) {
338
+					$selected = selected(true, in_array($key, $args['selected']), false);
339 339
 				} else {
340
-					$selected = selected( $args['selected'], $key, false );
340
+					$selected = selected($args['selected'], $key, false);
341 341
 				}
342 342
 
343
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
343
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
344 344
 			}
345 345
 		}
346 346
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @return string
360 360
 	 */
361
-	public function checkbox( $args = array() ) {
361
+	public function checkbox($args = array()) {
362 362
 		$defaults = array(
363 363
 			'name'    => null,
364 364
 			'current' => null,
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
 			)
370 370
 		);
371 371
 
372
-		$args = wp_parse_args( $args, $defaults );
372
+		$args = wp_parse_args($args, $defaults);
373 373
 
374 374
 		$options = '';
375
-		if ( ! empty( $args['options']['disabled'] ) ) {
375
+		if ( ! empty($args['options']['disabled'])) {
376 376
 			$options .= ' disabled="disabled"';
377
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
377
+		} elseif ( ! empty($args['options']['readonly'])) {
378 378
 			$options .= ' readonly';
379 379
 		}
380 380
 
381
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
381
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
382 382
 
383 383
 		return $output;
384 384
 	}
@@ -392,22 +392,22 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return string Text field
394 394
 	 */
395
-	public function text( $args = array() ) {
395
+	public function text($args = array()) {
396 396
 		// Backwards compatabliity
397
-		if ( func_num_args() > 1 ) {
397
+		if (func_num_args() > 1) {
398 398
 			$args = func_get_args();
399 399
 
400 400
 			$name  = $args[0];
401
-			$value = isset( $args[1] ) ? $args[1] : '';
402
-			$label = isset( $args[2] ) ? $args[2] : '';
403
-			$desc  = isset( $args[3] ) ? $args[3] : '';
401
+			$value = isset($args[1]) ? $args[1] : '';
402
+			$label = isset($args[2]) ? $args[2] : '';
403
+			$desc  = isset($args[3]) ? $args[3] : '';
404 404
 		}
405 405
 
406 406
 		$defaults = array(
407
-			'name'         => isset( $name ) ? $name : 'text',
408
-			'value'        => isset( $value ) ? $value : null,
409
-			'label'        => isset( $label ) ? $label : null,
410
-			'desc'         => isset( $desc ) ? $desc : null,
407
+			'name'         => isset($name) ? $name : 'text',
408
+			'value'        => isset($value) ? $value : null,
409
+			'label'        => isset($label) ? $label : null,
410
+			'desc'         => isset($desc) ? $desc : null,
411 411
 			'placeholder'  => '',
412 412
 			'class'        => 'regular-text',
413 413
 			'disabled'     => false,
@@ -415,29 +415,29 @@  discard block
 block discarded – undo
415 415
 			'data'         => false
416 416
 		);
417 417
 
418
-		$args = wp_parse_args( $args, $defaults );
418
+		$args = wp_parse_args($args, $defaults);
419 419
 
420 420
 		$disabled = '';
421
-		if ( $args['disabled'] ) {
421
+		if ($args['disabled']) {
422 422
 			$disabled = ' disabled="disabled"';
423 423
 		}
424 424
 
425 425
 		$data = '';
426
-		if ( ! empty( $args['data'] ) ) {
427
-			foreach ( $args['data'] as $key => $value ) {
428
-				$data .= 'data-' . $key . '="' . $value . '" ';
426
+		if ( ! empty($args['data'])) {
427
+			foreach ($args['data'] as $key => $value) {
428
+				$data .= 'data-'.$key.'="'.$value.'" ';
429 429
 			}
430 430
 		}
431 431
 
432
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
432
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
433 433
 
434
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
434
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
435 435
 
436
-		if ( ! empty( $args['desc'] ) ) {
437
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
436
+		if ( ! empty($args['desc'])) {
437
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
438 438
 		}
439 439
 
440
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
440
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
441 441
 
442 442
 		$output .= '</span>';
443 443
 
@@ -453,15 +453,15 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return string Datepicker field
455 455
 	 */
456
-	public function date_field( $args = array() ) {
456
+	public function date_field($args = array()) {
457 457
 
458
-		if ( empty( $args['class'] ) ) {
458
+		if (empty($args['class'])) {
459 459
 			$args['class'] = 'give_datepicker';
460
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
460
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
461 461
 			$args['class'] .= ' give_datepicker';
462 462
 		}
463 463
 
464
-		return $this->text( $args );
464
+		return $this->text($args);
465 465
 	}
466 466
 
467 467
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return string textarea
476 476
 	 */
477
-	public function textarea( $args = array() ) {
477
+	public function textarea($args = array()) {
478 478
 		$defaults = array(
479 479
 			'name'     => 'textarea',
480 480
 			'value'    => null,
@@ -484,21 +484,21 @@  discard block
 block discarded – undo
484 484
 			'disabled' => false
485 485
 		);
486 486
 
487
-		$args = wp_parse_args( $args, $defaults );
487
+		$args = wp_parse_args($args, $defaults);
488 488
 
489 489
 		$disabled = '';
490
-		if ( $args['disabled'] ) {
490
+		if ($args['disabled']) {
491 491
 			$disabled = ' disabled="disabled"';
492 492
 		}
493 493
 
494
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
494
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
495 495
 
496
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
496
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
497 497
 
498
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
498
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
499 499
 
500
-		if ( ! empty( $args['desc'] ) ) {
501
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
500
+		if ( ! empty($args['desc'])) {
501
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
502 502
 		}
503 503
 
504 504
 		$output .= '</span>';
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @return string text field with ajax search
517 517
 	 */
518
-	public function ajax_user_search( $args = array() ) {
518
+	public function ajax_user_search($args = array()) {
519 519
 
520 520
 		$defaults = array(
521 521
 			'name'         => 'user_id',
522 522
 			'value'        => null,
523
-			'placeholder'  => __( 'Enter username', 'give' ),
523
+			'placeholder'  => __('Enter username', 'give'),
524 524
 			'label'        => null,
525 525
 			'desc'         => null,
526 526
 			'class'        => '',
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 			'data'         => false
530 530
 		);
531 531
 
532
-		$args = wp_parse_args( $args, $defaults );
532
+		$args = wp_parse_args($args, $defaults);
533 533
 
534
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
534
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
535 535
 
536 536
 		$output = '<span class="give_user_search_wrap">';
537
-		$output .= $this->text( $args );
538
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . __( 'Cancel', 'give' ) . '" aria-label="' . __( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
537
+		$output .= $this->text($args);
538
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.__('Cancel', 'give').'" aria-label="'.__('Cancel', 'give').'" href="#">x</a><span></span></span>';
539 539
 		$output .= '</span>';
540 540
 
541 541
 		return $output;
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param $url
83 83
 	 *
84
-	 * @return mixed
84
+	 * @return string
85 85
 	 */
86 86
 	public function give_update_cmb_meta_box_url( $url ) {
87 87
 		//Path to Give's CMB
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  * @since 1.0
768 768
  *
769 769
  * @param string $key The Key to update
770
- * @param string|bool|int $value The value to set the key to
770
+ * @param integer $value The value to set the key to
771 771
  *
772 772
  * @return boolean True if updated, false if not.
773 773
  */
Please login to merge, or discard this patch.
Spacing   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -49,26 +49,26 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __construct() {
51 51
 
52
-		add_action( 'admin_init', array( $this, 'init' ) );
52
+		add_action('admin_init', array($this, 'init'));
53 53
 
54 54
 		//Customize CMB2 URL
55
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
55
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
56 56
 
57 57
 		//Custom CMB2 Settings Fields
58
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
59
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
60
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
61
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
62
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
63
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
64
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
65
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
66
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
58
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
59
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
60
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
61
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
62
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
63
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
64
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
65
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
66
+		add_action('admin_notices', array($this, 'settings_notices'));
67 67
 
68 68
 		// Include CMB CSS in the head to avoid FOUC
69
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
69
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
70 70
 
71
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
71
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
72 72
 
73 73
 	}
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since  1.0
79 79
 	 */
80 80
 	public function init() {
81
-		register_setting( $this->key, $this->key );
81
+		register_setting($this->key, $this->key);
82 82
 
83 83
 	}
84 84
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return mixed
94 94
 	 */
95
-	public function give_update_cmb_meta_box_url( $url ) {
95
+	public function give_update_cmb_meta_box_url($url) {
96 96
 		//Path to Give's CMB
97
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
97
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
98 98
 	}
99 99
 
100 100
 
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function give_get_settings_tabs() {
108 108
 
109
-		$settings = $this->give_settings( null );
109
+		$settings = $this->give_settings(null);
110 110
 
111 111
 		$tabs             = array();
112
-		$tabs['general']  = __( 'General', 'give' );
113
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
114
-		$tabs['display']  = __( 'Display Options', 'give' );
115
-		$tabs['emails']   = __( 'Emails', 'give' );
112
+		$tabs['general']  = __('General', 'give');
113
+		$tabs['gateways'] = __('Payment Gateways', 'give');
114
+		$tabs['display']  = __('Display Options', 'give');
115
+		$tabs['emails']   = __('Emails', 'give');
116 116
 
117
-		if ( ! empty( $settings['addons']['fields'] ) ) {
118
-			$tabs['addons'] = __( 'Add-ons', 'give' );
117
+		if ( ! empty($settings['addons']['fields'])) {
118
+			$tabs['addons'] = __('Add-ons', 'give');
119 119
 		}
120 120
 
121
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
122
-			$tabs['licenses'] = __( 'Licenses', 'give' );
121
+		if ( ! empty($settings['licenses']['fields'])) {
122
+			$tabs['licenses'] = __('Licenses', 'give');
123 123
 		}
124 124
 
125
-		$tabs['advanced']    = __( 'Advanced', 'give' );
126
-		$tabs['api']         = __( 'API', 'give' );
127
-		$tabs['system_info'] = __( 'System Info', 'give' );
125
+		$tabs['advanced']    = __('Advanced', 'give');
126
+		$tabs['api']         = __('API', 'give');
127
+		$tabs['system_info'] = __('System Info', 'give');
128 128
 
129
-		return apply_filters( 'give_settings_tabs', $tabs );
129
+		return apply_filters('give_settings_tabs', $tabs);
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function admin_page_display() {
138 138
 
139
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
139
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
140 140
 
141 141
 		?>
142 142
 
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 
145 145
 			<h1 class="nav-tab-wrapper">
146 146
 				<?php
147
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
147
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
148 148
 
149 149
 					//Support legacy tab creation conditions based off $_GET parameter
150 150
 					//We pass the $_GET['tab'] to conditions executed later
151 151
 					$_GET['tab'] = $tab_id;
152 152
 
153
-					$tab_url = esc_url( add_query_arg( array(
153
+					$tab_url = esc_url(add_query_arg(array(
154 154
 						'settings-updated' => false,
155 155
 						'tab'              => $tab_id
156
-					) ) );
156
+					)));
157 157
 
158
-					$active       = $active_tab == $tab_id ? ' nav-tab-active' : '';
158
+					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
159 159
 
160
-					echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
160
+					echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
161 161
 
162 162
 				}
163 163
 				?>
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 
166 166
 			<?php
167 167
 			//Loop through and output settings
168
-			foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
168
+			foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
169 169
 
170 170
 				//Support legacy tab creation conditions based off $_GET parameter
171 171
 				//We 'trick' the conditions into thinking this is the tab
172 172
 				$_GET['tab'] = $tab_id;
173 173
 
174
-				$tab_settings = $this->give_settings( $tab_id );
174
+				$tab_settings = $this->give_settings($tab_id);
175 175
 
176 176
 				//Pass active tab within $tab_settings so we can hide with CSS via PHP
177
-				if ( $active_tab == $tab_id ) {
177
+				if ($active_tab == $tab_id) {
178 178
 					$tab_settings['active_tab'] = true;
179 179
 				}
180 180
 
181
-				cmb2_metabox_form( $tab_settings, $this->key );
181
+				cmb2_metabox_form($tab_settings, $this->key);
182 182
 
183 183
 			} ?>
184 184
 
@@ -196,34 +196,34 @@  discard block
 block discarded – undo
196 196
 	 * @since 1.5 Modified to CSS hide non-active tabs
197 197
 	 * @since 1.0
198 198
 	 */
199
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
199
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
200 200
 
201 201
 
202
-		$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
202
+		$pagenow = isset($_GET['page']) ? $_GET['page'] : '';
203 203
 
204 204
 		//only modify the give settings form
205
-		if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) {
205
+		if ('give_settings' == $object_id && $pagenow == 'give-settings') {
206 206
 
207 207
 			$style = '';
208
-			if ( ! isset( $cmb->meta_box['active_tab'] ) ) {
208
+			if ( ! isset($cmb->meta_box['active_tab'])) {
209 209
 				$style = 'style="display:none;"';
210 210
 			}
211 211
 
212 212
 			//Set ID based off tab name - protects backwards compatibility
213
-			$tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id'];
213
+			$tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id'];
214 214
 
215
-			$save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div>' );
215
+			$save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div>');
216 216
 
217 217
 			//Filter so some tabs won't have save settings
218
-			$no_save_button = apply_filters( 'give_settings_no_save_output', array(
218
+			$no_save_button = apply_filters('give_settings_no_save_output', array(
219 219
 				'system_info'
220
-			) );
220
+			));
221 221
 
222
-			if ( in_array( $tab_id, $no_save_button ) ) {
222
+			if (in_array($tab_id, $no_save_button)) {
223 223
 				$save_button = '';
224 224
 			}
225 225
 
226
-			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>';
226
+			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>';
227 227
 
228 228
 		}
229 229
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return array
242 242
 	 */
243
-	public function give_settings( $active_tab ) {
243
+	public function give_settings($active_tab) {
244 244
 
245 245
 		$give_settings = array(
246 246
 			/**
@@ -248,60 +248,60 @@  discard block
 block discarded – undo
248 248
 			 */
249 249
 			'general'     => array(
250 250
 				'id'         => 'general_settings',
251
-				'give_title' => __( 'General Settings', 'give' ),
252
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
253
-				'fields'     => apply_filters( 'give_settings_general', array(
251
+				'give_title' => __('General Settings', 'give'),
252
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
253
+				'fields'     => apply_filters('give_settings_general', array(
254 254
 						array(
255
-							'name' => __( 'General Settings', 'give' ),
255
+							'name' => __('General Settings', 'give'),
256 256
 							'desc' => '',
257 257
 							'type' => 'give_title',
258 258
 							'id'   => 'give_title_general_settings_1'
259 259
 						),
260 260
 						array(
261
-							'name'    => __( 'Success Page', 'give' ),
262
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %1$s[give_receipt]%2$s shortcode should be on this page.', 'give' ), '<code>', '</code>' ),
261
+							'name'    => __('Success Page', 'give'),
262
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %1$s[give_receipt]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'),
263 263
 							'id'      => 'success_page',
264 264
 							'type'    => 'select',
265
-							'options' => give_cmb2_get_post_options( array(
265
+							'options' => give_cmb2_get_post_options(array(
266 266
 								'post_type'   => 'page',
267
-								'numberposts' => - 1
268
-							) ),
267
+								'numberposts' => -1
268
+							)),
269 269
 						),
270 270
 						array(
271
-							'name'    => __( 'Failed Transaction Page', 'give' ),
272
-							'desc'    => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
271
+							'name'    => __('Failed Transaction Page', 'give'),
272
+							'desc'    => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
273 273
 							'id'      => 'failure_page',
274 274
 							'type'    => 'select',
275
-							'options' => give_cmb2_get_post_options( array(
275
+							'options' => give_cmb2_get_post_options(array(
276 276
 								'post_type'   => 'page',
277
-								'numberposts' => - 1
278
-							) ),
277
+								'numberposts' => -1
278
+							)),
279 279
 						),
280 280
 						array(
281
-							'name'    => __( 'Donation History Page', 'give' ),
282
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %1$s[donation_history]%2$s shortcode should be on this page.', 'give' ), '<code>', '</code>' ),
281
+							'name'    => __('Donation History Page', 'give'),
282
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %1$s[donation_history]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'),
283 283
 							'id'      => 'history_page',
284 284
 							'type'    => 'select',
285
-							'options' => give_cmb2_get_post_options( array(
285
+							'options' => give_cmb2_get_post_options(array(
286 286
 								'post_type'   => 'page',
287
-								'numberposts' => - 1
288
-							) ),
287
+								'numberposts' => -1
288
+							)),
289 289
 						),
290 290
 						array(
291
-							'name'    => __( 'Base Country', 'give' ),
292
-							'desc'    => __( 'Where does your site operate from?', 'give' ),
291
+							'name'    => __('Base Country', 'give'),
292
+							'desc'    => __('Where does your site operate from?', 'give'),
293 293
 							'id'      => 'base_country',
294 294
 							'type'    => 'select',
295 295
 							'options' => give_get_country_list(),
296 296
 						),
297 297
 						array(
298
-							'name' => __( 'Currency Settings', 'give' ),
298
+							'name' => __('Currency Settings', 'give'),
299 299
 							'desc' => '',
300 300
 							'type' => 'give_title',
301 301
 							'id'   => 'give_title_general_settings_2'
302 302
 						),
303 303
 						array(
304
-							'name'    => __( 'Currency', 'give' ),
304
+							'name'    => __('Currency', 'give'),
305 305
 							'desc'    => 'Choose your currency. Note that some payment gateways have currency restrictions.',
306 306
 							'id'      => 'currency',
307 307
 							'type'    => 'select',
@@ -309,26 +309,26 @@  discard block
 block discarded – undo
309 309
 							'default' => 'USD',
310 310
 						),
311 311
 						array(
312
-							'name'    => __( 'Currency Position', 'give' ),
312
+							'name'    => __('Currency Position', 'give'),
313 313
 							'desc'    => 'Choose the position of the currency sign.',
314 314
 							'id'      => 'currency_position',
315 315
 							'type'    => 'select',
316 316
 							'options' => array(
317
-								'before' => sprintf( __( 'Before - %1$s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
318
-								'after'  => sprintf( __( 'After - 10%1$s', 'give' ), give_currency_symbol( give_get_currency() ) )
317
+								'before' => sprintf(__('Before - %1$s10', 'give'), give_currency_symbol(give_get_currency())),
318
+								'after'  => sprintf(__('After - 10%1$s', 'give'), give_currency_symbol(give_get_currency()))
319 319
 							),
320 320
 							'default' => 'before',
321 321
 						),
322 322
 						array(
323
-							'name'    => __( 'Thousands Separator', 'give' ),
324
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands', 'give' ),
323
+							'name'    => __('Thousands Separator', 'give'),
324
+							'desc'    => __('The symbol (typically , or .) to separate thousands', 'give'),
325 325
 							'id'      => 'thousands_separator',
326 326
 							'type'    => 'text_small',
327 327
 							'default' => ',',
328 328
 						),
329 329
 						array(
330
-							'name'    => __( 'Decimal Separator', 'give' ),
331
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points', 'give' ),
330
+							'name'    => __('Decimal Separator', 'give'),
331
+							'desc'    => __('The symbol (usually , or .) to separate decimal points', 'give'),
332 332
 							'id'      => 'decimal_separator',
333 333
 							'type'    => 'text_small',
334 334
 							'default' => '.',
@@ -341,83 +341,83 @@  discard block
 block discarded – undo
341 341
 			 */
342 342
 			'gateways'    => array(
343 343
 				'id'         => 'payment_gateways',
344
-				'give_title' => __( 'Payment Gateways', 'give' ),
345
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
346
-				'fields'     => apply_filters( 'give_settings_gateways', array(
344
+				'give_title' => __('Payment Gateways', 'give'),
345
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
346
+				'fields'     => apply_filters('give_settings_gateways', array(
347 347
 						array(
348
-							'name' => __( 'Gateways Settings', 'give' ),
348
+							'name' => __('Gateways Settings', 'give'),
349 349
 							'desc' => '',
350 350
 							'id'   => 'give_title_gateway_settings_1',
351 351
 							'type' => 'give_title'
352 352
 						),
353 353
 						array(
354
-							'name' => __( 'Test Mode', 'give' ),
355
-							'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
354
+							'name' => __('Test Mode', 'give'),
355
+							'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
356 356
 							'id'   => 'test_mode',
357 357
 							'type' => 'checkbox'
358 358
 						),
359 359
 						array(
360
-							'name' => __( 'Enabled Gateways', 'give' ),
361
-							'desc' => __( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
360
+							'name' => __('Enabled Gateways', 'give'),
361
+							'desc' => __('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
362 362
 							'id'   => 'gateways',
363 363
 							'type' => 'enabled_gateways'
364 364
 						),
365 365
 						array(
366
-							'name' => __( 'Default Gateway', 'give' ),
367
-							'desc' => __( 'This is the gateway that will be selected by default.', 'give' ),
366
+							'name' => __('Default Gateway', 'give'),
367
+							'desc' => __('This is the gateway that will be selected by default.', 'give'),
368 368
 							'id'   => 'default_gateway',
369 369
 							'type' => 'default_gateway'
370 370
 						),
371 371
 						array(
372
-							'name' => __( 'PayPal Standard', 'give' ),
372
+							'name' => __('PayPal Standard', 'give'),
373 373
 							'desc' => '',
374 374
 							'type' => 'give_title',
375 375
 							'id'   => 'give_title_gateway_settings_2',
376 376
 						),
377 377
 						array(
378
-							'name' => __( 'PayPal Email', 'give' ),
379
-							'desc' => __( 'Enter your PayPal account\'s email', 'give' ),
378
+							'name' => __('PayPal Email', 'give'),
379
+							'desc' => __('Enter your PayPal account\'s email', 'give'),
380 380
 							'id'   => 'paypal_email',
381 381
 							'type' => 'text_email',
382 382
 						),
383 383
 						array(
384
-							'name' => __( 'PayPal Page Style', 'give' ),
385
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default', 'give' ),
384
+							'name' => __('PayPal Page Style', 'give'),
385
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'),
386 386
 							'id'   => 'paypal_page_style',
387 387
 							'type' => 'text',
388 388
 						),
389 389
 						array(
390
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
391
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
390
+							'name'    => __('PayPal Transaction Type', 'give'),
391
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
392 392
 							'id'      => 'paypal_button_type',
393 393
 							'type'    => 'radio_inline',
394 394
 							'options' => array(
395
-								'donation' => __( 'Donation', 'give' ),
396
-								'standard' => __( 'Standard Transaction', 'give' )
395
+								'donation' => __('Donation', 'give'),
396
+								'standard' => __('Standard Transaction', 'give')
397 397
 							),
398 398
 							'default' => 'donation',
399 399
 						),
400 400
 						array(
401
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
402
-							'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
401
+							'name' => __('Disable PayPal IPN Verification', 'give'),
402
+							'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
403 403
 							'id'   => 'disable_paypal_verification',
404 404
 							'type' => 'checkbox'
405 405
 						),
406 406
 						array(
407
-							'name' => __( 'Offline Donations', 'give' ),
407
+							'name' => __('Offline Donations', 'give'),
408 408
 							'desc' => '',
409 409
 							'type' => 'give_title',
410 410
 							'id'   => 'give_title_gateway_settings_3',
411 411
 						),
412 412
 						array(
413
-							'name' => __( 'Collect Billing Details', 'give' ),
414
-							'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
413
+							'name' => __('Collect Billing Details', 'give'),
414
+							'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
415 415
 							'id'   => 'give_offline_donation_enable_billing_fields',
416 416
 							'type' => 'checkbox'
417 417
 						),
418 418
 						array(
419
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
420
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
419
+							'name'    => __('Offline Donation Instructions', 'give'),
420
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
421 421
 							'id'      => 'global_offline_donation_content',
422 422
 							'default' => give_get_default_offline_donation_content(),
423 423
 							'type'    => 'wysiwyg',
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
 							)
427 427
 						),
428 428
 						array(
429
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
430
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
429
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
430
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
431 431
 							'id'      => 'offline_donation_subject',
432
-							'default' => __( '{donation} - Offline Donation Instructions', 'give' ),
432
+							'default' => __('{donation} - Offline Donation Instructions', 'give'),
433 433
 							'type'    => 'text'
434 434
 						),
435 435
 						array(
436
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
437
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
436
+							'name'    => __('Offline Donation Email Instructions', 'give'),
437
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
438 438
 							'id'      => 'global_offline_donation_email',
439 439
 							'default' => give_get_default_offline_donation_email_content(),
440 440
 							'type'    => 'wysiwyg',
@@ -448,93 +448,93 @@  discard block
 block discarded – undo
448 448
 			/** Display Settings */
449 449
 			'display'     => array(
450 450
 				'id'         => 'display_settings',
451
-				'give_title' => __( 'Display Settings', 'give' ),
452
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
453
-				'fields'     => apply_filters( 'give_settings_display', array(
451
+				'give_title' => __('Display Settings', 'give'),
452
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
453
+				'fields'     => apply_filters('give_settings_display', array(
454 454
 						array(
455
-							'name' => __( 'Display Settings', 'give' ),
455
+							'name' => __('Display Settings', 'give'),
456 456
 							'desc' => '',
457 457
 							'id'   => 'give_title_display_settings_1',
458 458
 							'type' => 'give_title'
459 459
 						),
460 460
 						array(
461
-							'name' => __( 'Disable CSS', 'give' ),
462
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
461
+							'name' => __('Disable CSS', 'give'),
462
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
463 463
 							'id'   => 'disable_css',
464 464
 							'type' => 'checkbox'
465 465
 						),
466 466
 						array(
467
-							'name' => __( 'Enable Floating Labels', 'give' ),
468
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), '<a href="' . esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) . '" target="_blank">', '</a>', '<br />' ),
467
+							'name' => __('Enable Floating Labels', 'give'),
468
+							'desc' => sprintf(esc_html__('Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), '<a href="'.esc_url("http://bradfrost.com/blog/post/float-label-pattern/").'" target="_blank">', '</a>', '<br />'),
469 469
 							'id'   => 'enable_floatlabels',
470 470
 							'type' => 'checkbox'
471 471
 						),
472 472
 						array(
473
-							'name' => __( 'Disable Welcome Screen', 'give' ),
474
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen %1$shere%2$s if you want in the future.', 'give' ), '<a href="' . esc_url( admin_url( 'index.php?page=give-about' ) ) . '">', '</a>' ),
473
+							'name' => __('Disable Welcome Screen', 'give'),
474
+							'desc' => sprintf(esc_html__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen %1$shere%2$s if you want in the future.', 'give'), '<a href="'.esc_url(admin_url('index.php?page=give-about')).'">', '</a>'),
475 475
 							'id'   => 'disable_welcome',
476 476
 							'type' => 'checkbox'
477 477
 						),
478 478
 						array(
479
-							'name' => __( 'Post Types', 'give' ),
479
+							'name' => __('Post Types', 'give'),
480 480
 							'desc' => '',
481 481
 							'id'   => 'give_title_display_settings_2',
482 482
 							'type' => 'give_title'
483 483
 						),
484 484
 						array(
485
-							'name' => __( 'Disable Form Single Views', 'give' ),
486
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
485
+							'name' => __('Disable Form Single Views', 'give'),
486
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
487 487
 							'id'   => 'disable_forms_singular',
488 488
 							'type' => 'checkbox'
489 489
 						),
490 490
 						array(
491
-							'name' => __( 'Disable Form Archives', 'give' ),
492
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
491
+							'name' => __('Disable Form Archives', 'give'),
492
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
493 493
 							'id'   => 'disable_forms_archives',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => __( 'Disable Form Excerpts', 'give' ),
498
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
497
+							'name' => __('Disable Form Excerpts', 'give'),
498
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
499 499
 							'id'   => 'disable_forms_excerpt',
500 500
 							'type' => 'checkbox'
501 501
 						),
502 502
 
503 503
 						array(
504
-							'name'    => __( 'Featured Image Size', 'give' ),
505
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
504
+							'name'    => __('Featured Image Size', 'give'),
505
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
506 506
 							'id'      => 'featured_image_size',
507 507
 							'type'    => 'select',
508 508
 							'default' => 'large',
509 509
 							'options' => give_get_featured_image_sizes()
510 510
 						),
511 511
 						array(
512
-							'name' => __( 'Disable Form Featured Image', 'give' ),
513
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
512
+							'name' => __('Disable Form Featured Image', 'give'),
513
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
514 514
 							'id'   => 'disable_form_featured_img',
515 515
 							'type' => 'checkbox'
516 516
 						),
517 517
 						array(
518
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
519
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
518
+							'name' => __('Disable Single Form Sidebar', 'give'),
519
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
520 520
 							'id'   => 'disable_form_sidebar',
521 521
 							'type' => 'checkbox'
522 522
 						),
523 523
 						array(
524
-							'name' => __( 'Taxonomies', 'give' ),
524
+							'name' => __('Taxonomies', 'give'),
525 525
 							'desc' => '',
526 526
 							'id'   => 'give_title_display_settings_3',
527 527
 							'type' => 'give_title'
528 528
 						),
529 529
 						array(
530
-							'name' => __( 'Enable Form Categories', 'give' ),
531
-							'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
530
+							'name' => __('Enable Form Categories', 'give'),
531
+							'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
532 532
 							'id'   => 'enable_categories',
533 533
 							'type' => 'checkbox'
534 534
 						),
535 535
 						array(
536
-							'name' => __( 'Enable Form Tags', 'give' ),
537
-							'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
536
+							'name' => __('Enable Form Tags', 'give'),
537
+							'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
538 538
 							'id'   => 'enable_tags',
539 539
 							'type' => 'checkbox'
540 540
 						),
@@ -547,93 +547,93 @@  discard block
 block discarded – undo
547 547
 			 */
548 548
 			'emails'      => array(
549 549
 				'id'         => 'email_settings',
550
-				'give_title' => __( 'Email Settings', 'give' ),
551
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
552
-				'fields'     => apply_filters( 'give_settings_emails', array(
550
+				'give_title' => __('Email Settings', 'give'),
551
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
552
+				'fields'     => apply_filters('give_settings_emails', array(
553 553
 						array(
554
-							'name' => __( 'Email Settings', 'give' ),
554
+							'name' => __('Email Settings', 'give'),
555 555
 							'desc' => '',
556 556
 							'id'   => 'give_title_email_settings_1',
557 557
 							'type' => 'give_title'
558 558
 						),
559 559
 						array(
560 560
 							'id'      => 'email_template',
561
-							'name'    => __( 'Email Template', 'give' ),
562
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
561
+							'name'    => __('Email Template', 'give'),
562
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
563 563
 							'type'    => 'select',
564 564
 							'options' => give_get_email_templates()
565 565
 						),
566 566
 						array(
567 567
 							'id'   => 'email_logo',
568
-							'name' => __( 'Logo', 'give' ),
569
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
568
+							'name' => __('Logo', 'give'),
569
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
570 570
 							'type' => 'file'
571 571
 						),
572 572
 						array(
573 573
 							'id'      => 'from_name',
574
-							'name'    => __( 'From Name', 'give' ),
575
-							'desc'    => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
576
-							'default' => get_bloginfo( 'name' ),
574
+							'name'    => __('From Name', 'give'),
575
+							'desc'    => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
576
+							'default' => get_bloginfo('name'),
577 577
 							'type'    => 'text'
578 578
 						),
579 579
 						array(
580 580
 							'id'      => 'from_email',
581
-							'name'    => __( 'From Email', 'give' ),
582
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
583
-							'default' => get_bloginfo( 'admin_email' ),
581
+							'name'    => __('From Email', 'give'),
582
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
583
+							'default' => get_bloginfo('admin_email'),
584 584
 							'type'    => 'text'
585 585
 						),
586 586
 						array(
587
-							'name' => __( 'Donation Receipt', 'give' ),
587
+							'name' => __('Donation Receipt', 'give'),
588 588
 							'desc' => '',
589 589
 							'id'   => 'give_title_email_settings_2',
590 590
 							'type' => 'give_title'
591 591
 						),
592 592
 						array(
593 593
 							'id'      => 'donation_subject',
594
-							'name'    => __( 'Donation Email Subject', 'give' ),
595
-							'desc'    => __( 'Enter the subject line for the donation receipt email', 'give' ),
596
-							'default' => __( 'Donation Receipt', 'give' ),
594
+							'name'    => __('Donation Email Subject', 'give'),
595
+							'desc'    => __('Enter the subject line for the donation receipt email', 'give'),
596
+							'default' => __('Donation Receipt', 'give'),
597 597
 							'type'    => 'text'
598 598
 						),
599 599
 						array(
600 600
 							'id'      => 'donation_receipt',
601
-							'name'    => __( 'Donation Receipt', 'give' ),
602
-							'desc'    => __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(),
601
+							'name'    => __('Donation Receipt', 'give'),
602
+							'desc'    => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(),
603 603
 							'type'    => 'wysiwyg',
604 604
 							'default' => give_get_default_donation_receipt_email()
605 605
 						),
606 606
 						array(
607
-							'name' => __( 'New Donation Notification', 'give' ),
607
+							'name' => __('New Donation Notification', 'give'),
608 608
 							'desc' => '',
609 609
 							'id'   => 'give_title_email_settings_3',
610 610
 							'type' => 'give_title'
611 611
 						),
612 612
 						array(
613 613
 							'id'      => 'donation_notification_subject',
614
-							'name'    => __( 'Donation Notification Subject', 'give' ),
615
-							'desc'    => __( 'Enter the subject line for the donation notification email', 'give' ),
614
+							'name'    => __('Donation Notification Subject', 'give'),
615
+							'desc'    => __('Enter the subject line for the donation notification email', 'give'),
616 616
 							'type'    => 'text',
617
-							'default' => __( 'New Donation - #{payment_id}', 'give' )
617
+							'default' => __('New Donation - #{payment_id}', 'give')
618 618
 						),
619 619
 						array(
620 620
 							'id'      => 'donation_notification',
621
-							'name'    => __( 'Donation Notification', 'give' ),
622
-							'desc'    => __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(),
621
+							'name'    => __('Donation Notification', 'give'),
622
+							'desc'    => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(),
623 623
 							'type'    => 'wysiwyg',
624 624
 							'default' => give_get_default_donation_notification_email()
625 625
 						),
626 626
 						array(
627 627
 							'id'      => 'admin_notice_emails',
628
-							'name'    => __( 'Donation Notification Emails', 'give' ),
629
-							'desc'    => sprintf( __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give' ), '<span class="give-underline">', '</span>' ),
628
+							'name'    => __('Donation Notification Emails', 'give'),
629
+							'desc'    => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'),
630 630
 							'type'    => 'textarea',
631
-							'default' => get_bloginfo( 'admin_email' )
631
+							'default' => get_bloginfo('admin_email')
632 632
 						),
633 633
 						array(
634 634
 							'id'   => 'disable_admin_notices',
635
-							'name' => __( 'Disable Admin Notifications', 'give' ),
636
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
635
+							'name' => __('Disable Admin Notifications', 'give'),
636
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
637 637
 							'type' => 'checkbox'
638 638
 						)
639 639
 					)
@@ -642,96 +642,96 @@  discard block
 block discarded – undo
642 642
 			/** Extension Settings */
643 643
 			'addons'      => array(
644 644
 				'id'         => 'addons',
645
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
646
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
647
-				'fields'     => apply_filters( 'give_settings_addons', array()
645
+				'give_title' => __('Give Add-ons Settings', 'give'),
646
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
647
+				'fields'     => apply_filters('give_settings_addons', array()
648 648
 				)
649 649
 			),
650 650
 			/** Licenses Settings */
651 651
 			'licenses'    => array(
652 652
 				'id'         => 'licenses',
653
-				'give_title' => __( 'Give Licenses', 'give' ),
654
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
655
-				'fields'     => apply_filters( 'give_settings_licenses', array()
653
+				'give_title' => __('Give Licenses', 'give'),
654
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
655
+				'fields'     => apply_filters('give_settings_licenses', array()
656 656
 				)
657 657
 			),
658 658
 			/** Advanced Options */
659 659
 			'advanced'    => array(
660 660
 				'id'         => 'advanced_options',
661
-				'give_title' => __( 'Advanced Options', 'give' ),
662
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
663
-				'fields'     => apply_filters( 'give_settings_advanced', array(
661
+				'give_title' => __('Advanced Options', 'give'),
662
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
663
+				'fields'     => apply_filters('give_settings_advanced', array(
664 664
 						array(
665
-							'name' => __( 'Access Control', 'give' ),
665
+							'name' => __('Access Control', 'give'),
666 666
 							'desc' => '',
667 667
 							'id'   => 'give_title_session_control_1',
668 668
 							'type' => 'give_title'
669 669
 						),
670 670
 						array(
671 671
 							'id'      => 'session_lifetime',
672
-							'name'    => __( 'Session Lifetime', 'give' ),
673
-							'desc'    => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
672
+							'name'    => __('Session Lifetime', 'give'),
673
+							'desc'    => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
674 674
 							'type'    => 'select',
675 675
 							'options' => array(
676
-								'86400'  => __( '24 Hours', 'give' ),
677
-								'172800' => __( '48 Hours', 'give' ),
678
-								'259200' => __( '72 Hours', 'give' ),
679
-								'604800' => __( '1 Week', 'give' ),
676
+								'86400'  => __('24 Hours', 'give'),
677
+								'172800' => __('48 Hours', 'give'),
678
+								'259200' => __('72 Hours', 'give'),
679
+								'604800' => __('1 Week', 'give'),
680 680
 							)
681 681
 						),
682 682
 						array(
683
-							'name' => __( 'Email Access', 'give' ),
684
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
683
+							'name' => __('Email Access', 'give'),
684
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
685 685
 							'id'   => 'email_access',
686 686
 							'type' => 'checkbox',
687 687
 						),
688 688
 						array(
689 689
 							'id'      => 'recaptcha_key',
690
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
691
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>' ),
690
+							'name'    => __('reCAPTCHA Site Key', 'give'),
691
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>'),
692 692
 							'default' => '',
693 693
 							'type'    => 'text'
694 694
 						),
695 695
 						array(
696 696
 							'id'      => 'recaptcha_secret',
697
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
698
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
697
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
698
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
699 699
 							'default' => '',
700 700
 							'type'    => 'text'
701 701
 						),
702 702
 						array(
703
-							'name' => __( 'Data Control', 'give' ),
703
+							'name' => __('Data Control', 'give'),
704 704
 							'desc' => '',
705 705
 							'id'   => 'give_title_data_control_2',
706 706
 							'type' => 'give_title'
707 707
 						),
708 708
 						array(
709
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
710
-							'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
709
+							'name' => __('Remove All Data on Uninstall?', 'give'),
710
+							'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
711 711
 							'id'   => 'uninstall_on_delete',
712 712
 							'type' => 'checkbox'
713 713
 						),
714 714
 						array(
715
-							'name' => __( 'Filter Control', 'give' ),
715
+							'name' => __('Filter Control', 'give'),
716 716
 							'desc' => '',
717 717
 							'id'   => 'give_title_filter_control',
718 718
 							'type' => 'give_title'
719 719
 						),
720 720
 						array(
721
-							'name' => __( 'Disable <code>the_content</code> filter', 'give' ),
722
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ) ),
721
+							'name' => __('Disable <code>the_content</code> filter', 'give'),
722
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')),
723 723
 							'id'   => 'disable_the_content_filter',
724 724
 							'type' => 'checkbox'
725 725
 						),
726 726
 						array(
727
-							'name' => __( 'Script Loading', 'give' ),
727
+							'name' => __('Script Loading', 'give'),
728 728
 							'desc' => '',
729 729
 							'id'   => 'give_title_script_control',
730 730
 							'type' => 'give_title'
731 731
 						),
732 732
 						array(
733
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
734
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
733
+							'name' => __('Load Scripts in Footer?', 'give'),
734
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
735 735
 							'id'   => 'scripts_footer',
736 736
 							'type' => 'checkbox'
737 737
 						)
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 			/** API Settings */
742 742
 			'api'         => array(
743 743
 				'id'         => 'api',
744
-				'give_title' => __( 'API', 'give' ),
745
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
744
+				'give_title' => __('API', 'give'),
745
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
746 746
 				'show_names' => false, // Hide field names on the left
747
-				'fields'     => apply_filters( 'give_settings_system', array(
747
+				'fields'     => apply_filters('give_settings_system', array(
748 748
 						array(
749 749
 							'id'   => 'api',
750
-							'name' => __( 'API', 'give' ),
750
+							'name' => __('API', 'give'),
751 751
 							'type' => 'api'
752 752
 						)
753 753
 					)
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
 			/** Licenses Settings */
757 757
 			'system_info' => array(
758 758
 				'id'         => 'system_info',
759
-				'give_title' => __( 'System Info', 'give' ),
760
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
761
-				'fields'     => apply_filters( 'give_settings_system', array(
759
+				'give_title' => __('System Info', 'give'),
760
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
761
+				'fields'     => apply_filters('give_settings_system', array(
762 762
 						array(
763 763
 							'id'   => 'system_info',
764
-							'name' => __( 'System Info', 'give' ),
765
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
764
+							'name' => __('System Info', 'give'),
765
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
766 766
 							'type' => 'system_info'
767 767
 						)
768 768
 					)
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 		);
772 772
 
773 773
 		//Return all settings array if no active tab
774
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
774
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
775 775
 
776
-			return apply_filters( 'give_registered_settings', $give_settings );
776
+			return apply_filters('give_registered_settings', $give_settings);
777 777
 			
778 778
 		}
779 779
 
780 780
 
781 781
 		// Add other tabs and settings fields as needed
782
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
782
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
783 783
 
784 784
 	}
785 785
 
@@ -788,11 +788,11 @@  discard block
 block discarded – undo
788 788
 	 */
789 789
 	public function settings_notices() {
790 790
 
791
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
791
+		if ( ! isset($_POST['give_settings_saved'])) {
792 792
 			return;
793 793
 		}
794 794
 
795
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
795
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
796 796
 
797 797
 	}
798 798
 
@@ -806,17 +806,17 @@  discard block
 block discarded – undo
806 806
 	 *
807 807
 	 * @return mixed          Field value or exception is thrown
808 808
 	 */
809
-	public function __get( $field ) {
809
+	public function __get($field) {
810 810
 
811 811
 		// Allowed fields to retrieve
812
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
812
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
813 813
 			return $this->{$field};
814 814
 		}
815
-		if ( 'option_metabox' === $field ) {
815
+		if ('option_metabox' === $field) {
816 816
 			return $this->option_metabox();
817 817
 		}
818 818
 
819
-		throw new Exception( 'Invalid property: ' . $field );
819
+		throw new Exception('Invalid property: '.$field);
820 820
 	}
821 821
 
822 822
 
@@ -833,12 +833,12 @@  discard block
 block discarded – undo
833 833
  *
834 834
  * @return mixed        Option value
835 835
  */
836
-function give_get_option( $key = '', $default = false ) {
836
+function give_get_option($key = '', $default = false) {
837 837
 	global $give_options;
838
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
839
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
838
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
839
+	$value = apply_filters('give_get_option', $value, $key, $default);
840 840
 
841
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
841
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
842 842
 }
843 843
 
844 844
 
@@ -856,33 +856,33 @@  discard block
 block discarded – undo
856 856
  *
857 857
  * @return boolean True if updated, false if not.
858 858
  */
859
-function give_update_option( $key = '', $value = false ) {
859
+function give_update_option($key = '', $value = false) {
860 860
 
861 861
 	// If no key, exit
862
-	if ( empty( $key ) ) {
862
+	if (empty($key)) {
863 863
 		return false;
864 864
 	}
865 865
 
866
-	if ( empty( $value ) ) {
867
-		$remove_option = give_delete_option( $key );
866
+	if (empty($value)) {
867
+		$remove_option = give_delete_option($key);
868 868
 
869 869
 		return $remove_option;
870 870
 	}
871 871
 
872 872
 	// First let's grab the current settings
873
-	$options = get_option( 'give_settings' );
873
+	$options = get_option('give_settings');
874 874
 
875 875
 	// Let's let devs alter that value coming in
876
-	$value = apply_filters( 'give_update_option', $value, $key );
876
+	$value = apply_filters('give_update_option', $value, $key);
877 877
 
878 878
 	// Next let's try to update the value
879
-	$options[ $key ] = $value;
880
-	$did_update      = update_option( 'give_settings', $options );
879
+	$options[$key] = $value;
880
+	$did_update      = update_option('give_settings', $options);
881 881
 
882 882
 	// If it updated, let's update the global variable
883
-	if ( $did_update ) {
883
+	if ($did_update) {
884 884
 		global $give_options;
885
-		$give_options[ $key ] = $value;
885
+		$give_options[$key] = $value;
886 886
 	}
887 887
 
888 888
 	return $did_update;
@@ -899,27 +899,27 @@  discard block
 block discarded – undo
899 899
  *
900 900
  * @return boolean True if updated, false if not.
901 901
  */
902
-function give_delete_option( $key = '' ) {
902
+function give_delete_option($key = '') {
903 903
 
904 904
 	// If no key, exit
905
-	if ( empty( $key ) ) {
905
+	if (empty($key)) {
906 906
 		return false;
907 907
 	}
908 908
 
909 909
 	// First let's grab the current settings
910
-	$options = get_option( 'give_settings' );
910
+	$options = get_option('give_settings');
911 911
 
912 912
 	// Next let's try to update the value
913
-	if ( isset( $options[ $key ] ) ) {
913
+	if (isset($options[$key])) {
914 914
 
915
-		unset( $options[ $key ] );
915
+		unset($options[$key]);
916 916
 
917 917
 	}
918 918
 
919
-	$did_update = update_option( 'give_settings', $options );
919
+	$did_update = update_option('give_settings', $options);
920 920
 
921 921
 	// If it updated, let's update the global variable
922
-	if ( $did_update ) {
922
+	if ($did_update) {
923 923
 		global $give_options;
924 924
 		$give_options = $options;
925 925
 	}
@@ -938,9 +938,9 @@  discard block
 block discarded – undo
938 938
  */
939 939
 function give_get_settings() {
940 940
 
941
-	$settings = get_option( 'give_settings' );
941
+	$settings = get_option('give_settings');
942 942
 
943
-	return (array) apply_filters( 'give_get_settings', $settings );
943
+	return (array) apply_filters('give_get_settings', $settings);
944 944
 
945 945
 }
946 946
 
@@ -958,25 +958,25 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return array
960 960
  */
961
-function give_settings_array_insert( $array, $position, $insert ) {
962
-	if ( is_int( $position ) ) {
963
-		array_splice( $array, $position, 0, $insert );
961
+function give_settings_array_insert($array, $position, $insert) {
962
+	if (is_int($position)) {
963
+		array_splice($array, $position, 0, $insert);
964 964
 	} else {
965 965
 
966
-		foreach ( $array as $index => $subarray ) {
967
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
966
+		foreach ($array as $index => $subarray) {
967
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
968 968
 				$pos = $index;
969 969
 			}
970 970
 		}
971 971
 
972
-		if ( ! isset( $pos ) ) {
972
+		if ( ! isset($pos)) {
973 973
 			return $array;
974 974
 		}
975 975
 
976 976
 		$array = array_merge(
977
-			array_slice( $array, 0, $pos ),
977
+			array_slice($array, 0, $pos),
978 978
 			$insert,
979
-			array_slice( $array, $pos )
979
+			array_slice($array, $pos)
980 980
 		);
981 981
 	}
982 982
 
@@ -999,31 +999,31 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return void
1001 1001
  */
1002
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1002
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1003 1003
 
1004 1004
 	$id                = $field_type_object->field->args['id'];
1005 1005
 	$field_description = $field_type_object->field->args['desc'];
1006
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1006
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1007 1007
 
1008 1008
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1009 1009
 
1010
-	foreach ( $gateways as $key => $option ) :
1010
+	foreach ($gateways as $key => $option) :
1011 1011
 
1012
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1012
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1013 1013
 			$enabled = '1';
1014 1014
 		} else {
1015 1015
 			$enabled = null;
1016 1016
 		}
1017 1017
 
1018
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1019
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1018
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1019
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1020 1020
 
1021 1021
 	endforeach;
1022 1022
 
1023 1023
 	echo '</ul>';
1024 1024
 
1025
-	if ( $field_description ) {
1026
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1025
+	if ($field_description) {
1026
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1027 1027
 	}
1028 1028
 
1029 1029
 }
@@ -1039,31 +1039,31 @@  discard block
 block discarded – undo
1039 1039
  *
1040 1040
  * @return void
1041 1041
  */
1042
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1042
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1043 1043
 
1044 1044
 	$id                = $field_type_object->field->args['id'];
1045 1045
 	$field_description = $field_type_object->field->args['desc'];
1046 1046
 	$gateways          = give_get_enabled_payment_gateways();
1047 1047
 
1048
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1048
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1049 1049
 
1050 1050
 	//Add a field to the Give Form admin single post view of this field
1051
-	if ( $field_type_object->field->object_type === 'post' ) {
1052
-		echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>';
1051
+	if ($field_type_object->field->object_type === 'post') {
1052
+		echo '<option value="global">'.__('Global Default', 'give').'</option>';
1053 1053
 	}
1054 1054
 
1055
-	foreach ( $gateways as $key => $option ) :
1055
+	foreach ($gateways as $key => $option) :
1056 1056
 
1057
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1057
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1058 1058
 
1059 1059
 
1060
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1060
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1061 1061
 
1062 1062
 	endforeach;
1063 1063
 
1064 1064
 	echo '</select>';
1065 1065
 
1066
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1066
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1067 1067
 
1068 1068
 }
1069 1069
 
@@ -1078,13 +1078,13 @@  discard block
 block discarded – undo
1078 1078
  *
1079 1079
  * @return void
1080 1080
  */
1081
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1081
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1082 1082
 
1083 1083
 	$id                = $field_type_object->field->args['id'];
1084 1084
 	$title             = $field_type_object->field->args['name'];
1085 1085
 	$field_description = $field_type_object->field->args['desc'];
1086 1086
 
1087
-	echo '<hr>' . $field_description;
1087
+	echo '<hr>'.$field_description;
1088 1088
 
1089 1089
 }
1090 1090
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
  *
1100 1100
  * @return void
1101 1101
  */
1102
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1102
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1103 1103
 
1104 1104
 	$id                = $field_type_object->field->args['id'];
1105 1105
 	$title             = $field_type_object->field->args['name'];
@@ -1119,25 +1119,25 @@  discard block
 block discarded – undo
1119 1119
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1120 1120
  * @return array An array of options that matches the CMB2 options array
1121 1121
  */
1122
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1122
+function give_cmb2_get_post_options($query_args, $force = false) {
1123 1123
 
1124
-	$post_options = array( '' => '' ); // Blank option
1124
+	$post_options = array('' => ''); // Blank option
1125 1125
 
1126
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1126
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1127 1127
 		return $post_options;
1128 1128
 	}
1129 1129
 
1130
-	$args = wp_parse_args( $query_args, array(
1130
+	$args = wp_parse_args($query_args, array(
1131 1131
 		'post_type'   => 'page',
1132 1132
 		'numberposts' => 10,
1133
-	) );
1133
+	));
1134 1134
 
1135
-	$posts = get_posts( $args );
1135
+	$posts = get_posts($args);
1136 1136
 
1137
-	if ( $posts ) {
1138
-		foreach ( $posts as $post ) {
1137
+	if ($posts) {
1138
+		foreach ($posts as $post) {
1139 1139
 
1140
-			$post_options[ $post->ID ] = $post->post_title;
1140
+			$post_options[$post->ID] = $post->post_title;
1141 1141
 
1142 1142
 		}
1143 1143
 	}
@@ -1157,17 +1157,17 @@  discard block
 block discarded – undo
1157 1157
 	global $_wp_additional_image_sizes;
1158 1158
 	$sizes = array();
1159 1159
 
1160
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1160
+	foreach (get_intermediate_image_sizes() as $_size) {
1161 1161
 
1162
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1163
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1164
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1165
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1162
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1163
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1164
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1165
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1166 1166
 		}
1167 1167
 
1168 1168
 	}
1169 1169
 
1170
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1170
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1171 1171
 }
1172 1172
 
1173 1173
 
@@ -1181,34 +1181,34 @@  discard block
 block discarded – undo
1181 1181
  *
1182 1182
  * @return void
1183 1183
  */
1184
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1184
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1185 1185
 
1186 1186
 	$id                = $field_type_object->field->args['id'];
1187 1187
 	$field_description = $field_type_object->field->args['desc'];
1188
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1188
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1189 1189
 	$field_classes     = 'regular-text give-license-field';
1190
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1190
+	$type              = empty($escaped_value) ? 'text' : 'password';
1191 1191
 
1192
-	if ( $license_status === 'valid' ) {
1192
+	if ($license_status === 'valid') {
1193 1193
 		$field_classes .= ' give-license-active';
1194 1194
 	}
1195 1195
 
1196
-	$html = $field_type_object->input( array(
1196
+	$html = $field_type_object->input(array(
1197 1197
 		'class' => $field_classes,
1198 1198
 		'type'  => $type
1199
-	) );
1199
+	));
1200 1200
 
1201 1201
 	//License is active so show deactivate button
1202
-	if ( $license_status === 'valid' ) {
1203
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>';
1202
+	if ($license_status === 'valid') {
1203
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>';
1204 1204
 	} else {
1205 1205
 		//This license is not valid so delete it
1206
-		give_delete_option( $id );
1206
+		give_delete_option($id);
1207 1207
 	}
1208 1208
 
1209
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1209
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1210 1210
 
1211
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1211
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1212 1212
 
1213 1213
 	echo $html;
1214 1214
 }
@@ -1222,13 +1222,13 @@  discard block
 block discarded – undo
1222 1222
  */
1223 1223
 function give_api_callback() {
1224 1224
 
1225
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1225
+	if ( ! current_user_can('manage_give_settings')) {
1226 1226
 		return;
1227 1227
 	}
1228 1228
 
1229
-	do_action( 'give_tools_api_keys_before' );
1229
+	do_action('give_tools_api_keys_before');
1230 1230
 
1231
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1231
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1232 1232
 
1233 1233
 	$api_keys_table = new Give_API_Keys_Table();
1234 1234
 	$api_keys_table->prepare_items();
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	?>
1237 1237
 	<p>
1238 1238
 		<?php printf(
1239
-			__( 'API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give' ),
1239
+			__('API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give'),
1240 1240
 			'https://givewp.com/documentation/give-api-reference/',
1241 1241
 			'https://givewp.com/addons/zapier/'
1242 1242
 		); ?>
@@ -1244,10 +1244,10 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 	<?php
1246 1246
 
1247
-	do_action( 'give_tools_api_keys_after' );
1247
+	do_action('give_tools_api_keys_after');
1248 1248
 }
1249 1249
 
1250
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1250
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1251 1251
 
1252 1252
 /**
1253 1253
  * Hook Callback
@@ -1260,8 +1260,8 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @return void
1262 1262
  */
1263
-function give_hook_callback( $args ) {
1264
-	do_action( 'give_' . $args['id'] );
1263
+function give_hook_callback($args) {
1264
+	do_action('give_'.$args['id']);
1265 1265
 }
1266 1266
 
1267 1267
 /**
@@ -1271,10 +1271,10 @@  discard block
 block discarded – undo
1271 1271
  *
1272 1272
  */
1273 1273
 
1274
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1275
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1276
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1277
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1278
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1279
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1274
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1275
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1276
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1277
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1278
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1279
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1280 1280
 }
1281 1281
\ No newline at end of file
Please login to merge, or discard this patch.