Completed
Pull Request — master (#3647)
by
unknown
18:37 queued 07:00
created
includes/admin/tools/export/give-export-donations-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  *
10 10
  * @see http://wordpress.stackexchange.com/questions/58834/echo-all-meta-keys-of-a-custom-post-type
11 11
  *
12
- * @return string
12
+ * @return false|null
13 13
  */
14 14
 function give_export_donations_get_custom_fields() {
15 15
 
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
 	global $wpdb;
17 17
 	$post_type = 'give_payment';
18 18
 	$responses = array();
19
-	$donationmeta_table_key = Give()->payment_meta->get_meta_type() . '_id';
19
+	$donationmeta_table_key = Give()->payment_meta->get_meta_type().'_id';
20 20
 
21
-	$form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : '';
21
+	$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : '';
22 22
 
23
-	if ( empty( $form_id ) ) {
23
+	if (empty($form_id)) {
24 24
 		return false;
25 25
 	}
26 26
 
27
-	$args          = array(
28
-		'give_forms'     => array( $form_id ),
29
-		'posts_per_page' => - 1,
27
+	$args = array(
28
+		'give_forms'     => array($form_id),
29
+		'posts_per_page' => -1,
30 30
 		'fields'         => 'ids',
31 31
 	);
32
-	$donation_list = implode( ',', (array) give_get_payments( $args ) );
32
+	$donation_list = implode(',', (array) give_get_payments($args));
33 33
 
34 34
 	$query_and = sprintf(
35 35
 		"AND $wpdb->posts.ID IN (%s) 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
         LEFT JOIN $wpdb->donationmeta 
45 45
         ON $wpdb->posts.ID = {$wpdb->donationmeta}.{$donationmeta_table_key}
46 46
         WHERE $wpdb->posts.post_type = '%s'
47
-    " . $query_and;
47
+    ".$query_and;
48 48
 
49
-	$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
49
+	$meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
50 50
 
51
-	if ( ! empty( $meta_keys ) ) {
52
-		$responses['standard_fields'] = array_values( $meta_keys );
51
+	if ( ! empty($meta_keys)) {
52
+		$responses['standard_fields'] = array_values($meta_keys);
53 53
 	}
54 54
 
55 55
 	$query_and = sprintf(
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
         LEFT JOIN $wpdb->donationmeta 
66 66
         ON $wpdb->posts.ID = {$wpdb->donationmeta}.{$donationmeta_table_key} 
67 67
         WHERE $wpdb->posts.post_type = '%s'
68
-    " . $query_and;
68
+    ".$query_and;
69 69
 
70
-	$hidden_meta_keys   = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
70
+	$hidden_meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
71 71
 
72 72
 	/**
73 73
 	 * Filter to modify hidden keys that are going to be ignore when displaying the hidden keys
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return array $ignore_hidden_keys Hidden keys that are going to be ignore
81 81
 	 */
82
-	$ignore_hidden_keys = apply_filters( 'give_export_donations_ignore_hidden_keys', array(
82
+	$ignore_hidden_keys = apply_filters('give_export_donations_ignore_hidden_keys', array(
83 83
 		'_give_payment_meta',
84 84
 		'_give_payment_gateway',
85 85
 		'_give_payment_mode',
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	);
115 115
 
116 116
 	// Unset ignored hidden keys.
117
-	foreach ( $ignore_hidden_keys as $key ) {
118
-		if ( ( $key = array_search( $key, $hidden_meta_keys ) ) !== false ) {
119
-			unset( $hidden_meta_keys[ $key ] );
117
+	foreach ($ignore_hidden_keys as $key) {
118
+		if (($key = array_search($key, $hidden_meta_keys)) !== false) {
119
+			unset($hidden_meta_keys[$key]);
120 120
 		}
121 121
 	}
122 122
 
123
-	if ( ! empty( $hidden_meta_keys ) ) {
124
-		$responses['hidden_fields'] = array_values( $hidden_meta_keys );
123
+	if ( ! empty($hidden_meta_keys)) {
124
+		$responses['hidden_fields'] = array_values($hidden_meta_keys);
125 125
 	}
126 126
 
127 127
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return array $responses
136 136
 	 */
137
-	wp_send_json( (array) apply_filters( 'give_export_donations_get_custom_fields', $responses, $form_id ) );
137
+	wp_send_json((array) apply_filters('give_export_donations_get_custom_fields', $responses, $form_id));
138 138
 
139 139
 }
140 140
 
141
-add_action( 'wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields' );
141
+add_action('wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields');
142 142
 
143 143
 /**
144 144
  * Register the payments batch exporter
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
  * @since  1.0
147 147
  */
148 148
 function give_register_export_donations_batch_export() {
149
-	add_action( 'give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1 );
149
+	add_action('give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1);
150 150
 }
151 151
 
152
-add_action( 'give_register_batch_exporter', 'give_register_export_donations_batch_export', 10 );
152
+add_action('give_register_batch_exporter', 'give_register_export_donations_batch_export', 10);
153 153
 
154 154
 
155 155
 /**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
  *
158 158
  * @param $class Give_Export_Donations_CSV
159 159
  */
160
-function give_export_donations_include_export_class( $class ) {
161
-	if ( 'Give_Export_Donations_CSV' === $class ) {
162
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-exporter.php';
160
+function give_export_donations_include_export_class($class) {
161
+	if ('Give_Export_Donations_CSV' === $class) {
162
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-exporter.php';
163 163
 	}
164 164
 }
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @return string
173 173
  */
174
-function give_export_donations_create_column_key( $string ) {
175
-	return sanitize_key( str_replace( ' ', '_', $string ) );
174
+function give_export_donations_create_column_key($string) {
175
+	return sanitize_key(str_replace(' ', '_', $string));
176 176
 }
177 177
 
178 178
 /**
@@ -184,23 +184,23 @@  discard block
 block discarded – undo
184 184
  *
185 185
  * @return array
186 186
  */
187
-function give_export_donation_form_search_args( $args ) {
188
-	if ( empty( $_POST['fields'] ) ) {
187
+function give_export_donation_form_search_args($args) {
188
+	if (empty($_POST['fields'])) {
189 189
 		return $args;
190 190
 	}
191 191
 
192
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
193
-	parse_str( $fields );
192
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
193
+	parse_str($fields);
194 194
 
195
-	if ( ! empty( $give_forms_categories ) || ! empty( $give_forms_tags ) ) {
195
+	if ( ! empty($give_forms_categories) || ! empty($give_forms_tags)) {
196 196
 		$args['posts_per_page'] = -1;
197 197
 	}
198 198
 
199
-	if ( ! empty( $give_forms_categories ) && ! empty( $give_forms_tags ) ) {
199
+	if ( ! empty($give_forms_categories) && ! empty($give_forms_tags)) {
200 200
 		$args['tax_query']['relation'] = 'AND';
201 201
 	}
202 202
 
203
-	if ( ! empty( $give_forms_categories ) ) {
203
+	if ( ! empty($give_forms_categories)) {
204 204
 		$args['tax_query'][] = array(
205 205
 			'taxonomy' => 'give_forms_category',
206 206
 			'field'    => 'term_id',
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		);
210 210
 	}
211 211
 
212
-	if ( ! empty( $give_forms_tags ) ) {
212
+	if ( ! empty($give_forms_tags)) {
213 213
 		$args['tax_query'][] = array(
214 214
 			'taxonomy' => 'give_forms_tag',
215 215
 			'field'    => 'term_id',
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	return $args;
222 222
 }
223 223
 
224
-add_filter( 'give_ajax_form_search_args', 'give_export_donation_form_search_args' );
224
+add_filter('give_ajax_form_search_args', 'give_export_donation_form_search_args');
225 225
 
226 226
 /**
227 227
  * Add Donation standard fields in export donation page
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	?>
233 233
 	<tr>
234 234
 		<td scope="row" class="row-title">
235
-			<label><?php _e( 'Standard Columns:', 'give' ); ?></label>
235
+			<label><?php _e('Standard Columns:', 'give'); ?></label>
236 236
 		</td>
237 237
 		<td>
238 238
 			<div class="give-clearfix">
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 							<li class="give-export-option-label give-export-option-donation-label">
244 244
 								<span>
245
-									<?php _e( 'Donation Payment Fields', 'give' ); ?>
245
+									<?php _e('Donation Payment Fields', 'give'); ?>
246 246
 								</span>
247 247
 							</li>
248 248
 
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 								<label for="give-export-donation-id">
251 251
 									<input type="checkbox" checked
252 252
 									       name="give_give_donations_export_option[donation_id]"
253
-									       id="give-export-donation-id"><?php _e( 'Donation ID', 'give' ); ?>
253
+									       id="give-export-donation-id"><?php _e('Donation ID', 'give'); ?>
254 254
 								</label>
255 255
 							</li>
256 256
 
257 257
 							<?php
258
-							if ( give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) ) ) {
258
+							if (give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))) {
259 259
 								?>
260 260
 								<li>
261 261
 									<label for="give-export-seq-id">
262 262
 										<input type="checkbox" checked
263 263
 										       name="give_give_donations_export_option[seq_id]"
264
-										       id="give-export-seq-id"><?php _e( 'Donation Number', 'give' ); ?>
264
+										       id="give-export-seq-id"><?php _e('Donation Number', 'give'); ?>
265 265
 									</label>
266 266
 								</li>
267 267
 								<?php
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 								<label for="give-export-donation-sum">
273 273
 									<input type="checkbox" checked
274 274
 									       name="give_give_donations_export_option[donation_total]"
275
-									       id="give-export-donation-sum"><?php _e( 'Donation Total', 'give' ); ?>
275
+									       id="give-export-donation-sum"><?php _e('Donation Total', 'give'); ?>
276 276
 								</label>
277 277
 							</li>
278 278
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 								<label for="give-export-donation-currency_code">
281 281
 									<input type="checkbox" checked
282 282
 									       name="give_give_donations_export_option[currency_code]"
283
-									       id="give-export-donation-currency_code"><?php _e( 'Currency Code', 'give' ); ?>
283
+									       id="give-export-donation-currency_code"><?php _e('Currency Code', 'give'); ?>
284 284
 								</label>
285 285
 							</li>
286 286
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 								<label for="give-export-donation-currency_symbol">
289 289
 									<input type="checkbox" checked
290 290
 									       name="give_give_donations_export_option[currency_symbol]"
291
-									       id="give-export-donation-currency_symbol"><?php _e( 'Currency Symbol', 'give' ); ?>
291
+									       id="give-export-donation-currency_symbol"><?php _e('Currency Symbol', 'give'); ?>
292 292
 								</label>
293 293
 							</li>
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 								<label for="give-export-donation-status">
297 297
 									<input type="checkbox" checked
298 298
 									       name="give_give_donations_export_option[donation_status]"
299
-									       id="give-export-donation-status"><?php _e( 'Donation Status', 'give' ); ?>
299
+									       id="give-export-donation-status"><?php _e('Donation Status', 'give'); ?>
300 300
 								</label>
301 301
 							</li>
302 302
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 								<label for="give-export-donation-date">
305 305
 									<input type="checkbox" checked
306 306
 									       name="give_give_donations_export_option[donation_date]"
307
-									       id="give-export-donation-date"><?php _e( 'Donation Date', 'give' ); ?>
307
+									       id="give-export-donation-date"><?php _e('Donation Date', 'give'); ?>
308 308
 								</label>
309 309
 							</li>
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 								<label for="give-export-donation-time">
313 313
 									<input type="checkbox" checked
314 314
 									       name="give_give_donations_export_option[donation_time]"
315
-									       id="give-export-donation-time"><?php _e( 'Donation Time', 'give' ); ?>
315
+									       id="give-export-donation-time"><?php _e('Donation Time', 'give'); ?>
316 316
 								</label>
317 317
 							</li>
318 318
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 								<label for="give-export-payment-gateway">
321 321
 									<input type="checkbox" checked
322 322
 									       name="give_give_donations_export_option[payment_gateway]"
323
-									       id="give-export-payment-gateway"><?php _e( 'Payment Gateway', 'give' ); ?>
323
+									       id="give-export-payment-gateway"><?php _e('Payment Gateway', 'give'); ?>
324 324
 								</label>
325 325
 							</li>
326 326
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 								<label for="give-export-payment-mode">
329 329
 									<input type="checkbox" checked
330 330
 									       name="give_give_donations_export_option[payment_mode]"
331
-									       id="give-export-payment-mode"><?php _e( 'Payment Mode', 'give' ); ?>
331
+									       id="give-export-payment-mode"><?php _e('Payment Mode', 'give'); ?>
332 332
 								</label>
333 333
 							</li>
334 334
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 							 *
339 339
 							 * @since 2.1
340 340
 							 */
341
-							do_action( 'give_export_donation_standard_payment_fields' );
341
+							do_action('give_export_donation_standard_payment_fields');
342 342
 							?>
343 343
 						</ul>
344 344
 					</li>
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 							<li class="give-export-option-label give-export-option-Form-label">
350 350
 								<span>
351
-									<?php _e( 'Donation Form Fields', 'give' ); ?>
351
+									<?php _e('Donation Form Fields', 'give'); ?>
352 352
 								</span>
353 353
 							</li>
354 354
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 								<label for="give-export-donation-form-id">
358 358
 									<input type="checkbox" checked
359 359
 									       name="give_give_donations_export_option[form_id]"
360
-									       id="give-export-donation-form-id"><?php _e( 'Donation Form ID', 'give' ); ?>
360
+									       id="give-export-donation-form-id"><?php _e('Donation Form ID', 'give'); ?>
361 361
 								</label>
362 362
 							</li>
363 363
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 								<label for="give-export-donation-form-title">
366 366
 									<input type="checkbox" checked
367 367
 									       name="give_give_donations_export_option[form_title]"
368
-									       id="give-export-donation-form-title"><?php _e( 'Donation Form Title', 'give' ); ?>
368
+									       id="give-export-donation-form-title"><?php _e('Donation Form Title', 'give'); ?>
369 369
 								</label>
370 370
 							</li>
371 371
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 								<label for="give-export-donation-form-level-id">
374 374
 									<input type="checkbox" checked
375 375
 									       name="give_give_donations_export_option[form_level_id]"
376
-									       id="give-export-donation-form-level-id"><?php _e( 'Donation Form Level ID', 'give' ); ?>
376
+									       id="give-export-donation-form-level-id"><?php _e('Donation Form Level ID', 'give'); ?>
377 377
 								</label>
378 378
 							</li>
379 379
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 								<label for="give-export-donation-form-level-title">
382 382
 									<input type="checkbox" checked
383 383
 									       name="give_give_donations_export_option[form_level_title]"
384
-									       id="give-export-donation-form-level-title"><?php _e( 'Donation Form Level Title', 'give' ); ?>
384
+									       id="give-export-donation-form-level-title"><?php _e('Donation Form Level Title', 'give'); ?>
385 385
 								</label>
386 386
 							</li>
387 387
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 							 *
392 392
 							 * @since 2.1
393 393
 							 */
394
-							do_action( 'give_export_donation_standard_form_fields' );
394
+							do_action('give_export_donation_standard_form_fields');
395 395
 							?>
396 396
 						</ul>
397 397
 					</li>
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 							<li class="give-export-option-label give-export-option-donor-label">
403 403
 								<span>
404
-									<?php _e( 'Donor Fields', 'give' ); ?>
404
+									<?php _e('Donor Fields', 'give'); ?>
405 405
 								</span>
406 406
 							</li>
407 407
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 								<label for="give-export-title-prefix">
410 410
 									<input type="checkbox" checked
411 411
 											name="give_give_donations_export_option[title_prefix]"
412
-											id="give-export-title-prefix"><?php esc_html_e( 'Donor\'s Title Prefix', 'give' ); ?>
412
+											id="give-export-title-prefix"><?php esc_html_e('Donor\'s Title Prefix', 'give'); ?>
413 413
 								</label>
414 414
 							</li>
415 415
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 								<label for="give-export-first-name">
418 418
 									<input type="checkbox" checked
419 419
 									       name="give_give_donations_export_option[first_name]"
420
-									       id="give-export-first-name"><?php _e( 'Donor\'s First Name', 'give' ); ?>
420
+									       id="give-export-first-name"><?php _e('Donor\'s First Name', 'give'); ?>
421 421
 								</label>
422 422
 							</li>
423 423
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 								<label for="give-export-last-name">
426 426
 									<input type="checkbox" checked
427 427
 									       name="give_give_donations_export_option[last_name]"
428
-									       id="give-export-last-name"><?php _e( 'Donor\'s Last Name', 'give' ); ?>
428
+									       id="give-export-last-name"><?php _e('Donor\'s Last Name', 'give'); ?>
429 429
 								</label>
430 430
 							</li>
431 431
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 								<label for="give-export-email">
434 434
 									<input type="checkbox" checked
435 435
 									       name="give_give_donations_export_option[email]"
436
-									       id="give-export-email"><?php _e( 'Donor\'s Email', 'give' ); ?>
436
+									       id="give-export-email"><?php _e('Donor\'s Email', 'give'); ?>
437 437
 								</label>
438 438
 							</li>
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 								<label for="give-export-company">
442 442
 									<input type="checkbox" checked
443 443
 									       name="give_give_donations_export_option[company]"
444
-									       id="give-export-company"><?php _e( 'Company Name', 'give' ); ?>
444
+									       id="give-export-company"><?php _e('Company Name', 'give'); ?>
445 445
 								</label>
446 446
 							</li>
447 447
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 								<label for="give-export-address">
450 450
 									<input type="checkbox" checked
451 451
 									       name="give_give_donations_export_option[address]"
452
-									       id="give-export-address"><?php _e( 'Donor\'s Billing Address', 'give' ); ?>
452
+									       id="give-export-address"><?php _e('Donor\'s Billing Address', 'give'); ?>
453 453
 								</label>
454 454
 							</li>
455 455
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 								<label for="give-export-userid">
458 458
 									<input type="checkbox" checked
459 459
 									       name="give_give_donations_export_option[userid]"
460
-									       id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
460
+									       id="give-export-userid"><?php _e('User ID', 'give'); ?>
461 461
 								</label>
462 462
 							</li>
463 463
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 								<label for="give-export-donorid">
466 466
 									<input type="checkbox" checked
467 467
 									       name="give_give_donations_export_option[donorid]"
468
-									       id="give-export-donorid"><?php _e( 'Donor ID', 'give' ); ?>
468
+									       id="give-export-donorid"><?php _e('Donor ID', 'give'); ?>
469 469
 								</label>
470 470
 							</li>
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 								<label for="give-export-donor-ip">
474 474
 									<input type="checkbox" checked
475 475
 									       name="give_give_donations_export_option[donor_ip]"
476
-									       id="give-export-donor-ip"><?php _e( 'Donor IP Address', 'give' ); ?>
476
+									       id="give-export-donor-ip"><?php _e('Donor IP Address', 'give'); ?>
477 477
 								</label>
478 478
 							</li>
479 479
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 							 *
484 484
 							 * @since 2.1
485 485
 							 */
486
-							do_action( 'give_export_donation_standard_donor_fields' );
486
+							do_action('give_export_donation_standard_donor_fields');
487 487
 							?>
488 488
 						</ul>
489 489
 					</li>
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					 *
495 495
 					 * @since 2.1.4
496 496
 					 */
497
-					do_action( 'give_export_donation_add_custom_column' );
497
+					do_action('give_export_donation_add_custom_column');
498 498
 					?>
499 499
 				</ul>
500 500
 			</div>
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	<?php
504 504
 }
505 505
 
506
-add_action( 'give_export_donation_fields', 'give_export_donation_standard_fields', 10 );
506
+add_action('give_export_donation_fields', 'give_export_donation_standard_fields', 10);
507 507
 
508 508
 /**
509 509
  * Add Donation Custom fields in export donation page
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 	<tr
516 516
 		class="give-hidden give-export-donations-hide give-export-donations-standard-fields">
517 517
 		<td scope="row" class="row-title">
518
-			<label><?php _e( 'Custom Field Columns:', 'give' ); ?></label>
518
+			<label><?php _e('Custom Field Columns:', 'give'); ?></label>
519 519
 		</td>
520 520
 		<td class="give-field-wrap">
521 521
 			<div class="give-clearfix">
522 522
 				<ul class="give-export-option-ul"></ul>
523
-				<p class="give-field-description"><?php _e( 'The following fields may have been created by custom code, or another plugin.', 'give' ); ?></p>
523
+				<p class="give-field-description"><?php _e('The following fields may have been created by custom code, or another plugin.', 'give'); ?></p>
524 524
 			</div>
525 525
 		</td>
526 526
 	</tr>
527 527
 	<?php
528 528
 }
529 529
 
530
-add_action( 'give_export_donation_fields', 'give_export_donation_custom_fields', 30 );
530
+add_action('give_export_donation_fields', 'give_export_donation_custom_fields', 30);
531 531
 
532 532
 
533 533
 /**
@@ -540,17 +540,17 @@  discard block
 block discarded – undo
540 540
 
541 541
 	<tr class="give-hidden give-export-donations-hide give-export-donations-hidden-fields">
542 542
 		<td scope="row" class="row-title">
543
-			<label><?php _e( 'Hidden Custom Field Columns:', 'give' ); ?></label>
543
+			<label><?php _e('Hidden Custom Field Columns:', 'give'); ?></label>
544 544
 		</td>
545 545
 		<td class="give-field-wrap">
546 546
 			<div class="give-clearfix">
547 547
 				<ul class="give-export-option-ul"></ul>
548
-				<p class="give-field-description"><?php _e( 'The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give' ); ?></p>
548
+				<p class="give-field-description"><?php _e('The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give'); ?></p>
549 549
 			</div>
550 550
 		</td>
551 551
 	</tr>
552 552
 	<?php
553 553
 }
554 554
 
555
-add_action( 'give_export_donation_fields', 'give_export_donation_hidden_fields', 40 );
555
+add_action('give_export_donation_fields', 'give_export_donation_hidden_fields', 40);
556 556
 
Please login to merge, or discard this patch.
includes/api/class-give-api-v2.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
 	 * @param WP_REST_Request $request
149 149
 	 *
150 150
 	 * @access public
151
-	 * @return array|mixed|object
151
+	 * @return string|null
152 152
 	 */
153 153
 	public function get_donation_grid( $request ) {
154 154
 		$parameters = $request->get_params();
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return Give_API_V2
62 62
 	 */
63 63
 	public static function get_instance() {
64
-		if ( null === static::$instance ) {
64
+		if (null === static::$instance) {
65 65
 			self::$instance = new static();
66 66
 
67 67
 			self::$instance->init();
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	private function init() {
81 81
 		// Setup hooks.
82
-		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
83
-		add_action( 'wp_enqueue_scripts', array( $this, 'localize_script' ), 999 );
84
-		add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 999 );
82
+		add_action('rest_api_init', array($this, 'register_routes'));
83
+		add_action('wp_enqueue_scripts', array($this, 'localize_script'), 999);
84
+		add_action('admin_enqueue_scripts', array($this, 'localize_script'), 999);
85 85
 	}
86 86
 
87 87
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	 * @access private
94 94
 	 */
95 95
 	public function register_routes() {
96
-		register_rest_route( $this->rest_base, '/form/(?P<id>[\d]+)', array(
96
+		register_rest_route($this->rest_base, '/form/(?P<id>[\d]+)', array(
97 97
 			'methods'  => 'GET',
98
-			'callback' => array( $this, 'get_forms_data' ),
99
-		) );
98
+			'callback' => array($this, 'get_forms_data'),
99
+		));
100 100
 
101
-		register_rest_route( $this->rest_base, '/form-grid', array(
101
+		register_rest_route($this->rest_base, '/form-grid', array(
102 102
 			'methods'  => 'GET',
103
-			'callback' => array( $this, 'get_donation_grid' ),
104
-		) );
103
+			'callback' => array($this, 'get_donation_grid'),
104
+		));
105 105
 	}
106 106
 
107 107
 	/**
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function localize_script() {
114 114
 		$data = array(
115
-			'root' => esc_url_raw( Give_API_V2::get_rest_api() ),
115
+			'root' => esc_url_raw(Give_API_V2::get_rest_api()),
116 116
 			'rest_base' => $this->rest_base
117 117
 		);
118 118
 
119
-		if ( is_admin() ) {
120
-			wp_localize_script( 'give-admin-scripts', 'giveApiSettings', $data );
119
+		if (is_admin()) {
120
+			wp_localize_script('give-admin-scripts', 'giveApiSettings', $data);
121 121
 		} else {
122
-			wp_localize_script( 'give', 'giveApiSettings', $data );
122
+			wp_localize_script('give', 'giveApiSettings', $data);
123 123
 		}
124 124
 	}
125 125
 
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 	 * @access public
132 132
 	 * @return array|mixed|object
133 133
 	 */
134
-	public function get_forms_data( $request ) {
134
+	public function get_forms_data($request) {
135 135
 		$parameters = $request->get_params();
136 136
 
137 137
 		// Bailout
138
-		if ( ! isset( $parameters['id'] ) || empty( $parameters['id'] ) ) {
139
-			return array( 'error' => 'no_parameter_given' );
138
+		if ( ! isset($parameters['id']) || empty($parameters['id'])) {
139
+			return array('error' => 'no_parameter_given');
140 140
 		}
141 141
 
142
-		return give_form_shortcode( $parameters );
142
+		return give_form_shortcode($parameters);
143 143
 	}
144 144
 
145 145
 	/**
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 * @access public
151 151
 	 * @return array|mixed|object
152 152
 	 */
153
-	public function get_donation_grid( $request ) {
153
+	public function get_donation_grid($request) {
154 154
 		$parameters = $request->get_params();
155 155
 
156
-		return give_form_grid_shortcode( $parameters );
156
+		return give_form_grid_shortcode($parameters);
157 157
 	}
158 158
 
159 159
 	/**
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Full URL to the endpoint.
170 170
 	 */
171
-	public static function get_rest_api( $blog_id = null, $path = '/', $scheme = 'rest' ) {
172
-		return trailingslashit( get_rest_url( $blog_id, $path, $scheme ) . self::$instance->rest_base );
171
+	public static function get_rest_api($blog_id = null, $path = '/', $scheme = 'rest') {
172
+		return trailingslashit(get_rest_url($blog_id, $path, $scheme).self::$instance->rest_base);
173 173
 	}
174 174
 }
175 175
 
Please login to merge, or discard this patch.
includes/forms/template.php 3 patches
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
  *
1483 1483
  * @param  int $form_id The form ID.
1484 1484
  *
1485
- * @return bool
1485
+ * @return false|null
1486 1486
  */
1487 1487
 function give_terms_agreement( $form_id ) {
1488 1488
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
  * @param  int   $form_id The form ID.
1677 1677
  * @param  array $args    An array of form arguments.
1678 1678
  *
1679
- * @return mixed
1679
+ * @return boolean
1680 1680
  */
1681 1681
 function give_show_goal_progress( $form_id, $args = array() ) {
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
  * @param  int $total      Total amount based on shortcode parameter.
1704 1704
  * @param  int $total_goal Total Goal amount passed by Admin.
1705 1705
  *
1706
- * @return mixed
1706
+ * @return boolean
1707 1707
  */
1708 1708
 function give_show_goal_totals_progress( $total, $total_goal ) {
1709 1709
 
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
  *
1728 1728
  * @since  1.8
1729 1729
  *
1730
- * @param  $form_id
1730
+ * @param  integer $form_id
1731 1731
  * @param  $args
1732 1732
  *
1733 1733
  * @return mixed|string
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
  * @param  int   $form_id The form ID.
1769 1769
  * @param  array $args    An array of form arguments.
1770 1770
  *
1771
- * @return void|bool
1771
+ * @return false|null
1772 1772
  */
1773 1773
 function give_form_content( $form_id, $args ) {
1774 1774
 
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
  *
2059 2059
  * @since 2.1
2060 2060
  *
2061
- * @return array
2061
+ * @return string[]
2062 2062
  */
2063 2063
 function add_class_for_form_grid( $class, $id, $args ) {
2064 2064
 	$class[] = 'give-form-grid-wrap';
@@ -2069,7 +2069,6 @@  discard block
 block discarded – undo
2069 2069
 /**
2070 2070
  * Add hidden field to Form Grid page
2071 2071
  *
2072
- * @param int              $form_id The form ID.
2073 2072
  * @param array            $args    An array of form arguments.
2074 2073
  * @param Give_Donate_Form $form    Form object.
2075 2074
  *
Please login to merge, or discard this patch.
Spacing   +475 added lines, -477 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 	static $count = 1;
30 30
 
31
-	$form_id = is_object( $post ) ? $post->ID : 0;
31
+	$form_id = is_object($post) ? $post->ID : 0;
32 32
 
33
-	if ( isset( $args['id'] ) ) {
33
+	if (isset($args['id'])) {
34 34
 		$form_id = $args['id'];
35 35
 	}
36 36
 
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 		)
41 41
 	);
42 42
 
43
-	$args = wp_parse_args( $args, $defaults );
43
+	$args = wp_parse_args($args, $defaults);
44 44
 
45
-	$form = new Give_Donate_Form( $args['form_id'] );
45
+	$form = new Give_Donate_Form($args['form_id']);
46 46
 
47 47
 	// Bail out, if no form ID.
48
-	if ( empty( $form->ID ) ) {
48
+	if (empty($form->ID)) {
49 49
 		return false;
50 50
 	}
51 51
 
52 52
 	$args['id_prefix'] = "{$form_id}-{$count}";
53
-	$payment_mode      = give_get_chosen_gateway( $form->ID );
53
+	$payment_mode      = give_get_chosen_gateway($form->ID);
54 54
 
55 55
 	$form_action = add_query_arg(
56 56
 		apply_filters(
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 
64 64
 	// Sanity Check: Donation form not published or user doesn't have permission to view drafts.
65 65
 	if (
66
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
67
-		|| ( 'trash' === $form->post_status )
66
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
67
+		|| ('trash' === $form->post_status)
68 68
 	) {
69 69
 		return false;
70 70
 	}
71 71
 
72 72
 	// Get the form wrap CSS classes.
73
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
73
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
74 74
 
75 75
 	// Get the <form> tag wrap CSS classes.
76
-	$form_classes = $form->get_form_classes( $args );
76
+	$form_classes = $form->get_form_classes($args);
77 77
 
78 78
 	ob_start();
79 79
 
@@ -85,21 +85,21 @@  discard block
 block discarded – undo
85 85
 	 * @param int   $form_id The form ID.
86 86
 	 * @param array $args    An array of form arguments.
87 87
 	 */
88
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
88
+	do_action('give_pre_form_output', $form->ID, $args, $form);
89 89
 
90 90
 	?>
91 91
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
92 92
 		<?php
93
-		if ( $form->is_close_donation_form() ) {
93
+		if ($form->is_close_donation_form()) {
94 94
 
95
-			$form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : '';
95
+			$form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : '';
96 96
 
97 97
 			// Get Goal thank you message.
98
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
99
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : '';
98
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
99
+			$goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : '';
100 100
 
101 101
 			// Print thank you message.
102
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
102
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
103 103
 
104 104
 		} else {
105 105
 			/**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			 * 1. if show_title params set to true
108 108
 			 * 2. if admin set form display_style to button
109 109
 			 */
110
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
110
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
111 111
 			if (
112 112
 				(
113
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
114
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
113
+					(isset($args['show_title']) && $args['show_title'] == true)
114
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
115 115
 				)
116
-				&& ! doing_action( 'give_single_form_summary' )
116
+				&& ! doing_action('give_single_form_summary')
117 117
 			) {
118 118
 				echo $form_title;
119 119
 			}
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 			 * @param array            $args    An array of form arguments.
128 128
 			 * @param Give_Donate_Form $form    Form object.
129 129
 			 */
130
-			do_action( 'give_pre_form', $form->ID, $args, $form );
130
+			do_action('give_pre_form', $form->ID, $args, $form);
131 131
 
132 132
 			// Set form html tags.
133 133
 			$form_html_tags = array(
134 134
 				'id'      => "give-form-{$args['id_prefix']}",
135 135
 				'class'   => $form_classes,
136
-				'action'  => esc_url_raw( $form_action ),
136
+				'action'  => esc_url_raw($form_action),
137 137
 				'data-id' => $args['id_prefix'],
138 138
 			);
139 139
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 			 * @param array            $form_html_tags Array of form html tags.
146 146
 			 * @param Give_Donate_Form $form           Form object.
147 147
 			 */
148
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
148
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
149 149
 			?>
150
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
150
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
151 151
 				<!-- The following field is for robots only, invisible to humans: -->
152 152
 				<span class="give-hidden" style="display: none !important;">
153 153
 					<label for="give-form-honeypot-<?php echo $form_id; ?>"></label>
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				 * @param array            $args    An array of form arguments.
166 166
 				 * @param Give_Donate_Form $form    Form object.
167 167
 				 */
168
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
168
+				do_action('give_donation_form_top', $form->ID, $args, $form);
169 169
 
170 170
 				/**
171 171
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 				 * @param array            $args    An array of form arguments.
177 177
 				 * @param Give_Donate_Form $form    Form object.
178 178
 				 */
179
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
179
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
180 180
 
181 181
 				/**
182 182
 				 * Fires while outputting donation form, after all other fields.
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				 * @param array            $args    An array of form arguments.
188 188
 				 * @param Give_Donate_Form $form    Form object.
189 189
 				 */
190
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
190
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
191 191
 
192 192
 				?>
193 193
 			</form>
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			 * @param array            $args    An array of form arguments.
203 203
 			 * @param Give_Donate_Form $form    Form object.
204 204
 			 */
205
-			do_action( 'give_post_form', $form->ID, $args, $form );
205
+			do_action('give_post_form', $form->ID, $args, $form);
206 206
 
207 207
 		}
208 208
 		?>
209 209
 
210
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
210
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
211 211
 	<?php
212 212
 
213 213
 	/**
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 * @param int   $form_id The form ID.
219 219
 	 * @param array $args    An array of form arguments.
220 220
 	 */
221
-	do_action( 'give_post_form_output', $form->ID, $args );
221
+	do_action('give_post_form_output', $form->ID, $args);
222 222
 
223 223
 	$final_output = ob_get_clean();
224
-	$count ++;
224
+	$count++;
225 225
 
226
-	echo apply_filters( 'give_donate_form', $final_output, $args );
226
+	echo apply_filters('give_donate_form', $final_output, $args);
227 227
 }
228 228
 
229 229
 /**
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return string
242 242
  */
243
-function give_show_purchase_form( $form_id, $args ) {
243
+function give_show_purchase_form($form_id, $args) {
244 244
 
245
-	$payment_mode = give_get_chosen_gateway( $form_id );
245
+	$payment_mode = give_get_chosen_gateway($form_id);
246 246
 
247
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
247
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
248 248
 		$form_id = $_POST['give_form_id'];
249 249
 	}
250 250
 
@@ -253,33 +253,33 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @since 1.7
255 255
 	 */
256
-	do_action( 'give_payment_fields_top', $form_id );
256
+	do_action('give_payment_fields_top', $form_id);
257 257
 
258
-	if ( give_can_checkout() && isset( $form_id ) ) {
258
+	if (give_can_checkout() && isset($form_id)) {
259 259
 
260 260
 		/**
261 261
 		 * Fires while displaying donation form, before registration login.
262 262
 		 *
263 263
 		 * @since 1.7
264 264
 		 */
265
-		do_action( 'give_donation_form_before_register_login', $form_id, $args );
265
+		do_action('give_donation_form_before_register_login', $form_id, $args);
266 266
 
267 267
 		/**
268 268
 		 * Fire when register/login form fields render.
269 269
 		 *
270 270
 		 * @since 1.7
271 271
 		 */
272
-		do_action( 'give_donation_form_register_login_fields', $form_id, $args );
272
+		do_action('give_donation_form_register_login_fields', $form_id, $args);
273 273
 
274 274
 		/**
275 275
 		 * Fire when credit card form fields render.
276 276
 		 *
277 277
 		 * @since 1.7
278 278
 		 */
279
-		do_action( 'give_donation_form_before_cc_form', $form_id, $args );
279
+		do_action('give_donation_form_before_cc_form', $form_id, $args);
280 280
 
281 281
 		// Load the credit card form and allow gateways to load their own if they wish.
282
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
282
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
283 283
 			/**
284 284
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
285 285
 			 *
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			 *
288 288
 			 * @param int $form_id The form ID.
289 289
 			 */
290
-			do_action( "give_{$payment_mode}_cc_form", $form_id, $args );
290
+			do_action("give_{$payment_mode}_cc_form", $form_id, $args);
291 291
 		} else {
292 292
 			/**
293 293
 			 * Fires while displaying donation form, credit card form fields.
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 			 *
297 297
 			 * @param int $form_id The form ID.
298 298
 			 */
299
-			do_action( 'give_cc_form', $form_id, $args );
299
+			do_action('give_cc_form', $form_id, $args);
300 300
 		}
301 301
 
302 302
 		/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		 *
305 305
 		 * @since 1.7
306 306
 		 */
307
-		do_action( 'give_donation_form_after_cc_form', $form_id, $args );
307
+		do_action('give_donation_form_after_cc_form', $form_id, $args);
308 308
 
309 309
 	} else {
310 310
 		/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		 *
313 313
 		 * @since 1.7
314 314
 		 */
315
-		do_action( 'give_donation_form_no_access', $form_id );
315
+		do_action('give_donation_form_no_access', $form_id);
316 316
 
317 317
 	}
318 318
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @since 1.7
323 323
 	 */
324
-	do_action( 'give_payment_fields_bottom', $form_id, $args );
324
+	do_action('give_payment_fields_bottom', $form_id, $args);
325 325
 }
326 326
 
327
-add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 );
327
+add_action('give_donation_form', 'give_show_purchase_form', 10, 2);
328 328
 
329 329
 /**
330 330
  * Give Show Login/Register Form Fields.
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return void
337 337
  */
338
-function give_show_register_login_fields( $form_id ) {
338
+function give_show_register_login_fields($form_id) {
339 339
 
340
-	$show_register_form = give_show_login_register_option( $form_id );
340
+	$show_register_form = give_show_login_register_option($form_id);
341 341
 
342
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
342
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
343 343
 		?>
344 344
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
345 345
 			<?php
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 			 *
349 349
 			 * @since 1.7
350 350
 			 */
351
-			do_action( 'give_donation_form_register_fields', $form_id );
351
+			do_action('give_donation_form_register_fields', $form_id);
352 352
 			?>
353 353
 		</div>
354 354
 	<?php
355
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
355
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
356 356
 		?>
357 357
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
358 358
 			<?php
@@ -361,23 +361,23 @@  discard block
 block discarded – undo
361 361
 			 *
362 362
 			 * @since 1.7
363 363
 			 */
364
-			do_action( 'give_donation_form_login_fields', $form_id );
364
+			do_action('give_donation_form_login_fields', $form_id);
365 365
 			?>
366 366
 		</div>
367 367
 	<?php
368 368
 	endif;
369 369
 
370
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
370
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
371 371
 		/**
372 372
 		 * Fire when user info render.
373 373
 		 *
374 374
 		 * @since 1.7
375 375
 		 */
376
-		do_action( 'give_donation_form_after_user_info', $form_id );
376
+		do_action('give_donation_form_after_user_info', $form_id);
377 377
 	}
378 378
 }
379 379
 
380
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
380
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
381 381
 
382 382
 /**
383 383
  * Donation Amount Field.
@@ -392,21 +392,21 @@  discard block
 block discarded – undo
392 392
  *
393 393
  * @return void
394 394
  */
395
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
395
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
396 396
 
397 397
 	$give_options        = give_get_settings();
398
-	$variable_pricing    = give_has_variable_prices( $form_id );
399
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
400
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
401
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
402
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
398
+	$variable_pricing    = give_has_variable_prices($form_id);
399
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
400
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
401
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
402
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
403 403
 	$default_amount      = give_format_amount(
404
-		give_get_default_form_amount( $form_id ), array(
404
+		give_get_default_form_amount($form_id), array(
405 405
 			'sanitize' => false,
406
-			'currency' => give_get_currency( $form_id ),
406
+			'currency' => give_get_currency($form_id),
407 407
 		)
408 408
 	);
409
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
409
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
410 410
 
411 411
 	/**
412 412
 	 * Fires while displaying donation form, before donation level fields.
@@ -416,23 +416,23 @@  discard block
 block discarded – undo
416 416
 	 * @param int   $form_id The form ID.
417 417
 	 * @param array $args    An array of form arguments.
418 418
 	 */
419
-	do_action( 'give_before_donation_levels', $form_id, $args );
419
+	do_action('give_before_donation_levels', $form_id, $args);
420 420
 
421 421
 	// Set Price, No Custom Amount Allowed means hidden price field.
422
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
422
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
423 423
 		?>
424
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
424
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
425 425
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
426 426
 		       value="<?php echo $default_amount; ?>" required aria-required="true"/>
427 427
 		<div class="set-price give-donation-amount form-row-wide">
428 428
 			<?php
429
-			if ( 'before' === $currency_position ) {
429
+			if ('before' === $currency_position) {
430 430
 				echo $currency_output;
431 431
 			}
432 432
 			?>
433 433
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
434 434
 			<?php
435
-			if ( 'after' === $currency_position ) {
435
+			if ('after' === $currency_position) {
436 436
 				echo $currency_output;
437 437
 			}
438 438
 			?>
@@ -444,15 +444,15 @@  discard block
 block discarded – undo
444 444
 		<div class="give-total-wrap">
445 445
 			<div class="give-donation-amount form-row-wide">
446 446
 				<?php
447
-				if ( 'before' === $currency_position ) {
447
+				if ('before' === $currency_position) {
448 448
 					echo $currency_output;
449 449
 				}
450 450
 				?>
451
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
451
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
452 452
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
453 453
 				       placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
454 454
 				<?php
455
-				if ( 'after' === $currency_position ) {
455
+				if ('after' === $currency_position) {
456 456
 					echo $currency_output;
457 457
 				}
458 458
 				?>
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
 	 * @param int   $form_id The form ID.
470 470
 	 * @param array $args    An array of form arguments.
471 471
 	 */
472
-	do_action( 'give_after_donation_amount', $form_id, $args );
472
+	do_action('give_after_donation_amount', $form_id, $args);
473 473
 
474 474
 	// Custom Amount Text
475
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) {
475
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) {
476 476
 		?>
477 477
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
478 478
 		<?php
479 479
 	}
480 480
 
481 481
 	// Output Variable Pricing Levels.
482
-	if ( $variable_pricing ) {
483
-		give_output_levels( $form_id );
482
+	if ($variable_pricing) {
483
+		give_output_levels($form_id);
484 484
 	}
485 485
 
486 486
 	/**
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 * @param int   $form_id The form ID.
492 492
 	 * @param array $args    An array of form arguments.
493 493
 	 */
494
-	do_action( 'give_after_donation_levels', $form_id, $args );
494
+	do_action('give_after_donation_levels', $form_id, $args);
495 495
 }
496 496
 
497
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
497
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
498 498
 
499 499
 /**
500 500
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
  *
506 506
  * @return string Donation levels.
507 507
  */
508
-function give_output_levels( $form_id ) {
508
+function give_output_levels($form_id) {
509 509
 
510 510
 	/**
511 511
 	 * Filter the variable pricing
@@ -517,30 +517,30 @@  discard block
 block discarded – undo
517 517
 	 * @param array $prices Array of variable prices.
518 518
 	 * @param int   $form   Form ID.
519 519
 	 */
520
-	$prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
520
+	$prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
521 521
 
522
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
523
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
524
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
522
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
523
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
524
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
525 525
 
526
-	if ( empty( $custom_amount_text ) ) {
527
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
526
+	if (empty($custom_amount_text)) {
527
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
528 528
 	}
529 529
 
530 530
 	$output = '';
531 531
 
532
-	switch ( $display_style ) {
532
+	switch ($display_style) {
533 533
 		case 'buttons':
534 534
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
535 535
 
536
-			foreach ( $prices as $price ) {
537
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
538
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price );
536
+			foreach ($prices as $price) {
537
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
538
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.(give_is_default_level_id($price) ? 'give-default-level' : ''), $form_id, $price);
539 539
 
540 540
 				$formatted_amount = give_format_amount(
541 541
 					$price['_give_amount'], array(
542 542
 						'sanitize' => false,
543
-						'currency' => give_get_currency( $form_id ),
543
+						'currency' => give_get_currency($form_id),
544 544
 					)
545 545
 				);
546 546
 
@@ -549,15 +549,15 @@  discard block
 block discarded – undo
549 549
 					$price['_give_id']['level_id'],
550 550
 					$level_classes,
551 551
 					$formatted_amount,
552
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
552
+					array_key_exists('_give_default', $price) ? 1 : 0,
553 553
 					$level_text
554 554
 				);
555 555
 			}
556 556
 
557 557
 			// Custom Amount.
558 558
 			if (
559
-				give_is_setting_enabled( $custom_amount )
560
-				&& ! empty( $custom_amount_text )
559
+				give_is_setting_enabled($custom_amount)
560
+				&& ! empty($custom_amount_text)
561 561
 			) {
562 562
 
563 563
 				$output .= sprintf(
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 		case 'radios':
574 574
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
575 575
 
576
-			foreach ( $prices as $price ) {
577
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
578
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price );
576
+			foreach ($prices as $price) {
577
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
578
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, $price);
579 579
 
580 580
 				$formatted_amount = give_format_amount(
581 581
 					$price['_give_amount'], array(
582 582
 						'sanitize' => false,
583
-						'currency' => give_get_currency( $form_id ),
583
+						'currency' => give_get_currency($form_id),
584 584
 					)
585 585
 				);
586 586
 
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 					$price['_give_id']['level_id'],
590 590
 					$level_classes,
591 591
 					$formatted_amount,
592
-					( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ),
593
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
592
+					(give_is_default_level_id($price) ? 'checked="checked"' : ''),
593
+					array_key_exists('_give_default', $price) ? 1 : 0,
594 594
 					$level_text
595 595
 				);
596 596
 			}
597 597
 
598 598
 			// Custom Amount.
599 599
 			if (
600
-				give_is_setting_enabled( $custom_amount )
601
-				&& ! empty( $custom_amount_text )
600
+				give_is_setting_enabled($custom_amount)
601
+				&& ! empty($custom_amount_text)
602 602
 			) {
603 603
 				$output .= sprintf(
604 604
 					'<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>',
@@ -611,21 +611,21 @@  discard block
 block discarded – undo
611 611
 			break;
612 612
 
613 613
 		case 'dropdown':
614
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
615
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
614
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
615
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
616 616
 
617 617
 			// first loop through prices.
618
-			foreach ( $prices as $price ) {
619
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
618
+			foreach ($prices as $price) {
619
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
620 620
 				$level_classes = apply_filters(
621
-					'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id,
621
+					'give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id,
622 622
 					$price
623 623
 				);
624 624
 
625 625
 				$formatted_amount = give_format_amount(
626 626
 					$price['_give_amount'], array(
627 627
 						'sanitize' => false,
628
-						'currency' => give_get_currency( $form_id ),
628
+						'currency' => give_get_currency($form_id),
629 629
 					)
630 630
 				);
631 631
 
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 					$price['_give_id']['level_id'],
635 635
 					$level_classes,
636 636
 					$formatted_amount,
637
-					( give_is_default_level_id( $price ) ? 'selected="selected"' : '' ),
638
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
637
+					(give_is_default_level_id($price) ? 'selected="selected"' : ''),
638
+					array_key_exists('_give_default', $price) ? 1 : 0,
639 639
 					$level_text
640 640
 				);
641 641
 			}
642 642
 
643 643
 			// Custom Amount.
644
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
644
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
645 645
 				$output .= sprintf(
646 646
 					'<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>',
647 647
 					$custom_amount_text
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			break;
654 654
 	}
655 655
 
656
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
656
+	echo apply_filters('give_form_level_output', $output, $form_id);
657 657
 }
658 658
 
659 659
 /**
@@ -668,27 +668,27 @@  discard block
 block discarded – undo
668 668
  *
669 669
  * @return string Checkout button.
670 670
  */
671
-function give_display_checkout_button( $form_id, $args ) {
671
+function give_display_checkout_button($form_id, $args) {
672 672
 
673
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
673
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
674 674
 		? $args['display_style']
675
-		: give_get_meta( $form_id, '_give_payment_display', true );
675
+		: give_get_meta($form_id, '_give_payment_display', true);
676 676
 
677
-	if ( 'button' === $display_option ) {
677
+	if ('button' === $display_option) {
678 678
 		$display_option = 'modal';
679
-	} elseif ( $display_option === 'onpage' ) {
679
+	} elseif ($display_option === 'onpage') {
680 680
 		return '';
681 681
 	}
682 682
 
683
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
684
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
683
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
684
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
685 685
 
686
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
686
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
687 687
 
688
-	echo apply_filters( 'give_display_checkout_button', $output );
688
+	echo apply_filters('give_display_checkout_button', $output);
689 689
 }
690 690
 
691
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
691
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
692 692
 
693 693
 /**
694 694
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -701,53 +701,53 @@  discard block
 block discarded – undo
701 701
  *
702 702
  * @return void
703 703
  */
704
-function give_user_info_fields( $form_id ) {
704
+function give_user_info_fields($form_id) {
705 705
 
706 706
 	// Get user info.
707
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
708
-	$title          = ! empty( $give_user_info['give_title'] ) ? $give_user_info['give_title'] : '';
709
-	$first_name     = ! empty( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : '';
710
-	$last_name      = ! empty( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : '';
711
-	$company_name   = ! empty( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : '';
712
-	$email          = ! empty( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : '';
713
-	$title_prefixes = give_get_name_title_prefixes( $form_id );
707
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
708
+	$title          = ! empty($give_user_info['give_title']) ? $give_user_info['give_title'] : '';
709
+	$first_name     = ! empty($give_user_info['give_first']) ? $give_user_info['give_first'] : '';
710
+	$last_name      = ! empty($give_user_info['give_last']) ? $give_user_info['give_last'] : '';
711
+	$company_name   = ! empty($give_user_info['company_name']) ? $give_user_info['company_name'] : '';
712
+	$email          = ! empty($give_user_info['give_email']) ? $give_user_info['give_email'] : '';
713
+	$title_prefixes = give_get_name_title_prefixes($form_id);
714 714
 
715 715
 	/**
716 716
 	 * Fire before user personal information fields
717 717
 	 *
718 718
 	 * @since 1.7
719 719
 	 */
720
-	do_action( 'give_donation_form_before_personal_info', $form_id );
720
+	do_action('give_donation_form_before_personal_info', $form_id);
721 721
 
722 722
 	$title_prefix_classes = '';
723
-	if ( give_is_name_title_prefix_enabled( $form_id ) ) {
723
+	if (give_is_name_title_prefix_enabled($form_id)) {
724 724
 		$title_prefix_classes = 'give-title-prefix-wrap';
725 725
 	}
726 726
 	?>
727
-	<fieldset id="give_checkout_user_info" class="<?php echo esc_html( $title_prefix_classes ); ?>">
727
+	<fieldset id="give_checkout_user_info" class="<?php echo esc_html($title_prefix_classes); ?>">
728 728
 		<legend>
729
-			<?php echo esc_html( apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ) ); ?>
729
+			<?php echo esc_html(apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give'))); ?>
730 730
 		</legend>
731 731
 
732
-		<?php if ( give_is_name_title_prefix_enabled( $form_id ) && is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { ?>
732
+		<?php if (give_is_name_title_prefix_enabled($form_id) && is_array($title_prefixes) && count($title_prefixes) > 0) { ?>
733 733
 			<p id="give-title-wrap" class="form-row form-row-title form-row-responsive">
734 734
 				<label class="give-label" for="give-title">
735
-					<?php esc_attr_e( 'Title', 'give' ); ?>
736
-					<?php if ( give_field_is_required( 'give_title', $form_id ) ) : ?>
735
+					<?php esc_attr_e('Title', 'give'); ?>
736
+					<?php if (give_field_is_required('give_title', $form_id)) : ?>
737 737
 						<span class="give-required-indicator">*</span>
738 738
 					<?php endif ?>
739
-					<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
739
+					<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
740 740
 				</label>
741 741
 				<select
742 742
 					class="give-input required"
743 743
 					type="text"
744 744
 					name="give_title"
745 745
 					id="give-title"
746
-					<?php echo( give_field_is_required( 'give_title', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
746
+					<?php echo(give_field_is_required('give_title', $form_id) ? ' required aria-required="true" ' : ''); ?>
747 747
 				>
748
-					<?php foreach ( $title_prefixes as $key => $value ) { ?>
748
+					<?php foreach ($title_prefixes as $key => $value) { ?>
749 749
 						<option
750
-							value="<?php echo esc_html( $value ); ?>" <?php selected( $value, $title, true ); ?>><?php echo esc_html( $value ); ?></option>
750
+							value="<?php echo esc_html($value); ?>" <?php selected($value, $title, true); ?>><?php echo esc_html($value); ?></option>
751 751
 					<?php } ?>
752 752
 				</select>
753 753
 			</p>
@@ -755,63 +755,63 @@  discard block
 block discarded – undo
755 755
 
756 756
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
757 757
 			<label class="give-label" for="give-first">
758
-				<?php esc_attr_e( 'First Name', 'give' ); ?>
759
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
758
+				<?php esc_attr_e('First Name', 'give'); ?>
759
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
760 760
 					<span class="give-required-indicator">*</span>
761 761
 				<?php endif ?>
762
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
762
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
763 763
 			</label>
764 764
 			<input
765 765
 				class="give-input required"
766 766
 				type="text"
767 767
 				name="give_first"
768 768
 				autocomplete="given-name"
769
-				placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
769
+				placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
770 770
 				id="give-first"
771
-				value="<?php echo esc_html( $first_name ); ?>"
772
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
771
+				value="<?php echo esc_html($first_name); ?>"
772
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
773 773
 			/>
774 774
 		</p>
775 775
 
776 776
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
777 777
 			<label class="give-label" for="give-last">
778
-				<?php esc_attr_e( 'Last Name', 'give' ); ?>
779
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
778
+				<?php esc_attr_e('Last Name', 'give'); ?>
779
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
780 780
 					<span class="give-required-indicator">*</span>
781 781
 				<?php endif ?>
782
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
782
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
783 783
 			</label>
784 784
 
785 785
 			<input
786
-				class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
786
+				class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
787 787
 				type="text"
788 788
 				name="give_last"
789 789
 				autocomplete="family-name"
790 790
 				id="give-last"
791
-				placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
792
-				value="<?php echo esc_html( $last_name ); ?>"
793
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
791
+				placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
792
+				value="<?php echo esc_html($last_name); ?>"
793
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
794 794
 			/>
795 795
 		</p>
796 796
 
797
-		<?php if ( give_is_company_field_enabled( $form_id ) ) : ?>
798
-			<?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?>
797
+		<?php if (give_is_company_field_enabled($form_id)) : ?>
798
+			<?php $give_company = give_field_is_required('give_company_name', $form_id); ?>
799 799
 			<p id="give-company-wrap" class="form-row form-row-wide">
800 800
 				<label class="give-label" for="give-company">
801
-					<?php esc_attr_e( 'Company Name', 'give' ); ?>
802
-					<?php if ( $give_company ) : ?>
801
+					<?php esc_attr_e('Company Name', 'give'); ?>
802
+					<?php if ($give_company) : ?>
803 803
 						<span class="give-required-indicator">*</span>
804 804
 					<?php endif; ?>
805
-					<?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?>
805
+					<?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?>
806 806
 				</label>
807 807
 				<input
808
-					class="give-input<?php echo( $give_company ? ' required' : '' ); ?>"
808
+					class="give-input<?php echo($give_company ? ' required' : ''); ?>"
809 809
 					type="text"
810 810
 					name="give_company_name"
811
-					placeholder="<?php esc_attr_e( 'Company Name', 'give' ); ?>"
811
+					placeholder="<?php esc_attr_e('Company Name', 'give'); ?>"
812 812
 					id="give-company"
813
-					value="<?php echo esc_html( $company_name ); ?>"
814
-					<?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?>
813
+					value="<?php echo esc_html($company_name); ?>"
814
+					<?php echo($give_company ? ' required aria-required="true" ' : ''); ?>
815 815
 				/>
816 816
 			</p>
817 817
 		<?php endif ?>
@@ -822,31 +822,31 @@  discard block
 block discarded – undo
822 822
 		 *
823 823
 		 * @since 1.7
824 824
 		 */
825
-		do_action( 'give_donation_form_before_email', $form_id );
825
+		do_action('give_donation_form_before_email', $form_id);
826 826
 		?>
827 827
 		<p id="give-email-wrap" class="form-row form-row-wide">
828 828
 			<label class="give-label" for="give-email">
829
-				<?php esc_attr_e( 'Email Address', 'give' ); ?>
830
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
829
+				<?php esc_attr_e('Email Address', 'give'); ?>
830
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
831 831
 					<span class="give-required-indicator">*</span>
832 832
 				<?php } ?>
833
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
833
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
834 834
 			</label>
835 835
 			<input
836 836
 				class="give-input required"
837 837
 				type="email"
838 838
 				name="give_email"
839 839
 				autocomplete="email"
840
-				placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
840
+				placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
841 841
 				id="give-email"
842
-				value="<?php echo esc_html( $email ); ?>"
843
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
842
+				value="<?php echo esc_html($email); ?>"
843
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
844 844
 			/>
845 845
 
846 846
 		</p>
847 847
 
848
-		<?php if ( give_is_anonymous_donation_field_enabled( $form_id ) ) : ?>
849
-			<?php $is_anonymous_donation = isset( $_POST['give_anonymous_donation'] ) ? absint( $_POST['give_anonymous_donation'] ) : 0; ?>
848
+		<?php if (give_is_anonymous_donation_field_enabled($form_id)) : ?>
849
+			<?php $is_anonymous_donation = isset($_POST['give_anonymous_donation']) ? absint($_POST['give_anonymous_donation']) : 0; ?>
850 850
 			<p id="give-anonymous-donation-wrap" class="form-row form-row-wide">
851 851
 				<label class="give-label" for="give-anonymous-donation">
852 852
 					<input
@@ -855,35 +855,35 @@  discard block
 block discarded – undo
855 855
 						name="give_anonymous_donation"
856 856
 						id="give-anonymous-donation"
857 857
 						value="1"
858
-						<?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
859
-						<?php checked( 1, $is_anonymous_donation ); ?>
858
+						<?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required aria-required="true" ' : ''); ?>
859
+						<?php checked(1, $is_anonymous_donation); ?>
860 860
 					>
861
-					<?php _e( 'Make this an anonymous donation', 'give' ); ?>
862
-					<?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?>
861
+					<?php _e('Make this an anonymous donation', 'give'); ?>
862
+					<?php if (give_field_is_required('give_comment', $form_id)) { ?>
863 863
 						<span class="give-required-indicator">*</span>
864 864
 					<?php } ?>
865
-					<?php echo Give()->tooltips->render_help( esc_html__( 'Would you like to prevent this donation from being displayed publicy?', 'give' ) ); ?>
865
+					<?php echo Give()->tooltips->render_help(esc_html__('Would you like to prevent this donation from being displayed publicy?', 'give')); ?>
866 866
 				</label>
867 867
 			</p>
868 868
 		<?php endif; ?>
869 869
 
870
-		<?php if ( give_is_donor_comment_field_enabled( $form_id ) ) : ?>
870
+		<?php if (give_is_donor_comment_field_enabled($form_id)) : ?>
871 871
 			<p id="give-comment-wrap" class="form-row form-row-wide">
872 872
 				<label class="give-label" for="give-comment">
873
-					<?php _e( 'Comment', 'give' ); ?>
874
-					<?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?>
873
+					<?php _e('Comment', 'give'); ?>
874
+					<?php if (give_field_is_required('give_comment', $form_id)) { ?>
875 875
 						<span class="give-required-indicator">*</span>
876 876
 					<?php } ?>
877
-					<?php echo Give()->tooltips->render_help( __( 'Would you like to add a comment to this donation?', 'give' ) ); ?>
877
+					<?php echo Give()->tooltips->render_help(__('Would you like to add a comment to this donation?', 'give')); ?>
878 878
 				</label>
879 879
 
880 880
 				<textarea
881 881
 					class="give-input required"
882 882
 					name="give_comment"
883
-					placeholder="<?php _e( 'Leave a comment', 'give' ); ?>"
883
+					placeholder="<?php _e('Leave a comment', 'give'); ?>"
884 884
 					id="give-comment"
885
-					<?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
886
-				><?php echo isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : ''; ?></textarea>
885
+					<?php echo(give_field_is_required('give_comment', $form_id) ? ' required aria-required="true" ' : ''); ?>
886
+				><?php echo isset($_POST['give_comment']) ? give_clean($_POST['give_comment']) : ''; ?></textarea>
887 887
 
888 888
 			</p>
889 889
 		<?php endif; ?>
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 		 *
894 894
 		 * @since 1.7
895 895
 		 */
896
-		do_action( 'give_donation_form_after_email', $form_id );
896
+		do_action('give_donation_form_after_email', $form_id);
897 897
 
898 898
 		/**
899 899
 		 * Fire after personal email field
900 900
 		 *
901 901
 		 * @since 1.7
902 902
 		 */
903
-		do_action( 'give_donation_form_user_info', $form_id );
903
+		do_action('give_donation_form_user_info', $form_id);
904 904
 		?>
905 905
 	</fieldset>
906 906
 	<?php
@@ -909,11 +909,11 @@  discard block
 block discarded – undo
909 909
 	 *
910 910
 	 * @since 1.7
911 911
 	 */
912
-	do_action( 'give_donation_form_after_personal_info', $form_id );
912
+	do_action('give_donation_form_after_personal_info', $form_id);
913 913
 }
914 914
 
915
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
916
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
915
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
916
+add_action('give_register_fields_before', 'give_user_info_fields');
917 917
 
918 918
 /**
919 919
  * Renders the credit card info form.
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @return void
926 926
  */
927
-function give_get_cc_form( $form_id ) {
927
+function give_get_cc_form($form_id) {
928 928
 
929 929
 	ob_start();
930 930
 
@@ -935,50 +935,50 @@  discard block
 block discarded – undo
935 935
 	 *
936 936
 	 * @param int $form_id The form ID.
937 937
 	 */
938
-	do_action( 'give_before_cc_fields', $form_id );
938
+	do_action('give_before_cc_fields', $form_id);
939 939
 	?>
940 940
 	<fieldset id="give_cc_fields-<?php echo $form_id; ?>" class="give-do-validate">
941
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
942
-		<?php if ( is_ssl() ) : ?>
941
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
942
+		<?php if (is_ssl()) : ?>
943 943
 			<div id="give_secure_site_wrapper-<?php echo $form_id; ?>">
944 944
 				<span class="give-icon padlock"></span>
945
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
945
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
946 946
 			</div>
947 947
 		<?php endif; ?>
948 948
 		<p id="give-card-number-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive">
949 949
 			<label for="card_number-<?php echo $form_id; ?>" class="give-label">
950
-				<?php _e( 'Card Number', 'give' ); ?>
950
+				<?php _e('Card Number', 'give'); ?>
951 951
 				<span class="give-required-indicator">*</span>
952
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
952
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
953 953
 				<span class="card-type"></span>
954 954
 			</label>
955 955
 
956 956
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id; ?>"
957
-			       class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
957
+			       class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
958 958
 			       required aria-required="true"/>
959 959
 		</p>
960 960
 
961 961
 		<p id="give-card-cvc-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-responsive">
962 962
 			<label for="card_cvc-<?php echo $form_id; ?>" class="give-label">
963
-				<?php _e( 'CVC', 'give' ); ?>
963
+				<?php _e('CVC', 'give'); ?>
964 964
 				<span class="give-required-indicator">*</span>
965
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
965
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
966 966
 			</label>
967 967
 
968 968
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id; ?>"
969
-			       class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
969
+			       class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
970 970
 			       required aria-required="true"/>
971 971
 		</p>
972 972
 
973 973
 		<p id="give-card-name-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive">
974 974
 			<label for="card_name-<?php echo $form_id; ?>" class="give-label">
975
-				<?php _e( 'Name on the Card', 'give' ); ?>
975
+				<?php _e('Name on the Card', 'give'); ?>
976 976
 				<span class="give-required-indicator">*</span>
977
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
977
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
978 978
 			</label>
979 979
 
980 980
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id; ?>"
981
-			       class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
981
+			       class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
982 982
 			       required aria-required="true"/>
983 983
 		</p>
984 984
 		<?php
@@ -989,13 +989,13 @@  discard block
 block discarded – undo
989 989
 		 *
990 990
 		 * @param int $form_id The form ID.
991 991
 		 */
992
-		do_action( 'give_before_cc_expiration' );
992
+		do_action('give_before_cc_expiration');
993 993
 		?>
994 994
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
995 995
 			<label for="card_expiry-<?php echo $form_id; ?>" class="give-label">
996
-				<?php _e( 'Expiration', 'give' ); ?>
996
+				<?php _e('Expiration', 'give'); ?>
997 997
 				<span class="give-required-indicator">*</span>
998
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
998
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
999 999
 			</label>
1000 1000
 
1001 1001
 			<input type="hidden" id="card_exp_month-<?php echo $form_id; ?>" name="card_exp_month"
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			       class="card-expiry-year"/>
1005 1005
 
1006 1006
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id; ?>"
1007
-			       class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
1007
+			       class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
1008 1008
 			       required aria-required="true"/>
1009 1009
 		</p>
1010 1010
 		<?php
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 		 *
1016 1016
 		 * @param int $form_id The form ID.
1017 1017
 		 */
1018
-		do_action( 'give_after_cc_expiration', $form_id );
1018
+		do_action('give_after_cc_expiration', $form_id);
1019 1019
 		?>
1020 1020
 	</fieldset>
1021 1021
 	<?php
@@ -1026,12 +1026,12 @@  discard block
 block discarded – undo
1026 1026
 	 *
1027 1027
 	 * @param int $form_id The form ID.
1028 1028
 	 */
1029
-	do_action( 'give_after_cc_fields', $form_id );
1029
+	do_action('give_after_cc_fields', $form_id);
1030 1030
 
1031 1031
 	echo ob_get_clean();
1032 1032
 }
1033 1033
 
1034
-add_action( 'give_cc_form', 'give_get_cc_form' );
1034
+add_action('give_cc_form', 'give_get_cc_form');
1035 1035
 
1036 1036
 /**
1037 1037
  * Outputs the default credit card address fields.
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
  *
1043 1043
  * @return void
1044 1044
  */
1045
-function give_default_cc_address_fields( $form_id ) {
1045
+function give_default_cc_address_fields($form_id) {
1046 1046
 	// Get user info.
1047
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
1047
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
1048 1048
 
1049 1049
 	$logged_in = is_user_logged_in();
1050 1050
 
1051
-	if ( $logged_in ) {
1052
-		$user_address = give_get_donor_address( get_current_user_id() );
1051
+	if ($logged_in) {
1052
+		$user_address = give_get_donor_address(get_current_user_id());
1053 1053
 	}
1054 1054
 
1055 1055
 	ob_start();
1056 1056
 	?>
1057 1057
 	<fieldset id="give_cc_address" class="cc-address">
1058
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
1058
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
1059 1059
 		<?php
1060 1060
 		/**
1061 1061
 		 * Fires while rendering credit card billing form, before address fields.
@@ -1064,36 +1064,36 @@  discard block
 block discarded – undo
1064 1064
 		 *
1065 1065
 		 * @param int $form_id The form ID.
1066 1066
 		 */
1067
-		do_action( 'give_cc_billing_top' );
1067
+		do_action('give_cc_billing_top');
1068 1068
 
1069 1069
 		// For Country.
1070 1070
 		$selected_country = give_get_country();
1071
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1071
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1072 1072
 			$selected_country = $give_user_info['billing_country'];
1073 1073
 		}
1074 1074
 		$countries = give_get_country_list();
1075 1075
 
1076 1076
 		// For state.
1077 1077
 		$selected_state = '';
1078
-		if ( $selected_country === give_get_country() ) {
1078
+		if ($selected_country === give_get_country()) {
1079 1079
 			// Get default selected state by admin.
1080 1080
 			$selected_state = give_get_state();
1081 1081
 		}
1082 1082
 		// Get the last payment made by user states.
1083
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
1083
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
1084 1084
 			$selected_state = $give_user_info['card_state'];
1085 1085
 		}
1086 1086
 		// Get the country code.
1087
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1087
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1088 1088
 			$selected_country = $give_user_info['billing_country'];
1089 1089
 		}
1090
-		$label        = __( 'State', 'give' );
1090
+		$label        = __('State', 'give');
1091 1091
 		$states_label = give_get_states_label();
1092 1092
 		// Check if $country code exists in the array key for states label.
1093
-		if ( array_key_exists( $selected_country, $states_label ) ) {
1094
-			$label = $states_label[ $selected_country ];
1093
+		if (array_key_exists($selected_country, $states_label)) {
1094
+			$label = $states_label[$selected_country];
1095 1095
 		}
1096
-		$states = give_get_states( $selected_country );
1096
+		$states = give_get_states($selected_country);
1097 1097
 		// Get the country list that do not have any states init.
1098 1098
 		$no_states_country = give_no_states_country_list();
1099 1099
 		// Get the country list that does not require states.
@@ -1101,24 +1101,24 @@  discard block
 block discarded – undo
1101 1101
 		?>
1102 1102
 		<p id="give-card-country-wrap" class="form-row form-row-wide">
1103 1103
 			<label for="billing_country" class="give-label">
1104
-				<?php esc_html_e( 'Country', 'give' ); ?>
1105
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
1104
+				<?php esc_html_e('Country', 'give'); ?>
1105
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
1106 1106
 					<span class="give-required-indicator">*</span>
1107 1107
 				<?php endif; ?>
1108 1108
 				<span class="give-tooltip give-icon give-icon-question"
1109
-				      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
1109
+				      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
1110 1110
 			</label>
1111 1111
 
1112 1112
 			<select
1113 1113
 				name="billing_country"
1114 1114
 				autocomplete="country-name"
1115 1115
 				id="billing_country"
1116
-				class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
1117
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1116
+				class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
1117
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
1118 1118
 			>
1119 1119
 				<?php
1120
-				foreach ( $countries as $country_code => $country ) {
1121
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1120
+				foreach ($countries as $country_code => $country) {
1121
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1122 1122
 				}
1123 1123
 				?>
1124 1124
 			</select>
@@ -1126,13 +1126,13 @@  discard block
 block discarded – undo
1126 1126
 
1127 1127
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
1128 1128
 			<label for="card_address" class="give-label">
1129
-				<?php _e( 'Address 1', 'give' ); ?>
1129
+				<?php _e('Address 1', 'give'); ?>
1130 1130
 				<?php
1131
-				if ( give_field_is_required( 'card_address', $form_id ) ) :
1131
+				if (give_field_is_required('card_address', $form_id)) :
1132 1132
 					?>
1133 1133
 					<span class="give-required-indicator">*</span>
1134 1134
 				<?php endif; ?>
1135
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
1135
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
1136 1136
 			</label>
1137 1137
 
1138 1138
 			<input
@@ -1140,20 +1140,20 @@  discard block
 block discarded – undo
1140 1140
 				id="card_address"
1141 1141
 				name="card_address"
1142 1142
 				autocomplete="address-line1"
1143
-				class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
1144
-				placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
1145
-				value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
1146
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
1143
+				class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
1144
+				placeholder="<?php _e('Address line 1', 'give'); ?>"
1145
+				value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
1146
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
1147 1147
 			/>
1148 1148
 		</p>
1149 1149
 
1150 1150
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
1151 1151
 			<label for="card_address_2" class="give-label">
1152
-				<?php _e( 'Address 2', 'give' ); ?>
1153
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
1152
+				<?php _e('Address 2', 'give'); ?>
1153
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
1154 1154
 					<span class="give-required-indicator">*</span>
1155 1155
 				<?php endif; ?>
1156
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
1156
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
1157 1157
 			</label>
1158 1158
 
1159 1159
 			<input
@@ -1161,59 +1161,59 @@  discard block
 block discarded – undo
1161 1161
 				id="card_address_2"
1162 1162
 				name="card_address_2"
1163 1163
 				autocomplete="address-line2"
1164
-				class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
1165
-				placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
1166
-				value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
1167
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1164
+				class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
1165
+				placeholder="<?php _e('Address line 2', 'give'); ?>"
1166
+				value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
1167
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
1168 1168
 			/>
1169 1169
 		</p>
1170 1170
 
1171 1171
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
1172 1172
 			<label for="card_city" class="give-label">
1173
-				<?php _e( 'City', 'give' ); ?>
1174
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
1173
+				<?php _e('City', 'give'); ?>
1174
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
1175 1175
 					<span class="give-required-indicator">*</span>
1176 1176
 				<?php endif; ?>
1177
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
1177
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
1178 1178
 			</label>
1179 1179
 			<input
1180 1180
 				type="text"
1181 1181
 				id="card_city"
1182 1182
 				name="card_city"
1183 1183
 				autocomplete="address-level3"
1184
-				class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1185
-				placeholder="<?php _e( 'City', 'give' ); ?>"
1186
-				value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1187
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1184
+				class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1185
+				placeholder="<?php _e('City', 'give'); ?>"
1186
+				value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1187
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1188 1188
 			/>
1189 1189
 		</p>
1190 1190
 
1191 1191
 		<p id="give-card-state-wrap"
1192
-		   class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
1192
+		   class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1193 1193
 			<label for="card_state" class="give-label">
1194 1194
 				<span class="state-label-text"><?php echo $label; ?></span>
1195 1195
 				<?php
1196
-				if ( give_field_is_required( 'card_state', $form_id ) ) :
1196
+				if (give_field_is_required('card_state', $form_id)) :
1197 1197
 					?>
1198 1198
 					<span
1199
-						class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ); ?> ">*</span>
1199
+						class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : ''); ?> ">*</span>
1200 1200
 				<?php endif; ?>
1201 1201
 				<span class="give-tooltip give-icon give-icon-question"
1202
-				      data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1202
+				      data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1203 1203
 			</label>
1204 1204
 			<?php
1205 1205
 
1206
-			if ( ! empty( $states ) ) :
1206
+			if ( ! empty($states)) :
1207 1207
 				?>
1208 1208
 				<select
1209 1209
 					name="card_state"
1210 1210
 					autocomplete="address-level4"
1211 1211
 					id="card_state"
1212
-					class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1213
-					<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1212
+					class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1213
+					<?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1214 1214
 					<?php
1215
-					foreach ( $states as $state_code => $state ) {
1216
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1215
+					foreach ($states as $state_code => $state) {
1216
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1217 1217
 					}
1218 1218
 					?>
1219 1219
 				</select>
@@ -1225,11 +1225,11 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1227 1227
 			<label for="card_zip" class="give-label">
1228
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1229
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1228
+				<?php _e('Zip / Postal Code', 'give'); ?>
1229
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1230 1230
 					<span class="give-required-indicator">*</span>
1231 1231
 				<?php endif; ?>
1232
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1232
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1233 1233
 			</label>
1234 1234
 
1235 1235
 			<input
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
 				id="card_zip"
1239 1239
 				name="card_zip"
1240 1240
 				autocomplete="postal-code"
1241
-				class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1242
-				placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1243
-				value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1244
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1241
+				class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1242
+				placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1243
+				value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1244
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1245 1245
 			/>
1246 1246
 		</p>
1247 1247
 		<?php
@@ -1252,14 +1252,14 @@  discard block
 block discarded – undo
1252 1252
 		 *
1253 1253
 		 * @param int $form_id The form ID.
1254 1254
 		 */
1255
-		do_action( 'give_cc_billing_bottom' );
1255
+		do_action('give_cc_billing_bottom');
1256 1256
 		?>
1257 1257
 	</fieldset>
1258 1258
 	<?php
1259 1259
 	echo ob_get_clean();
1260 1260
 }
1261 1261
 
1262
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1262
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1263 1263
 
1264 1264
 
1265 1265
 /**
@@ -1272,15 +1272,15 @@  discard block
 block discarded – undo
1272 1272
  *
1273 1273
  * @return string
1274 1274
  */
1275
-function give_get_register_fields( $form_id ) {
1275
+function give_get_register_fields($form_id) {
1276 1276
 
1277 1277
 	global $user_ID;
1278 1278
 
1279
-	if ( is_user_logged_in() ) {
1280
-		$user_data = get_userdata( $user_ID );
1279
+	if (is_user_logged_in()) {
1280
+		$user_data = get_userdata($user_ID);
1281 1281
 	}
1282 1282
 
1283
-	$show_register_form = give_show_login_register_option( $form_id );
1283
+	$show_register_form = give_show_login_register_option($form_id);
1284 1284
 
1285 1285
 	ob_start();
1286 1286
 	?>
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 		 *
1295 1295
 		 * @param int $form_id The form ID.
1296 1296
 		 */
1297
-		do_action( 'give_register_fields_before', $form_id );
1297
+		do_action('give_register_fields_before', $form_id);
1298 1298
 		?>
1299 1299
 
1300 1300
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1306,25 +1306,25 @@  discard block
 block discarded – undo
1306 1306
 			 *
1307 1307
 			 * @param int $form_id The form ID.
1308 1308
 			 */
1309
-			do_action( 'give_register_account_fields_before', $form_id );
1309
+			do_action('give_register_account_fields_before', $form_id);
1310 1310
 
1311
-			$class = ( 'registration' === $show_register_form ) ? 'form-row-wide' : 'form-row-first';
1311
+			$class = ('registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first';
1312 1312
 			?>
1313 1313
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>"
1314
-			     class="form-row <?php echo esc_attr( $class ); ?> form-row-responsive">
1314
+			     class="form-row <?php echo esc_attr($class); ?> form-row-responsive">
1315 1315
 				<label for="give-create-account-<?php echo $form_id; ?>">
1316 1316
 					<?php
1317 1317
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1318
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1319
-					$id                = 'give-create-account-' . $form_id;
1320
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1318
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1319
+					$id                = 'give-create-account-'.$form_id;
1320
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1321 1321
 						echo Give()->tooltips->render(
1322 1322
 							array(
1323 1323
 								'tag_content' => sprintf(
1324 1324
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1325 1325
 									$id
1326 1326
 								),
1327
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1327
+								'label'       => __('Registration is required to donate.', 'give'),
1328 1328
 							)
1329 1329
 						);
1330 1330
 					} else {
@@ -1334,22 +1334,22 @@  discard block
 block discarded – undo
1334 1334
 						<?php
1335 1335
 					}
1336 1336
 
1337
-					_e( 'Create an account', 'give' );
1338
-					echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) );
1337
+					_e('Create an account', 'give');
1338
+					echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give'));
1339 1339
 					echo str_replace(
1340 1340
 						'/>',
1341
-						'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>',
1342
-						give_get_nonce_field( "give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false )
1341
+						'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>',
1342
+						give_get_nonce_field("give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false)
1343 1343
 					);
1344 1344
 					?>
1345 1345
 				</label>
1346 1346
 			</div>
1347 1347
 
1348
-			<?php if ( 'both' === $show_register_form ) { ?>
1348
+			<?php if ('both' === $show_register_form) { ?>
1349 1349
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1350
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1351
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1352
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1350
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1351
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1352
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1353 1353
 					</p>
1354 1354
 					<p class="give-loading-text">
1355 1355
 						<span class="give-loading-animation"></span>
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
 			 *
1366 1366
 			 * @param int $form_id The form ID.
1367 1367
 			 */
1368
-			do_action( 'give_register_account_fields_after', $form_id );
1368
+			do_action('give_register_account_fields_after', $form_id);
1369 1369
 			?>
1370 1370
 		</fieldset>
1371 1371
 
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		 *
1378 1378
 		 * @param int $form_id The form ID.
1379 1379
 		 */
1380
-		do_action( 'give_register_fields_after', $form_id );
1380
+		do_action('give_register_fields_after', $form_id);
1381 1381
 		?>
1382 1382
 
1383 1383
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 		 *
1389 1389
 		 * @since 1.7
1390 1390
 		 */
1391
-		do_action( 'give_donation_form_user_info', $form_id );
1391
+		do_action('give_donation_form_user_info', $form_id);
1392 1392
 		?>
1393 1393
 
1394 1394
 	</fieldset>
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 	echo ob_get_clean();
1397 1397
 }
1398 1398
 
1399
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1399
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1400 1400
 
1401 1401
 /**
1402 1402
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1409,32 +1409,32 @@  discard block
 block discarded – undo
1409 1409
  *
1410 1410
  * @return string
1411 1411
  */
1412
-function give_get_login_fields( $form_id ) {
1412
+function give_get_login_fields($form_id) {
1413 1413
 
1414
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1415
-	$show_register_form = give_show_login_register_option( $form_id );
1414
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1415
+	$show_register_form = give_show_login_register_option($form_id);
1416 1416
 
1417 1417
 	ob_start();
1418 1418
 	?>
1419 1419
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1420 1420
 		<legend>
1421 1421
 			<?php
1422
-			echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1423
-			if ( ! give_logged_in_only( $form_id ) ) {
1424
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1422
+			echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1423
+			if ( ! give_logged_in_only($form_id)) {
1424
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1425 1425
 			}
1426 1426
 			?>
1427 1427
 		</legend>
1428
-		<?php if ( $show_register_form == 'both' ) { ?>
1428
+		<?php if ($show_register_form == 'both') { ?>
1429 1429
 			<p class="give-new-account-link">
1430
-				<?php _e( 'Don\'t have an account?', 'give' ); ?>&nbsp;
1431
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1430
+				<?php _e('Don\'t have an account?', 'give'); ?>&nbsp;
1431
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1432 1432
 				   data-action="give_checkout_register">
1433 1433
 					<?php
1434
-					if ( give_logged_in_only( $form_id ) ) {
1435
-						_e( 'Register as a part of your donation &raquo;', 'give' );
1434
+					if (give_logged_in_only($form_id)) {
1435
+						_e('Register as a part of your donation &raquo;', 'give');
1436 1436
 					} else {
1437
-						_e( 'Register or donate as a guest &raquo;', 'give' );
1437
+						_e('Register or donate as a guest &raquo;', 'give');
1438 1438
 					}
1439 1439
 					?>
1440 1440
 				</a>
@@ -1451,41 +1451,41 @@  discard block
 block discarded – undo
1451 1451
 		 *
1452 1452
 		 * @param int $form_id The form ID.
1453 1453
 		 */
1454
-		do_action( 'give_donation_form_login_fields_before', $form_id );
1454
+		do_action('give_donation_form_login_fields_before', $form_id);
1455 1455
 		?>
1456 1456
 		<div class="give-user-login-fields-container">
1457 1457
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1458 1458
 				<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1459
-					<?php _e( 'Username', 'give' ); ?>
1460
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1459
+					<?php _e('Username', 'give'); ?>
1460
+					<?php if (give_logged_in_only($form_id)) { ?>
1461 1461
 						<span class="give-required-indicator">*</span>
1462 1462
 					<?php } ?>
1463 1463
 				</label>
1464 1464
 
1465
-				<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1465
+				<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1466 1466
 				       type="text"
1467 1467
 				       name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1468
-				       placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1468
+				       placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1469 1469
 			</div>
1470 1470
 
1471 1471
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1472 1472
 			     class="give_login_password form-row form-row-last form-row-responsive">
1473 1473
 				<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1474
-					<?php _e( 'Password', 'give' ); ?>
1475
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1474
+					<?php _e('Password', 'give'); ?>
1475
+					<?php if (give_logged_in_only($form_id)) { ?>
1476 1476
 						<span class="give-required-indicator">*</span>
1477 1477
 					<?php } ?>
1478 1478
 				</label>
1479
-				<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1479
+				<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1480 1480
 				       type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1481
-				       placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1481
+				       placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1482 1482
 				<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1483 1483
 			</div>
1484 1484
 
1485 1485
 			<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1486 1486
 				 <span class="give-forgot-password ">
1487 1487
 					 <a href="<?php echo wp_lostpassword_url(); ?>"
1488
-					    target="_blank"><?php _e( 'Reset Password', 'give' ); ?></a>
1488
+					    target="_blank"><?php _e('Reset Password', 'give'); ?></a>
1489 1489
 				 </span>
1490 1490
 			</div>
1491 1491
 		</div>
@@ -1493,11 +1493,11 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1495 1495
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1496
-			       value="<?php _e( 'Login', 'give' ); ?>"/>
1497
-			<?php if ( $show_register_form !== 'login' ) { ?>
1496
+			       value="<?php _e('Login', 'give'); ?>"/>
1497
+			<?php if ($show_register_form !== 'login') { ?>
1498 1498
 				<input type="button" data-action="give_cancel_login"
1499 1499
 				       class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1500
-				       value="<?php _e( 'Cancel', 'give' ); ?>"/>
1500
+				       value="<?php _e('Cancel', 'give'); ?>"/>
1501 1501
 			<?php } ?>
1502 1502
 			<span class="give-loading-animation"></span>
1503 1503
 		</div>
@@ -1509,14 +1509,14 @@  discard block
 block discarded – undo
1509 1509
 		 *
1510 1510
 		 * @param int $form_id The form ID.
1511 1511
 		 */
1512
-		do_action( 'give_donation_form_login_fields_after', $form_id );
1512
+		do_action('give_donation_form_login_fields_after', $form_id);
1513 1513
 		?>
1514 1514
 	</fieldset><!--end #give-login-fields-->
1515 1515
 	<?php
1516 1516
 	echo ob_get_clean();
1517 1517
 }
1518 1518
 
1519
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1519
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1520 1520
 
1521 1521
 /**
1522 1522
  * Payment Mode Select.
@@ -1532,10 +1532,10 @@  discard block
 block discarded – undo
1532 1532
  *
1533 1533
  * @return void
1534 1534
  */
1535
-function give_payment_mode_select( $form_id, $args ) {
1535
+function give_payment_mode_select($form_id, $args) {
1536 1536
 
1537
-	$gateways  = give_get_enabled_payment_gateways( $form_id );
1538
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
1537
+	$gateways  = give_get_enabled_payment_gateways($form_id);
1538
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
1539 1539
 
1540 1540
 	/**
1541 1541
 	 * Fires while selecting payment gateways, before the fields.
@@ -1544,12 +1544,12 @@  discard block
 block discarded – undo
1544 1544
 	 *
1545 1545
 	 * @param int $form_id The form ID.
1546 1546
 	 */
1547
-	do_action( 'give_payment_mode_top', $form_id );
1547
+	do_action('give_payment_mode_top', $form_id);
1548 1548
 	?>
1549 1549
 
1550 1550
 	<fieldset id="give-payment-mode-select"
1551 1551
 		<?php
1552
-		if ( count( $gateways ) <= 1 ) {
1552
+		if (count($gateways) <= 1) {
1553 1553
 			echo 'style="display: none;"';
1554 1554
 		}
1555 1555
 		?>
@@ -1562,10 +1562,10 @@  discard block
 block discarded – undo
1562 1562
 		 *
1563 1563
 		 * @param int $form_id The form ID.
1564 1564
 		 */
1565
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1565
+		do_action('give_payment_mode_before_gateways_wrap');
1566 1566
 		?>
1567 1567
 		<legend
1568
-			class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1568
+			class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1569 1569
 			<span class="give-loading-text"><span
1570 1570
 					class="give-loading-animation"></span>
1571 1571
 			</span>
@@ -1578,38 +1578,37 @@  discard block
 block discarded – undo
1578 1578
 			 *
1579 1579
 			 * @since 1.7
1580 1580
 			 */
1581
-			do_action( 'give_payment_mode_before_gateways' )
1581
+			do_action('give_payment_mode_before_gateways')
1582 1582
 			?>
1583 1583
 			<ul id="give-gateway-radio-list">
1584 1584
 				<?php
1585 1585
 				/**
1586 1586
 				 * Loop through the active payment gateways.
1587 1587
 				 */
1588
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1588
+				$selected_gateway  = give_get_chosen_gateway($form_id);
1589 1589
 				$give_settings     = give_get_settings();
1590
-				$gateways_label    = array_key_exists( 'gateways_label', $give_settings ) ?
1591
-					$give_settings['gateways_label'] :
1592
-					array();
1590
+				$gateways_label    = array_key_exists('gateways_label', $give_settings) ?
1591
+					$give_settings['gateways_label'] : array();
1593 1592
 
1594
-				foreach ( $gateways as $gateway_id => $gateway ) :
1593
+				foreach ($gateways as $gateway_id => $gateway) :
1595 1594
 					// Determine the default gateway.
1596
-					$checked = checked( $gateway_id, $selected_gateway, false );
1595
+					$checked = checked($gateway_id, $selected_gateway, false);
1597 1596
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : '';
1598 1597
 					?>
1599 1598
 					<li<?php echo $checked_class; ?>>
1600 1599
 						<input type="radio" name="payment-mode" class="give-gateway"
1601
-						       id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1602
-						       value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1600
+						       id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1601
+						       value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1603 1602
 
1604 1603
 						<?php
1605 1604
 						$label = $gateway['checkout_label'];
1606
-						if ( ! empty( $gateways_label[ $gateway_id ] ) ) {
1607
-							$label = $gateways_label[ $gateway_id ];
1605
+						if ( ! empty($gateways_label[$gateway_id])) {
1606
+							$label = $gateways_label[$gateway_id];
1608 1607
 						}
1609 1608
 						?>
1610
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1609
+						<label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1611 1610
 						       class="give-gateway-option"
1612
-						       id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label>
1611
+						       id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label>
1613 1612
 					</li>
1614 1613
 				<?php
1615 1614
 				endforeach;
@@ -1621,7 +1620,7 @@  discard block
 block discarded – undo
1621 1620
 			 *
1622 1621
 			 * @since 1.7
1623 1622
 			 */
1624
-			do_action( 'give_payment_mode_after_gateways' );
1623
+			do_action('give_payment_mode_after_gateways');
1625 1624
 			?>
1626 1625
 		</div>
1627 1626
 		<?php
@@ -1632,7 +1631,7 @@  discard block
 block discarded – undo
1632 1631
 		 *
1633 1632
 		 * @param int $form_id The form ID.
1634 1633
 		 */
1635
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1634
+		do_action('give_payment_mode_after_gateways_wrap');
1636 1635
 		?>
1637 1636
 	</fieldset>
1638 1637
 
@@ -1644,7 +1643,7 @@  discard block
 block discarded – undo
1644 1643
 	 *
1645 1644
 	 * @param int $form_id The form ID.
1646 1645
 	 */
1647
-	do_action( 'give_payment_mode_bottom', $form_id );
1646
+	do_action('give_payment_mode_bottom', $form_id);
1648 1647
 	?>
1649 1648
 
1650 1649
 	<div id="give_purchase_form_wrap">
@@ -1655,7 +1654,7 @@  discard block
 block discarded – undo
1655 1654
 		 *
1656 1655
 		 * @since 1.7
1657 1656
 		 */
1658
-		do_action( 'give_donation_form', $form_id, $args );
1657
+		do_action('give_donation_form', $form_id, $args);
1659 1658
 		?>
1660 1659
 
1661 1660
 	</div>
@@ -1666,10 +1665,10 @@  discard block
 block discarded – undo
1666 1665
 	 *
1667 1666
 	 * @since 1.7
1668 1667
 	 */
1669
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1668
+	do_action('give_donation_form_wrap_bottom', $form_id);
1670 1669
 }
1671 1670
 
1672
-add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 );
1671
+add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2);
1673 1672
 
1674 1673
 /**
1675 1674
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1682,31 +1681,31 @@  discard block
 block discarded – undo
1682 1681
  *
1683 1682
  * @return bool
1684 1683
  */
1685
-function give_terms_agreement( $form_id ) {
1686
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1684
+function give_terms_agreement($form_id) {
1685
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1687 1686
 
1688 1687
 	// Bailout if per form and global term and conditions is not setup.
1689 1688
 	if (
1690
-		give_is_setting_enabled( $form_option, 'global' )
1691
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1689
+		give_is_setting_enabled($form_option, 'global')
1690
+		&& give_is_setting_enabled(give_get_option('terms'))
1692 1691
 	) {
1693
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1694
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1695
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1692
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1693
+		$terms         = $terms = give_get_option('agreement_text', '');
1694
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1696 1695
 
1697
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1698
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1699
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1700
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1696
+	} elseif (give_is_setting_enabled($form_option)) {
1697
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1698
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1699
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1701 1700
 
1702 1701
 	} else {
1703 1702
 		return false;
1704 1703
 	}
1705 1704
 
1706 1705
 	// Bailout: Check if term and conditions text is empty or not.
1707
-	if ( empty( $terms ) ) {
1708
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1709
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1706
+	if (empty($terms)) {
1707
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1708
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1710 1709
 		}
1711 1710
 
1712 1711
 		return false;
@@ -1717,11 +1716,11 @@  discard block
 block discarded – undo
1717 1716
 	 *
1718 1717
 	 * @since  2.1.5
1719 1718
 	 */
1720
-	$terms = apply_filters( 'give_the_term_content', wpautop( do_shortcode( $terms ) ), $terms, $form_id );
1719
+	$terms = apply_filters('give_the_term_content', wpautop(do_shortcode($terms)), $terms, $form_id);
1721 1720
 
1722 1721
 	?>
1723 1722
 	<fieldset id="give_terms_agreement">
1724
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1723
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1725 1724
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1726 1725
 			<?php
1727 1726
 			/**
@@ -1729,7 +1728,7 @@  discard block
 block discarded – undo
1729 1728
 			 *
1730 1729
 			 * @since 1.0
1731 1730
 			 */
1732
-			do_action( 'give_before_terms' );
1731
+			do_action('give_before_terms');
1733 1732
 
1734 1733
 			echo $terms;
1735 1734
 			/**
@@ -1737,14 +1736,14 @@  discard block
 block discarded – undo
1737 1736
 			 *
1738 1737
 			 * @since 1.0
1739 1738
 			 */
1740
-			do_action( 'give_after_terms' );
1739
+			do_action('give_after_terms');
1741 1740
 			?>
1742 1741
 		</div>
1743 1742
 		<div id="give_show_terms">
1744 1743
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1745
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1744
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1746 1745
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1747
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1746
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1748 1747
 		</div>
1749 1748
 
1750 1749
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1755,7 +1754,7 @@  discard block
 block discarded – undo
1755 1754
 	<?php
1756 1755
 }
1757 1756
 
1758
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1757
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1759 1758
 
1760 1759
 /**
1761 1760
  * Checkout Final Total.
@@ -1768,14 +1767,13 @@  discard block
 block discarded – undo
1768 1767
  *
1769 1768
  * @return void
1770 1769
  */
1771
-function give_checkout_final_total( $form_id ) {
1770
+function give_checkout_final_total($form_id) {
1772 1771
 
1773
-	$total = isset( $_POST['give_total'] ) ?
1774
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1775
-		give_get_default_form_amount( $form_id );
1772
+	$total = isset($_POST['give_total']) ?
1773
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1776 1774
 
1777 1775
 	// Only proceed if give_total available.
1778
-	if ( empty( $total ) ) {
1776
+	if (empty($total)) {
1779 1777
 		return;
1780 1778
 	}
1781 1779
 	?>
@@ -1786,21 +1784,21 @@  discard block
 block discarded – undo
1786 1784
 		 *
1787 1785
 		 * @since 2.0.5
1788 1786
 		 */
1789
-		do_action( 'give_donation_final_total_label_before', $form_id );
1787
+		do_action('give_donation_final_total_label_before', $form_id);
1790 1788
 		?>
1791 1789
 		<span class="give-donation-total-label">
1792
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1790
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1793 1791
 		</span>
1794 1792
 		<span class="give-final-total-amount"
1795
-		      data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1793
+		      data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1796 1794
 			<?php
1797 1795
 			echo give_currency_filter(
1798 1796
 				give_format_amount(
1799 1797
 					$total, array(
1800 1798
 						'sanitize' => false,
1801
-						'currency' => give_get_currency( $form_id ),
1799
+						'currency' => give_get_currency($form_id),
1802 1800
 					)
1803
-				), array( 'currency_code' => give_get_currency( $form_id ) )
1801
+				), array('currency_code' => give_get_currency($form_id))
1804 1802
 			);
1805 1803
 			?>
1806 1804
 		</span>
@@ -1810,13 +1808,13 @@  discard block
 block discarded – undo
1810 1808
 		 *
1811 1809
 		 * @since 2.0.5
1812 1810
 		 */
1813
-		do_action( 'give_donation_final_total_label_after', $form_id );
1811
+		do_action('give_donation_final_total_label_after', $form_id);
1814 1812
 		?>
1815 1813
 	</p>
1816 1814
 	<?php
1817 1815
 }
1818 1816
 
1819
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1817
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1820 1818
 
1821 1819
 /**
1822 1820
  * Renders the Checkout Submit section.
@@ -1828,7 +1826,7 @@  discard block
 block discarded – undo
1828 1826
  *
1829 1827
  * @return void
1830 1828
  */
1831
-function give_checkout_submit( $form_id, $args ) {
1829
+function give_checkout_submit($form_id, $args) {
1832 1830
 	?>
1833 1831
 	<fieldset id="give_purchase_submit" class="give-donation-submit">
1834 1832
 		<?php
@@ -1837,24 +1835,24 @@  discard block
 block discarded – undo
1837 1835
 		 *
1838 1836
 		 * @since 1.7
1839 1837
 		 */
1840
-		do_action( 'give_donation_form_before_submit', $form_id, $args );
1838
+		do_action('give_donation_form_before_submit', $form_id, $args);
1841 1839
 
1842
-		give_checkout_hidden_fields( $form_id );
1840
+		give_checkout_hidden_fields($form_id);
1843 1841
 
1844
-		echo give_get_donation_form_submit_button( $form_id );
1842
+		echo give_get_donation_form_submit_button($form_id);
1845 1843
 
1846 1844
 		/**
1847 1845
 		 * Fire after donation form submit.
1848 1846
 		 *
1849 1847
 		 * @since 1.7
1850 1848
 		 */
1851
-		do_action( 'give_donation_form_after_submit', $form_id, $args );
1849
+		do_action('give_donation_form_after_submit', $form_id, $args);
1852 1850
 		?>
1853 1851
 	</fieldset>
1854 1852
 	<?php
1855 1853
 }
1856 1854
 
1857
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 );
1855
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2);
1858 1856
 
1859 1857
 /**
1860 1858
  * Give Donation form submit button.
@@ -1865,10 +1863,10 @@  discard block
 block discarded – undo
1865 1863
  *
1866 1864
  * @return string
1867 1865
  */
1868
-function give_get_donation_form_submit_button( $form_id ) {
1866
+function give_get_donation_form_submit_button($form_id) {
1869 1867
 
1870
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1871
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1868
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1869
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1872 1870
 	ob_start();
1873 1871
 	?>
1874 1872
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1877,7 +1875,7 @@  discard block
 block discarded – undo
1877 1875
 		<span class="give-loading-animation"></span>
1878 1876
 	</div>
1879 1877
 	<?php
1880
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1878
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1881 1879
 }
1882 1880
 
1883 1881
 /**
@@ -1892,7 +1890,7 @@  discard block
 block discarded – undo
1892 1890
  *
1893 1891
  * @return mixed
1894 1892
  */
1895
-function give_show_goal_progress( $form_id, $args = array() ) {
1893
+function give_show_goal_progress($form_id, $args = array()) {
1896 1894
 
1897 1895
 	ob_start();
1898 1896
 	give_get_template(
@@ -1907,12 +1905,12 @@  discard block
 block discarded – undo
1907 1905
 	 *
1908 1906
 	 * @since 2.0
1909 1907
 	 */
1910
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1908
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1911 1909
 
1912 1910
 	return true;
1913 1911
 }
1914 1912
 
1915
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1913
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1916 1914
 
1917 1915
 /**
1918 1916
  * Show Give Totals Progress.
@@ -1924,10 +1922,10 @@  discard block
 block discarded – undo
1924 1922
  *
1925 1923
  * @return mixed
1926 1924
  */
1927
-function give_show_goal_totals_progress( $total, $total_goal ) {
1925
+function give_show_goal_totals_progress($total, $total_goal) {
1928 1926
 
1929 1927
 	// Bail out if total goal is set as an array.
1930
-	if ( isset( $total_goal ) && is_array( $total_goal ) ) {
1928
+	if (isset($total_goal) && is_array($total_goal)) {
1931 1929
 		return false;
1932 1930
 	}
1933 1931
 
@@ -1939,12 +1937,12 @@  discard block
 block discarded – undo
1939 1937
 		)
1940 1938
 	);
1941 1939
 
1942
-	echo apply_filters( 'give_total_progress_output', ob_get_clean() );
1940
+	echo apply_filters('give_total_progress_output', ob_get_clean());
1943 1941
 
1944 1942
 	return true;
1945 1943
 }
1946 1944
 
1947
-add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 );
1945
+add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2);
1948 1946
 
1949 1947
 /**
1950 1948
  * Get form content position.
@@ -1956,10 +1954,10 @@  discard block
 block discarded – undo
1956 1954
  *
1957 1955
  * @return mixed|string
1958 1956
  */
1959
-function give_get_form_content_placement( $form_id, $args ) {
1957
+function give_get_form_content_placement($form_id, $args) {
1960 1958
 	$show_content = '';
1961 1959
 
1962
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1960
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1963 1961
 		// Content positions.
1964 1962
 		$content_placement = array(
1965 1963
 			'above' => 'give_pre_form',
@@ -1967,18 +1965,18 @@  discard block
 block discarded – undo
1967 1965
 		);
1968 1966
 
1969 1967
 		// Check if content position already decoded.
1970
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1968
+		if (in_array($args['show_content'], $content_placement)) {
1971 1969
 			return $args['show_content'];
1972 1970
 		}
1973 1971
 
1974
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1972
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1975 1973
 
1976
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1977
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1974
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1975
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1978 1976
 
1979
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1977
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1980 1978
 		// Backward compatibility for _give_content_option for v18.
1981
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1979
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1982 1980
 	}
1983 1981
 
1984 1982
 	return $show_content;
@@ -1994,20 +1992,20 @@  discard block
 block discarded – undo
1994 1992
  *
1995 1993
  * @return void|bool
1996 1994
  */
1997
-function give_form_content( $form_id, $args ) {
1995
+function give_form_content($form_id, $args) {
1998 1996
 
1999
-	$show_content = give_get_form_content_placement( $form_id, $args );
1997
+	$show_content = give_get_form_content_placement($form_id, $args);
2000 1998
 
2001 1999
 	// Bailout.
2002
-	if ( empty( $show_content ) ) {
2000
+	if (empty($show_content)) {
2003 2001
 		return false;
2004 2002
 	}
2005 2003
 
2006 2004
 	// Add action according to value.
2007
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
2005
+	add_action($show_content, 'give_form_display_content', 10, 2);
2008 2006
 }
2009 2007
 
2010
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
2008
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
2011 2009
 
2012 2010
 /**
2013 2011
  * Renders Post Form Content.
@@ -2021,14 +2019,14 @@  discard block
 block discarded – undo
2021 2019
  *
2022 2020
  * @return void
2023 2021
  */
2024
-function give_form_display_content( $form_id, $args ) {
2025
-	$content      = give_get_meta( $form_id, '_give_form_content', true );
2026
-	$show_content = give_get_form_content_placement( $form_id, $args );
2022
+function give_form_display_content($form_id, $args) {
2023
+	$content      = give_get_meta($form_id, '_give_form_content', true);
2024
+	$show_content = give_get_form_content_placement($form_id, $args);
2027 2025
 
2028
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
2029
-		$content = apply_filters( 'the_content', $content );
2026
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
2027
+		$content = apply_filters('the_content', $content);
2030 2028
 	} else {
2031
-		$content = wpautop( do_shortcode( $content ) );
2029
+		$content = wpautop(do_shortcode($content));
2032 2030
 	}
2033 2031
 
2034 2032
 	$output = sprintf(
@@ -2047,11 +2045,11 @@  discard block
 block discarded – undo
2047 2045
 	 * @param int    $form_id
2048 2046
 	 * @param array  $args
2049 2047
 	 */
2050
-	echo apply_filters( 'give_form_content_output', $output, $form_id, $args );
2048
+	echo apply_filters('give_form_content_output', $output, $form_id, $args);
2051 2049
 
2052 2050
 	// remove action to prevent content output on addition forms on page.
2053 2051
 	// @see: https://github.com/WordImpress/Give/issues/634.
2054
-	remove_action( $show_content, 'give_form_display_content' );
2052
+	remove_action($show_content, 'give_form_display_content');
2055 2053
 }
2056 2054
 
2057 2055
 /**
@@ -2063,7 +2061,7 @@  discard block
 block discarded – undo
2063 2061
  *
2064 2062
  * @return void
2065 2063
  */
2066
-function give_checkout_hidden_fields( $form_id ) {
2064
+function give_checkout_hidden_fields($form_id) {
2067 2065
 
2068 2066
 	/**
2069 2067
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -2072,14 +2070,14 @@  discard block
 block discarded – undo
2072 2070
 	 *
2073 2071
 	 * @param int $form_id The form ID.
2074 2072
 	 */
2075
-	do_action( 'give_hidden_fields_before', $form_id );
2073
+	do_action('give_hidden_fields_before', $form_id);
2076 2074
 
2077
-	if ( is_user_logged_in() ) {
2075
+	if (is_user_logged_in()) {
2078 2076
 		?>
2079 2077
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
2080 2078
 	<?php } ?>
2081 2079
 	<input type="hidden" name="give_action" value="purchase"/>
2082
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
2080
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
2083 2081
 	<?php
2084 2082
 	/**
2085 2083
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -2088,7 +2086,7 @@  discard block
 block discarded – undo
2088 2086
 	 *
2089 2087
 	 * @param int $form_id The form ID.
2090 2088
 	 */
2091
-	do_action( 'give_hidden_fields_after', $form_id );
2089
+	do_action('give_hidden_fields_after', $form_id);
2092 2090
 
2093 2091
 }
2094 2092
 
@@ -2103,20 +2101,20 @@  discard block
 block discarded – undo
2103 2101
  *
2104 2102
  * @return string $content Filtered content.
2105 2103
  */
2106
-function give_filter_success_page_content( $content ) {
2104
+function give_filter_success_page_content($content) {
2107 2105
 
2108 2106
 	$give_options = give_get_settings();
2109 2107
 
2110
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
2111
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
2112
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
2108
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
2109
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
2110
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
2113 2111
 		}
2114 2112
 	}
2115 2113
 
2116 2114
 	return $content;
2117 2115
 }
2118 2116
 
2119
-add_filter( 'the_content', 'give_filter_success_page_content' );
2117
+add_filter('the_content', 'give_filter_success_page_content');
2120 2118
 
2121 2119
 /**
2122 2120
  * Test Mode Frontend Warning.
@@ -2127,12 +2125,12 @@  discard block
 block discarded – undo
2127 2125
  */
2128 2126
 function give_test_mode_frontend_warning() {
2129 2127
 
2130
-	if ( give_is_test_mode() ) {
2131
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
2128
+	if (give_is_test_mode()) {
2129
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
2132 2130
 	}
2133 2131
 }
2134 2132
 
2135
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
2133
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
2136 2134
 
2137 2135
 /**
2138 2136
  * Members-only Form.
@@ -2146,21 +2144,21 @@  discard block
 block discarded – undo
2146 2144
  *
2147 2145
  * @return string
2148 2146
  */
2149
-function give_members_only_form( $final_output, $args ) {
2147
+function give_members_only_form($final_output, $args) {
2150 2148
 
2151
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
2149
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
2152 2150
 
2153 2151
 	// Sanity Check: Must have form_id & not be logged in.
2154
-	if ( empty( $form_id ) || is_user_logged_in() ) {
2152
+	if (empty($form_id) || is_user_logged_in()) {
2155 2153
 		return $final_output;
2156 2154
 	}
2157 2155
 
2158 2156
 	// Logged in only and Register / Login set to none.
2159
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
2157
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
2160 2158
 
2161
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
2159
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
2162 2160
 
2163
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
2161
+		return apply_filters('give_members_only_output', $final_output, $form_id);
2164 2162
 
2165 2163
 	}
2166 2164
 
@@ -2168,7 +2166,7 @@  discard block
 block discarded – undo
2168 2166
 
2169 2167
 }
2170 2168
 
2171
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
2169
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
2172 2170
 
2173 2171
 
2174 2172
 /**
@@ -2180,40 +2178,40 @@  discard block
 block discarded – undo
2180 2178
  * @param array            $args
2181 2179
  * @param Give_Donate_Form $form
2182 2180
  */
2183
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
2184
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
2181
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
2182
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
2185 2183
 	?>
2186 2184
 	<input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/>
2187
-	<input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/>
2188
-	<input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/>
2189
-	<input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
2190
-	<input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
2185
+	<input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/>
2186
+	<input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/>
2187
+	<input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2188
+	<input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2191 2189
 	<?php
2192 2190
 	// Get the custom option amount.
2193
-	$custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
2191
+	$custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
2194 2192
 
2195 2193
 	// If custom amount enabled.
2196
-	if ( give_is_setting_enabled( $custom_amount ) ) {
2194
+	if (give_is_setting_enabled($custom_amount)) {
2197 2195
 		?>
2198 2196
 		<input type="hidden" name="give-form-minimum"
2199
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/>
2197
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/>
2200 2198
 		<input type="hidden" name="give-form-maximum"
2201
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/>
2199
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/>
2202 2200
 		<?php
2203 2201
 	}
2204 2202
 
2205 2203
 	// WP nonce field.
2206 2204
 	echo str_replace(
2207 2205
 		'/>',
2208
-		'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>',
2209
-		give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false )
2206
+		'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>',
2207
+		give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false)
2210 2208
 	);
2211 2209
 
2212 2210
 	// Price ID hidden field for variable (multi-level) donation forms.
2213
-	if ( give_has_variable_prices( $form_id ) ) {
2211
+	if (give_has_variable_prices($form_id)) {
2214 2212
 		// Get the default price ID.
2215
-		$default_price = give_form_get_default_level( $form_id );
2216
-		$price_id      = isset( $default_price['_give_id']['level_id'] ) ? $default_price['_give_id']['level_id'] : 0;
2213
+		$default_price = give_form_get_default_level($form_id);
2214
+		$price_id      = isset($default_price['_give_id']['level_id']) ? $default_price['_give_id']['level_id'] : 0;
2217 2215
 
2218 2216
 		echo sprintf(
2219 2217
 			'<input type="hidden" name="give-price-id" value="%s"/>',
@@ -2222,7 +2220,7 @@  discard block
 block discarded – undo
2222 2220
 	}
2223 2221
 }
2224 2222
 
2225
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
2223
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
2226 2224
 
2227 2225
 /**
2228 2226
  * Add currency settings on donation form.
@@ -2234,20 +2232,20 @@  discard block
 block discarded – undo
2234 2232
  *
2235 2233
  * @return array
2236 2234
  */
2237
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
2238
-	$form_currency     = give_get_currency( $form->ID );
2239
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
2235
+function __give_form_add_currency_settings($form_html_tags, $form) {
2236
+	$form_currency     = give_get_currency($form->ID);
2237
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
2240 2238
 
2241 2239
 	// Check if currency exist.
2242
-	if ( empty( $currency_settings ) ) {
2240
+	if (empty($currency_settings)) {
2243 2241
 		return $form_html_tags;
2244 2242
 	}
2245 2243
 
2246
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
2244
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
2247 2245
 	$form_html_tags['data-currency_code']   = $form_currency;
2248 2246
 
2249
-	if ( ! empty( $currency_settings ) ) {
2250
-		foreach ( $currency_settings as $key => $value ) {
2247
+	if ( ! empty($currency_settings)) {
2248
+		foreach ($currency_settings as $key => $value) {
2251 2249
 			$form_html_tags["data-{$key}"] = $value;
2252 2250
 		}
2253 2251
 	}
@@ -2255,7 +2253,7 @@  discard block
 block discarded – undo
2255 2253
 	return $form_html_tags;
2256 2254
 }
2257 2255
 
2258
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
2256
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
2259 2257
 
2260 2258
 /**
2261 2259
  * Adds classes to progress bar container.
@@ -2266,7 +2264,7 @@  discard block
 block discarded – undo
2266 2264
  *
2267 2265
  * @return string
2268 2266
  */
2269
-function add_give_goal_progress_class( $class_goal ) {
2267
+function add_give_goal_progress_class($class_goal) {
2270 2268
 	$class_goal = 'progress progress-striped active';
2271 2269
 
2272 2270
 	return $class_goal;
@@ -2281,7 +2279,7 @@  discard block
 block discarded – undo
2281 2279
  *
2282 2280
  * @return string
2283 2281
  */
2284
-function add_give_goal_progress_bar_class( $class_bar ) {
2282
+function add_give_goal_progress_bar_class($class_bar) {
2285 2283
 	$class_bar = 'bar';
2286 2284
 
2287 2285
 	return $class_bar;
@@ -2298,12 +2296,12 @@  discard block
 block discarded – undo
2298 2296
  *
2299 2297
  * @return array
2300 2298
  */
2301
-function add_class_for_form_grid( $class, $id, $args ) {
2299
+function add_class_for_form_grid($class, $id, $args) {
2302 2300
 	$class[] = 'give-form-grid-wrap';
2303 2301
 
2304
-	foreach ( $class as $index => $item ) {
2305
-		if ( false !== strpos( $item, 'give-display-' ) ) {
2306
-			unset( $class[ $index ] );
2302
+	foreach ($class as $index => $item) {
2303
+		if (false !== strpos($item, 'give-display-')) {
2304
+			unset($class[$index]);
2307 2305
 		}
2308 2306
 	}
2309 2307
 
@@ -2319,7 +2317,7 @@  discard block
 block discarded – undo
2319 2317
  *
2320 2318
  * @since 2.1
2321 2319
  */
2322
-function give_is_form_grid_page_hidden_field( $id, $args, $form ) {
2320
+function give_is_form_grid_page_hidden_field($id, $args, $form) {
2323 2321
 	echo '<input type="hidden" name="is-form-grid" value="true" />';
2324 2322
 }
2325 2323
 
@@ -2334,18 +2332,18 @@  discard block
 block discarded – undo
2334 2332
  * @since 2.1
2335 2333
  * @return string
2336 2334
  */
2337
-function give_redirect_and_popup_form( $redirect, $args ) {
2335
+function give_redirect_and_popup_form($redirect, $args) {
2338 2336
 
2339 2337
 	// Check the page has Form Grid.
2340
-	$is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : '';
2338
+	$is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : '';
2341 2339
 
2342
-	if ( 'true' === $is_form_grid ) {
2340
+	if ('true' === $is_form_grid) {
2343 2341
 
2344
-		$payment_mode = give_clean( $_POST['payment-mode'] );
2342
+		$payment_mode = give_clean($_POST['payment-mode']);
2345 2343
 		$form_id      = $args['form-id'];
2346 2344
 
2347 2345
 		// Get the URL without Query parameters.
2348
-		$redirect = strtok( $redirect, '?' );
2346
+		$redirect = strtok($redirect, '?');
2349 2347
 
2350 2348
 		// Add query parameters 'form-id' and 'payment-mode'.
2351 2349
 		$redirect = add_query_arg(
@@ -2360,4 +2358,4 @@  discard block
 block discarded – undo
2360 2358
 	return $redirect;
2361 2359
 }
2362 2360
 
2363
-add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 );
2361
+add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1217,9 +1217,12 @@
 block discarded – undo
1217 1217
 					}
1218 1218
 					?>
1219 1219
 				</select>
1220
-			<?php else : ?>
1220
+			<?php else {
1221
+	: ?>
1221 1222
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1222
-				       placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/>
1223
+				       placeholder="<?php echo $label;
1224
+}
1225
+?>" value="<?php echo $selected_state; ?>"/>
1223 1226
 			<?php endif; ?>
1224 1227
 		</p>
1225 1228
 
Please login to merge, or discard this patch.
includes/import-functions.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
  *
556 556
  * @since 2.1
557 557
  *
558
- * @param $file_dir
559
- * @param $start
560
- * @param $end
561
- * @param $delimiter
558
+ * @param false|string $file_dir
559
+ * @param integer $start
560
+ * @param integer $end
561
+ * @param string $delimiter
562 562
  *
563 563
  * @return array
564 564
  */
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
  *
585 585
  * @since 2.1
586 586
  *
587
- * @param $file_id
587
+ * @param integer $file_id
588 588
  *
589 589
  * @return false|string file content
590 590
  */
Please login to merge, or discard this patch.
Spacing   +344 added lines, -344 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.8.13
21 21
  */
22 22
 function give_import_donation_report() {
23
-	return get_option( 'give_import_donation_report', array() );
23
+	return get_option('give_import_donation_report', array());
24 24
 }
25 25
 
26 26
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 1.8.13
31 31
  */
32
-function give_import_donation_report_update( $value = array() ) {
33
-	update_option( 'give_import_donation_report', $value, false );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value, false);
34 34
 }
35 35
 
36 36
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @since 1.8.13
40 40
  */
41 41
 function give_import_donation_report_reset() {
42
-	update_option( 'give_import_donation_report', array(), false );
42
+	update_option('give_import_donation_report', array(), false);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  *
52 52
  * @return array|bool|Give_Donate_Form|int|null|WP_Post
53 53
  */
54
-function give_import_get_form_data_from_csv( $data, $import_setting = array() ) {
54
+function give_import_get_form_data_from_csv($data, $import_setting = array()) {
55 55
 	$new_form = false;
56
-	$dry_run  = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
56
+	$dry_run  = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
57 57
 
58 58
 	// Get the import report
59 59
 	$report = give_import_donation_report();
@@ -61,25 +61,25 @@  discard block
 block discarded – undo
61 61
 	$form = false;
62 62
 	$meta = array();
63 63
 
64
-	if ( ! empty( $data['form_id'] ) ) {
65
-		$form = new Give_Donate_Form( $data['form_id'] );
64
+	if ( ! empty($data['form_id'])) {
65
+		$form = new Give_Donate_Form($data['form_id']);
66 66
 		// Add support to older php version.
67 67
 		$form_id = $form->get_ID();
68
-		if ( empty( $form_id ) ) {
68
+		if (empty($form_id)) {
69 69
 			$form = false;
70 70
 		} else {
71
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
71
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
72 72
 		}
73 73
 	}
74 74
 
75
-	if ( false === $form && ! empty( $data['form_title'] ) ) {
76
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
75
+	if (false === $form && ! empty($data['form_title'])) {
76
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
77 77
 
78
-		if ( ! empty( $form->ID ) ) {
78
+		if ( ! empty($form->ID)) {
79 79
 
80
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
80
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
81 81
 
82
-			$form = new Give_Donate_Form( $form->ID );
82
+			$form = new Give_Donate_Form($form->ID);
83 83
 		} else {
84 84
 			$form = new Give_Donate_Form();
85 85
 			$args = array(
@@ -87,43 +87,43 @@  discard block
 block discarded – undo
87 87
 				'post_status' => 'publish',
88 88
 			);
89 89
 
90
-			if ( empty( $dry_run ) ) {
91
-				$form = $form->create( $args );
90
+			if (empty($dry_run)) {
91
+				$form = $form->create($args);
92 92
 			}
93 93
 
94
-			$report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 );
94
+			$report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1);
95 95
 			$new_form              = true;
96 96
 
97 97
 		}
98 98
 
99
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
100
-		if ( ! empty( $form->ID ) ) {
101
-			$form = new Give_Donate_Form( $form->ID );
99
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
100
+		if ( ! empty($form->ID)) {
101
+			$form = new Give_Donate_Form($form->ID);
102 102
 		}
103 103
 	}
104 104
 
105
-	if ( ! empty( $form ) && $form->get_ID() && ! empty( $data['form_level'] ) && empty( $dry_run ) ) {
105
+	if ( ! empty($form) && $form->get_ID() && ! empty($data['form_level']) && empty($dry_run)) {
106 106
 
107 107
 		$price_option = 'set';
108
-		$form_level   = strtolower( preg_replace( '/\s+/', '', $data['form_level'] ) );
108
+		$form_level   = strtolower(preg_replace('/\s+/', '', $data['form_level']));
109 109
 
110
-		if ( 'custom' !== $form_level ) {
110
+		if ('custom' !== $form_level) {
111 111
 			$prices     = (array) $form->get_prices();
112 112
 			$price_text = array();
113
-			foreach ( $prices as $key => $price ) {
114
-				if ( isset( $price['_give_id']['level_id'] ) ) {
115
-					$price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? strtolower( preg_replace( '/\s+/', '', $price['_give_text'] ) ) : '' );
113
+			foreach ($prices as $key => $price) {
114
+				if (isset($price['_give_id']['level_id'])) {
115
+					$price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? strtolower(preg_replace('/\s+/', '', $price['_give_text'])) : '');
116 116
 				}
117 117
 			}
118 118
 
119
-			if ( ! in_array( $form_level, $price_text ) ) {
119
+			if ( ! in_array($form_level, $price_text)) {
120 120
 
121 121
 				// For generating unquiet level id.
122 122
 				$count     = 1;
123
-				$new_level = count( $prices ) + $count;
124
-				while ( array_key_exists( $new_level, $price_text ) ) {
125
-					$count ++;
126
-					$new_level = count( $prices ) + $count;
123
+				$new_level = count($prices) + $count;
124
+				while (array_key_exists($new_level, $price_text)) {
125
+					$count++;
126
+					$new_level = count($prices) + $count;
127 127
 				}
128 128
 
129 129
 				$multi_level_donations = array(
@@ -131,42 +131,42 @@  discard block
 block discarded – undo
131 131
 						'_give_id'     => array(
132 132
 							'level_id' => $new_level,
133 133
 						),
134
-						'_give_amount' => give_sanitize_amount_for_db( $data['amount'] ),
134
+						'_give_amount' => give_sanitize_amount_for_db($data['amount']),
135 135
 						'_give_text'   => $data['form_level'],
136 136
 					),
137 137
 				);
138 138
 
139
-				$price_text[ $new_level ] = strtolower( preg_replace( '/\s+/', '', $data['form_level'] ) );
139
+				$price_text[$new_level] = strtolower(preg_replace('/\s+/', '', $data['form_level']));
140 140
 
141
-				if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) {
142
-					$prices = wp_parse_args( $multi_level_donations, $prices );
141
+				if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) {
142
+					$prices = wp_parse_args($multi_level_donations, $prices);
143 143
 
144 144
 					// Sort $prices by amount in ascending order.
145
-					$prices = wp_list_sort( $prices, '_give_amount', 'ASC' );
145
+					$prices = wp_list_sort($prices, '_give_amount', 'ASC');
146 146
 				} else {
147 147
 					$prices = $multi_level_donations;
148 148
 				}
149 149
 
150 150
 				// Unset _give_default key from $prices.
151
-				foreach ( $prices as $key => $price ) {
152
-					if ( isset( $prices[ $key ]['_give_default'] ) ) {
153
-						unset( $prices[ $key ]['_give_default'] );
151
+				foreach ($prices as $key => $price) {
152
+					if (isset($prices[$key]['_give_default'])) {
153
+						unset($prices[$key]['_give_default']);
154 154
 					}
155 155
 				}
156 156
 
157 157
 				// Set the first $price of the $prices as default.
158 158
 				$prices[0]['_give_default'] = 'default';
159 159
 			}
160
-			$form->price_id = array_search( $form_level, $price_text );
160
+			$form->price_id = array_search($form_level, $price_text);
161 161
 
162
-			$donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' );
163
-			$min_amount              = min( $donation_levels_amounts );
164
-			$max_amount              = max( $donation_levels_amounts );
162
+			$donation_levels_amounts = wp_list_pluck($prices, '_give_amount');
163
+			$min_amount              = min($donation_levels_amounts);
164
+			$max_amount              = max($donation_levels_amounts);
165 165
 
166 166
 			$meta = array(
167 167
 				'_give_levels_minimum_amount' => $min_amount,
168 168
 				'_give_levels_maximum_amount' => $max_amount,
169
-				'_give_donation_levels'       => array_values( $prices ),
169
+				'_give_donation_levels'       => array_values($prices),
170 170
 			);
171 171
 
172 172
 			$price_option = 'multi';
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 		}
176 176
 
177 177
 		$defaults = array(
178
-			'_give_set_price' => give_sanitize_amount_for_db( $data['amount'] ),
178
+			'_give_set_price' => give_sanitize_amount_for_db($data['amount']),
179 179
 		);
180 180
 
181 181
 		// If new form is created.
182
-		if ( ! empty( $new_form ) ) {
182
+		if ( ! empty($new_form)) {
183 183
 			$new_form = array(
184
-				'_give_custom_amount_text'          => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'custom' ),
184
+				'_give_custom_amount_text'          => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'custom'),
185 185
 				'_give_logged_in_only'              => 'enabled',
186 186
 				'_give_custom_amount'               => 'enabled',
187 187
 				'_give_payment_import'              => true,
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 				'_give_show_register_form'          => 'both',
195 195
 				'_give_price_option'                => $price_option,
196 196
 			);
197
-			$defaults = wp_parse_args( $defaults, $new_form );
197
+			$defaults = wp_parse_args($defaults, $new_form);
198 198
 		}
199 199
 
200
-		$meta = wp_parse_args( $meta, $defaults );
200
+		$meta = wp_parse_args($meta, $defaults);
201 201
 
202
-		foreach ( $meta as $key => $value ) {
203
-			give_update_meta( $form->get_ID(), $key, $value );
202
+		foreach ($meta as $key => $value) {
203
+			give_update_meta($form->get_ID(), $key, $value);
204 204
 		}
205 205
 	}
206 206
 
207 207
 	// update the report
208
-	give_import_donation_report_update( $report );
208
+	give_import_donation_report_update($report);
209 209
 
210 210
 	return $form;
211 211
 }
@@ -219,36 +219,36 @@  discard block
 block discarded – undo
219 219
  *
220 220
  * @return bool|false|WP_User
221 221
  */
222
-function give_import_get_user_from_csv( $data, $import_setting = array() ) {
222
+function give_import_get_user_from_csv($data, $import_setting = array()) {
223 223
 	$report               = give_import_donation_report();
224
-	$dry_run              = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
224
+	$dry_run              = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
225 225
 	$dry_run_donor_create = false;
226 226
 	$donor_data           = array();
227 227
 	$donor_id             = false;
228 228
 
229 229
 	// check if donor id is not empty
230
-	if ( ! empty( $data['donor_id'] ) ) {
231
-		$donor_data = new Give_Donor( (int) $data['donor_id'] );
232
-		if ( ! empty( $donor_data->id ) ) {
233
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
230
+	if ( ! empty($data['donor_id'])) {
231
+		$donor_data = new Give_Donor((int) $data['donor_id']);
232
+		if ( ! empty($donor_data->id)) {
233
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
234 234
 		}
235 235
 	}
236 236
 
237
-	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
237
+	if (empty($donor_data->id) && ! empty($data['user_id'])) {
238 238
 		$user_id    = (int) $data['user_id'];
239
-		$donor_data = new Give_Donor( $user_id, true );
239
+		$donor_data = new Give_Donor($user_id, true);
240 240
 
241 241
 
242
-		if ( empty( $donor_data->id ) ) {
243
-			$donor_data = get_user_by( 'id', $user_id );
242
+		if (empty($donor_data->id)) {
243
+			$donor_data = get_user_by('id', $user_id);
244 244
 
245 245
 			// if no wp user is found then no donor is create with that user id
246
-			if ( ! empty( $donor_data->ID ) ) {
246
+			if ( ! empty($donor_data->ID)) {
247 247
 
248
-				if ( empty( $dry_run ) ) {
249
-					$first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename );
250
-					$last_name  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) );
251
-					$name       = $first_name . ' ' . $last_name;
248
+				if (empty($dry_run)) {
249
+					$first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename);
250
+					$last_name  = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : ''));
251
+					$name       = $first_name.' '.$last_name;
252 252
 					$user_email = $donor_data->user_email;
253 253
 					$donor_args = array(
254 254
 						'name'    => $name,
@@ -257,51 +257,51 @@  discard block
 block discarded – undo
257 257
 					);
258 258
 
259 259
 					$donor_data = new Give_Donor();
260
-					$donor_data->create( $donor_args );
260
+					$donor_data->create($donor_args);
261 261
 
262 262
 					// Adding notes that donor is being imported from CSV.
263 263
 					$current_user = wp_get_current_user();
264
-					$donor_data->add_note( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) );
264
+					$donor_data->add_note(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email));
265 265
 
266 266
 					// Add is used to ensure duplicate emails are not added
267
-					if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) {
268
-						$donor_data->add_meta( 'additional_email', $data['email'] );
267
+					if ($user_email != $data['email'] && ! empty($data['email'])) {
268
+						$donor_data->add_meta('additional_email', $data['email']);
269 269
 					}
270 270
 				} else {
271 271
 					$dry_run_donor_create = true;
272
-					$donor_data           = array( 'id' => 1 );
272
+					$donor_data           = array('id' => 1);
273 273
 				}
274 274
 
275
-				$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
276
-			} elseif ( $dry_run ) {
275
+				$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
276
+			} elseif ($dry_run) {
277 277
 				$donor_data = array();
278 278
 			}
279 279
 		} else {
280 280
 			// Add is used to ensure duplicate emails are not added
281
-			if ( $donor_data->email != $data['email'] && empty( $dry_run ) ) {
282
-				$donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) );
281
+			if ($donor_data->email != $data['email'] && empty($dry_run)) {
282
+				$donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email));
283 283
 			}
284
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
284
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
285 285
 		}
286 286
 	}
287 287
 
288
-	if ( empty( $donor_data->id ) && ! empty( $data['email'] ) && empty( $dry_run_donor_create ) ) {
288
+	if (empty($donor_data->id) && ! empty($data['email']) && empty($dry_run_donor_create)) {
289 289
 
290
-		$donor_data = new Give_Donor( $data['email'] );
291
-		if ( empty( $donor_data->id ) ) {
292
-			$donor_data = get_user_by( 'email', $data['email'] );
290
+		$donor_data = new Give_Donor($data['email']);
291
+		if (empty($donor_data->id)) {
292
+			$donor_data = get_user_by('email', $data['email']);
293 293
 
294
-			if ( empty( $donor_data->ID ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) {
295
-				$data['first_name'] = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $data['email'] );
296
-				$data['last_name']  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : '' );
297
-				$give_role          = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) );
294
+			if (empty($donor_data->ID) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) {
295
+				$data['first_name'] = ( ! empty($data['first_name']) ? $data['first_name'] : $data['email']);
296
+				$data['last_name']  = ( ! empty($data['last_name']) ? $data['last_name'] : '');
297
+				$give_role          = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber')));
298 298
 				$donor_args         = array(
299 299
 					'user_login'      => $data['email'],
300 300
 					'user_email'      => $data['email'],
301
-					'user_registered' => date( 'Y-m-d H:i:s' ),
301
+					'user_registered' => date('Y-m-d H:i:s'),
302 302
 					'user_first'      => $data['first_name'],
303 303
 					'user_last'       => $data['last_name'],
304
-					'user_pass'       => wp_generate_password( 8, true ),
304
+					'user_pass'       => wp_generate_password(8, true),
305 305
 					'role'            => $give_role,
306 306
 				);
307 307
 
@@ -310,64 +310,64 @@  discard block
 block discarded – undo
310 310
 				 *
311 311
 				 * @since 1.8.13
312 312
 				 */
313
-				$donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting );
313
+				$donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting);
314 314
 
315
-				if ( empty( $dry_run ) ) {
315
+				if (empty($dry_run)) {
316 316
 
317 317
 					// This action was added to remove the login when using the give register function.
318
-					add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
319
-					$donor_id = give_register_and_login_new_user( $donor_args );
320
-					remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
318
+					add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
319
+					$donor_id = give_register_and_login_new_user($donor_args);
320
+					remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
321 321
 
322
-					$donor_data = new Give_Donor( $donor_id, true );
323
-					$donor_data->update_meta( '_give_payment_import', true );
322
+					$donor_data = new Give_Donor($donor_id, true);
323
+					$donor_data->update_meta('_give_payment_import', true);
324 324
 
325 325
 				} else {
326 326
 					$dry_run_donor_create   = true;
327
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
327
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
328 328
 				}
329 329
 			} else {
330
-				$donor_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
330
+				$donor_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false);
331 331
 			}
332 332
 
333
-			if ( empty( $dry_run_donor_create ) && ( ! empty( $donor_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) ) {
334
-				$donor_data = new Give_Donor( $donor_id, true );
333
+			if (empty($dry_run_donor_create) && ( ! empty($donor_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user'])))) {
334
+				$donor_data = new Give_Donor($donor_id, true);
335 335
 
336
-				if ( empty( $donor_data->id ) ) {
336
+				if (empty($donor_data->id)) {
337 337
 
338
-					if ( ! empty( $data['form_id'] ) ) {
339
-						$form = new Give_Donate_Form( $data['form_id'] );
338
+					if ( ! empty($data['form_id'])) {
339
+						$form = new Give_Donate_Form($data['form_id']);
340 340
 					}
341 341
 
342
-					if ( empty( $dry_run ) ) {
343
-						$payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : __( 'New Form', 'give' ) ) );
342
+					if (empty($dry_run)) {
343
+						$payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : __('New Form', 'give')));
344 344
 						$donor_args    = array(
345
-							'name'  => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '',
345
+							'name'  => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '',
346 346
 							'email' => $data['email'],
347 347
 						);
348
-						if ( ! empty( $donor_id ) ) {
348
+						if ( ! empty($donor_id)) {
349 349
 							$donor_args['user_id'] = $donor_id;
350 350
 						}
351
-						$donor_data->create( $donor_args );
351
+						$donor_data->create($donor_args);
352 352
 
353 353
 						// Adding notes that donor is being imported from CSV.
354 354
 						$current_user = wp_get_current_user();
355
-						$donor_data->add_note( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) );
355
+						$donor_data->add_note(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email));
356 356
 					} else {
357 357
 						$dry_run_donor_create = true;
358 358
 					}
359
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
359
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
360 360
 				} else {
361
-					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
361
+					$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
362 362
 				}
363 363
 			}
364 364
 		} else {
365
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
365
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
366 366
 		}
367 367
 	}
368 368
 
369 369
 	// update the report
370
-	give_import_donation_report_update( $report );
370
+	give_import_donation_report_update($report);
371 371
 
372 372
 	return $donor_data;
373 373
 }
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @return array
387 387
 	 */
388
-	return (array) apply_filters( 'give_import_default_options', array(
389
-		'' => __( 'Do not import', 'give' ),
390
-	) );
388
+	return (array) apply_filters('give_import_default_options', array(
389
+		'' => __('Do not import', 'give'),
390
+	));
391 391
 }
392 392
 
393 393
 /**
@@ -403,93 +403,93 @@  discard block
 block discarded – undo
403 403
 	 *
404 404
 	 * @return array
405 405
 	 */
406
-	return (array) apply_filters( 'give_import_donations_options', array(
407
-		'id'           => __( 'Donation ID', 'give' ),
406
+	return (array) apply_filters('give_import_donations_options', array(
407
+		'id'           => __('Donation ID', 'give'),
408 408
 		'amount'       => array(
409
-			__( 'Donation Amount', 'give' ),
410
-			__( 'Amount', 'give' ),
411
-			__( 'Donation Total', 'give' ),
412
-			__( 'Total', 'give' ),
409
+			__('Donation Amount', 'give'),
410
+			__('Amount', 'give'),
411
+			__('Donation Total', 'give'),
412
+			__('Total', 'give'),
413 413
 		),
414 414
 		'currency'     => array(
415
-			__( 'Donation Currencies', 'give' ),
416
-			__( 'Currencies', 'give' ),
417
-			__( 'Currencies Code', 'give' ),
418
-			__( 'Currency Code', 'give' ),
419
-			__( 'Code', 'give' ),
415
+			__('Donation Currencies', 'give'),
416
+			__('Currencies', 'give'),
417
+			__('Currencies Code', 'give'),
418
+			__('Currency Code', 'give'),
419
+			__('Code', 'give'),
420 420
 		),
421 421
 		'post_date'    => array(
422
-			__( 'Donation Date', 'give' ),
423
-			__( 'Date', 'give' ),
422
+			__('Donation Date', 'give'),
423
+			__('Date', 'give'),
424 424
 		),
425 425
 		'post_time'    => array(
426
-			__( 'Donation Time', 'give' ),
427
-			__( 'Time', 'give' ),
426
+			__('Donation Time', 'give'),
427
+			__('Time', 'give'),
428 428
 		),
429 429
 		'title_prefix' => array(
430
-			__( 'Title Prefix', 'give' ),
431
-			__( 'Prefix', 'give' ),
430
+			__('Title Prefix', 'give'),
431
+			__('Prefix', 'give'),
432 432
 		),
433 433
 		'first_name'   => array(
434
-			__( 'Donor First Name', 'give' ),
435
-			__( 'First Name', 'give' ),
436
-			__( 'Name', 'give' ),
437
-			__( 'First', 'give' ),
434
+			__('Donor First Name', 'give'),
435
+			__('First Name', 'give'),
436
+			__('Name', 'give'),
437
+			__('First', 'give'),
438 438
 		),
439 439
 		'last_name'    => array(
440
-			__( 'Donor Last Name', 'give' ),
441
-			__( 'Last Name', 'give' ),
442
-			__( 'Last', 'give' ),
440
+			__('Donor Last Name', 'give'),
441
+			__('Last Name', 'give'),
442
+			__('Last', 'give'),
443 443
 		),
444 444
 		'company_name' => array(
445
-			__( 'Company Name', 'give' ),
446
-			__( 'Donor Company Name', 'give' ),
447
-			__( 'Donor Company', 'give' ),
448
-			__( 'Company', 'give' ),
445
+			__('Company Name', 'give'),
446
+			__('Donor Company Name', 'give'),
447
+			__('Donor Company', 'give'),
448
+			__('Company', 'give'),
449 449
 		),
450 450
 		'line1'        => array(
451
-			__( 'Address 1', 'give' ),
452
-			__( 'Address', 'give' ),
451
+			__('Address 1', 'give'),
452
+			__('Address', 'give'),
453 453
 		),
454
-		'line2'        => __( 'Address 2', 'give' ),
455
-		'city'         => __( 'City', 'give' ),
454
+		'line2'        => __('Address 2', 'give'),
455
+		'city'         => __('City', 'give'),
456 456
 		'state'        => array(
457
-			__( 'State', 'give' ),
458
-			__( 'Province', 'give' ),
459
-			__( 'County', 'give' ),
460
-			__( 'Region', 'give' ),
457
+			__('State', 'give'),
458
+			__('Province', 'give'),
459
+			__('County', 'give'),
460
+			__('Region', 'give'),
461 461
 		),
462
-		'country'      => __( 'Country', 'give' ),
462
+		'country'      => __('Country', 'give'),
463 463
 		'zip'          => array(
464
-			__( 'Zip Code', 'give' ),
465
-			__( 'Zip', 'give' ),
466
-			__( 'zipcode', 'give' ),
467
-			__( 'Postal Code', 'give' ),
468
-			__( 'Postal', 'give' ),
464
+			__('Zip Code', 'give'),
465
+			__('Zip', 'give'),
466
+			__('zipcode', 'give'),
467
+			__('Postal Code', 'give'),
468
+			__('Postal', 'give'),
469 469
 		),
470 470
 		'email'        => array(
471
-			__( 'Donor Email', 'give' ),
472
-			__( 'Email', 'give' ),
473
-			__( 'Email Address', 'give' ),
471
+			__('Donor Email', 'give'),
472
+			__('Email', 'give'),
473
+			__('Email Address', 'give'),
474 474
 		),
475 475
 		'post_status'  => array(
476
-			__( 'Donation Status', 'give' ),
477
-			__( 'Status', 'give' ),
476
+			__('Donation Status', 'give'),
477
+			__('Status', 'give'),
478 478
 		),
479 479
 		'gateway'      => array(
480
-			__( 'Payment Method', 'give' ),
481
-			__( 'Method', 'give' ),
482
-			__( 'Payment Gateway', 'give' ),
483
-			__( 'Gateway', 'give' ),
480
+			__('Payment Method', 'give'),
481
+			__('Method', 'give'),
482
+			__('Payment Gateway', 'give'),
483
+			__('Gateway', 'give'),
484 484
 		),
485
-		'notes'        => __( 'Notes', 'give' ),
485
+		'notes'        => __('Notes', 'give'),
486 486
 		'mode'         => array(
487
-			__( 'Payment Mode', 'give' ),
488
-			__( 'Mode', 'give' ),
489
-			__( 'Test Mode', 'give' ),
487
+			__('Payment Mode', 'give'),
488
+			__('Mode', 'give'),
489
+			__('Test Mode', 'give'),
490 490
 		),
491
-		'post_meta'    => __( 'Import as Meta', 'give' ),
492
-	) );
491
+		'post_meta'    => __('Import as Meta', 'give'),
492
+	));
493 493
 }
494 494
 
495 495
 /**
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return array
507 507
 	 */
508
-	return (array) apply_filters( 'give_import_donor_options', array(
509
-		'donor_id' => __( 'Donor ID', 'give' ),
510
-		'user_id'  => __( 'User ID', 'give' ),
511
-	) );
508
+	return (array) apply_filters('give_import_donor_options', array(
509
+		'donor_id' => __('Donor ID', 'give'),
510
+		'user_id'  => __('User ID', 'give'),
511
+	));
512 512
 }
513 513
 
514 514
 /**
@@ -524,29 +524,29 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return array
526 526
 	 */
527
-	return (array) apply_filters( 'give_import_donation_form_options', array(
527
+	return (array) apply_filters('give_import_donation_form_options', array(
528 528
 		'form_title'              => array(
529
-			__( 'Donation Form Title', 'give' ),
530
-			__( 'Donation Form', 'give' ),
531
-			__( 'Form Name', 'give' ),
532
-			__( 'Title', 'give' ),
533
-			__( 'Form Title', 'give' ),
529
+			__('Donation Form Title', 'give'),
530
+			__('Donation Form', 'give'),
531
+			__('Form Name', 'give'),
532
+			__('Title', 'give'),
533
+			__('Form Title', 'give'),
534 534
 			'ignore' => array(
535
-				__( 'Title Prefix', 'give' ),
536
-				__( 'Prefix', 'give' ),
535
+				__('Title Prefix', 'give'),
536
+				__('Prefix', 'give'),
537 537
 			),
538 538
 		),
539 539
 		'form_id'                 => array(
540
-			__( 'Donation Form ID', 'give' ),
541
-			__( 'Form ID', 'give' ),
540
+			__('Donation Form ID', 'give'),
541
+			__('Form ID', 'give'),
542 542
 		),
543 543
 		'form_level'              => array(
544
-			__( 'Donation Level', 'give' ),
545
-			__( 'Level', 'give' ),
546
-			__( 'Level Title', 'give' ),
544
+			__('Donation Level', 'give'),
545
+			__('Level', 'give'),
546
+			__('Level Title', 'give'),
547 547
 		),
548
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
549
-	) );
548
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
549
+	));
550 550
 }
551 551
 
552 552
 /**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
  *
560 560
  * @return array
561 561
  */
562
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
562
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
563 563
 	/**
564 564
 	 * Filter to modify delimiter of Import
565 565
 	 *
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return string $delimiter
571 571
 	 */
572
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
572
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
573 573
 
574
-	$file_dir = give_get_file_data_by_file_id( $file_id );
574
+	$file_dir = give_get_file_data_by_file_id($file_id);
575 575
 
576
-	return give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter );
576
+	return give_get_raw_data_from_file($file_dir, $start, $end, $delimiter);
577 577
 }
578 578
 
579 579
 /**
@@ -588,18 +588,18 @@  discard block
 block discarded – undo
588 588
  *
589 589
  * @return array
590 590
  */
591
-function give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter ) {
591
+function give_get_raw_data_from_file($file_dir, $start, $end, $delimiter) {
592 592
 	$raw_data = array();
593 593
 
594 594
 	$count    = 0;
595
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
596
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
597
-			if ( $count >= $start && $count <= $end ) {
595
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
596
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
597
+			if ($count >= $start && $count <= $end) {
598 598
 				$raw_data[] = $row;
599 599
 			}
600
-			$count ++;
600
+			$count++;
601 601
 		}
602
-		fclose( $handle );
602
+		fclose($handle);
603 603
 	}
604 604
 
605 605
 	return $raw_data;
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
  *
615 615
  * @return false|string file content
616 616
  */
617
-function give_get_file_data_by_file_id( $file_id ) {
618
-	return get_attached_file( $file_id );
617
+function give_get_file_data_by_file_id($file_id) {
618
+	return get_attached_file($file_id);
619 619
 }
620 620
 
621 621
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
  *
629 629
  * @return bool
630 630
  */
631
-function give_log_user_in_on_register_callback( $value ) {
631
+function give_log_user_in_on_register_callback($value) {
632 632
 	return false;
633 633
 }
634 634
 
@@ -644,87 +644,87 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return bool
646 646
  */
647
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
648
-	$data                          = array_combine( $raw_key, $row_data );
647
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
648
+	$data                          = array_combine($raw_key, $row_data);
649 649
 	$price_id                      = false;
650 650
 	$donor_id                      = 0;
651 651
 	$donor_data                    = array();
652 652
 	$form                          = array();
653
-	$import_setting['create_user'] = isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1;
654
-	$dry_run                       = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
653
+	$import_setting['create_user'] = isset($import_setting['create_user']) ? $import_setting['create_user'] : 1;
654
+	$dry_run                       = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
655 655
 	$_dry_run_is_duplicate         = false;
656 656
 	$dry_run_duplicate_form        = false;
657 657
 	$dry_run_duplicate_donor       = false;
658
-	$donation_key                  = empty( $import_setting['donation_key'] ) ? 1 : (int) $import_setting['donation_key'];
658
+	$donation_key                  = empty($import_setting['donation_key']) ? 1 : (int) $import_setting['donation_key'];
659 659
 	$payment_id                    = false;
660 660
 
661
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
661
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
662 662
 
663
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
663
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
664 664
 	$diff           = array();
665 665
 
666
-	if ( ! empty( $dry_run ) && 1 !== $donation_key ) {
667
-		$csv_raw_data = empty( $import_setting['csv_raw_data'] ) ? array() : $import_setting['csv_raw_data'];
668
-		$donors_list  = empty( $import_setting['donors_list'] ) ? array() : $import_setting['donors_list'];
666
+	if ( ! empty($dry_run) && 1 !== $donation_key) {
667
+		$csv_raw_data = empty($import_setting['csv_raw_data']) ? array() : $import_setting['csv_raw_data'];
668
+		$donors_list  = empty($import_setting['donors_list']) ? array() : $import_setting['donors_list'];
669 669
 		$key          = $donation_key - 1;
670
-		for ( $i = 0; $i < $key; $i ++ ) {
671
-			$csv_data           = array_combine( $raw_key, $csv_raw_data[ $i ] );
672
-			$csv_data['amount'] = give_maybe_sanitize_amount( $csv_data['amount'] );
670
+		for ($i = 0; $i < $key; $i++) {
671
+			$csv_data           = array_combine($raw_key, $csv_raw_data[$i]);
672
+			$csv_data['amount'] = give_maybe_sanitize_amount($csv_data['amount']);
673 673
 			// check for duplicate donations
674
-			$diff = array_diff( $csv_data, $data );
675
-			if ( empty( $diff ) ) {
674
+			$diff = array_diff($csv_data, $data);
675
+			if (empty($diff)) {
676 676
 				$_dry_run_is_duplicate   = true;
677 677
 				$dry_run_duplicate_form  = true;
678 678
 				$dry_run_duplicate_donor = true;
679 679
 			} else {
680 680
 				// check for duplicate donation form with form id
681
-				if ( ! empty( $csv_data['form_id'] ) && ! empty( $data['form_id'] ) && $csv_data['form_id'] === $data['form_id'] ) {
682
-					$form    = new Give_Donate_Form( $data['form_id'] );
681
+				if ( ! empty($csv_data['form_id']) && ! empty($data['form_id']) && $csv_data['form_id'] === $data['form_id']) {
682
+					$form    = new Give_Donate_Form($data['form_id']);
683 683
 					$form_id = $form->get_ID();
684
-					if ( ! empty( $form_id ) ) {
684
+					if ( ! empty($form_id)) {
685 685
 						$dry_run_duplicate_form = true;
686 686
 					}
687 687
 				}
688 688
 				// check for duplicate donation form with form title
689
-				if ( empty( $dry_run_duplicate_form ) && ! empty( $csv_data['form_title'] ) && ! empty( $data['form_title'] ) && $csv_data['form_title'] === $data['form_title'] ) {
689
+				if (empty($dry_run_duplicate_form) && ! empty($csv_data['form_title']) && ! empty($data['form_title']) && $csv_data['form_title'] === $data['form_title']) {
690 690
 					$dry_run_duplicate_form = true;
691 691
 				}
692 692
 
693 693
 
694 694
 				// check for duplicate donor by donor id
695
-				if ( ! empty( $csv_data['donor_id'] ) && ! empty( $data['donor_id'] ) && $csv_data['donor_id'] === $data['donor_id'] ) {
696
-					$donor = array_search( (int) $data['donor_id'], array_column( 'id', $donors_list ) );
697
-					if ( ! empty( $donor ) ) {
695
+				if ( ! empty($csv_data['donor_id']) && ! empty($data['donor_id']) && $csv_data['donor_id'] === $data['donor_id']) {
696
+					$donor = array_search((int) $data['donor_id'], array_column('id', $donors_list));
697
+					if ( ! empty($donor)) {
698 698
 						$dry_run_duplicate_donor = true;
699 699
 					}
700 700
 				}
701 701
 
702 702
 				// check for duplicate donor by user id
703
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['user_id'] ) && ! empty( $data['user_id'] ) && $csv_data['user_id'] === $data['user_id'] ) {
704
-					$donor = array_search( (int) $data['user_id'], array_column( 'user_id', $donors_list ) );
705
-					if ( ! empty( $donor ) ) {
703
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['user_id']) && ! empty($data['user_id']) && $csv_data['user_id'] === $data['user_id']) {
704
+					$donor = array_search((int) $data['user_id'], array_column('user_id', $donors_list));
705
+					if ( ! empty($donor)) {
706 706
 						$dry_run_duplicate_donor = true;
707 707
 					} else {
708
-						$donor = get_user_by( 'id', $csv_data['user_id'] );
709
-						if ( ! empty( $donor->ID ) ) {
708
+						$donor = get_user_by('id', $csv_data['user_id']);
709
+						if ( ! empty($donor->ID)) {
710 710
 							$dry_run_duplicate_donor = true;
711 711
 						}
712 712
 					}
713 713
 				}
714 714
 
715 715
 				// check for duplicate donor by donor id
716
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['email'] ) && ! empty( $data['email'] ) && $csv_data['email'] === $data['email'] ) {
716
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['email']) && ! empty($data['email']) && $csv_data['email'] === $data['email']) {
717 717
 					$dry_run_duplicate_donor = true;
718 718
 				}
719 719
 			}
720 720
 		}
721 721
 	}
722 722
 
723
-	if ( empty( $dry_run_duplicate_donor ) ) {
723
+	if (empty($dry_run_duplicate_donor)) {
724 724
 		// Here come the login function.
725
-		$donor_data = give_import_get_user_from_csv( $data, $import_setting );
726
-		if ( empty( $dry_run ) ) {
727
-			if ( ! empty( $donor_data->id ) ) {
725
+		$donor_data = give_import_get_user_from_csv($data, $import_setting);
726
+		if (empty($dry_run)) {
727
+			if ( ! empty($donor_data->id)) {
728 728
 				$donor_id = $donor_data->id;
729 729
 			} else {
730 730
 				return $payment_id;
@@ -733,52 +733,52 @@  discard block
 block discarded – undo
733 733
 	} else {
734 734
 		// Get the report
735 735
 		$report                    = give_import_donation_report();
736
-		$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
736
+		$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
737 737
 		// update the report
738
-		give_import_donation_report_update( $report );
738
+		give_import_donation_report_update($report);
739 739
 	}
740 740
 
741
-	if ( empty( $dry_run_duplicate_form ) ) {
741
+	if (empty($dry_run_duplicate_form)) {
742 742
 		// get form data or register a form data.
743
-		$form = give_import_get_form_data_from_csv( $data, $import_setting );
744
-		if ( false == $form && empty( $dry_run ) ) {
743
+		$form = give_import_get_form_data_from_csv($data, $import_setting);
744
+		if (false == $form && empty($dry_run)) {
745 745
 			return $payment_id;
746 746
 		} else {
747
-			$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
747
+			$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
748 748
 		}
749 749
 	} else {
750 750
 		// Get the report
751 751
 		$report                   = give_import_donation_report();
752
-		$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
752
+		$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
753 753
 		// update the report
754
-		give_import_donation_report_update( $report );
754
+		give_import_donation_report_update($report);
755 755
 	}
756 756
 
757 757
 	// Get the report
758 758
 	$report = give_import_donation_report();
759 759
 
760 760
 
761
-	$status  = give_import_donation_get_status( $data );
762
-	$country = ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' );
763
-	$state   = ( ! empty( $data['state'] ) ? ( ( $state_code = array_search( $data['state'], give_get_states( $country ) ) ) ? $state_code : $data['state'] ) : '' );
761
+	$status  = give_import_donation_get_status($data);
762
+	$country = ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : '');
763
+	$state   = ( ! empty($data['state']) ? (($state_code = array_search($data['state'], give_get_states($country))) ? $state_code : $data['state']) : '');
764 764
 
765 765
 	$address = array(
766
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
767
-		'line2'   => ( ! empty( $data['line2'] ) ? give_clean( $data['line2'] ) : '' ),
768
-		'city'    => ( ! empty( $data['city'] ) ? give_clean( $data['city'] ) : '' ),
769
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
766
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
767
+		'line2'   => ( ! empty($data['line2']) ? give_clean($data['line2']) : ''),
768
+		'city'    => ( ! empty($data['city']) ? give_clean($data['city']) : ''),
769
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
770 770
 		'state'   => $state,
771 771
 		'country' => $country,
772 772
 	);
773 773
 
774
-	$test_mode = array( 'test', 'true', );
775
-	$post_date = current_time( 'mysql' );
776
-	if ( ! empty( $data['post_date'] ) ) {
777
-		if ( ! empty( $data['post_time'] ) ) {
778
-			$post_date = mysql2date( 'Y-m-d', $data['post_date'] );
779
-			$post_date = mysql2date( 'Y-m-d H:i:s', $post_date . ' ' . $data['post_time'] );
774
+	$test_mode = array('test', 'true',);
775
+	$post_date = current_time('mysql');
776
+	if ( ! empty($data['post_date'])) {
777
+		if ( ! empty($data['post_time'])) {
778
+			$post_date = mysql2date('Y-m-d', $data['post_date']);
779
+			$post_date = mysql2date('Y-m-d H:i:s', $post_date.' '.$data['post_time']);
780 780
 		} else {
781
-			$post_date = mysql2date( 'Y-m-d H:i:s', $data['post_date'] );
781
+			$post_date = mysql2date('Y-m-d H:i:s', $data['post_date']);
782 782
 		}
783 783
 	}
784 784
 
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		'donor_id'        => $donor_id,
788 788
 		'price'           => $data['amount'],
789 789
 		'status'          => $status,
790
-		'currency'        => ! empty( $data['currency'] ) && array_key_exists( $data['currency'], give_get_currencies_list() ) ? $data['currency'] : give_get_currency(),
790
+		'currency'        => ! empty($data['currency']) && array_key_exists($data['currency'], give_get_currencies_list()) ? $data['currency'] : give_get_currency(),
791 791
 		'user_info'       => array(
792 792
 			'id'         => $donor_id,
793
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
794
-			'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $donor_id ) && ( $first_name = get_user_meta( $donor_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ),
795
-			'last_name'  => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $donor_id ) && ( $last_name = get_user_meta( $donor_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ),
793
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
794
+			'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($donor_id) && ($first_name = get_user_meta($donor_id, 'first_name', true)) ? $first_name : $donor_data->name)),
795
+			'last_name'  => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($donor_id) && ($last_name = get_user_meta($donor_id, 'last_name', true)) ? $last_name : $donor_data->name)),
796 796
 			'address'    => $address,
797
-			'title'      => ! empty( $data['title_prefix'] ) ? $data['title_prefix'] : '',
797
+			'title'      => ! empty($data['title_prefix']) ? $data['title_prefix'] : '',
798 798
 		),
799
-		'gateway'         => ( ! empty( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
800
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : ( method_exists( $form, 'get_name' ) ? $form->get_name() : '' ) ),
801
-		'give_form_id'    => method_exists( $form, 'get_ID' ) ? $form->get_ID() : '',
799
+		'gateway'         => ( ! empty($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
800
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : (method_exists($form, 'get_name') ? $form->get_name() : '')),
801
+		'give_form_id'    => method_exists($form, 'get_ID') ? $form->get_ID() : '',
802 802
 		'give_price_id'   => $price_id,
803
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
803
+		'purchase_key'    => strtolower(md5(uniqid())),
804 804
 		'user_email'      => $data['email'],
805 805
 		'post_date'       => $post_date,
806
-		'mode'            => ( ! empty( $data['mode'] ) ? ( in_array( strtolower( $data['mode'] ), $test_mode ) ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
806
+		'mode'            => ( ! empty($data['mode']) ? (in_array(strtolower($data['mode']), $test_mode) ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
807 807
 	);
808 808
 
809 809
 	/**
@@ -818,76 +818,76 @@  discard block
 block discarded – undo
818 818
 	 *
819 819
 	 * @return array $payment_data payment data
820 820
 	 */
821
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
821
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
822 822
 
823 823
 	// Get the report
824 824
 	$report = give_import_donation_report();
825 825
 
826 826
 	// Check for duplicate code.
827
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
828
-	if ( false !== $donation_duplicate || ! empty( $_dry_run_is_duplicate ) ) {
829
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
830
-		$report['duplicate_donation']                                               = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
827
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
828
+	if (false !== $donation_duplicate || ! empty($_dry_run_is_duplicate)) {
829
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
830
+		$report['duplicate_donation']                                               = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
831 831
 	} else {
832 832
 
833
-		if ( empty( $dry_run ) ) {
834
-			add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
835
-			add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
836
-			add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
837
-			add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
838
-			add_filter( 'give_is_stop_email_notification', '__return_true' );
833
+		if (empty($dry_run)) {
834
+			add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
835
+			add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
836
+			add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
837
+			add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
838
+			add_filter('give_is_stop_email_notification', '__return_true');
839 839
 
840 840
 			// if it status is other then pending then first change the donation status to pending and after adding the payment meta update the donation status.
841
-			if ( 'pending' !== $status ) {
842
-				unset( $payment_data['status'] );
841
+			if ('pending' !== $status) {
842
+				unset($payment_data['status']);
843 843
 			}
844 844
 
845
-			$payment_id = give_insert_payment( $payment_data );
846
-			remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
847
-			remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
848
-			remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
849
-			remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
850
-			remove_filter( 'give_is_stop_email_notification', '__return_true' );
845
+			$payment_id = give_insert_payment($payment_data);
846
+			remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
847
+			remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
848
+			remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
849
+			remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
850
+			remove_filter('give_is_stop_email_notification', '__return_true');
851 851
 
852
-			if ( $payment_id ) {
852
+			if ($payment_id) {
853 853
 
854
-				$payment = new Give_Payment( $payment_id );
854
+				$payment = new Give_Payment($payment_id);
855 855
 
856
-				$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
856
+				$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
857 857
 
858
-				$payment->update_meta( '_give_payment_import', true );
858
+				$payment->update_meta('_give_payment_import', true);
859 859
 
860
-				if ( ! empty( $import_setting['csv'] ) ) {
861
-					$payment->update_meta( '_give_payment_import_id', $import_setting['csv'] );
860
+				if ( ! empty($import_setting['csv'])) {
861
+					$payment->update_meta('_give_payment_import_id', $import_setting['csv']);
862 862
 				}
863 863
 
864 864
 				// Insert Company Name.
865
-				if ( ! empty( $data['company_name'] ) ) {
866
-					$payment->update_meta( '_give_donation_company', $data['company_name'] );
867
-					$donor_data->update_meta( '_give_donor_company', $data['company_name'] );
865
+				if ( ! empty($data['company_name'])) {
866
+					$payment->update_meta('_give_donation_company', $data['company_name']);
867
+					$donor_data->update_meta('_give_donor_company', $data['company_name']);
868 868
 				}
869 869
 
870 870
 				// Insert Notes.
871
-				if ( ! empty( $data['notes'] ) ) {
872
-					$payment->add_note( $data['notes'] );
871
+				if ( ! empty($data['notes'])) {
872
+					$payment->add_note($data['notes']);
873 873
 				}
874 874
 
875
-				$meta_exists = array_keys( $raw_key, 'post_meta' );
876
-				if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
877
-					foreach ( $meta_exists as $meta_exist ) {
878
-						if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
879
-							$payment->update_meta( $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
875
+				$meta_exists = array_keys($raw_key, 'post_meta');
876
+				if ( ! empty($main_key) && ! empty($meta_exists)) {
877
+					foreach ($meta_exists as $meta_exist) {
878
+						if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
879
+							$payment->update_meta($main_key[$meta_exist], $row_data[$meta_exist]);
880 880
 						}
881 881
 					}
882 882
 				}
883 883
 
884 884
 				// update the donation status if it's other then pending
885
-				if ( 'pending' !== $status ) {
886
-					$payment->update_status( $status );
885
+				if ('pending' !== $status) {
886
+					$payment->update_status($status);
887 887
 				}
888 888
 
889 889
 			} else {
890
-				$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
890
+				$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
891 891
 				$payment_id                = false;
892 892
 			}
893 893
 
@@ -902,15 +902,15 @@  discard block
 block discarded – undo
902 902
 			 * @param array $donor_data donor data
903 903
 			 * @param object $donor_data form object
904 904
 			 */
905
-			do_action( 'give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form );
905
+			do_action('give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form);
906 906
 		} else {
907
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
907
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
908 908
 			$payment_id                = true;
909 909
 		}
910 910
 	}
911 911
 
912 912
 	// update the report
913
-	give_import_donation_report_update( $report );
913
+	give_import_donation_report_update($report);
914 914
 
915 915
 	return $payment_id;
916 916
 }
@@ -924,25 +924,25 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @return string $status Donation status.
926 926
  */
927
-function give_import_donation_get_status( $data ) {
928
-	if ( empty( $data['post_status'] ) ) {
927
+function give_import_donation_get_status($data) {
928
+	if (empty($data['post_status'])) {
929 929
 		return 'publish';
930 930
 	}
931 931
 
932 932
 	$status = 'publish';
933 933
 
934
-	$donation_status = trim( $data['post_status'] );
935
-	$donation_status_key      = strtolower( preg_replace( '/\s+/', '', $donation_status ) );
934
+	$donation_status = trim($data['post_status']);
935
+	$donation_status_key = strtolower(preg_replace('/\s+/', '', $donation_status));
936 936
 
937
-	foreach ( give_get_payment_statuses() as $key => $value ) {
937
+	foreach (give_get_payment_statuses() as $key => $value) {
938 938
 		$match = false;
939
-		if ( $key === $donation_status_key ) {
939
+		if ($key === $donation_status_key) {
940 940
 			$match = true;
941
-		} else if ( stristr( $donation_status, $value ) ) {
941
+		} else if (stristr($donation_status, $value)) {
942 942
 			$match = true;
943 943
 		}
944 944
 
945
-		if ( ! empty( $match ) ) {
945
+		if ( ! empty($match)) {
946 946
 			$status = $key;
947 947
 			break;
948 948
 		}
@@ -962,12 +962,12 @@  discard block
 block discarded – undo
962 962
  *
963 963
  * @return Give_Donor
964 964
  */
965
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
965
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
966 966
 	$old_donor = $donor;
967
-	if ( ! empty( $payment_data['donor_id'] ) ) {
968
-		$donor_id = absint( $payment_data['donor_id'] );
969
-		$donor    = new Give_Donor( $donor_id );
970
-		if ( ! empty( $donor->id ) ) {
967
+	if ( ! empty($payment_data['donor_id'])) {
968
+		$donor_id = absint($payment_data['donor_id']);
969
+		$donor    = new Give_Donor($donor_id);
970
+		if ( ! empty($donor->id)) {
971 971
 			return $donor;
972 972
 		}
973 973
 	}
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
  *
981 981
  * @since 1.8.13
982 982
  */
983
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
983
+function give_import_donation_insert_payment($payment_id, $payment_data) {
984 984
 	// Update Give Customers purchase_count
985
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
986
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
987
-		if ( ! empty( $donor_id ) ) {
988
-			$donor = new Give_Donor( $donor_id );
985
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
986
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
987
+		if ( ! empty($donor_id)) {
988
+			$donor = new Give_Donor($donor_id);
989 989
 			$donor->increase_purchase_count();
990 990
 		}
991 991
 	}
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
  *
997 997
  * @since 1.8.13
998 998
  */
999
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
1000
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
999
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
1000
+	if ( ! empty($payment_data['user_info']['id'])) {
1001 1001
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
1002 1002
 	}
1003 1003
 
@@ -1009,11 +1009,11 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @since 1.8.13
1011 1011
  */
1012
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
1012
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
1013 1013
 	$return = false;
1014
-	if ( ! empty( $data['post_date'] ) ) {
1015
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $payment_data['post_date'] );
1016
-		$post_date = explode( '-', $post_date );
1014
+	if ( ! empty($data['post_date'])) {
1015
+		$post_date = mysql2date('Y-m-d-H-i-s', $payment_data['post_date']);
1016
+		$post_date = explode('-', $post_date);
1017 1017
 		$args      = array(
1018 1018
 			'output'                 => 'post',
1019 1019
 			'cache_results'          => false,
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 			'meta_query'             => array(
1035 1035
 				array(
1036 1036
 					'key'     => '_give_payment_total',
1037
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
1037
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
1038 1038
 					'compare' => 'LIKE',
1039 1039
 				),
1040 1040
 				array(
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 				),
1051 1051
 				array(
1052 1052
 					'key'     => '_give_payment_donor_id',
1053
-					'value'   => isset( $donor_data->id ) ? $donor_data->id : '',
1053
+					'value'   => isset($donor_data->id) ? $donor_data->id : '',
1054 1054
 					'compare' => '=',
1055 1055
 				),
1056 1056
 				array(
@@ -1061,9 +1061,9 @@  discard block
 block discarded – undo
1061 1061
 			),
1062 1062
 		);
1063 1063
 
1064
-		$payments  = new Give_Payments_Query( $args );
1064
+		$payments  = new Give_Payments_Query($args);
1065 1065
 		$donations = $payments->get_payments();
1066
-		if ( ! empty( $donations ) ) {
1066
+		if ( ! empty($donations)) {
1067 1067
 			$return = $donations;
1068 1068
 		}
1069 1069
 	}
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 *
1074 1074
 	 * @since 1.8.18
1075 1075
 	 */
1076
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
1076
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
1077 1077
 }
1078 1078
 
1079 1079
 /**
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
  *
1086 1086
  * @return void
1087 1087
  */
1088
-function give_donation_import_insert_default_payment_note( $payment_id ) {
1088
+function give_donation_import_insert_default_payment_note($payment_id) {
1089 1089
 	$current_user = wp_get_current_user();
1090
-	give_insert_payment_note( $payment_id, wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) );
1090
+	give_insert_payment_note($payment_id, wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email));
1091 1091
 }
1092 1092
 
1093 1093
 /**
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
  *
1100 1100
  * @return string URL
1101 1101
  */
1102
-function give_import_page_url( $parameter = array() ) {
1102
+function give_import_page_url($parameter = array()) {
1103 1103
 	$defalut_query_arg = array(
1104 1104
 		'post_type'     => 'give_forms',
1105 1105
 		'page'          => 'give-tools',
1106 1106
 		'tab'           => 'import',
1107 1107
 		'importer-type' => 'import_donations',
1108 1108
 	);
1109
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
1109
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
1110 1110
 
1111
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
1111
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
1112 1112
 }
Please login to merge, or discard this patch.
includes/payments/class-give-sequential-donation-number.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 	 * @since
198 198
 	 * @access public
199 199
 	 *
200
-	 * @param $serial_number
200
+	 * @param integer $serial_number
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
Please login to merge, or discard this patch.
Spacing   +47 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if access directly.
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined('ABSPATH')) {
4 4
 	exit;
5 5
 }
6 6
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return Give_Sequential_Donation_Number
41 41
 	 */
42 42
 	public static function get_instance() {
43
-		if ( null === static::$instance ) {
43
+		if (null === static::$instance) {
44 44
 			self::$instance = new static();
45 45
 
46 46
 			self::$instance->init();
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @since 2.1.0
57 57
 	 */
58 58
 	public function init() {
59
-		add_action( 'wp_insert_post', array( $this, '__save_donation_title' ), 10, 3 );
60
-		add_action( 'after_delete_post', array( $this, '__remove_serial_number' ), 10, 1 );
59
+		add_action('wp_insert_post', array($this, '__save_donation_title'), 10, 3);
60
+		add_action('after_delete_post', array($this, '__remove_serial_number'), 10, 1);
61 61
 	}
62 62
 
63 63
 	/**
@@ -73,27 +73,27 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return void
75 75
 	 */
76
-	public function __save_donation_title( $donation_id, $post, $existing_donation_updated ) {
76
+	public function __save_donation_title($donation_id, $post, $existing_donation_updated) {
77 77
 		// Bailout
78 78
 		if (
79
-			! give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) )
79
+			! give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))
80 80
 			|| $existing_donation_updated
81 81
 			|| 'give_payment' !== $post->post_type
82 82
 		) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$serial_number = $this->__set_donation_number( $donation_id );
87
-		$serial_code   = $this->set_number_padding( $serial_number );
86
+		$serial_number = $this->__set_donation_number($donation_id);
87
+		$serial_code   = $this->set_number_padding($serial_number);
88 88
 
89 89
 		// Add prefix.
90
-		if ( $prefix = give_get_option( 'sequential-ordering_number_prefix', '' ) ) {
91
-			$serial_code = $prefix . $serial_code;
90
+		if ($prefix = give_get_option('sequential-ordering_number_prefix', '')) {
91
+			$serial_code = $prefix.$serial_code;
92 92
 		}
93 93
 
94 94
 		// Add suffix.
95
-		if ( $suffix = give_get_option( 'sequential-ordering_number_suffix', '' ) ) {
96
-			$serial_code = $serial_code . $suffix;
95
+		if ($suffix = give_get_option('sequential-ordering_number_suffix', '')) {
96
+			$serial_code = $serial_code.$suffix;
97 97
 		}
98 98
 
99 99
 		/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 */
104 104
 		$serial_code = apply_filters(
105 105
 			'give_set_sequential_donation_title',
106
-			give_time_do_tags( $serial_code ),
106
+			give_time_do_tags($serial_code),
107 107
 			$donation_id,
108 108
 			$post,
109 109
 			$existing_donation_updated,
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 				array(
121 121
 					'ID'         => $donation_id,
122 122
 					'post_name'  => "{$this->donation_title_prefix}-{$serial_number}",
123
-					'post_title' => trim( $serial_code )
123
+					'post_title' => trim($serial_code)
124 124
 				)
125 125
 			);
126 126
 
127
-			if ( is_wp_error( $wp_error ) ) {
128
-				throw new Exception( $wp_error->get_error_message() );
127
+			if (is_wp_error($wp_error)) {
128
+				throw new Exception($wp_error->get_error_message());
129 129
 			}
130 130
 
131
-			give_update_option( 'sequential-ordering_number', ( $serial_number + 1 ) );
132
-		} catch ( Exception $e ) {
133
-			error_log( "Give caught exception: {$e->getMessage()}" );
131
+			give_update_option('sequential-ordering_number', ($serial_number + 1));
132
+		} catch (Exception $e) {
133
+			error_log("Give caught exception: {$e->getMessage()}");
134 134
 		}
135 135
 	}
136 136
 
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return int
147 147
 	 */
148
-	public function __set_donation_number( $donation_id ) {
148
+	public function __set_donation_number($donation_id) {
149 149
 		$table_data = array(
150 150
 			'payment_id' => $donation_id
151 151
 		);
152 152
 
153 153
 		// Customize sequential donation number starting point if needed.
154 154
 		if (
155
-			get_option( '_give_reset_sequential_number' ) &&
156
-			( $number = give_get_option( 'sequential-ordering_number', 0 ) )
155
+			get_option('_give_reset_sequential_number') &&
156
+			($number = give_get_option('sequential-ordering_number', 0))
157 157
 		) {
158
-			if ( Give()->sequential_donation_db->get_id_auto_increment_val() <= $number ) {
159
-				delete_option( '_give_reset_sequential_number' );
158
+			if (Give()->sequential_donation_db->get_id_auto_increment_val() <= $number) {
159
+				delete_option('_give_reset_sequential_number');
160 160
 			}
161 161
 
162 162
 			$table_data['id'] = $number;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 */
171 171
 		return apply_filters(
172 172
 			'give_set_sequential_donation_number',
173
-			Give()->sequential_donation_db->insert( $table_data ),
173
+			Give()->sequential_donation_db->insert($table_data),
174 174
 			$table_data
175 175
 		);
176 176
 	}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return bool
189 189
 	 */
190
-	public function __remove_serial_number( $donation_id ) {
191
-		return Give()->sequential_donation_db->delete( $this->get_serial_number( $donation_id ) );
190
+	public function __remove_serial_number($donation_id) {
191
+		return Give()->sequential_donation_db->delete($this->get_serial_number($donation_id));
192 192
 	}
193 193
 
194 194
 	/**
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
204
-	public function set_number_padding( $serial_number ) {
205
-		if ( $number_padding = give_get_option( 'sequential-ordering_number_padding', 0 ) ) {
206
-			$serial_number = str_pad( $serial_number, $number_padding, '0', STR_PAD_LEFT );
204
+	public function set_number_padding($serial_number) {
205
+		if ($number_padding = give_get_option('sequential-ordering_number_padding', 0)) {
206
+			$serial_number = str_pad($serial_number, $number_padding, '0', STR_PAD_LEFT);
207 207
 		}
208 208
 
209 209
 		return $serial_number;
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function get_serial_code( $donation, $args = array() ) {
223
+	public function get_serial_code($donation, $args = array()) {
224 224
 		// Get id from object.
225
-		if( ! is_numeric( $donation ) ) {
226
-			if( $donation instanceof Give_Payment ) {
225
+		if ( ! is_numeric($donation)) {
226
+			if ($donation instanceof Give_Payment) {
227 227
 				$donation = $donation->ID;
228
-			} elseif ( $donation instanceof WP_Post ){
228
+			} elseif ($donation instanceof WP_Post) {
229 229
 				$donation = $donation->ID;
230 230
 			}
231 231
 		}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 
242 242
 		$serial_code = $args['default'] ? $donation : '';
243 243
 
244
-		if ( $donation_number = $this->get_serial_number( $donation ) ) {
245
-			$serial_code = get_the_title( $donation );
244
+		if ($donation_number = $this->get_serial_number($donation)) {
245
+			$serial_code = get_the_title($donation);
246 246
 		}
247 247
 
248 248
 		$serial_code = $args['with_hash'] ? "#{$serial_code}" : $serial_code;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * @param array $args
258 258
 		 * @param string $donation_number
259 259
 		 */
260
-		return apply_filters( 'give_get_donation_serial_code', $serial_code, $donation, $args, $donation_number );
260
+		return apply_filters('give_get_donation_serial_code', $serial_code, $donation, $args, $donation_number);
261 261
 	}
262 262
 
263 263
 	/**
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return string
272 272
 	 */
273
-	public function get_serial_number( $donation_id_or_serial_code ) {
274
-		if ( is_numeric( $donation_id_or_serial_code ) ) {
275
-			return Give()->sequential_donation_db->get_column_by( 'id', 'payment_id', $donation_id_or_serial_code );
273
+	public function get_serial_number($donation_id_or_serial_code) {
274
+		if (is_numeric($donation_id_or_serial_code)) {
275
+			return Give()->sequential_donation_db->get_column_by('id', 'payment_id', $donation_id_or_serial_code);
276 276
 		}
277 277
 
278
-		return $this->get_serial_number( $this->get_donation_id( $donation_id_or_serial_code ) );
278
+		return $this->get_serial_number($this->get_donation_id($donation_id_or_serial_code));
279 279
 	}
280 280
 
281 281
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string
291 291
 	 */
292
-	public function get_donation_id( $donation_number_or_serial_code ) {
292
+	public function get_donation_id($donation_number_or_serial_code) {
293 293
 		global $wpdb;
294 294
 
295
-		if ( is_numeric( $donation_number_or_serial_code ) ) {
295
+		if (is_numeric($donation_number_or_serial_code)) {
296 296
 			return Give()->sequential_donation_db->get_column_by(
297 297
 				'payment_id',
298 298
 				'id',
@@ -377,12 +377,11 @@  discard block
 block discarded – undo
377 377
 		$donation_id = $this->get_max_donation_id();
378 378
 		$next_number = $this->get_max_number();
379 379
 
380
-		if ( ! $this->get_serial_number( $donation_id ) ) {
381
-			$next_number = $donation_id && ( $next_number < $donation_id ) ?
382
-				$donation_id :
383
-				$this->get_max_number();
380
+		if ( ! $this->get_serial_number($donation_id)) {
381
+			$next_number = $donation_id && ($next_number < $donation_id) ?
382
+				$donation_id : $this->get_max_number();
384 383
 		}
385 384
 
386
-		return ( $next_number + 1 );
385
+		return ($next_number + 1);
387 386
 	}
388 387
 }
Please login to merge, or discard this patch.
includes/payments/class-payment-stats.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param  $end_date   string|bool  The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
37 37
 	 * @param  $status     string|array The sale status(es) to count. Only valid when retrieving global stats
38 38
 	 *
39
-	 * @return float|int                Total amount of donations based on the passed arguments.
39
+	 * @return string                Total amount of donations based on the passed arguments.
40 40
 	 */
41 41
 	public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) {
42 42
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param  $end_date    string|bool The end date for which we'd like to filter the donations stats. If false, method will use the default end date of `this_month`.
85 85
 	 * @param  $gateway_id  string|bool The gateway to get earnings for such as 'paypal' or 'stripe'.
86 86
 	 *
87
-	 * @return float|int                Total amount of donations based on the passed arguments.
87
+	 * @return string                Total amount of donations based on the passed arguments.
88 88
 	 */
89 89
 	public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
90 90
 		global $wpdb;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param  $end_date    string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
208 208
 	 * @param  $gateway_id  string|bool The gateway to get earnings for such as 'paypal' or 'stripe'
209 209
 	 *
210
-	 * @return float|int                Total amount of donations based on the passed arguments.
210
+	 * @return string                Total amount of donations based on the passed arguments.
211 211
 	 */
212 212
 	public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
213 213
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 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
 
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return float|int                Total amount of donations based on the passed arguments.
40 40
 	 */
41
-	public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) {
41
+	public function get_sales($form_id = 0, $start_date = false, $end_date = false, $status = 'publish') {
42 42
 
43
-		$this->setup_dates( $start_date, $end_date );
43
+		$this->setup_dates($start_date, $end_date);
44 44
 
45 45
 		// Make sure start date is valid
46
-		if ( is_wp_error( $this->start_date ) ) {
46
+		if (is_wp_error($this->start_date)) {
47 47
 			return $this->start_date;
48 48
 		}
49 49
 
50 50
 		// Make sure end date is valid
51
-		if ( is_wp_error( $this->end_date ) ) {
51
+		if (is_wp_error($this->end_date)) {
52 52
 			return $this->end_date;
53 53
 		}
54 54
 
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 			'start_date' => $this->start_date,
58 58
 			'end_date'   => $this->end_date,
59 59
 			'fields'     => 'ids',
60
-			'number'     => - 1,
60
+			'number'     => -1,
61 61
 			'output'     => ''
62 62
 		);
63 63
 
64
-		if ( ! empty( $form_id ) ) {
64
+		if ( ! empty($form_id)) {
65 65
 			$args['give_forms'] = $form_id;
66 66
 		}
67 67
 
68 68
 		/* @var Give_Payments_Query $payments */
69
-		$payments = new Give_Payments_Query( $args );
69
+		$payments = new Give_Payments_Query($args);
70 70
 		$payments = $payments->get_payments();
71 71
 
72
-		return count( $payments );
72
+		return count($payments);
73 73
 	}
74 74
 
75 75
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return float|int                Total amount of donations based on the passed arguments.
88 88
 	 */
89
-	public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
89
+	public function get_earnings($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
90 90
 		global $wpdb;
91
-		$this->setup_dates( $start_date, $end_date );
91
+		$this->setup_dates($start_date, $end_date);
92 92
 
93 93
 		// Make sure start date is valid
94
-		if ( is_wp_error( $this->start_date ) ) {
94
+		if (is_wp_error($this->start_date)) {
95 95
 			return $this->start_date;
96 96
 		}
97 97
 
98 98
 		// Make sure end date is valid
99
-		if ( is_wp_error( $this->end_date ) ) {
99
+		if (is_wp_error($this->end_date)) {
100 100
 			return $this->end_date;
101 101
 		}
102 102
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 			'start_date' => $this->start_date,
107 107
 			'end_date'   => $this->end_date,
108 108
 			'fields'     => 'ids',
109
-			'number'     => - 1,
109
+			'number'     => -1,
110 110
 			'output'     => '',
111 111
 		);
112 112
 
113 113
 
114 114
 		// Filter by Gateway ID meta_key
115
-		if ( $gateway_id ) {
115
+		if ($gateway_id) {
116 116
 			$args['meta_query'][] = array(
117 117
 				'key'   => '_give_payment_gateway',
118 118
 				'value' => $gateway_id,
@@ -120,42 +120,42 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 
122 122
 		// Filter by Gateway ID meta_key
123
-		if ( $form_id ) {
123
+		if ($form_id) {
124 124
 			$args['meta_query'][] = array(
125 125
 				'key'   => '_give_payment_form_id',
126 126
 				'value' => $form_id,
127 127
 			);
128 128
 		}
129 129
 
130
-		if ( ! empty( $args['meta_query'] ) && 1 < count( $args['meta_query'] ) ) {
130
+		if ( ! empty($args['meta_query']) && 1 < count($args['meta_query'])) {
131 131
 			$args['meta_query']['relation'] = 'AND';
132 132
 		}
133 133
 
134
-		$args = apply_filters( 'give_stats_earnings_args', $args );
135
-		$key  = Give_Cache::get_key( 'give_stats', $args );
134
+		$args = apply_filters('give_stats_earnings_args', $args);
135
+		$key  = Give_Cache::get_key('give_stats', $args);
136 136
 
137 137
 		// Set transient for faster stats.
138
-		$earnings = Give_Cache::get( $key );
138
+		$earnings = Give_Cache::get($key);
139 139
 
140
-		if ( false === $earnings ) {
140
+		if (false === $earnings) {
141 141
 
142 142
 			$this->timestamp = false;
143
-			$payments        = new Give_Payments_Query( $args );
143
+			$payments        = new Give_Payments_Query($args);
144 144
 			$payments        = $payments->get_payments();
145 145
 			$earnings        = 0;
146 146
 
147
-			if ( ! empty( $payments ) ) {
148
-				$donation_id_col = Give()->payment_meta->get_meta_type() . '_id';
147
+			if ( ! empty($payments)) {
148
+				$donation_id_col = Give()->payment_meta->get_meta_type().'_id';
149 149
 				$query = "SELECT {$donation_id_col} as id, meta_value as total
150 150
 					FROM {$wpdb->donationmeta}
151 151
 					WHERE meta_key='_give_payment_total'
152
-					AND {$donation_id_col} IN ('". implode( '\',\'', $payments ) ."')";
152
+					AND {$donation_id_col} IN ('".implode('\',\'', $payments)."')";
153 153
 
154 154
 				$payments = $wpdb->get_results($query, ARRAY_A);
155 155
 
156
-				if( ! empty( $payments ) ) {
157
-					foreach ( $payments as $payment ) {
158
-						$currency_code = give_get_payment_currency_code( $payment['id'] );
156
+				if ( ! empty($payments)) {
157
+					foreach ($payments as $payment) {
158
+						$currency_code = give_get_payment_currency_code($payment['id']);
159 159
 
160 160
 						/**
161 161
 						 * Filter the donation amount
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 						 */
166 166
 						$formatted_amount = apply_filters(
167 167
 							'give_donation_amount',
168
-							give_format_amount(  $payment['total'], array( 'donation_id' =>  $payment['id'] ) ),
168
+							give_format_amount($payment['total'], array('donation_id' =>  $payment['id'])),
169 169
 							$payment['total'],
170 170
 							$payment['id'],
171
-							array( 'type' => 'stats', 'currency'=> false, 'amount' => false )
171
+							array('type' => 'stats', 'currency'=> false, 'amount' => false)
172 172
 						);
173 173
 
174
-						$earnings += (float) give_maybe_sanitize_amount( $formatted_amount, array( 'currency' => $currency_code  ) );
174
+						$earnings += (float) give_maybe_sanitize_amount($formatted_amount, array('currency' => $currency_code));
175 175
 					}
176 176
 				}
177 177
 
178 178
 			}
179 179
 
180 180
 			// Cache the results for one hour.
181
-			Give_Cache::set( $key, give_sanitize_amount_for_db( $earnings ), 60 * 60 );
181
+			Give_Cache::set($key, give_sanitize_amount_for_db($earnings), 60 * 60);
182 182
 		}
183 183
 
184 184
 		/**
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 		 * @param  string|bool $end_date   Earning end date.
193 193
 		 * @param  string|bool $gateway_id Payment gateway id.
194 194
 		 */
195
-		$earnings = apply_filters( 'give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id );
195
+		$earnings = apply_filters('give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id);
196 196
 
197 197
 		//return earnings
198
-		return round( $earnings, give_get_price_decimals( $form_id ) );
198
+		return round($earnings, give_get_price_decimals($form_id));
199 199
 
200 200
 	}
201 201
 
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return float|int                Total amount of donations based on the passed arguments.
214 214
 	 */
215
-	public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
215
+	public function get_earnings_cache_key($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
216 216
 
217
-		$this->setup_dates( $start_date, $end_date );
217
+		$this->setup_dates($start_date, $end_date);
218 218
 
219 219
 		// Make sure start date is valid
220
-		if ( is_wp_error( $this->start_date ) ) {
220
+		if (is_wp_error($this->start_date)) {
221 221
 			return $this->start_date;
222 222
 		}
223 223
 
224 224
 		// Make sure end date is valid
225
-		if ( is_wp_error( $this->end_date ) ) {
225
+		if (is_wp_error($this->end_date)) {
226 226
 			return $this->end_date;
227 227
 		}
228 228
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 			'start_date' => $this->start_date,
233 233
 			'end_date'   => $this->end_date,
234 234
 			'fields'     => 'ids',
235
-			'number'     => - 1,
235
+			'number'     => -1,
236 236
 		);
237 237
 
238 238
 
239 239
 		// Filter by Gateway ID meta_key
240
-		if ( $gateway_id ) {
240
+		if ($gateway_id) {
241 241
 			$args['meta_query'][] = array(
242 242
 				'key'   => '_give_payment_gateway',
243 243
 				'value' => $gateway_id,
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 		}
246 246
 
247 247
 		// Filter by Gateway ID meta_key
248
-		if ( $form_id ) {
248
+		if ($form_id) {
249 249
 			$args['meta_query'][] = array(
250 250
 				'key'   => '_give_payment_form_id',
251 251
 				'value' => $form_id,
252 252
 			);
253 253
 		}
254 254
 
255
-		if ( ! empty( $args['meta_query'] ) && 1 < count( $args['meta_query'] ) ) {
255
+		if ( ! empty($args['meta_query']) && 1 < count($args['meta_query'])) {
256 256
 			$args['meta_query']['relation'] = 'AND';
257 257
 		}
258 258
 
259
-		$args = apply_filters( 'give_stats_earnings_args', $args );
260
-		$key  = Give_Cache::get_key( 'give_stats', $args );
259
+		$args = apply_filters('give_stats_earnings_args', $args);
260
+		$key  = Give_Cache::get_key('give_stats', $args);
261 261
 
262 262
 		//return earnings
263 263
 		return $key;
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return array       Best selling forms
277 277
 	 */
278
-	public function get_best_selling( $number = 10 ) {
278
+	public function get_best_selling($number = 10) {
279 279
 		global $wpdb;
280 280
 
281
-		$meta_table = __give_v20_bc_table_details( 'form' );
281
+		$meta_table = __give_v20_bc_table_details('form');
282 282
 
283
-		$give_forms = $wpdb->get_results( $wpdb->prepare(
283
+		$give_forms = $wpdb->get_results($wpdb->prepare(
284 284
 			"SELECT {$meta_table['column']['id']} as form_id, max(meta_value) as sales
285 285
 				FROM {$meta_table['name']} WHERE meta_key='_give_form_sales' AND meta_value > 0
286 286
 				GROUP BY meta_value+0
287 287
 				DESC LIMIT %d;", $number
288
-		) );
288
+		));
289 289
 
290 290
 		return $give_forms;
291 291
 	}
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -571,7 +571,7 @@
 block discarded – undo
571 571
  *
572 572
  * @since 1.0
573 573
  *
574
- * @return int $earnings Earnings
574
+ * @return double $earnings Earnings
575 575
  */
576 576
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
577 577
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
Please login to merge, or discard this patch.
Spacing   +326 added lines, -329 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 				)
96 96
 			);
97 97
 
98
-			if ( $payment ) {
99
-				$payment = new Give_Payment( $payment[0] );
98
+			if ($payment) {
99
+				$payment = new Give_Payment($payment[0]);
100 100
 			}
101 101
 
102 102
 			break;
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 				)
112 112
 			);
113 113
 
114
-			if ( $payment ) {
115
-				$payment = new Give_Payment( $payment[0] );
114
+			if ($payment) {
115
+				$payment = new Give_Payment($payment[0]);
116 116
 			}
117 117
 
118 118
 			break;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			return false;
122 122
 	}// End switch().
123 123
 
124
-	if ( $payment ) {
124
+	if ($payment) {
125 125
 		return $payment;
126 126
 	}
127 127
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
  *
138 138
  * @return int|bool Payment ID if payment is inserted, false otherwise.
139 139
  */
140
-function give_insert_payment( $payment_data = array() ) {
140
+function give_insert_payment($payment_data = array()) {
141 141
 
142
-	if ( empty( $payment_data ) ) {
142
+	if (empty($payment_data)) {
143 143
 		return false;
144 144
 	}
145 145
 
@@ -150,35 +150,35 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param array $payment_data Arguments passed.
152 152
 	 */
153
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
153
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
154 154
 
155 155
 	$payment    = new Give_Payment();
156
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
157
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? give_clean( $_POST['give-gateway'] ) : $gateway; // WPCS: input var ok, sanitization ok, CSRF ok.
158
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
159
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
160
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
156
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
157
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? give_clean($_POST['give-gateway']) : $gateway; // WPCS: input var ok, sanitization ok, CSRF ok.
158
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
159
+	$price_id   = give_get_payment_meta_price_id($payment_data);
160
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
161 161
 
162 162
 	// Set properties.
163 163
 	$payment->total          = $payment_data['price'];
164
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
165
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
164
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
165
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
166 166
 	$payment->user_info      = $payment_data['user_info'];
167 167
 	$payment->gateway        = $gateway;
168 168
 	$payment->form_title     = $form_title;
169 169
 	$payment->form_id        = $form_id;
170 170
 	$payment->price_id       = $price_id;
171
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
171
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
172 172
 	$payment->user_id        = $payment_data['user_info']['id'];
173 173
 	$payment->email          = $payment_data['user_email'];
174 174
 	$payment->first_name     = $payment_data['user_info']['first_name'];
175 175
 	$payment->last_name      = $payment_data['user_info']['last_name'];
176
-	$payment->title_prefix   = ! empty( $payment_data['user_info']['title'] ) ? $payment_data['user_info']['title'] : '';
176
+	$payment->title_prefix   = ! empty($payment_data['user_info']['title']) ? $payment_data['user_info']['title'] : '';
177 177
 	$payment->email          = $payment_data['user_info']['email'];
178 178
 	$payment->ip             = give_get_ip();
179 179
 	$payment->key            = $payment_data['purchase_key'];
180
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
181
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
180
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
181
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
182 182
 
183 183
 	// Add the donation.
184 184
 	$args = array(
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 		'price_id' => $payment->price_id,
187 187
 	);
188 188
 
189
-	$payment->add_donation( $payment->form_id, $args );
189
+	$payment->add_donation($payment->form_id, $args);
190 190
 
191 191
 	// Set date if present.
192
-	if ( isset( $payment_data['post_date'] ) ) {
192
+	if (isset($payment_data['post_date'])) {
193 193
 		$payment->date = $payment_data['post_date'];
194 194
 	}
195 195
 
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount = give_donation_amount( $payment_id );
306
+	$amount = give_donation_amount($payment_id);
307 307
 	$status = $payment->post_status;
308
-	$donor  = new Give_Donor( $payment->donor_id );
308
+	$donor  = new Give_Donor($payment->donor_id);
309 309
 
310 310
 	// Only undo donations that aren't these statuses.
311 311
 	$dont_undo_statuses = apply_filters(
@@ -315,26 +315,26 @@  discard block
 block discarded – undo
315 315
 		)
316 316
 	);
317 317
 
318
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
319
-		give_undo_donation( $payment_id );
318
+	if ( ! in_array($status, $dont_undo_statuses)) {
319
+		give_undo_donation($payment_id);
320 320
 	}
321 321
 
322 322
 	// Only undo donations that aren't these statuses.
323
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
323
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
324 324
 
325
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
325
+	if (in_array($status, $status_to_decrease_stats)) {
326 326
 
327 327
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
328
-		give_decrease_total_earnings( $amount );
328
+		give_decrease_total_earnings($amount);
329 329
 
330 330
 		// @todo: Refresh only range related stat cache
331 331
 		give_delete_donation_stats();
332 332
 
333
-		if ( $donor->id && $update_donor ) {
333
+		if ($donor->id && $update_donor) {
334 334
 
335 335
 			// Decrement the stats for the donor.
336 336
 			$donor->decrease_donation_count();
337
-			$donor->decrease_value( $amount );
337
+			$donor->decrease_value($amount);
338 338
 
339 339
 		}
340 340
 	}
@@ -346,20 +346,20 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @since 1.0
348 348
 	 */
349
-	do_action( 'give_payment_delete', $payment_id );
349
+	do_action('give_payment_delete', $payment_id);
350 350
 
351
-	if ( $donor->id && $update_donor ) {
351
+	if ($donor->id && $update_donor) {
352 352
 		// Remove the payment ID from the donor.
353
-		$donor->remove_payment( $payment_id );
353
+		$donor->remove_payment($payment_id);
354 354
 	}
355 355
 
356 356
 	// Remove the payment.
357
-	wp_delete_post( $payment_id, true );
357
+	wp_delete_post($payment_id, true);
358 358
 
359
-	Give()->payment_meta->delete_all_meta( $payment_id );
359
+	Give()->payment_meta->delete_all_meta($payment_id);
360 360
 
361 361
 	// Remove related sale log entries.
362
-	Give()->logs->delete_logs( $payment_id );
362
+	Give()->logs->delete_logs($payment_id);
363 363
 
364 364
 	/**
365 365
 	 * Fires after payment deleted.
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @since 1.0
370 370
 	 */
371
-	do_action( 'give_payment_deleted', $payment_id );
371
+	do_action('give_payment_deleted', $payment_id);
372 372
 }
373 373
 
374 374
 /**
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return void
385 385
  */
386
-function give_undo_donation( $payment_id ) {
386
+function give_undo_donation($payment_id) {
387 387
 
388
-	$payment = new Give_Payment( $payment_id );
388
+	$payment = new Give_Payment($payment_id);
389 389
 
390
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
391
-	if ( true === $maybe_decrease_earnings ) {
390
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
391
+	if (true === $maybe_decrease_earnings) {
392 392
 		// Decrease earnings.
393
-		give_decrease_form_earnings( $payment->form_id, $payment->total, $payment_id );
393
+		give_decrease_form_earnings($payment->form_id, $payment->total, $payment_id);
394 394
 	}
395 395
 
396
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
397
-	if ( true === $maybe_decrease_donations ) {
396
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
397
+	if (true === $maybe_decrease_donations) {
398 398
 		// Decrease donation count.
399
-		give_decrease_donation_count( $payment->form_id );
399
+		give_decrease_donation_count($payment->form_id);
400 400
 	}
401 401
 
402 402
 }
@@ -413,21 +413,21 @@  discard block
 block discarded – undo
413 413
  *
414 414
  * @return object $stats Contains the number of payments per payment status.
415 415
  */
416
-function give_count_payments( $args = array() ) {
416
+function give_count_payments($args = array()) {
417 417
 	// Backward compatibility.
418
-	if ( ! empty( $args['start-date'] ) ) {
418
+	if ( ! empty($args['start-date'])) {
419 419
 		$args['start_date'] = $args['start-date'];
420
-		unset( $args['start-date'] );
420
+		unset($args['start-date']);
421 421
 	}
422 422
 
423
-	if ( ! empty( $args['end-date'] ) ) {
423
+	if ( ! empty($args['end-date'])) {
424 424
 		$args['end_date'] = $args['end-date'];
425
-		unset( $args['end-date'] );
425
+		unset($args['end-date']);
426 426
 	}
427 427
 
428
-	if ( ! empty( $args['form_id'] ) ) {
428
+	if ( ! empty($args['form_id'])) {
429 429
 		$args['give_forms'] = $args['form_id'];
430
-		unset( $args['form_id'] );
430
+		unset($args['form_id']);
431 431
 	}
432 432
 
433 433
 	// Extract all donations
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	$args['group_by'] = 'post_status';
436 436
 	$args['count']    = 'true';
437 437
 
438
-	$donations_obj   = new Give_Payments_Query( $args );
438
+	$donations_obj   = new Give_Payments_Query($args);
439 439
 	$donations_count = $donations_obj->get_payment_by_group();
440 440
 
441 441
 	/**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @since 1.0
445 445
 	 */
446
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
446
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
447 447
 }
448 448
 
449 449
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
  *
457 457
  * @return bool $exists True if payment exists, false otherwise.
458 458
  */
459
-function give_check_for_existing_payment( $payment_id ) {
459
+function give_check_for_existing_payment($payment_id) {
460 460
 	global $wpdb;
461 461
 
462 462
 	return (bool) $wpdb->get_var(
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
  *
485 485
  * @return bool|mixed True if payment status exists, false otherwise.
486 486
  */
487
-function give_get_payment_status( $payment_id, $return_label = false ) {
487
+function give_get_payment_status($payment_id, $return_label = false) {
488 488
 
489
-	if ( ! is_numeric( $payment_id ) ) {
489
+	if ( ! is_numeric($payment_id)) {
490 490
 		if (
491 491
 			$payment_id instanceof  Give_Payment
492 492
 			|| $payment_id instanceof WP_Post
@@ -495,28 +495,28 @@  discard block
 block discarded – undo
495 495
 		}
496 496
 	}
497 497
 
498
-	if ( ! $payment_id > 0 ) {
498
+	if ( ! $payment_id > 0) {
499 499
 		return false;
500 500
 	}
501 501
 
502
-	$payment_status = get_post_status( $payment_id );
502
+	$payment_status = get_post_status($payment_id);
503 503
 
504 504
 	$statuses = give_get_payment_statuses();
505 505
 
506
-	if ( empty( $payment_status ) || ! is_array( $statuses ) || empty( $statuses ) ) {
506
+	if (empty($payment_status) || ! is_array($statuses) || empty($statuses)) {
507 507
 		return false;
508 508
 	}
509 509
 
510
-	if ( array_key_exists( $payment_status, $statuses ) ) {
511
-		if ( true === $return_label ) {
510
+	if (array_key_exists($payment_status, $statuses)) {
511
+		if (true === $return_label) {
512 512
 			// Return translated status label.
513
-			return $statuses[ $payment_status ];
513
+			return $statuses[$payment_status];
514 514
 		} else {
515 515
 			// Account that our 'publish' status is labeled 'Complete'
516 516
 			$post_status = 'publish' === $payment_status ? 'Complete' : $payment_status;
517 517
 
518 518
 			// Make sure we're matching cases, since they matter
519
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
519
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
520 520
 		}
521 521
 	}
522 522
 
@@ -532,18 +532,18 @@  discard block
 block discarded – undo
532 532
  */
533 533
 function give_get_payment_statuses() {
534 534
 	$payment_statuses = array(
535
-		'pending'     => __( 'Pending', 'give' ),
536
-		'publish'     => __( 'Complete', 'give' ),
537
-		'refunded'    => __( 'Refunded', 'give' ),
538
-		'failed'      => __( 'Failed', 'give' ),
539
-		'cancelled'   => __( 'Cancelled', 'give' ),
540
-		'abandoned'   => __( 'Abandoned', 'give' ),
541
-		'preapproval' => __( 'Pre-Approved', 'give' ),
542
-		'processing'  => __( 'Processing', 'give' ),
543
-		'revoked'     => __( 'Revoked', 'give' ),
535
+		'pending'     => __('Pending', 'give'),
536
+		'publish'     => __('Complete', 'give'),
537
+		'refunded'    => __('Refunded', 'give'),
538
+		'failed'      => __('Failed', 'give'),
539
+		'cancelled'   => __('Cancelled', 'give'),
540
+		'abandoned'   => __('Abandoned', 'give'),
541
+		'preapproval' => __('Pre-Approved', 'give'),
542
+		'processing'  => __('Processing', 'give'),
543
+		'revoked'     => __('Revoked', 'give'),
544 544
 	);
545 545
 
546
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
546
+	return apply_filters('give_payment_statuses', $payment_statuses);
547 547
 }
548 548
 
549 549
 /**
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
  * @return array $payment_status All the available payment statuses.
557 557
  */
558 558
 function give_get_payment_status_keys() {
559
-	$statuses = array_keys( give_get_payment_statuses() );
560
-	asort( $statuses );
559
+	$statuses = array_keys(give_get_payment_statuses());
560
+	asort($statuses);
561 561
 
562
-	return array_values( $statuses );
562
+	return array_values($statuses);
563 563
 }
564 564
 
565 565
 /**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
  *
575 575
  * @return int $earnings Earnings
576 576
  */
577
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
577
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
578 578
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
579 579
 	global $wpdb;
580 580
 
@@ -583,37 +583,37 @@  discard block
 block discarded – undo
583 583
 		'nopaging'               => true,
584 584
 		'year'                   => $year,
585 585
 		'monthnum'               => $month_num,
586
-		'post_status'            => array( 'publish' ),
586
+		'post_status'            => array('publish'),
587 587
 		'fields'                 => 'ids',
588 588
 		'update_post_term_cache' => false,
589 589
 	);
590
-	if ( ! empty( $day ) ) {
590
+	if ( ! empty($day)) {
591 591
 		$args['day'] = $day;
592 592
 	}
593 593
 
594
-	if ( isset( $hour ) ) {
594
+	if (isset($hour)) {
595 595
 		$args['hour'] = $hour;
596 596
 	}
597 597
 
598
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
599
-	$key  = Give_Cache::get_key( 'give_stats', $args );
598
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
599
+	$key  = Give_Cache::get_key('give_stats', $args);
600 600
 
601
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
601
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
602 602
 		$earnings = false;
603 603
 	} else {
604
-		$earnings = Give_Cache::get( $key );
604
+		$earnings = Give_Cache::get($key);
605 605
 	}
606 606
 
607
-	if ( false === $earnings ) {
608
-		$donations = get_posts( $args );
607
+	if (false === $earnings) {
608
+		$donations = get_posts($args);
609 609
 		$earnings  = 0;
610 610
 
611 611
 		$donation_table     = Give()->payment_meta->table_name;
612
-		$donation_table_col = Give()->payment_meta->get_meta_type() . '_id';
612
+		$donation_table_col = Give()->payment_meta->get_meta_type().'_id';
613 613
 
614
-		if ( $donations ) {
615
-			$donations      = implode( ',', $donations );
616
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM {$donation_table} WHERE meta_key = '_give_payment_total' AND {$donation_table_col} IN ({$donations})" );
614
+		if ($donations) {
615
+			$donations      = implode(',', $donations);
616
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM {$donation_table} WHERE meta_key = '_give_payment_total' AND {$donation_table_col} IN ({$donations})");
617 617
 
618 618
 			/**
619 619
 			 * Filter The earnings by dates.
@@ -624,13 +624,13 @@  discard block
 block discarded – undo
624 624
 			 * @param array $donations      Donations lists.
625 625
 			 * @param array $args           Donation query args.
626 626
 			 */
627
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
627
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
628 628
 		}
629 629
 		// Cache the results for one hour.
630
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
630
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
631 631
 	}
632 632
 
633
-	return round( $earnings, 2 );
633
+	return round($earnings, 2);
634 634
 }
635 635
 
636 636
 /**
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
  *
646 646
  * @return int $count Sales
647 647
  */
648
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
648
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
649 649
 
650 650
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
651 651
 	$args = array(
@@ -653,14 +653,14 @@  discard block
 block discarded – undo
653 653
 		'nopaging'               => true,
654 654
 		'year'                   => $year,
655 655
 		'fields'                 => 'ids',
656
-		'post_status'            => array( 'publish' ),
656
+		'post_status'            => array('publish'),
657 657
 		'update_post_meta_cache' => false,
658 658
 		'update_post_term_cache' => false,
659 659
 	);
660 660
 
661
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
661
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
662 662
 
663
-	if ( false === $show_free ) {
663
+	if (false === $show_free) {
664 664
 		$args['meta_query'] = array(
665 665
 			array(
666 666
 				'key'     => '_give_payment_total',
@@ -671,33 +671,33 @@  discard block
 block discarded – undo
671 671
 		);
672 672
 	}
673 673
 
674
-	if ( ! empty( $month_num ) ) {
674
+	if ( ! empty($month_num)) {
675 675
 		$args['monthnum'] = $month_num;
676 676
 	}
677 677
 
678
-	if ( ! empty( $day ) ) {
678
+	if ( ! empty($day)) {
679 679
 		$args['day'] = $day;
680 680
 	}
681 681
 
682
-	if ( isset( $hour ) ) {
682
+	if (isset($hour)) {
683 683
 		$args['hour'] = $hour;
684 684
 	}
685 685
 
686
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
686
+	$args = apply_filters('give_get_sales_by_date_args', $args);
687 687
 
688
-	$key = Give_Cache::get_key( 'give_stats', $args );
688
+	$key = Give_Cache::get_key('give_stats', $args);
689 689
 
690
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
690
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
691 691
 		$count = false;
692 692
 	} else {
693
-		$count = Give_Cache::get( $key );
693
+		$count = Give_Cache::get($key);
694 694
 	}
695 695
 
696
-	if ( false === $count ) {
697
-		$donations = new WP_Query( $args );
696
+	if (false === $count) {
697
+		$donations = new WP_Query($args);
698 698
 		$count     = (int) $donations->post_count;
699 699
 		// Cache the results for one hour.
700
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
700
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
701 701
 	}
702 702
 
703 703
 	return $count;
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
  *
713 713
  * @return bool $ret True if complete, false otherwise.
714 714
  */
715
-function give_is_payment_complete( $payment_id ) {
715
+function give_is_payment_complete($payment_id) {
716 716
 	$ret            = false;
717 717
 	$payment_status = '';
718 718
 
719
-	if ( $payment_id > 0 && 'give_payment' === get_post_type( $payment_id ) ) {
720
-		$payment_status = get_post_status( $payment_id );
719
+	if ($payment_id > 0 && 'give_payment' === get_post_type($payment_id)) {
720
+		$payment_status = get_post_status($payment_id);
721 721
 
722
-		if ( 'publish' === $payment_status ) {
722
+		if ('publish' === $payment_status) {
723 723
 			$ret = true;
724 724
 		}
725 725
 	}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 	 *
730 730
 	 * @since 1.0
731 731
 	 */
732
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment_status );
732
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment_status);
733 733
 }
734 734
 
735 735
 /**
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
  *
756 756
  * @return float $total Total earnings.
757 757
  */
758
-function give_get_total_earnings( $recalculate = false ) {
758
+function give_get_total_earnings($recalculate = false) {
759 759
 
760
-	$total      = get_option( 'give_earnings_total', 0 );
761
-	$meta_table = __give_v20_bc_table_details( 'payment' );
760
+	$total      = get_option('give_earnings_total', 0);
761
+	$meta_table = __give_v20_bc_table_details('payment');
762 762
 
763 763
 	// Calculate total earnings.
764
-	if ( ! $total || $recalculate ) {
764
+	if ( ! $total || $recalculate) {
765 765
 		global $wpdb;
766 766
 
767 767
 		$total = (float) 0;
@@ -769,38 +769,38 @@  discard block
 block discarded – undo
769 769
 		$args = apply_filters(
770 770
 			'give_get_total_earnings_args', array(
771 771
 				'offset' => 0,
772
-				'number' => - 1,
773
-				'status' => array( 'publish' ),
772
+				'number' => -1,
773
+				'status' => array('publish'),
774 774
 				'fields' => 'ids',
775 775
 			)
776 776
 		);
777 777
 
778
-		$payments = give_get_payments( $args );
779
-		if ( $payments ) {
778
+		$payments = give_get_payments($args);
779
+		if ($payments) {
780 780
 
781 781
 			/**
782 782
 			 * If performing a donation, we need to skip the very last payment in the database,
783 783
 			 * since it calls give_increase_total_earnings() on completion,
784 784
 			 * which results in duplicated earnings for the very first donation.
785 785
 			 */
786
-			if ( did_action( 'give_update_payment_status' ) ) {
787
-				array_pop( $payments );
786
+			if (did_action('give_update_payment_status')) {
787
+				array_pop($payments);
788 788
 			}
789 789
 
790
-			if ( ! empty( $payments ) ) {
791
-				$payments = implode( ',', $payments );
792
-				$total   += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
790
+			if ( ! empty($payments)) {
791
+				$payments = implode(',', $payments);
792
+				$total   += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
793 793
 			}
794 794
 		}
795 795
 
796
-		update_option( 'give_earnings_total', $total, false );
796
+		update_option('give_earnings_total', $total, false);
797 797
 	}
798 798
 
799
-	if ( $total < 0 ) {
799
+	if ($total < 0) {
800 800
 		$total = 0; // Don't ever show negative earnings.
801 801
 	}
802 802
 
803
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
803
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
804 804
 }
805 805
 
806 806
 /**
@@ -812,10 +812,10 @@  discard block
 block discarded – undo
812 812
  *
813 813
  * @return float $total Total earnings.
814 814
  */
815
-function give_increase_total_earnings( $amount = 0 ) {
815
+function give_increase_total_earnings($amount = 0) {
816 816
 	$total  = give_get_total_earnings();
817 817
 	$total += $amount;
818
-	update_option( 'give_earnings_total', $total, false );
818
+	update_option('give_earnings_total', $total, false);
819 819
 
820 820
 	return $total;
821 821
 }
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
  *
830 830
  * @return float $total Total earnings.
831 831
  */
832
-function give_decrease_total_earnings( $amount = 0 ) {
832
+function give_decrease_total_earnings($amount = 0) {
833 833
 	$total  = give_get_total_earnings();
834 834
 	$total -= $amount;
835
-	if ( $total < 0 ) {
835
+	if ($total < 0) {
836 836
 		$total = 0;
837 837
 	}
838
-	update_option( 'give_earnings_total', $total, false );
838
+	update_option('give_earnings_total', $total, false);
839 839
 
840 840
 	return $total;
841 841
 }
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed $meta Payment Meta.
853 853
  */
854
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
855
-	return give_get_meta( $payment_id, $meta_key, $single );
854
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
855
+	return give_get_meta($payment_id, $meta_key, $single);
856 856
 }
857 857
 
858 858
 /**
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
  *
866 866
  * @return mixed Meta ID if successful, false if unsuccessful.
867 867
  */
868
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
869
-	return give_update_meta( $payment_id, $meta_key, $meta_value );
868
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
869
+	return give_update_meta($payment_id, $meta_key, $meta_value);
870 870
 }
871 871
 
872 872
 /**
@@ -878,34 +878,34 @@  discard block
 block discarded – undo
878 878
  *
879 879
  * @return array $user_info User Info Meta Values.
880 880
  */
881
-function give_get_payment_meta_user_info( $payment_id ) {
881
+function give_get_payment_meta_user_info($payment_id) {
882 882
 	$donor_id   = 0;
883 883
 	$donor_info = array(
884
-		'first_name' => give_get_meta( $payment_id, '_give_donor_billing_first_name', true ),
885
-		'last_name'  => give_get_meta( $payment_id, '_give_donor_billing_last_name', true ),
886
-		'email'      => give_get_meta( $payment_id, '_give_donor_billing_donor_email', true ),
884
+		'first_name' => give_get_meta($payment_id, '_give_donor_billing_first_name', true),
885
+		'last_name'  => give_get_meta($payment_id, '_give_donor_billing_last_name', true),
886
+		'email'      => give_get_meta($payment_id, '_give_donor_billing_donor_email', true),
887 887
 	);
888 888
 
889
-	if ( empty( $donor_info['first_name'] ) ) {
890
-		$donor_id                 = give_get_payment_donor_id( $payment_id );
891
-		$donor_info['first_name'] = Give()->donor_meta->get_meta( $donor_id, '_give_donor_first_name', true );
889
+	if (empty($donor_info['first_name'])) {
890
+		$donor_id                 = give_get_payment_donor_id($payment_id);
891
+		$donor_info['first_name'] = Give()->donor_meta->get_meta($donor_id, '_give_donor_first_name', true);
892 892
 	}
893 893
 
894
-	if ( empty( $donor_info['last_name'] ) ) {
895
-		$donor_id                = $donor_id ? $donor_id : give_get_payment_donor_id( $payment_id );
896
-		$donor_info['last_name'] = Give()->donor_meta->get_meta( $donor_id, '_give_donor_last_name', true );
894
+	if (empty($donor_info['last_name'])) {
895
+		$donor_id                = $donor_id ? $donor_id : give_get_payment_donor_id($payment_id);
896
+		$donor_info['last_name'] = Give()->donor_meta->get_meta($donor_id, '_give_donor_last_name', true);
897 897
 	}
898 898
 
899
-	if ( empty( $donor_info['email'] ) ) {
900
-		$donor_id            = $donor_id ? $donor_id : give_get_payment_donor_id( $payment_id );
901
-		$donor_info['email'] = Give()->donors->get_column_by( 'email', 'id', $donor_id );
899
+	if (empty($donor_info['email'])) {
900
+		$donor_id            = $donor_id ? $donor_id : give_get_payment_donor_id($payment_id);
901
+		$donor_info['email'] = Give()->donors->get_column_by('email', 'id', $donor_id);
902 902
 	}
903 903
 
904
-	$donor_info['title'] = Give()->donor_meta->get_meta( $donor_id, '_give_donor_title_prefix', true );
904
+	$donor_info['title'] = Give()->donor_meta->get_meta($donor_id, '_give_donor_title_prefix', true);
905 905
 
906
-	$donor_info['address']  = give_get_donation_address( $payment_id );
907
-	$donor_info['id']       = give_get_payment_user_id( $payment_id );
908
-	$donor_info['donor_id'] = give_get_payment_donor_id( $payment_id );
906
+	$donor_info['address']  = give_get_donation_address($payment_id);
907
+	$donor_info['id']       = give_get_payment_user_id($payment_id);
908
+	$donor_info['donor_id'] = give_get_payment_donor_id($payment_id);
909 909
 
910 910
 	return $donor_info;
911 911
 }
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
  *
922 922
  * @return int $form_id Form ID.
923 923
  */
924
-function give_get_payment_form_id( $payment_id ) {
925
-	return (int) give_get_meta( $payment_id, '_give_payment_form_id', true );
924
+function give_get_payment_form_id($payment_id) {
925
+	return (int) give_get_meta($payment_id, '_give_payment_form_id', true);
926 926
 }
927 927
 
928 928
 /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return string $email User email.
936 936
  */
937
-function give_get_payment_user_email( $payment_id ) {
938
-	$email = give_get_meta( $payment_id, '_give_payment_donor_email', true );
937
+function give_get_payment_user_email($payment_id) {
938
+	$email = give_get_meta($payment_id, '_give_payment_donor_email', true);
939 939
 
940
-	if ( empty( $email ) && ( $donor_id = give_get_payment_donor_id( $payment_id ) ) ) {
941
-		$email = Give()->donors->get_column( 'email', $donor_id );
940
+	if (empty($email) && ($donor_id = give_get_payment_donor_id($payment_id))) {
941
+		$email = Give()->donors->get_column('email', $donor_id);
942 942
 	}
943 943
 
944 944
 	return $email;
@@ -953,11 +953,11 @@  discard block
 block discarded – undo
953 953
  *
954 954
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
955 955
  */
956
-function give_is_guest_payment( $payment_id ) {
957
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
958
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
956
+function give_is_guest_payment($payment_id) {
957
+	$payment_user_id  = give_get_payment_user_id($payment_id);
958
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
959 959
 
960
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
960
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
961 961
 }
962 962
 
963 963
 /**
@@ -969,10 +969,10 @@  discard block
 block discarded – undo
969 969
  *
970 970
  * @return int $user_id User ID.
971 971
  */
972
-function give_get_payment_user_id( $payment_id ) {
972
+function give_get_payment_user_id($payment_id) {
973 973
 	global $wpdb;
974 974
 	$paymentmeta_table = Give()->payment_meta->table_name;
975
-	$donationmeta_primary_key = Give()->payment_meta->get_meta_type() . '_id';
975
+	$donationmeta_primary_key = Give()->payment_meta->get_meta_type().'_id';
976 976
 
977 977
 	return (int) $wpdb->get_var(
978 978
 		$wpdb->prepare(
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @return int $payment->customer_id Donor ID.
1003 1003
  */
1004
-function give_get_payment_donor_id( $payment_id ) {
1005
-	return give_get_meta( $payment_id, '_give_payment_donor_id', true );
1004
+function give_get_payment_donor_id($payment_id) {
1005
+	return give_get_meta($payment_id, '_give_payment_donor_id', true);
1006 1006
 }
1007 1007
 
1008 1008
 /**
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
  *
1015 1015
  * @return string
1016 1016
  */
1017
-function give_get_donation_donor_email( $payment_id ) {
1018
-	return give_get_meta( $payment_id, '_give_payment_donor_email', true );
1017
+function give_get_donation_donor_email($payment_id) {
1018
+	return give_get_meta($payment_id, '_give_payment_donor_email', true);
1019 1019
 }
1020 1020
 
1021 1021
 /**
@@ -1027,8 +1027,8 @@  discard block
 block discarded – undo
1027 1027
  *
1028 1028
  * @return string $ip User IP.
1029 1029
  */
1030
-function give_get_payment_user_ip( $payment_id ) {
1031
-	return give_get_meta( $payment_id, '_give_payment_donor_ip', true );
1030
+function give_get_payment_user_ip($payment_id) {
1031
+	return give_get_meta($payment_id, '_give_payment_donor_ip', true);
1032 1032
 }
1033 1033
 
1034 1034
 /**
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return string $date The date the payment was completed.
1042 1042
  */
1043
-function give_get_payment_completed_date( $payment_id = 0 ) {
1044
-	return give_get_meta( $payment_id, '_give_completed_date', true );
1043
+function give_get_payment_completed_date($payment_id = 0) {
1044
+	return give_get_meta($payment_id, '_give_completed_date', true);
1045 1045
 }
1046 1046
 
1047 1047
 /**
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
  *
1054 1054
  * @return string $gateway Gateway.
1055 1055
  */
1056
-function give_get_payment_gateway( $payment_id ) {
1057
-	return give_get_meta( $payment_id, '_give_payment_gateway', true );
1056
+function give_get_payment_gateway($payment_id) {
1057
+	return give_get_meta($payment_id, '_give_payment_gateway', true);
1058 1058
 }
1059 1059
 
1060 1060
 /**
@@ -1067,10 +1067,9 @@  discard block
 block discarded – undo
1067 1067
  *
1068 1068
  * @return bool
1069 1069
  */
1070
-function give_has_payment_gateway( $donation_id, $gateway_id ) {
1070
+function give_has_payment_gateway($donation_id, $gateway_id) {
1071 1071
 	$donation_gateway = $donation_id instanceof Give_Payment ?
1072
-		$donation_id->gateway :
1073
-		give_get_payment_gateway( $donation_id );
1072
+		$donation_id->gateway : give_get_payment_gateway($donation_id);
1074 1073
 
1075 1074
 	return $gateway_id === $donation_gateway;
1076 1075
 }
@@ -1084,8 +1083,8 @@  discard block
 block discarded – undo
1084 1083
  *
1085 1084
  * @return string $currency The currency code.
1086 1085
  */
1087
-function give_get_payment_currency_code( $payment_id = 0 ) {
1088
-	return give_get_meta( $payment_id, '_give_payment_currency', true );
1086
+function give_get_payment_currency_code($payment_id = 0) {
1087
+	return give_get_meta($payment_id, '_give_payment_currency', true);
1089 1088
 }
1090 1089
 
1091 1090
 /**
@@ -1097,10 +1096,10 @@  discard block
 block discarded – undo
1097 1096
  *
1098 1097
  * @return string $currency The currency name.
1099 1098
  */
1100
-function give_get_payment_currency( $payment_id = 0 ) {
1101
-	$currency = give_get_payment_currency_code( $payment_id );
1099
+function give_get_payment_currency($payment_id = 0) {
1100
+	$currency = give_get_payment_currency_code($payment_id);
1102 1101
 
1103
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1102
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1104 1103
 }
1105 1104
 
1106 1105
 /**
@@ -1112,8 +1111,8 @@  discard block
 block discarded – undo
1112 1111
  *
1113 1112
  * @return string $key Donation key.
1114 1113
  */
1115
-function give_get_payment_key( $payment_id = 0 ) {
1116
-	return give_get_meta( $payment_id, '_give_payment_purchase_key', true );
1114
+function give_get_payment_key($payment_id = 0) {
1115
+	return give_get_meta($payment_id, '_give_payment_purchase_key', true);
1117 1116
 }
1118 1117
 
1119 1118
 /**
@@ -1127,8 +1126,8 @@  discard block
 block discarded – undo
1127 1126
  *
1128 1127
  * @return string $number Payment order number.
1129 1128
  */
1130
-function give_get_payment_number( $payment_id = 0 ) {
1131
-	return Give()->seq_donation_number->get_serial_code( $payment_id );
1129
+function give_get_payment_number($payment_id = 0) {
1130
+	return Give()->seq_donation_number->get_serial_code($payment_id);
1132 1131
 }
1133 1132
 
1134 1133
 
@@ -1146,17 +1145,17 @@  discard block
 block discarded – undo
1146 1145
  *
1147 1146
  * @return string $amount Fully formatted donation amount.
1148 1147
  */
1149
-function give_donation_amount( $donation_id, $format_args = array() ) {
1150
-	if ( ! $donation_id ) {
1148
+function give_donation_amount($donation_id, $format_args = array()) {
1149
+	if ( ! $donation_id) {
1151 1150
 		return '';
1152
-	} elseif ( ! is_numeric( $donation_id ) && ( $donation_id instanceof Give_Payment ) ) {
1151
+	} elseif ( ! is_numeric($donation_id) && ($donation_id instanceof Give_Payment)) {
1153 1152
 		$donation_id = $donation_id->ID;
1154 1153
 	}
1155 1154
 
1156
-	$amount        = $formatted_amount = give_get_payment_total( $donation_id );
1157
-	$currency_code = give_get_payment_currency_code( $donation_id );
1155
+	$amount        = $formatted_amount = give_get_payment_total($donation_id);
1156
+	$currency_code = give_get_payment_currency_code($donation_id);
1158 1157
 
1159
-	if ( is_bool( $format_args ) ) {
1158
+	if (is_bool($format_args)) {
1160 1159
 		$format_args = array(
1161 1160
 			'currency' => (bool) $format_args,
1162 1161
 			'amount'   => (bool) $format_args,
@@ -1179,27 +1178,25 @@  discard block
 block discarded – undo
1179 1178
 		)
1180 1179
 	);
1181 1180
 
1182
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1181
+	if ($format_args['amount'] || $format_args['currency']) {
1183 1182
 
1184
-		if ( $format_args['amount'] ) {
1183
+		if ($format_args['amount']) {
1185 1184
 
1186 1185
 			$formatted_amount = give_format_amount(
1187 1186
 				$amount,
1188
-				! is_array( $format_args['amount'] ) ?
1187
+				! is_array($format_args['amount']) ?
1189 1188
 					array(
1190 1189
 						'sanitize' => false,
1191 1190
 						'currency' => $currency_code,
1192
-					) :
1193
-					$format_args['amount']
1191
+					) : $format_args['amount']
1194 1192
 			);
1195 1193
 		}
1196 1194
 
1197
-		if ( $format_args['currency'] ) {
1195
+		if ($format_args['currency']) {
1198 1196
 			$formatted_amount = give_currency_filter(
1199 1197
 				$formatted_amount,
1200
-				! is_array( $format_args['currency'] ) ?
1201
-					array( 'currency_code' => $currency_code ) :
1202
-					$format_args['currency']
1198
+				! is_array($format_args['currency']) ?
1199
+					array('currency_code' => $currency_code) : $format_args['currency']
1203 1200
 			);
1204 1201
 		}
1205 1202
 	}
@@ -1214,7 +1211,7 @@  discard block
 block discarded – undo
1214 1211
 	 * @param int    $donation_id      Donation ID.
1215 1212
 	 * @param string $type             Donation amount type.
1216 1213
 	 */
1217
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation_id, $format_args );
1214
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation_id, $format_args);
1218 1215
 }
1219 1216
 
1220 1217
 /**
@@ -1231,10 +1228,10 @@  discard block
 block discarded – undo
1231 1228
  *
1232 1229
  * @return array Fully formatted payment subtotal.
1233 1230
  */
1234
-function give_payment_subtotal( $payment_id = 0 ) {
1235
-	$subtotal = give_get_payment_subtotal( $payment_id );
1231
+function give_payment_subtotal($payment_id = 0) {
1232
+	$subtotal = give_get_payment_subtotal($payment_id);
1236 1233
 
1237
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1234
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1238 1235
 }
1239 1236
 
1240 1237
 /**
@@ -1248,8 +1245,8 @@  discard block
 block discarded – undo
1248 1245
  *
1249 1246
  * @return float $subtotal Subtotal for payment (non formatted).
1250 1247
  */
1251
-function give_get_payment_subtotal( $payment_id = 0 ) {
1252
-	$payment = new Give_Payment( $payment_id );
1248
+function give_get_payment_subtotal($payment_id = 0) {
1249
+	$payment = new Give_Payment($payment_id);
1253 1250
 
1254 1251
 	return $payment->subtotal;
1255 1252
 }
@@ -1263,12 +1260,12 @@  discard block
 block discarded – undo
1263 1260
  *
1264 1261
  * @return string The donation ID.
1265 1262
  */
1266
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1267
-	$transaction_id = give_get_meta( $payment_id, '_give_payment_transaction_id', true );
1263
+function give_get_payment_transaction_id($payment_id = 0) {
1264
+	$transaction_id = give_get_meta($payment_id, '_give_payment_transaction_id', true);
1268 1265
 
1269
-	if ( empty( $transaction_id ) ) {
1270
-		$gateway        = give_get_payment_gateway( $payment_id );
1271
-		$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $payment_id );
1266
+	if (empty($transaction_id)) {
1267
+		$gateway        = give_get_payment_gateway($payment_id);
1268
+		$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $payment_id);
1272 1269
 	}
1273 1270
 
1274 1271
 	return $transaction_id;
@@ -1284,15 +1281,15 @@  discard block
 block discarded – undo
1284 1281
  *
1285 1282
  * @return bool|mixed
1286 1283
  */
1287
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1284
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1288 1285
 
1289
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1286
+	if (empty($payment_id) || empty($transaction_id)) {
1290 1287
 		return false;
1291 1288
 	}
1292 1289
 
1293
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1290
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1294 1291
 
1295
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1292
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1296 1293
 }
1297 1294
 
1298 1295
 /**
@@ -1305,10 +1302,10 @@  discard block
 block discarded – undo
1305 1302
  *
1306 1303
  * @return int $purchase Donation ID.
1307 1304
  */
1308
-function give_get_donation_id_by_key( $key ) {
1305
+function give_get_donation_id_by_key($key) {
1309 1306
 	global $wpdb;
1310 1307
 
1311
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1308
+	$meta_table = __give_v20_bc_table_details('payment');
1312 1309
 
1313 1310
 	$purchase = $wpdb->get_var(
1314 1311
 		$wpdb->prepare(
@@ -1324,7 +1321,7 @@  discard block
 block discarded – undo
1324 1321
 		)
1325 1322
 	);
1326 1323
 
1327
-	if ( $purchase != null ) {
1324
+	if ($purchase != null) {
1328 1325
 		return $purchase;
1329 1326
 	}
1330 1327
 
@@ -1342,13 +1339,13 @@  discard block
 block discarded – undo
1342 1339
  *
1343 1340
  * @return int $purchase Donation ID.
1344 1341
  */
1345
-function give_get_purchase_id_by_transaction_id( $key ) {
1342
+function give_get_purchase_id_by_transaction_id($key) {
1346 1343
 	global $wpdb;
1347
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1344
+	$meta_table = __give_v20_bc_table_details('payment');
1348 1345
 
1349
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1346
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1350 1347
 
1351
-	if ( $purchase != null ) {
1348
+	if ($purchase != null) {
1352 1349
 		return $purchase;
1353 1350
 	}
1354 1351
 
@@ -1365,8 +1362,8 @@  discard block
 block discarded – undo
1365 1362
  *
1366 1363
  * @return array $notes Donation Notes
1367 1364
  */
1368
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1369
-	return Give_Comment::get( $payment_id,'payment', array(), $search );
1365
+function give_get_payment_notes($payment_id = 0, $search = '') {
1366
+	return Give_Comment::get($payment_id, 'payment', array(), $search);
1370 1367
 }
1371 1368
 
1372 1369
 
@@ -1380,8 +1377,8 @@  discard block
 block discarded – undo
1380 1377
  *
1381 1378
  * @return int The new note ID
1382 1379
  */
1383
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1384
-	return Give_Comment::add( $payment_id, $note, 'payment' );
1380
+function give_insert_payment_note($payment_id = 0, $note = '') {
1381
+	return Give_Comment::add($payment_id, $note, 'payment');
1385 1382
 }
1386 1383
 
1387 1384
 /**
@@ -1394,8 +1391,8 @@  discard block
 block discarded – undo
1394 1391
  *
1395 1392
  * @return bool True on success, false otherwise.
1396 1393
  */
1397
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1398
-	return Give_Comment::delete( $comment_id, $payment_id, 'payment' );
1394
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1395
+	return Give_Comment::delete($comment_id, $payment_id, 'payment');
1399 1396
 }
1400 1397
 
1401 1398
 /**
@@ -1408,20 +1405,20 @@  discard block
 block discarded – undo
1408 1405
  *
1409 1406
  * @return string
1410 1407
  */
1411
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1408
+function give_get_payment_note_html($note, $payment_id = 0) {
1412 1409
 
1413
-	if ( is_numeric( $note ) ) {
1414
-		$note = get_comment( $note );
1410
+	if (is_numeric($note)) {
1411
+		$note = get_comment($note);
1415 1412
 	}
1416 1413
 
1417
-	if ( ! empty( $note->user_id ) ) {
1418
-		$user = get_userdata( $note->user_id );
1414
+	if ( ! empty($note->user_id)) {
1415
+		$user = get_userdata($note->user_id);
1419 1416
 		$user = $user->display_name;
1420 1417
 	} else {
1421
-		$user = __( 'System', 'give' );
1418
+		$user = __('System', 'give');
1422 1419
 	}
1423 1420
 
1424
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1421
+	$date_format = give_date_format().', '.get_option('time_format');
1425 1422
 
1426 1423
 	$delete_note_url = wp_nonce_url(
1427 1424
 		add_query_arg(
@@ -1430,14 +1427,14 @@  discard block
 block discarded – undo
1430 1427
 				'note_id'     => $note->comment_ID,
1431 1428
 				'payment_id'  => $payment_id,
1432 1429
 			)
1433
-		), 'give_delete_payment_note_' . $note->comment_ID
1430
+		), 'give_delete_payment_note_'.$note->comment_ID
1434 1431
 	);
1435 1432
 
1436
-	$note_html  = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1433
+	$note_html  = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1437 1434
 	$note_html .= '<p>';
1438
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1435
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1439 1436
 	$note_html .= $note->comment_content;
1440
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1437
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1441 1438
 	$note_html .= '</p>';
1442 1439
 	$note_html .= '</div>';
1443 1440
 
@@ -1456,9 +1453,9 @@  discard block
 block discarded – undo
1456 1453
  *
1457 1454
  * @return string $where Modified where clause.
1458 1455
  */
1459
-function give_filter_where_older_than_week( $where = '' ) {
1456
+function give_filter_where_older_than_week($where = '') {
1460 1457
 	// Payments older than one week.
1461
-	$start  = date( 'Y-m-d', strtotime( '-7 days' ) );
1458
+	$start  = date('Y-m-d', strtotime('-7 days'));
1462 1459
 	$where .= " AND post_date <= '{$start}'";
1463 1460
 
1464 1461
 	return $where;
@@ -1479,13 +1476,13 @@  discard block
 block discarded – undo
1479 1476
  *
1480 1477
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1481 1478
  */
1482
-function give_get_donation_form_title( $donation_id, $args = array() ) {
1479
+function give_get_donation_form_title($donation_id, $args = array()) {
1483 1480
 	// Backward compatibility.
1484
-	if ( ! is_numeric( $donation_id ) && $donation_id instanceof Give_Payment ) {
1481
+	if ( ! is_numeric($donation_id) && $donation_id instanceof Give_Payment) {
1485 1482
 		$donation_id = $donation_id->ID;
1486 1483
 	}
1487 1484
 
1488
-	if ( ! $donation_id ) {
1485
+	if ( ! $donation_id) {
1489 1486
 		return '';
1490 1487
 	}
1491 1488
 
@@ -1494,11 +1491,11 @@  discard block
 block discarded – undo
1494 1491
 		'separator'  => '',
1495 1492
 	);
1496 1493
 
1497
-	$args = wp_parse_args( $args, $defaults );
1494
+	$args = wp_parse_args($args, $defaults);
1498 1495
 
1499
-	$form_id     = give_get_payment_form_id( $donation_id );
1500
-	$price_id    = give_get_meta( $donation_id, '_give_payment_price_id', true );
1501
-	$form_title  = give_get_meta( $donation_id, '_give_payment_form_title', true );
1496
+	$form_id     = give_get_payment_form_id($donation_id);
1497
+	$price_id    = give_get_meta($donation_id, '_give_payment_price_id', true);
1498
+	$form_title  = give_get_meta($donation_id, '_give_payment_form_title', true);
1502 1499
 	$only_level  = $args['only_level'];
1503 1500
 	$separator   = $args['separator'];
1504 1501
 	$level_label = '';
@@ -1514,38 +1511,38 @@  discard block
 block discarded – undo
1514 1511
 		), false
1515 1512
 	);
1516 1513
 
1517
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1514
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1518 1515
 
1519
-	if ( is_null( $form_title_html ) ) {
1520
-		if ( true === $only_level ) {
1516
+	if (is_null($form_title_html)) {
1517
+		if (true === $only_level) {
1521 1518
 			$form_title = '';
1522 1519
 		}
1523 1520
 
1524 1521
 		$form_title_html = $form_title;
1525 1522
 
1526
-		if ( 'custom' === $price_id ) {
1523
+		if ('custom' === $price_id) {
1527 1524
 
1528
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1529
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1525
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1526
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1530 1527
 
1531 1528
 			// Show custom amount level only in backend otherwise hide it.
1532
-			if ( 'set' === give_get_meta( $form_id, '_give_price_option', true ) && ! is_admin() ) {
1529
+			if ('set' === give_get_meta($form_id, '_give_price_option', true) && ! is_admin()) {
1533 1530
 				$level_label = '';
1534 1531
 			}
1535
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1536
-			$level_label = give_get_price_option_name( $form_id, $price_id, $donation_id, false );
1532
+		} elseif (give_has_variable_prices($form_id)) {
1533
+			$level_label = give_get_price_option_name($form_id, $price_id, $donation_id, false);
1537 1534
 		}
1538 1535
 
1539 1536
 		// Only add separator if there is a form title.
1540 1537
 		if (
1541
-			! empty( $form_title_html ) &&
1542
-			! empty( $level_label )
1538
+			! empty($form_title_html) &&
1539
+			! empty($level_label)
1543 1540
 		) {
1544 1541
 			$form_title_html .= " {$separator} ";
1545 1542
 		}
1546 1543
 
1547 1544
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1548
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1545
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1549 1546
 	}
1550 1547
 
1551 1548
 	/**
@@ -1554,7 +1551,7 @@  discard block
 block discarded – undo
1554 1551
 	 * @since 1.0
1555 1552
 	 * @todo: remove third param after 2.1.0
1556 1553
 	 */
1557
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation_id, '' );
1554
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation_id, '');
1558 1555
 }
1559 1556
 
1560 1557
 /**
@@ -1567,19 +1564,19 @@  discard block
 block discarded – undo
1567 1564
  *
1568 1565
  * @return string $price_id
1569 1566
  */
1570
-function give_get_price_id( $form_id, $price ) {
1567
+function give_get_price_id($form_id, $price) {
1571 1568
 	$price_id = null;
1572 1569
 
1573
-	if ( give_has_variable_prices( $form_id ) ) {
1570
+	if (give_has_variable_prices($form_id)) {
1574 1571
 
1575
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1572
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1576 1573
 
1577
-		foreach ( $levels as $level ) {
1574
+		foreach ($levels as $level) {
1578 1575
 
1579
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1576
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1580 1577
 
1581 1578
 			// Check that this indeed the recurring price.
1582
-			if ( $level_amount == $price ) {
1579
+			if ($level_amount == $price) {
1583 1580
 
1584 1581
 				$price_id = $level['_give_id']['level_id'];
1585 1582
 				break;
@@ -1587,13 +1584,13 @@  discard block
 block discarded – undo
1587 1584
 			}
1588 1585
 		}
1589 1586
 
1590
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1587
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1591 1588
 			$price_id = 'custom';
1592 1589
 		}
1593 1590
 	}
1594 1591
 
1595 1592
 	// Price ID must be numeric or string.
1596
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1593
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1597 1594
 
1598 1595
 	/**
1599 1596
 	 * Filter the price id
@@ -1603,7 +1600,7 @@  discard block
 block discarded – undo
1603 1600
 	 * @param string $price_id
1604 1601
 	 * @param int    $form_id
1605 1602
 	 */
1606
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1603
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1607 1604
 }
1608 1605
 
1609 1606
 /**
@@ -1619,10 +1616,10 @@  discard block
 block discarded – undo
1619 1616
  *
1620 1617
  * @return string
1621 1618
  */
1622
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1623
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1619
+function give_get_form_dropdown($args = array(), $echo = false) {
1620
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1624 1621
 
1625
-	if ( ! $echo ) {
1622
+	if ( ! $echo) {
1626 1623
 		return $form_dropdown_html;
1627 1624
 	}
1628 1625
 
@@ -1639,17 +1636,17 @@  discard block
 block discarded – undo
1639 1636
  *
1640 1637
  * @return string|bool
1641 1638
  */
1642
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1639
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1643 1640
 
1644 1641
 	// Check for give form id.
1645
-	if ( empty( $args['id'] ) ) {
1642
+	if (empty($args['id'])) {
1646 1643
 		return false;
1647 1644
 	}
1648 1645
 
1649
-	$form = new Give_Donate_Form( $args['id'] );
1646
+	$form = new Give_Donate_Form($args['id']);
1650 1647
 
1651 1648
 	// Check if form has variable prices or not.
1652
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1649
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1653 1650
 		return false;
1654 1651
 	}
1655 1652
 
@@ -1657,13 +1654,13 @@  discard block
 block discarded – undo
1657 1654
 	$variable_price_options = array();
1658 1655
 
1659 1656
 	// Check if multi donation form support custom donation or not.
1660
-	if ( $form->is_custom_price_mode() ) {
1661
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1657
+	if ($form->is_custom_price_mode()) {
1658
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1662 1659
 	}
1663 1660
 
1664 1661
 	// Get variable price and ID from variable price array.
1665
-	foreach ( $variable_prices as $variable_price ) {
1666
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1662
+	foreach ($variable_prices as $variable_price) {
1663
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1667 1664
 	}
1668 1665
 
1669 1666
 	// Update options.
@@ -1674,9 +1671,9 @@  discard block
 block discarded – undo
1674 1671
 	);
1675 1672
 
1676 1673
 	// Generate select html.
1677
-	$form_dropdown_html = Give()->html->select( $args );
1674
+	$form_dropdown_html = Give()->html->select($args);
1678 1675
 
1679
-	if ( ! $echo ) {
1676
+	if ( ! $echo) {
1680 1677
 		return $form_dropdown_html;
1681 1678
 	}
1682 1679
 
@@ -1695,14 +1692,14 @@  discard block
 block discarded – undo
1695 1692
  *
1696 1693
  * @return string
1697 1694
  */
1698
-function give_get_payment_meta_price_id( $payment_meta ) {
1695
+function give_get_payment_meta_price_id($payment_meta) {
1699 1696
 
1700
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1697
+	if (isset($payment_meta['give_price_id'])) {
1701 1698
 		$price_id = $payment_meta['give_price_id'];
1702
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1699
+	} elseif (isset($payment_meta['price_id'])) {
1703 1700
 		$price_id = $payment_meta['price_id'];
1704 1701
 	} else {
1705
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1702
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1706 1703
 	}
1707 1704
 
1708 1705
 	/**
@@ -1713,7 +1710,7 @@  discard block
 block discarded – undo
1713 1710
 	 * @param string $price_id
1714 1711
 	 * @param array  $payment_meta
1715 1712
 	 */
1716
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1713
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1717 1714
 
1718 1715
 }
1719 1716
 
@@ -1727,10 +1724,10 @@  discard block
 block discarded – undo
1727 1724
  *
1728 1725
  * @return float
1729 1726
  */
1730
-function give_get_payment_total( $payment_id = 0 ) {
1727
+function give_get_payment_total($payment_id = 0) {
1731 1728
 	return round(
1732
-		floatval( give_get_meta( $payment_id, '_give_payment_total', true ) ),
1733
-		give_get_price_decimals( $payment_id )
1729
+		floatval(give_get_meta($payment_id, '_give_payment_total', true)),
1730
+		give_get_price_decimals($payment_id)
1734 1731
 	);
1735 1732
 }
1736 1733
 
@@ -1743,13 +1740,13 @@  discard block
 block discarded – undo
1743 1740
  *
1744 1741
  * @return array
1745 1742
  */
1746
-function give_get_donation_address( $donation_id ) {
1747
-	$address['line1']   = give_get_meta( $donation_id, '_give_donor_billing_address1', true, '' );
1748
-	$address['line2']   = give_get_meta( $donation_id, '_give_donor_billing_address2', true, '' );
1749
-	$address['city']    = give_get_meta( $donation_id, '_give_donor_billing_city', true, '' );
1750
-	$address['state']   = give_get_meta( $donation_id, '_give_donor_billing_state', true, '' );
1751
-	$address['zip']     = give_get_meta( $donation_id, '_give_donor_billing_zip', true, '' );
1752
-	$address['country'] = give_get_meta( $donation_id, '_give_donor_billing_country', true, '' );
1743
+function give_get_donation_address($donation_id) {
1744
+	$address['line1']   = give_get_meta($donation_id, '_give_donor_billing_address1', true, '');
1745
+	$address['line2']   = give_get_meta($donation_id, '_give_donor_billing_address2', true, '');
1746
+	$address['city']    = give_get_meta($donation_id, '_give_donor_billing_city', true, '');
1747
+	$address['state']   = give_get_meta($donation_id, '_give_donor_billing_state', true, '');
1748
+	$address['zip']     = give_get_meta($donation_id, '_give_donor_billing_zip', true, '');
1749
+	$address['country'] = give_get_meta($donation_id, '_give_donor_billing_country', true, '');
1753 1750
 
1754 1751
 	return $address;
1755 1752
 }
@@ -1764,7 +1761,7 @@  discard block
 block discarded – undo
1764 1761
  *
1765 1762
  * @return bool
1766 1763
  */
1767
-function give_is_donation_completed( $donation_id ) {
1764
+function give_is_donation_completed($donation_id) {
1768 1765
 	global $wpdb;
1769 1766
 
1770 1767
 	/**
@@ -1805,10 +1802,10 @@  discard block
 block discarded – undo
1805 1802
  *
1806 1803
  * @return bool
1807 1804
  */
1808
-function give_is_anonymous_donation( $donation_id ) {
1805
+function give_is_anonymous_donation($donation_id) {
1809 1806
 	$value = false;
1810 1807
 
1811
-	if( (int) give_get_meta( $donation_id, '_give_anonymous_donation', true ) ){
1808
+	if ((int) give_get_meta($donation_id, '_give_anonymous_donation', true)) {
1812 1809
 		$value = true;
1813 1810
 	}
1814 1811
 
Please login to merge, or discard this patch.
blocks/load.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if access directly.
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined('ABSPATH')) {
4 4
 	exit;
5 5
 }
6 6
 
7 7
 /**
8 8
 * Blocks
9 9
 */
10
-require_once GIVE_PLUGIN_DIR . 'blocks/donation-form/class-give-donation-form-block.php';
11
-require_once GIVE_PLUGIN_DIR . 'blocks/donation-form-grid/class-give-donation-form-grid-block.php';
10
+require_once GIVE_PLUGIN_DIR.'blocks/donation-form/class-give-donation-form-block.php';
11
+require_once GIVE_PLUGIN_DIR.'blocks/donation-form-grid/class-give-donation-form-grid-block.php';
Please login to merge, or discard this patch.
blocks/donation-form/class-give-donation-form-block.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return Give_Donation_Form_Block
50 50
 	 */
51 51
 	public static function get_instance() {
52
-		if ( null === static::$instance ) {
52
+		if (null === static::$instance) {
53 53
 			self::$instance = new static();
54 54
 
55 55
 			self::$instance->init();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access private
68 68
 	 */
69 69
 	private function init() {
70
-		add_action( 'init', array( $this, 'register_block' ), 999 );
70
+		add_action('init', array($this, 'register_block'), 999);
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function register_block() {
82 82
 		// Bailout.
83
-		if( ! function_exists('register_block_type' ) ) {
83
+		if ( ! function_exists('register_block_type')) {
84 84
 			return;
85 85
 		}
86 86
 
87 87
 		// Register block.
88
-		register_block_type( 'give/donation-form', array(
89
-			'render_callback' => array( $this, 'render_donation_form' ),
88
+		register_block_type('give/donation-form', array(
89
+			'render_callback' => array($this, 'render_donation_form'),
90 90
 			'attributes'      => array(
91 91
 				'id'                  => array(
92 92
 					'type' => 'number',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					'default' => 'none',
111 111
 				),
112 112
 			),
113
-		) );
113
+		));
114 114
 	}
115 115
 
116 116
 	/**
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @access public
122 122
 	 * @return string;
123 123
 	 */
124
-	public function render_donation_form( $attributes ) {
124
+	public function render_donation_form($attributes) {
125 125
 		// Bailout.
126
-		if ( empty( $attributes['id'] ) ) {
126
+		if (empty($attributes['id'])) {
127 127
 			return '';
128 128
 		}
129 129
 
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 		$parameters['show_goal']             = $attributes['showGoal'];
135 135
 		$parameters['show_content']          = $attributes['showContent'];
136 136
 		$parameters['display_style']         = $attributes['displayStyle'];
137
-		$parameters['continue_button_title'] = trim( $attributes['continueButtonTitle'] );
137
+		$parameters['continue_button_title'] = trim($attributes['continueButtonTitle']);
138 138
 
139
-		return give_form_shortcode( $parameters );
139
+		return give_form_shortcode($parameters);
140 140
 	}
141 141
 }
142 142
 
Please login to merge, or discard this patch.