Test Failed
Pull Request — master (#2225)
by Devin
04:31
created
includes/misc-functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
  *
1158 1158
  * @todo  Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828).
1159 1159
  *
1160
- * @return bool
1160
+ * @return false|null
1161 1161
  */
1162 1162
 function give_donation_metabox_menu() {
1163 1163
 
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
  * @param int    $id
1541 1541
  * @param string $meta_key
1542 1542
  * @param mixed  $meta_value
1543
- * @param mixed  $prev_value
1543
+ * @param string  $prev_value
1544 1544
  *
1545 1545
  * @return mixed
1546 1546
  */
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
  * @since 1.8.13
1748 1748
  *
1749 1749
  * @param array      $list      List of objects or arrays
1750
- * @param int|string $field     Field from the object to place instead of the entire object
1750
+ * @param string $field     Field from the object to place instead of the entire object
1751 1751
  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
1752 1752
  *                              Default null.
1753 1753
  *
Please login to merge, or discard this patch.
Spacing   +335 added lines, -335 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return string The currency code
42 42
  */
43
-function give_get_currency( $donation_or_form_id = null, $args = array() ) {
43
+function give_get_currency($donation_or_form_id = null, $args = array()) {
44 44
 
45 45
 	// Get currency from donation
46
-	if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) {
47
-		$donation_meta = give_get_meta( $donation_or_form_id, '_give_payment_meta', true );
46
+	if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) {
47
+		$donation_meta = give_get_meta($donation_or_form_id, '_give_payment_meta', true);
48 48
 
49
-		if ( ! empty( $donation_meta['currency'] ) ) {
49
+		if ( ! empty($donation_meta['currency'])) {
50 50
 			$currency = $donation_meta['currency'];
51 51
 		} else {
52
-			$currency = give_get_option( 'currency', 'USD' );
52
+			$currency = give_get_option('currency', 'USD');
53 53
 		}
54 54
 	} else {
55
-		$currency = give_get_option( 'currency', 'USD' );
55
+		$currency = give_get_option('currency', 'USD');
56 56
 	}
57 57
 
58 58
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @since 1.0
62 62
 	 */
63
-	return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args );
63
+	return apply_filters('give_currency', $currency, $donation_or_form_id, $args);
64 64
 }
65 65
 
66 66
 /**
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function give_get_currency_position() {
74 74
 
75
-	$currency_pos = give_get_option( 'currency_position', 'before' );
75
+	$currency_pos = give_get_option('currency_position', 'before');
76 76
 
77
-	return apply_filters( 'give_currency_position', $currency_pos );
77
+	return apply_filters('give_currency_position', $currency_pos);
78 78
 }
79 79
 
80 80
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
  *
88 88
  * @return array $currencies A list of the available currencies
89 89
  */
90
-function give_get_currencies( $info = 'admin_label' ) {
90
+function give_get_currencies($info = 'admin_label') {
91 91
 	$currencies = array(
92 92
 		'USD'  => array(
93
-			'admin_label' => __( 'US Dollars ($)', 'give' ),
93
+			'admin_label' => __('US Dollars ($)', 'give'),
94 94
 			'symbol'      => '$',
95 95
 			'setting'     => array(
96 96
 				'currency_position'   => 'before',
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			),
101 101
 		),
102 102
 		'EUR'  => array(
103
-			'admin_label' => __( 'Euros (€)', 'give' ),
103
+			'admin_label' => __('Euros (€)', 'give'),
104 104
 			'symbol'      => '€',
105 105
 			'setting'     => array(
106 106
 				'currency_position'   => 'before',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			),
111 111
 		),
112 112
 		'GBP'  => array(
113
-			'admin_label' => __( 'Pounds Sterling (£)', 'give' ),
113
+			'admin_label' => __('Pounds Sterling (£)', 'give'),
114 114
 			'symbol'      => '£',
115 115
 			'setting'     => array(
116 116
 				'currency_position'   => 'before',
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			),
121 121
 		),
122 122
 		'AUD'  => array(
123
-			'admin_label' => __( 'Australian Dollars ($)', 'give' ),
123
+			'admin_label' => __('Australian Dollars ($)', 'give'),
124 124
 			'symbol'      => '$',
125 125
 			'setting'     => array(
126 126
 				'currency_position'   => 'before',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			),
131 131
 		),
132 132
 		'BRL'  => array(
133
-			'admin_label' => __( 'Brazilian Real (R$)', 'give' ),
133
+			'admin_label' => __('Brazilian Real (R$)', 'give'),
134 134
 			'symbol'      => 'R$',
135 135
 			'setting'     => array(
136 136
 				'currency_position'   => 'before',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			),
141 141
 		),
142 142
 		'CAD'  => array(
143
-			'admin_label' => __( 'Canadian Dollars ($)', 'give' ),
143
+			'admin_label' => __('Canadian Dollars ($)', 'give'),
144 144
 			'symbol'      => '$',
145 145
 			'setting'     => array(
146 146
 				'currency_position'   => 'before',
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			),
151 151
 		),
152 152
 		'CZK'  => array(
153
-			'admin_label' => __( 'Czech Koruna (Kč)', 'give' ),
153
+			'admin_label' => __('Czech Koruna (Kč)', 'give'),
154 154
 			'symbol'      => 'Kč',
155 155
 			'setting'     => array(
156 156
 				'currency_position'   => 'before',
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			),
161 161
 		),
162 162
 		'DKK'  => array(
163
-			'admin_label' => __( 'Danish Krone (kr.)', 'give' ),
163
+			'admin_label' => __('Danish Krone (kr.)', 'give'),
164 164
 			'symbol'      => ' kr. ',
165 165
 			'setting'     => array(
166 166
 				'currency_position'   => 'before',
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			),
171 171
 		),
172 172
 		'HKD'  => array(
173
-			'admin_label' => __( 'Hong Kong Dollar ($)', 'give' ),
173
+			'admin_label' => __('Hong Kong Dollar ($)', 'give'),
174 174
 			'symbol'      => '$',
175 175
 			'setting'     => array(
176 176
 				'currency_position'   => 'before',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			),
181 181
 		),
182 182
 		'HUF'  => array(
183
-			'admin_label' => __( 'Hungarian Forint (Ft)', 'give' ),
183
+			'admin_label' => __('Hungarian Forint (Ft)', 'give'),
184 184
 			'symbol'      => 'Ft',
185 185
 			'setting'     => array(
186 186
 				'currency_position'   => 'before',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			),
191 191
 		),
192 192
 		'ILS'  => array(
193
-			'admin_label' => __( 'Israeli Shekel (₪)', 'give' ),
193
+			'admin_label' => __('Israeli Shekel (₪)', 'give'),
194 194
 			'symbol'      => '₪',
195 195
 			'setting'     => array(
196 196
 				'currency_position'   => 'before',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			),
201 201
 		),
202 202
 		'JPY'  => array(
203
-			'admin_label' => __( 'Japanese Yen (¥)', 'give' ),
203
+			'admin_label' => __('Japanese Yen (¥)', 'give'),
204 204
 			'symbol'      => '¥',
205 205
 			'setting'     => array(
206 206
 				'currency_position'   => 'before',
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			),
211 211
 		),
212 212
 		'MYR'  => array(
213
-			'admin_label' => __( 'Malaysian Ringgits (RM)', 'give' ),
213
+			'admin_label' => __('Malaysian Ringgits (RM)', 'give'),
214 214
 			'symbol'      => 'RM',
215 215
 			'setting'     => array(
216 216
 				'currency_position'   => 'before',
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			),
221 221
 		),
222 222
 		'MXN'  => array(
223
-			'admin_label' => __( 'Mexican Peso ($)', 'give' ),
223
+			'admin_label' => __('Mexican Peso ($)', 'give'),
224 224
 			'symbol'      => '$',
225 225
 			'setting'     => array(
226 226
 				'currency_position'   => 'before',
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			),
231 231
 		),
232 232
 		'MAD'  => array(
233
-			'admin_label' => __( 'Moroccan Dirham (.د.م)', 'give' ),
233
+			'admin_label' => __('Moroccan Dirham (.د.م)', 'give'),
234 234
 			'symbol'      => '.د.م',
235 235
 			'setting'     => array(
236 236
 				'currency_position'   => 'before',
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			),
241 241
 		),
242 242
 		'NZD'  => array(
243
-			'admin_label' => __( 'New Zealand Dollar ($)', 'give' ),
243
+			'admin_label' => __('New Zealand Dollar ($)', 'give'),
244 244
 			'symbol'      => '$',
245 245
 			'setting'     => array(
246 246
 				'currency_position'   => 'before',
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			),
251 251
 		),
252 252
 		'NOK'  => array(
253
-			'admin_label' => __( 'Norwegian Krone (Kr.)', 'give' ),
253
+			'admin_label' => __('Norwegian Krone (Kr.)', 'give'),
254 254
 			'symbol'      => 'kr.',
255 255
 			'setting'     => array(
256 256
 				'currency_position'   => 'before',
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 			),
261 261
 		),
262 262
 		'PHP'  => array(
263
-			'admin_label' => __( 'Philippine Pesos (₱)', 'give' ),
263
+			'admin_label' => __('Philippine Pesos (₱)', 'give'),
264 264
 			'symbol'      => '₱',
265 265
 			'setting'     => array(
266 266
 				'currency_position'   => 'before',
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			),
271 271
 		),
272 272
 		'PLN'  => array(
273
-			'admin_label' => __( 'Polish Zloty (zł)', 'give' ),
273
+			'admin_label' => __('Polish Zloty (zł)', 'give'),
274 274
 			'symbol'      => 'zł',
275 275
 			'setting'     => array(
276 276
 				'currency_position'   => 'before',
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			),
281 281
 		),
282 282
 		'SGD'  => array(
283
-			'admin_label' => __( 'Singapore Dollar ($)', 'give' ),
283
+			'admin_label' => __('Singapore Dollar ($)', 'give'),
284 284
 			'symbol'      => '$',
285 285
 			'setting'     => array(
286 286
 				'currency_position'   => 'before',
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			),
291 291
 		),
292 292
 		'KRW'  => array(
293
-			'admin_label' => __( 'South Korean Won (₩)', 'give' ),
293
+			'admin_label' => __('South Korean Won (₩)', 'give'),
294 294
 			'symbol'      => '₩',
295 295
 			'setting'     => array(
296 296
 				'currency_position'   => 'before',
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			),
301 301
 		),
302 302
 		'ZAR'  => array(
303
-			'admin_label' => __( 'South African Rand (R)', 'give' ),
303
+			'admin_label' => __('South African Rand (R)', 'give'),
304 304
 			'symbol'      => 'R',
305 305
 			'setting'     => array(
306 306
 				'currency_position'   => 'before',
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			),
311 311
 		),
312 312
 		'SEK'  => array(
313
-			'admin_label' => __( 'Swedish Krona (kr)', 'give' ),
313
+			'admin_label' => __('Swedish Krona (kr)', 'give'),
314 314
 			'symbol'      => ' kr. ',
315 315
 			'setting'     => array(
316 316
 				'currency_position'   => 'before',
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			),
321 321
 		),
322 322
 		'CHF'  => array(
323
-			'admin_label' => __( 'Swiss Franc (CHF)', 'give' ),
323
+			'admin_label' => __('Swiss Franc (CHF)', 'give'),
324 324
 			'symbol'      => 'CHF',
325 325
 			'setting'     => array(
326 326
 				'currency_position'   => 'before',
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 			),
331 331
 		),
332 332
 		'TWD'  => array(
333
-			'admin_label' => __( 'Taiwan New Dollars (NT$)', 'give' ),
333
+			'admin_label' => __('Taiwan New Dollars (NT$)', 'give'),
334 334
 			'symbol'      => 'NT$',
335 335
 			'setting'     => array(
336 336
 				'currency_position'   => 'before',
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 			),
341 341
 		),
342 342
 		'THB'  => array(
343
-			'admin_label' => __( 'Thai Baht (฿)', 'give' ),
343
+			'admin_label' => __('Thai Baht (฿)', 'give'),
344 344
 			'symbol'      => '฿',
345 345
 			'setting'     => array(
346 346
 				'currency_position'   => 'before',
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			),
351 351
 		),
352 352
 		'INR'  => array(
353
-			'admin_label' => __( 'Indian Rupee (₹)', 'give' ),
353
+			'admin_label' => __('Indian Rupee (₹)', 'give'),
354 354
 			'symbol'      => '₹',
355 355
 			'setting'     => array(
356 356
 				'currency_position'   => 'before',
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 			),
361 361
 		),
362 362
 		'TRY'  => array(
363
-			'admin_label' => __( 'Turkish Lira (₺)', 'give' ),
363
+			'admin_label' => __('Turkish Lira (₺)', 'give'),
364 364
 			'symbol'      => '₺',
365 365
 			'setting'     => array(
366 366
 				'currency_position'   => 'before',
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			),
371 371
 		),
372 372
 		'RIAL' => array(
373
-			'admin_label' => __( 'Iranian Rial (﷼)', 'give' ),
373
+			'admin_label' => __('Iranian Rial (﷼)', 'give'),
374 374
 			'symbol'      => '﷼',
375 375
 			'setting'     => array(
376 376
 				'currency_position'   => 'after',
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			),
381 381
 		),
382 382
 		'RUB'  => array(
383
-			'admin_label' => __( 'Russian Rubles (руб)', 'give' ),
383
+			'admin_label' => __('Russian Rubles (руб)', 'give'),
384 384
 			'symbol'      => '₽',
385 385
 			'setting'     => array(
386 386
 				'currency_position'   => 'before',
@@ -406,14 +406,14 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @param array $currencies
408 408
 	 */
409
-	$currencies = apply_filters( 'give_currencies', $currencies );
409
+	$currencies = apply_filters('give_currencies', $currencies);
410 410
 
411 411
 	// Backward compatibility: handle old way of currency registration.
412 412
 	// Backward compatibility: Return desired result.
413
-	if ( ! empty( $currencies ) ) {
414
-		foreach ( $currencies as $currency_code => $currency_setting ) {
415
-			if ( is_string( $currency_setting ) ) {
416
-				$currencies[ $currency_code ] = array(
413
+	if ( ! empty($currencies)) {
414
+		foreach ($currencies as $currency_code => $currency_setting) {
415
+			if (is_string($currency_setting)) {
416
+				$currencies[$currency_code] = array(
417 417
 					'admin_label' => $currency_setting,
418 418
 					'symbol'      => '',
419 419
 					'setting'     => array(),
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 			}
422 422
 		}
423 423
 
424
-		if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) {
425
-			$currencies = wp_list_pluck( $currencies, $info );
424
+		if ( ! empty($info) && is_string($info) && 'all' !== $info) {
425
+			$currencies = wp_list_pluck($currencies, $info);
426 426
 		}
427 427
 	}
428 428
 
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
  *
440 440
  * @return array
441 441
  */
442
-function give_currency_symbols( $decode_currencies = false ) {
443
-	$currencies = give_get_currencies('symbol' );
442
+function give_currency_symbols($decode_currencies = false) {
443
+	$currencies = give_get_currencies('symbol');
444 444
 
445
-	if ( $decode_currencies ) {
446
-		$currencies = array_map( 'html_entity_decode', $currencies );
445
+	if ($decode_currencies) {
446
+		$currencies = array_map('html_entity_decode', $currencies);
447 447
 	}
448 448
 
449 449
 	/**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @param array $currencies
455 455
 	 */
456
-	return apply_filters( 'give_currency_symbols', $currencies );
456
+	return apply_filters('give_currency_symbols', $currencies);
457 457
 }
458 458
 
459 459
 
@@ -470,14 +470,14 @@  discard block
 block discarded – undo
470 470
  *
471 471
  * @return string           The symbol to use for the currency
472 472
  */
473
-function give_currency_symbol( $currency = '', $decode_currency = false ) {
473
+function give_currency_symbol($currency = '', $decode_currency = false) {
474 474
 
475
-	if ( empty( $currency ) ) {
475
+	if (empty($currency)) {
476 476
 		$currency = give_get_currency();
477 477
 	}
478 478
 
479
-	$currencies = give_currency_symbols( $decode_currency );
480
-	$symbol     = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency;
479
+	$currencies = give_currency_symbols($decode_currency);
480
+	$symbol     = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency;
481 481
 
482 482
 	/**
483 483
 	 * Filter the currency symbol
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @param string $symbol
488 488
 	 * @param string $currency
489 489
 	 */
490
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
490
+	return apply_filters('give_currency_symbol', $symbol, $currency);
491 491
 }
492 492
 
493 493
 
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return string
502 502
  */
503
-function give_get_currency_name( $currency_code ) {
503
+function give_get_currency_name($currency_code) {
504 504
 	$currency_name  = '';
505 505
 	$currency_names = give_get_currencies();
506 506
 
507
-	if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) {
508
-		$currency_name = explode( '(', $currency_names[ $currency_code ] );
509
-		$currency_name = trim( current( $currency_name ) );
507
+	if ($currency_code && array_key_exists($currency_code, $currency_names)) {
508
+		$currency_name = explode('(', $currency_names[$currency_code]);
509
+		$currency_name = trim(current($currency_name));
510 510
 	}
511 511
 
512 512
 	/**
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 * @param string $currency_name
518 518
 	 * @param string $currency_code
519 519
 	 */
520
-	return apply_filters( 'give_currency_name', $currency_name, $currency_code );
520
+	return apply_filters('give_currency_name', $currency_name, $currency_code);
521 521
 }
522 522
 
523 523
 
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
 
532 532
 	global $wp;
533 533
 
534
-	if ( get_option( 'permalink_structure' ) ) {
535
-		$base = trailingslashit( home_url( $wp->request ) );
534
+	if (get_option('permalink_structure')) {
535
+		$base = trailingslashit(home_url($wp->request));
536 536
 	} else {
537
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
538
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
537
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
538
+		$base = remove_query_arg(array('post_type', 'name'), $base);
539 539
 	}
540 540
 
541 541
 	$scheme      = is_ssl() ? 'https' : 'http';
542
-	$current_uri = set_url_scheme( $base, $scheme );
542
+	$current_uri = set_url_scheme($base, $scheme);
543 543
 
544
-	if ( is_front_page() ) {
545
-		$current_uri = home_url( '/' );
544
+	if (is_front_page()) {
545
+		$current_uri = home_url('/');
546 546
 	}
547 547
 
548 548
 	/**
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @param string $current_uri
554 554
 	 */
555
-	return apply_filters( 'give_get_current_page_url', $current_uri );
555
+	return apply_filters('give_get_current_page_url', $current_uri);
556 556
 
557 557
 }
558 558
 
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 	 */
575 575
 	$gateways = give_get_enabled_payment_gateways();
576 576
 
577
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
577
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
578 578
 		$ret = true;
579
-	} elseif ( count( $gateways ) == 1 ) {
579
+	} elseif (count($gateways) == 1) {
580 580
 		$ret = false;
581
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
581
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
582 582
 		$ret = false;
583 583
 	}
584 584
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 *
590 590
 	 * @param bool $ret
591 591
 	 */
592
-	return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret );
592
+	return (bool) apply_filters('give_is_cc_verify_enabled', $ret);
593 593
 }
594 594
 
595 595
 /**
@@ -601,26 +601,26 @@  discard block
 block discarded – undo
601 601
 function give_get_timezone_id() {
602 602
 
603 603
 	// if site timezone string exists, return it.
604
-	if ( $timezone = get_option( 'timezone_string' ) ) {
604
+	if ($timezone = get_option('timezone_string')) {
605 605
 		return $timezone;
606 606
 	}
607 607
 
608 608
 	// get UTC offset, if it isn't set return UTC.
609
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
609
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
610 610
 		return 'UTC';
611 611
 	}
612 612
 
613 613
 	// attempt to guess the timezone string from the UTC offset.
614
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
614
+	$timezone = timezone_name_from_abbr('', $utc_offset);
615 615
 
616 616
 	// last try, guess timezone string manually.
617
-	if ( $timezone === false ) {
617
+	if ($timezone === false) {
618 618
 
619
-		$is_dst = date( 'I' );
619
+		$is_dst = date('I');
620 620
 
621
-		foreach ( timezone_abbreviations_list() as $abbr ) {
622
-			foreach ( $abbr as $city ) {
623
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
621
+		foreach (timezone_abbreviations_list() as $abbr) {
622
+			foreach ($abbr as $city) {
623
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
624 624
 					return $city['timezone_id'];
625 625
 				}
626 626
 			}
@@ -644,17 +644,17 @@  discard block
 block discarded – undo
644 644
 
645 645
 	$ip = '127.0.0.1';
646 646
 
647
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
647
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
648 648
 		// check ip from share internet
649 649
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
650
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
650
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
651 651
 		// to check ip is pass from proxy
652 652
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
653
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
653
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
654 654
 		$ip = $_SERVER['REMOTE_ADDR'];
655 655
 	}
656 656
 
657
-	return apply_filters( 'give_get_ip', $ip );
657
+	return apply_filters('give_get_ip', $ip);
658 658
 }
659 659
 
660 660
 
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
  *
670 670
  * @uses  Give()->session->set()
671 671
  */
672
-function give_set_purchase_session( $purchase_data = array() ) {
673
-	Give()->session->set( 'give_purchase', $purchase_data );
674
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
672
+function give_set_purchase_session($purchase_data = array()) {
673
+	Give()->session->set('give_purchase', $purchase_data);
674
+	Give()->session->set('give_email', $purchase_data['user_email']);
675 675
 }
676 676
 
677 677
 /**
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
  * @return mixed array | false
686 686
  */
687 687
 function give_get_purchase_session() {
688
-	return Give()->session->get( 'give_purchase' );
688
+	return Give()->session->get('give_purchase');
689 689
 }
690 690
 
691 691
 /**
@@ -697,33 +697,33 @@  discard block
 block discarded – undo
697 697
  *
698 698
  * @return string
699 699
  */
700
-function give_payment_gateway_item_title( $payment_data ) {
701
-	$form_id          = intval( $payment_data['post_data']['give-form-id'] );
700
+function give_payment_gateway_item_title($payment_data) {
701
+	$form_id          = intval($payment_data['post_data']['give-form-id']);
702 702
 	$item_name        = $payment_data['post_data']['give-form-title'];
703
-	$is_custom_amount = give_is_setting_enabled( give_get_meta( $form_id, '_give_custom_amount', true ) );
703
+	$is_custom_amount = give_is_setting_enabled(give_get_meta($form_id, '_give_custom_amount', true));
704 704
 
705 705
 	// Verify has variable prices.
706
-	if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
706
+	if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
707 707
 
708
-		$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
709
-		$price_level_amount    = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
708
+		$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
709
+		$price_level_amount    = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
710 710
 
711 711
 		// Donation given doesn't match selected level (must be a custom amount).
712
-		if ( $price_level_amount !== give_maybe_sanitize_amount( $payment_data['post_data']['give-amount'] ) ) {
713
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
712
+		if ($price_level_amount !== give_maybe_sanitize_amount($payment_data['post_data']['give-amount'])) {
713
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
714 714
 
715 715
 			// user custom amount text if any, fallback to default if not.
716
-			$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
716
+			$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
717 717
 
718
-		} elseif ( ! empty( $item_price_level_text ) ) {
718
+		} elseif ( ! empty($item_price_level_text)) {
719 719
 			// Matches a donation level - append level text.
720
-			$item_name .= ' - ' . $item_price_level_text;
720
+			$item_name .= ' - '.$item_price_level_text;
721 721
 		}
722 722
 	} // End if().
723
-	elseif ( $is_custom_amount && give_get_form_price( $form_id ) !== give_maybe_sanitize_amount( $payment_data['post_data']['give-amount'] ) ) {
724
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
723
+	elseif ($is_custom_amount && give_get_form_price($form_id) !== give_maybe_sanitize_amount($payment_data['post_data']['give-amount'])) {
724
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
725 725
 		// user custom amount text if any, fallback to default if not.
726
-		$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
726
+		$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
727 727
 	}
728 728
 
729 729
 	/**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	 *
738 738
 	 * @return string
739 739
 	 */
740
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
740
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
741 741
 }
742 742
 
743 743
 /**
@@ -753,36 +753,36 @@  discard block
 block discarded – undo
753 753
  *
754 754
  * @return string
755 755
  */
756
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
757
-	$form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
756
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
757
+	$form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
758 758
 
759 759
 	// Form title.
760
-	$summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) );
760
+	$summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give')));
761 761
 
762 762
 	// Form multilevel if applicable.
763
-	if ( isset( $donation_data['post_data']['give-price-id'] ) ) {
764
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
763
+	if (isset($donation_data['post_data']['give-price-id'])) {
764
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
765 765
 	}
766 766
 
767 767
 	// Add Donor's name + email if requested.
768
-	if ( $name_and_email ) {
768
+	if ($name_and_email) {
769 769
 
770 770
 		// First name
771
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
772
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
771
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
772
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
773 773
 		}
774 774
 
775
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
776
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
775
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
776
+			$summary .= ' '.$donation_data['user_info']['last_name'];
777 777
 		}
778 778
 
779
-		$summary .= ' (' . $donation_data['user_email'] . ')';
779
+		$summary .= ' ('.$donation_data['user_email'].')';
780 780
 	}
781 781
 
782 782
 	// Cut the length
783
-	$summary = substr( $summary, 0, $length );
783
+	$summary = substr($summary, 0, $length);
784 784
 
785
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
785
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
786 786
 }
787 787
 
788 788
 
@@ -797,31 +797,31 @@  discard block
 block discarded – undo
797 797
 function give_get_host() {
798 798
 	$host = false;
799 799
 
800
-	if ( defined( 'WPE_APIKEY' ) ) {
800
+	if (defined('WPE_APIKEY')) {
801 801
 		$host = 'WP Engine';
802
-	} elseif ( defined( 'PAGELYBIN' ) ) {
802
+	} elseif (defined('PAGELYBIN')) {
803 803
 		$host = 'Pagely';
804
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
804
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
805 805
 		$host = 'ICDSoft';
806
-	} elseif ( DB_HOST == 'mysqlv5' ) {
806
+	} elseif (DB_HOST == 'mysqlv5') {
807 807
 		$host = 'NetworkSolutions';
808
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
808
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
809 809
 		$host = 'iPage';
810
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
810
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
811 811
 		$host = 'IPower';
812
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
812
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
813 813
 		$host = 'MediaTemple Grid';
814
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
814
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
815 815
 		$host = 'pair Networks';
816
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
816
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
817 817
 		$host = 'Rackspace Cloud';
818
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
818
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
819 819
 		$host = 'SysFix.eu Power Hosting';
820
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
820
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
821 821
 		$host = 'Flywheel';
822 822
 	} else {
823 823
 		// Adding a general fallback for data gathering
824
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
824
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
825 825
 	}
826 826
 
827 827
 	return $host;
@@ -837,67 +837,67 @@  discard block
 block discarded – undo
837 837
  *
838 838
  * @return bool true if host matches, false if not
839 839
  */
840
-function give_is_host( $host = false ) {
840
+function give_is_host($host = false) {
841 841
 
842 842
 	$return = false;
843 843
 
844
-	if ( $host ) {
845
-		$host = str_replace( ' ', '', strtolower( $host ) );
844
+	if ($host) {
845
+		$host = str_replace(' ', '', strtolower($host));
846 846
 
847
-		switch ( $host ) {
847
+		switch ($host) {
848 848
 			case 'wpengine':
849
-				if ( defined( 'WPE_APIKEY' ) ) {
849
+				if (defined('WPE_APIKEY')) {
850 850
 					$return = true;
851 851
 				}
852 852
 				break;
853 853
 			case 'pagely':
854
-				if ( defined( 'PAGELYBIN' ) ) {
854
+				if (defined('PAGELYBIN')) {
855 855
 					$return = true;
856 856
 				}
857 857
 				break;
858 858
 			case 'icdsoft':
859
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
859
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
860 860
 					$return = true;
861 861
 				}
862 862
 				break;
863 863
 			case 'networksolutions':
864
-				if ( DB_HOST == 'mysqlv5' ) {
864
+				if (DB_HOST == 'mysqlv5') {
865 865
 					$return = true;
866 866
 				}
867 867
 				break;
868 868
 			case 'ipage':
869
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
869
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
870 870
 					$return = true;
871 871
 				}
872 872
 				break;
873 873
 			case 'ipower':
874
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
874
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
875 875
 					$return = true;
876 876
 				}
877 877
 				break;
878 878
 			case 'mediatemplegrid':
879
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
879
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
880 880
 					$return = true;
881 881
 				}
882 882
 				break;
883 883
 			case 'pairnetworks':
884
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
884
+				if (strpos(DB_HOST, '.pair.com') !== false) {
885 885
 					$return = true;
886 886
 				}
887 887
 				break;
888 888
 			case 'rackspacecloud':
889
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
889
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
890 890
 					$return = true;
891 891
 				}
892 892
 				break;
893 893
 			case 'sysfix.eu':
894 894
 			case 'sysfix.eupowerhosting':
895
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
895
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
896 896
 					$return = true;
897 897
 				}
898 898
 				break;
899 899
 			case 'flywheel':
900
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
900
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
901 901
 					$return = true;
902 902
 				}
903 903
 				break;
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
  * @param string $replacement Optional. The function that should have been called.
931 931
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
932 932
  */
933
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
933
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
934 934
 
935 935
 	/**
936 936
 	 * Fires while give deprecated function call occurs.
@@ -943,19 +943,19 @@  discard block
 block discarded – undo
943 943
 	 * @param string $replacement Optional. The function that should have been called.
944 944
 	 * @param string $version     The plugin version that deprecated the function.
945 945
 	 */
946
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
946
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
947 947
 
948
-	$show_errors = current_user_can( 'manage_options' );
948
+	$show_errors = current_user_can('manage_options');
949 949
 
950 950
 	// Allow plugin to filter the output error trigger.
951
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
952
-		if ( ! is_null( $replacement ) ) {
953
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
954
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
951
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
952
+		if ( ! is_null($replacement)) {
953
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
954
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
955 955
 			// Alternatively we could dump this to a file.
956 956
 		} else {
957
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
958
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
957
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
958
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
959 959
 			// Alternatively we could dump this to a file.
960 960
 		}
961 961
 	}
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
  * @return string $post_id
970 970
  */
971 971
 function give_get_admin_post_id() {
972
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
973
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
972
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
973
+	if ( ! $post_id && isset($_POST['post_id'])) {
974 974
 		$post_id = $_POST['post_id'];
975 975
 	}
976 976
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
  * @return string Arg separator output
985 985
  */
986 986
 function give_get_php_arg_separator_output() {
987
-	return ini_get( 'arg_separator.output' );
987
+	return ini_get('arg_separator.output');
988 988
 }
989 989
 
990 990
 
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return string Short month name
1001 1001
  */
1002
-function give_month_num_to_name( $n ) {
1003
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
1002
+function give_month_num_to_name($n) {
1003
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
1004 1004
 
1005
-	return date_i18n( 'M', $timestamp );
1005
+	return date_i18n('M', $timestamp);
1006 1006
 }
1007 1007
 
1008 1008
 
@@ -1015,10 +1015,10 @@  discard block
 block discarded – undo
1015 1015
  *
1016 1016
  * @return bool Whether or not function is disabled.
1017 1017
  */
1018
-function give_is_func_disabled( $function ) {
1019
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
1018
+function give_is_func_disabled($function) {
1019
+	$disabled = explode(',', ini_get('disable_functions'));
1020 1020
 
1021
-	return in_array( $function, $disabled );
1021
+	return in_array($function, $disabled);
1022 1022
 }
1023 1023
 
1024 1024
 /**
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 function give_get_newsletter() {
1030 1030
 	?>
1031 1031
 
1032
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
1032
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
1033 1033
 
1034 1034
 	<div class="give-newsletter-form-wrap">
1035 1035
 
@@ -1037,33 +1037,33 @@  discard block
 block discarded – undo
1037 1037
 			  method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
1038 1038
 			  target="_blank" novalidate>
1039 1039
 			<div class="give-newsletter-confirmation">
1040
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
1040
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
1041 1041
 			</div>
1042 1042
 
1043 1043
 			<table class="form-table give-newsletter-form">
1044 1044
 				<tr valign="middle">
1045 1045
 					<td>
1046 1046
 						<label for="mce-EMAIL"
1047
-							   class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
1047
+							   class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
1048 1048
 						<input type="email" name="EMAIL" id="mce-EMAIL"
1049
-							   placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
1049
+							   placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
1050 1050
 							   class="required email" value="">
1051 1051
 					</td>
1052 1052
 					<td>
1053 1053
 						<label for="mce-FNAME"
1054
-							   class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
1054
+							   class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
1055 1055
 						<input type="text" name="FNAME" id="mce-FNAME"
1056
-							   placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
1056
+							   placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
1057 1057
 					</td>
1058 1058
 					<td>
1059 1059
 						<label for="mce-LNAME"
1060
-							   class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
1060
+							   class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
1061 1061
 						<input type="text" name="LNAME" id="mce-LNAME"
1062
-							   placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
1062
+							   placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
1063 1063
 					</td>
1064 1064
 					<td>
1065 1065
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
1066
-							   value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
1066
+							   value="<?php esc_attr_e('Subscribe', 'give'); ?>">
1067 1067
 					</td>
1068 1068
 				</tr>
1069 1069
 			</table>
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
  *
1117 1117
  * @return string
1118 1118
  */
1119
-function give_svg_icons( $icon ) {
1119
+function give_svg_icons($icon) {
1120 1120
 
1121 1121
 	// Store your SVGs in an associative array
1122 1122
 	$svgs = array(
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	);
1129 1129
 
1130 1130
 	// Return the chosen icon's SVG string
1131
-	return $svgs[ $icon ];
1131
+	return $svgs[$icon];
1132 1132
 }
1133 1133
 
1134 1134
 /**
@@ -1140,15 +1140,15 @@  discard block
 block discarded – undo
1140 1140
  *
1141 1141
  * @return mixed
1142 1142
  */
1143
-function modify_nav_menu_meta_box_object( $post_type ) {
1144
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
1145
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
1143
+function modify_nav_menu_meta_box_object($post_type) {
1144
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
1145
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
1146 1146
 	}
1147 1147
 
1148 1148
 	return $post_type;
1149 1149
 }
1150 1150
 
1151
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
1151
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
1152 1152
 
1153 1153
 /**
1154 1154
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -1167,35 +1167,35 @@  discard block
 block discarded – undo
1167 1167
 	// Proceed, if current screen is navigation menus.
1168 1168
 	if (
1169 1169
 		'nav-menus' === $screen->id &&
1170
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
1171
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
1170
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
1171
+		! get_user_option('give_is_donation_forms_menu_updated')
1172 1172
 	) {
1173 1173
 
1174 1174
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
1175 1175
 		if (
1176 1176
 			! is_admin() ||
1177
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
1177
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
1178 1178
 		) {
1179 1179
 			return false;
1180 1180
 		}
1181 1181
 
1182 1182
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
1183
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
1183
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
1184 1184
 			return false;
1185 1185
 		}
1186 1186
 
1187 1187
 		// Exclude 'Donation Form' value from hidden meta box's list.
1188
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
1188
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
1189 1189
 
1190 1190
 		// Get current user ID.
1191 1191
 		$user = wp_get_current_user();
1192 1192
 
1193
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
1194
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
1193
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
1194
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
1195 1195
 	}
1196 1196
 }
1197 1197
 
1198
-add_action( 'current_screen', 'give_donation_metabox_menu' );
1198
+add_action('current_screen', 'give_donation_metabox_menu');
1199 1199
 
1200 1200
 /**
1201 1201
  * Array_column backup usage
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
  * @license    https://opensource.org/licenses/MIT MIT
1209 1209
  */
1210 1210
 
1211
-if ( ! function_exists( 'array_column' ) ) {
1211
+if ( ! function_exists('array_column')) {
1212 1212
 	/**
1213 1213
 	 * Returns the values from a single column of the input array, identified by
1214 1214
 	 * the $columnKey.
@@ -1227,53 +1227,53 @@  discard block
 block discarded – undo
1227 1227
 	 *
1228 1228
 	 * @return array
1229 1229
 	 */
1230
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
1230
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
1231 1231
 		// Using func_get_args() in order to check for proper number of
1232 1232
 		// parameters and trigger errors exactly as the built-in array_column()
1233 1233
 		// does in PHP 5.5.
1234 1234
 		$argc   = func_num_args();
1235 1235
 		$params = func_get_args();
1236 1236
 
1237
-		if ( $argc < 2 ) {
1238
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
1237
+		if ($argc < 2) {
1238
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
1239 1239
 
1240 1240
 			return null;
1241 1241
 		}
1242 1242
 
1243
-		if ( ! is_array( $params[0] ) ) {
1244
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
1243
+		if ( ! is_array($params[0])) {
1244
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
1245 1245
 
1246 1246
 			return null;
1247 1247
 		}
1248 1248
 
1249
-		if ( ! is_int( $params[1] )
1250
-			 && ! is_float( $params[1] )
1251
-			 && ! is_string( $params[1] )
1249
+		if ( ! is_int($params[1])
1250
+			 && ! is_float($params[1])
1251
+			 && ! is_string($params[1])
1252 1252
 			 && $params[1] !== null
1253
-			 && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
1253
+			 && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
1254 1254
 		) {
1255
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
1255
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
1256 1256
 
1257 1257
 			return false;
1258 1258
 		}
1259 1259
 
1260
-		if ( isset( $params[2] )
1261
-			 && ! is_int( $params[2] )
1262
-			 && ! is_float( $params[2] )
1263
-			 && ! is_string( $params[2] )
1264
-			 && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
1260
+		if (isset($params[2])
1261
+			 && ! is_int($params[2])
1262
+			 && ! is_float($params[2])
1263
+			 && ! is_string($params[2])
1264
+			 && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
1265 1265
 		) {
1266
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
1266
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
1267 1267
 
1268 1268
 			return false;
1269 1269
 		}
1270 1270
 
1271 1271
 		$paramsInput     = $params[0];
1272
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
1272
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
1273 1273
 
1274 1274
 		$paramsIndexKey = null;
1275
-		if ( isset( $params[2] ) ) {
1276
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
1275
+		if (isset($params[2])) {
1276
+			if (is_float($params[2]) || is_int($params[2])) {
1277 1277
 				$paramsIndexKey = (int) $params[2];
1278 1278
 			} else {
1279 1279
 				$paramsIndexKey = (string) $params[2];
@@ -1282,26 +1282,26 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 		$resultArray = array();
1284 1284
 
1285
-		foreach ( $paramsInput as $row ) {
1285
+		foreach ($paramsInput as $row) {
1286 1286
 			$key    = $value = null;
1287 1287
 			$keySet = $valueSet = false;
1288 1288
 
1289
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
1289
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
1290 1290
 				$keySet = true;
1291
-				$key    = (string) $row[ $paramsIndexKey ];
1291
+				$key    = (string) $row[$paramsIndexKey];
1292 1292
 			}
1293 1293
 
1294
-			if ( $paramsColumnKey === null ) {
1294
+			if ($paramsColumnKey === null) {
1295 1295
 				$valueSet = true;
1296 1296
 				$value    = $row;
1297
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
1297
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
1298 1298
 				$valueSet = true;
1299
-				$value    = $row[ $paramsColumnKey ];
1299
+				$value    = $row[$paramsColumnKey];
1300 1300
 			}
1301 1301
 
1302
-			if ( $valueSet ) {
1303
-				if ( $keySet ) {
1304
-					$resultArray[ $key ] = $value;
1302
+			if ($valueSet) {
1303
+				if ($keySet) {
1304
+					$resultArray[$key] = $value;
1305 1305
 				} else {
1306 1306
 					$resultArray[] = $value;
1307 1307
 				}
@@ -1321,40 +1321,40 @@  discard block
 block discarded – undo
1321 1321
  *
1322 1322
  * @return bool Whether the receipt is visible or not.
1323 1323
  */
1324
-function give_can_view_receipt( $payment_key = '' ) {
1324
+function give_can_view_receipt($payment_key = '') {
1325 1325
 
1326 1326
 	$return = false;
1327 1327
 
1328
-	if ( empty( $payment_key ) ) {
1328
+	if (empty($payment_key)) {
1329 1329
 		return $return;
1330 1330
 	}
1331 1331
 
1332 1332
 	global $give_receipt_args;
1333 1333
 
1334
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
1334
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
1335 1335
 
1336
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
1336
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
1337 1337
 
1338
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
1338
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
1339 1339
 
1340
-	if ( is_user_logged_in() ) {
1341
-		if ( $user_id === (int) get_current_user_id() ) {
1340
+	if (is_user_logged_in()) {
1341
+		if ($user_id === (int) get_current_user_id()) {
1342 1342
 			$return = true;
1343
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
1343
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
1344 1344
 			$return = true;
1345
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
1345
+		} elseif (current_user_can('view_give_sensitive_data')) {
1346 1346
 			$return = true;
1347 1347
 		}
1348 1348
 	}
1349 1349
 
1350 1350
 	$session = give_get_purchase_session();
1351
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
1352
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
1351
+	if ( ! empty($session) && ! is_user_logged_in()) {
1352
+		if ($session['purchase_key'] === $payment_meta['key']) {
1353 1353
 			$return = true;
1354 1354
 		}
1355 1355
 	}
1356 1356
 
1357
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
1357
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
1358 1358
 
1359 1359
 }
1360 1360
 
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
  *
1364 1364
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
1365 1365
  */
1366
-if ( ! function_exists( 'cal_days_in_month' ) ) {
1366
+if ( ! function_exists('cal_days_in_month')) {
1367 1367
 	/**
1368 1368
 	 * cal_days_in_month
1369 1369
 	 *
@@ -1373,8 +1373,8 @@  discard block
 block discarded – undo
1373 1373
 	 *
1374 1374
 	 * @return bool|string
1375 1375
 	 */
1376
-	function cal_days_in_month( $calendar, $month, $year ) {
1377
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
1376
+	function cal_days_in_month($calendar, $month, $year) {
1377
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
1378 1378
 	}
1379 1379
 }
1380 1380
 
@@ -1393,42 +1393,42 @@  discard block
 block discarded – undo
1393 1393
  */
1394 1394
 function give_get_plugins() {
1395 1395
 	$plugins             = get_plugins();
1396
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
1396
+	$active_plugin_paths = (array) get_option('active_plugins', array());
1397 1397
 
1398
-	if ( is_multisite() ) {
1399
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
1400
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
1398
+	if (is_multisite()) {
1399
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
1400
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
1401 1401
 	}
1402 1402
 
1403
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
1403
+	foreach ($plugins as $plugin_path => $plugin_data) {
1404 1404
 		// Is plugin active?
1405
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
1406
-			$plugins[ $plugin_path ]['Status'] = 'active';
1405
+		if (in_array($plugin_path, $active_plugin_paths)) {
1406
+			$plugins[$plugin_path]['Status'] = 'active';
1407 1407
 		} else {
1408
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
1408
+			$plugins[$plugin_path]['Status'] = 'inactive';
1409 1409
 		}
1410 1410
 
1411
-		$dirname = strtolower( dirname( $plugin_path ) );
1411
+		$dirname = strtolower(dirname($plugin_path));
1412 1412
 
1413 1413
 		// Is plugin a Give add-on by WordImpress?
1414
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
1414
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
1415 1415
 			// Plugin is a Give-addon.
1416
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
1416
+			$plugins[$plugin_path]['Type'] = 'add-on';
1417 1417
 
1418 1418
 			// Get license info from database.
1419
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
1420
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
1421
-			$license_active = get_option( $db_option );
1419
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
1420
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
1421
+			$license_active = get_option($db_option);
1422 1422
 
1423 1423
 			// Does a valid license exist?
1424
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
1425
-				$plugins[ $plugin_path ]['License'] = true;
1424
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
1425
+				$plugins[$plugin_path]['License'] = true;
1426 1426
 			} else {
1427
-				$plugins[ $plugin_path ]['License'] = false;
1427
+				$plugins[$plugin_path]['License'] = false;
1428 1428
 			}
1429 1429
 		} else {
1430 1430
 			// Plugin is not a Give add-on.
1431
-			$plugins[ $plugin_path ]['Type'] = 'other';
1431
+			$plugins[$plugin_path]['Type'] = 'other';
1432 1432
 		}
1433 1433
 	}
1434 1434
 
@@ -1445,16 +1445,16 @@  discard block
 block discarded – undo
1445 1445
  *
1446 1446
  * @return bool
1447 1447
  */
1448
-function give_is_terms_enabled( $form_id ) {
1449
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1448
+function give_is_terms_enabled($form_id) {
1449
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1450 1450
 
1451 1451
 	if (
1452
-		give_is_setting_enabled( $form_option, 'global' )
1453
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1452
+		give_is_setting_enabled($form_option, 'global')
1453
+		&& give_is_setting_enabled(give_get_option('terms'))
1454 1454
 	) {
1455 1455
 		return true;
1456 1456
 
1457
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1457
+	} elseif (give_is_setting_enabled($form_option)) {
1458 1458
 		return true;
1459 1459
 
1460 1460
 	} else {
@@ -1478,9 +1478,9 @@  discard block
 block discarded – undo
1478 1478
  *
1479 1479
  * @return WP_Error|bool
1480 1480
  */
1481
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1481
+function give_delete_donation_stats($date_range = '', $args = array()) {
1482 1482
 	// Delete all cache.
1483
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1483
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1484 1484
 
1485 1485
 	/**
1486 1486
 	 * Fire the action when donation stats delete.
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 	 * @param string|array $date_range
1491 1491
 	 * @param array        $args
1492 1492
 	 */
1493
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1493
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1494 1494
 
1495 1495
 	return $status;
1496 1496
 }
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
  *
1509 1509
  * @return mixed
1510 1510
  */
1511
-function give_get_meta( $id, $meta_key, $single = false, $default = false ) {
1511
+function give_get_meta($id, $meta_key, $single = false, $default = false) {
1512 1512
 	/**
1513 1513
 	 * Filter the meta value
1514 1514
 	 *
@@ -1516,14 +1516,14 @@  discard block
 block discarded – undo
1516 1516
 	 */
1517 1517
 	$meta_value = apply_filters(
1518 1518
 		'give_get_meta',
1519
-		get_post_meta( $id, $meta_key, $single ),
1519
+		get_post_meta($id, $meta_key, $single),
1520 1520
 		$id,
1521 1521
 		$meta_key,
1522 1522
 		$default
1523 1523
 	);
1524 1524
 
1525 1525
 	if (
1526
-		( empty( $meta_key ) || empty( $meta_value ) )
1526
+		(empty($meta_key) || empty($meta_value))
1527 1527
 		&& $default
1528 1528
 	) {
1529 1529
 		$meta_value = $default;
@@ -1544,15 +1544,15 @@  discard block
 block discarded – undo
1544 1544
  *
1545 1545
  * @return mixed
1546 1546
  */
1547
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1548
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1547
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1548
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1549 1549
 
1550 1550
 	/**
1551 1551
 	 * Filter the meta value update status
1552 1552
 	 *
1553 1553
 	 * @since 1.8.8
1554 1554
 	 */
1555
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1555
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1556 1556
 }
1557 1557
 
1558 1558
 /**
@@ -1566,15 +1566,15 @@  discard block
 block discarded – undo
1566 1566
  *
1567 1567
  * @return mixed
1568 1568
  */
1569
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1570
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1569
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1570
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1571 1571
 
1572 1572
 	/**
1573 1573
 	 * Filter the meta value delete status
1574 1574
 	 *
1575 1575
 	 * @since 1.8.8
1576 1576
 	 */
1577
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1577
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1578 1578
 }
1579 1579
 
1580 1580
 /**
@@ -1586,15 +1586,15 @@  discard block
 block discarded – undo
1586 1586
  *
1587 1587
  * @return bool                   If the action has been added to the completed actions array
1588 1588
  */
1589
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1589
+function give_has_upgrade_completed($upgrade_action = '') {
1590 1590
 
1591
-	if ( empty( $upgrade_action ) ) {
1591
+	if (empty($upgrade_action)) {
1592 1592
 		return false;
1593 1593
 	}
1594 1594
 
1595 1595
 	$completed_upgrades = give_get_completed_upgrades();
1596 1596
 
1597
-	return in_array( $upgrade_action, $completed_upgrades );
1597
+	return in_array($upgrade_action, $completed_upgrades);
1598 1598
 
1599 1599
 }
1600 1600
 
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1607 1607
  */
1608 1608
 function give_maybe_resume_upgrade() {
1609
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1610
-	if ( empty( $doing_upgrade ) ) {
1609
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1610
+	if (empty($doing_upgrade)) {
1611 1611
 		return false;
1612 1612
 	}
1613 1613
 
@@ -1623,9 +1623,9 @@  discard block
 block discarded – undo
1623 1623
  *
1624 1624
  * @return bool                   If the function was successfully added
1625 1625
  */
1626
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1626
+function give_set_upgrade_complete($upgrade_action = '') {
1627 1627
 
1628
-	if ( empty( $upgrade_action ) ) {
1628
+	if (empty($upgrade_action)) {
1629 1629
 		return false;
1630 1630
 	}
1631 1631
 
@@ -1633,16 +1633,16 @@  discard block
 block discarded – undo
1633 1633
 	$completed_upgrades[] = $upgrade_action;
1634 1634
 
1635 1635
 	// Remove any blanks, and only show uniques.
1636
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1636
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1637 1637
 
1638 1638
 	/**
1639 1639
 	 * Fire the action when any upgrade set to complete.
1640 1640
 	 *
1641 1641
 	 * @since 1.8.12
1642 1642
 	 */
1643
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1643
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1644 1644
 
1645
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
1645
+	return update_option('give_completed_upgrades', $completed_upgrades);
1646 1646
 }
1647 1647
 
1648 1648
 /**
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
  * @return array The array of completed upgrades
1653 1653
  */
1654 1654
 function give_get_completed_upgrades() {
1655
-	return (array) get_option( 'give_completed_upgrades' );
1655
+	return (array) get_option('give_completed_upgrades');
1656 1656
 }
1657 1657
 
1658 1658
 /**
@@ -1662,21 +1662,21 @@  discard block
 block discarded – undo
1662 1662
  *
1663 1663
  * @param \WP_Query
1664 1664
  */
1665
-function give_remove_pages_from_search( $query ) {
1666
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1667
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1668
-		$success_page       = give_get_option( 'success_page', 0 );
1665
+function give_remove_pages_from_search($query) {
1666
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1667
+		$transaction_failed = give_get_option('failure_page', 0);
1668
+		$success_page       = give_get_option('success_page', 0);
1669 1669
 		$args               = apply_filters(
1670 1670
 			'give_remove_pages_from_search', array(
1671 1671
 				$transaction_failed,
1672 1672
 				$success_page,
1673 1673
 			), $query
1674 1674
 		);
1675
-		$query->set( 'post__not_in', $args );
1675
+		$query->set('post__not_in', $args);
1676 1676
 	}
1677 1677
 }
1678 1678
 
1679
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1679
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1680 1680
 
1681 1681
 /**
1682 1682
  * Inserts a new key/value before a key in the array.
@@ -1692,14 +1692,14 @@  discard block
 block discarded – undo
1692 1692
  *
1693 1693
  * @see   array_insert_before()
1694 1694
  */
1695
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1696
-	if ( array_key_exists( $key, $array ) ) {
1695
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1696
+	if (array_key_exists($key, $array)) {
1697 1697
 		$new = array();
1698
-		foreach ( $array as $k => $value ) {
1699
-			if ( $k === $key ) {
1700
-				$new[ $new_key ] = $new_value;
1698
+		foreach ($array as $k => $value) {
1699
+			if ($k === $key) {
1700
+				$new[$new_key] = $new_value;
1701 1701
 			}
1702
-			$new[ $k ] = $value;
1702
+			$new[$k] = $value;
1703 1703
 		}
1704 1704
 
1705 1705
 		return $new;
@@ -1722,13 +1722,13 @@  discard block
 block discarded – undo
1722 1722
  *
1723 1723
  * @see   array_insert_before()
1724 1724
  */
1725
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1726
-	if ( array_key_exists( $key, $array ) ) {
1725
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1726
+	if (array_key_exists($key, $array)) {
1727 1727
 		$new = array();
1728
-		foreach ( $array as $k => $value ) {
1729
-			$new[ $k ] = $value;
1730
-			if ( $k === $key ) {
1731
-				$new[ $new_key ] = $new_value;
1728
+		foreach ($array as $k => $value) {
1729
+			$new[$k] = $value;
1730
+			if ($k === $key) {
1731
+				$new[$new_key] = $new_value;
1732 1732
 			}
1733 1733
 		}
1734 1734
 
@@ -1755,21 +1755,21 @@  discard block
 block discarded – undo
1755 1755
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1756 1756
  *               `$list` will be preserved in the results.
1757 1757
  */
1758
-function give_list_pluck( $list, $field, $index_key = null ) {
1758
+function give_list_pluck($list, $field, $index_key = null) {
1759 1759
 
1760
-	if ( ! $index_key ) {
1760
+	if ( ! $index_key) {
1761 1761
 		/*
1762 1762
 		 * This is simple. Could at some point wrap array_column()
1763 1763
 		 * if we knew we had an array of arrays.
1764 1764
 		 */
1765
-		foreach ( $list as $key => $value ) {
1766
-			if ( is_object( $value ) ) {
1767
-				if ( isset( $value->$field ) ) {
1768
-					$list[ $key ] = $value->$field;
1765
+		foreach ($list as $key => $value) {
1766
+			if (is_object($value)) {
1767
+				if (isset($value->$field)) {
1768
+					$list[$key] = $value->$field;
1769 1769
 				}
1770 1770
 			} else {
1771
-				if ( isset( $value[ $field ] ) ) {
1772
-					$list[ $key ] = $value[ $field ];
1771
+				if (isset($value[$field])) {
1772
+					$list[$key] = $value[$field];
1773 1773
 				}
1774 1774
 			}
1775 1775
 		}
@@ -1782,18 +1782,18 @@  discard block
 block discarded – undo
1782 1782
 	 * to the end of the stack. This is how array_column() behaves.
1783 1783
 	 */
1784 1784
 	$newlist = array();
1785
-	foreach ( $list as $value ) {
1786
-		if ( is_object( $value ) ) {
1787
-			if ( isset( $value->$index_key ) ) {
1788
-				$newlist[ $value->$index_key ] = $value->$field;
1785
+	foreach ($list as $value) {
1786
+		if (is_object($value)) {
1787
+			if (isset($value->$index_key)) {
1788
+				$newlist[$value->$index_key] = $value->$field;
1789 1789
 			} else {
1790 1790
 				$newlist[] = $value->$field;
1791 1791
 			}
1792 1792
 		} else {
1793
-			if ( isset( $value[ $index_key ] ) ) {
1794
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1793
+			if (isset($value[$index_key])) {
1794
+				$newlist[$value[$index_key]] = $value[$field];
1795 1795
 			} else {
1796
-				$newlist[] = $value[ $field ];
1796
+				$newlist[] = $value[$field];
1797 1797
 			}
1798 1798
 		}
1799 1799
 	}
@@ -1816,8 +1816,8 @@  discard block
 block discarded – undo
1816 1816
  *
1817 1817
  * @return int|false Meta ID on success, false on failure.
1818 1818
  */
1819
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1820
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1819
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1820
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1821 1821
 }
1822 1822
 
1823 1823
 /**
@@ -1835,8 +1835,8 @@  discard block
 block discarded – undo
1835 1835
  *
1836 1836
  * @return bool True on success, false on failure.
1837 1837
  */
1838
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1839
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1838
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1839
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1840 1840
 }
1841 1841
 
1842 1842
 /**
@@ -1851,8 +1851,8 @@  discard block
 block discarded – undo
1851 1851
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1852 1852
  *  is true.
1853 1853
  */
1854
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1855
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1854
+function get_donor_meta($donor_id, $key = '', $single = false) {
1855
+	return get_metadata('give_customer', $donor_id, $key, $single);
1856 1856
 }
1857 1857
 
1858 1858
 /**
@@ -1869,8 +1869,8 @@  discard block
 block discarded – undo
1869 1869
  *
1870 1870
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1871 1871
  */
1872
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1873
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1872
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1873
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1874 1874
 }
1875 1875
 
1876 1876
 /*
@@ -1880,15 +1880,15 @@  discard block
 block discarded – undo
1880 1880
  *
1881 1881
  * @param int $form_id Form id of which recalculation needs to be done.
1882 1882
  */
1883
-function give_recount_form_income_donation( $form_id = false ) {
1883
+function give_recount_form_income_donation($form_id = false) {
1884 1884
 	// Check if form id is not empty.
1885
-	if ( ! empty( $form_id ) ) {
1885
+	if ( ! empty($form_id)) {
1886 1886
 		/**
1887 1887
 		 * Filter to modify payment status.
1888 1888
 		 *
1889 1889
 		 * @since 1.8.13
1890 1890
 		 */
1891
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1891
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1892 1892
 
1893 1893
 		/**
1894 1894
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 			'give_recount_form_stats_args', array(
1900 1900
 				'give_forms'     => $form_id,
1901 1901
 				'status'         => $accepted_statuses,
1902
-				'posts_per_page' => - 1,
1902
+				'posts_per_page' => -1,
1903 1903
 				'fields'         => 'ids',
1904 1904
 			)
1905 1905
 		);
@@ -1909,28 +1909,28 @@  discard block
 block discarded – undo
1909 1909
 			'earnings' => 0,
1910 1910
 		);
1911 1911
 
1912
-		$payments = new Give_Payments_Query( $args );
1912
+		$payments = new Give_Payments_Query($args);
1913 1913
 		$payments = $payments->get_payments();
1914 1914
 
1915
-		if ( $payments ) {
1916
-			foreach ( $payments as $payment ) {
1915
+		if ($payments) {
1916
+			foreach ($payments as $payment) {
1917 1917
 				// Ensure acceptible status only
1918
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1918
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1919 1919
 					continue;
1920 1920
 				}
1921 1921
 
1922 1922
 				// Ensure only payments for this form are counted
1923
-				if ( $payment->form_id != $form_id ) {
1923
+				if ($payment->form_id != $form_id) {
1924 1924
 					continue;
1925 1925
 				}
1926 1926
 
1927
-				$totals['sales'] ++;
1927
+				$totals['sales']++;
1928 1928
 				$totals['earnings'] += $payment->total;
1929 1929
 
1930 1930
 			}
1931 1931
 		}
1932
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1933
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1932
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1933
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1934 1934
 	}// End if().
1935 1935
 }
1936 1936
 
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
  *
1946 1946
  * @return bool
1947 1947
  */
1948
-function give_is_zero_based_currency( $currency = '' ) {
1948
+function give_is_zero_based_currency($currency = '') {
1949 1949
 	$zero_based_currency = array(
1950 1950
 		'PYG', // Paraguayan Guarani.
1951 1951
 		'GNF', // Guinean Franc.
@@ -1965,12 +1965,12 @@  discard block
 block discarded – undo
1965 1965
 	);
1966 1966
 
1967 1967
 	// Set default currency.
1968
-	if( empty( $currency ) ) {
1968
+	if (empty($currency)) {
1969 1969
 		$currency = give_get_currency();
1970 1970
 	}
1971 1971
 
1972 1972
 	// Check for Zero Based Currency.
1973
-	if ( in_array( $currency, $zero_based_currency ) ) {
1973
+	if (in_array($currency, $zero_based_currency)) {
1974 1974
 		return true;
1975 1975
 	}
1976 1976
 
Please login to merge, or discard this patch.
templates/history-donations.php 2 patches
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -3,33 +3,33 @@  discard block
 block discarded – undo
3 3
  * This template is used to display the donation history of the current user.
4 4
  */
5 5
 
6
-$donation_history_args = Give()->session->get( 'give_donation_history_args' );
6
+$donation_history_args = Give()->session->get('give_donation_history_args');
7 7
 
8 8
 $donations = array();
9 9
 
10 10
 // User's Donations.
11
-if ( is_user_logged_in() ) {
12
-	$donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' );
13
-} elseif ( Give()->email_access->token_exists ) {
11
+if (is_user_logged_in()) {
12
+	$donations = give_get_users_donations(get_current_user_id(), 20, true, 'any');
13
+} elseif (Give()->email_access->token_exists) {
14 14
 	// Email Access Token?
15
-	$donations = give_get_users_donations( 0, 20, true, 'any' );
16
-} elseif ( Give()->session->get_session_expiration() !== false ) {
15
+	$donations = give_get_users_donations(0, 20, true, 'any');
16
+} elseif (Give()->session->get_session_expiration() !== false) {
17 17
 	// Session active?
18
-	$email     = Give()->session->get( 'give_email' );
19
-	$donations = give_get_users_donations( $email, 20, true, 'any' );
18
+	$email     = Give()->session->get('give_email');
19
+	$donations = give_get_users_donations($email, 20, true, 'any');
20 20
 }
21 21
 
22 22
 
23
-if ( $donations ) : ?>
23
+if ($donations) : ?>
24 24
 	<?php
25 25
 	$table_headings = array(
26
-		'id'             => __( 'ID', 'give' ),
27
-		'date'           => __( 'Date', 'give' ),
28
-		'donor'          => __( 'Donor', 'give' ),
29
-		'amount'         => __( 'Amount', 'give' ),
30
-		'status'         => __( 'Status', 'give' ),
31
-		'payment_method' => __( 'Payment Method', 'give' ),
32
-		'details'        => __( 'Details', 'give' ),
26
+		'id'             => __('ID', 'give'),
27
+		'date'           => __('Date', 'give'),
28
+		'donor'          => __('Donor', 'give'),
29
+		'amount'         => __('Amount', 'give'),
30
+		'status'         => __('Status', 'give'),
31
+		'payment_method' => __('Payment Method', 'give'),
32
+		'details'        => __('Details', 'give'),
33 33
 	);
34 34
 	?>
35 35
 	<table id="give_user_history" class="give-table">
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 				 *
44 44
 				 * @since 1.7
45 45
 				 */
46
-				do_action( 'give_donation_history_header_before' );
46
+				do_action('give_donation_history_header_before');
47 47
 
48
-				foreach ( $donation_history_args as $index => $value ) {
49
-					if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) :
48
+				foreach ($donation_history_args as $index => $value) {
49
+					if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) :
50 50
 						echo sprintf(
51 51
 							'<th scope="col" class="give-donation-%1$s>">%2$s</th>',
52 52
 							$index,
53
-							$table_headings[ $index ]
53
+							$table_headings[$index]
54 54
 						);
55 55
 					endif;
56 56
 				}
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 				 *
63 63
 				 * @since 1.7
64 64
 				 */
65
-				do_action( 'give_donation_history_header_after' );
65
+				do_action('give_donation_history_header_after');
66 66
 				?>
67 67
 			</tr>
68 68
 		</thead>
69
-		<?php foreach ( $donations as $post ) :
70
-			setup_postdata( $post );
71
-			$donation_data = give_get_payment_meta( $post->ID ); ?>
69
+		<?php foreach ($donations as $post) :
70
+			setup_postdata($post);
71
+			$donation_data = give_get_payment_meta($post->ID); ?>
72 72
 			<tr class="give-donation-row">
73 73
 				<?php
74 74
 				/**
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 				 * @param int   $post_id       The ID of the post.
82 82
 				 * @param mixed $donation_data Payment meta data.
83 83
 				 */
84
-				do_action( 'give_donation_history_row_start', $post->ID, $donation_data );
84
+				do_action('give_donation_history_row_start', $post->ID, $donation_data);
85 85
 
86
-				if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) :
86
+				if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) :
87 87
 					echo sprintf(
88 88
 						'<td class="give-donation-id">#%s</td>',
89
-						give_get_payment_number( $post->ID )
89
+						give_get_payment_number($post->ID)
90 90
 					);
91 91
 				endif;
92 92
 
93
-				if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) :
93
+				if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) :
94 94
 					echo sprintf(
95 95
 						'<td class="give-donation-date">#%s</td>',
96
-						date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) )
96
+						date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID)))
97 97
 					);
98 98
 				endif;
99 99
 
100
-				if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) :
100
+				if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) :
101 101
 					echo sprintf(
102 102
 						'<td class="give-donation-donor">#%s</td>',
103
-						give_get_donor_name_by( $post->ID )
103
+						give_get_donor_name_by($post->ID)
104 104
 					);
105 105
 				endif;
106 106
 				?>
107 107
 
108
-				<?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
108
+				<?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?>
109 109
 					<td class="give-donation-amount">
110 110
 						<span class="give-donation-amount">
111 111
 							<?php
112
-							$currency_code   = give_get_payment_currency_code( $post->ID );
112
+							$currency_code   = give_get_payment_currency_code($post->ID);
113 113
 							$donation_amount = give_currency_filter(
114
-								give_format_amount( give_get_payment_amount( $post->ID ), array(
114
+								give_format_amount(give_get_payment_amount($post->ID), array(
115 115
 									'sanitize'    => false,
116 116
 									'currency'    => $currency_code,
117 117
 								)),
@@ -128,42 +128,42 @@  discard block
 block discarded – undo
128 128
 							 *
129 129
 							 * @return int
130 130
 							 */
131
-							echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID );
131
+							echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID);
132 132
 							?>
133 133
 						</span>
134 134
 					</td>
135 135
 				<?php endif; ?>
136 136
 
137 137
 				<?php
138
-				if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) :
138
+				if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) :
139 139
 					echo sprintf(
140 140
 						'<td class="give-donation-status">#%s</td>',
141
-						give_get_payment_status( $post, true )
141
+						give_get_payment_status($post, true)
142 142
 					);
143 143
 				endif;
144 144
 
145
-				if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) :
145
+				if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) :
146 146
 					echo sprintf(
147 147
 						'<td class="give-donation-payment-method">#%s</td>',
148
-						give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) )
148
+						give_get_gateway_checkout_label(give_get_payment_gateway($post->ID))
149 149
 					);
150 150
 				endif;
151 151
 				?>
152 152
 				<td class="give-donation-details">
153 153
 					<?php
154 154
 					// Display View Receipt or.
155
-					if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) :
155
+					if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) :
156 156
 						echo sprintf(
157 157
 							'<a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>',
158 158
 							esc_url(
159 159
 								add_query_arg(
160 160
 									'payment_key',
161
-									give_get_payment_key( $post->ID ),
161
+									give_get_payment_key($post->ID),
162 162
 									give_get_history_page_uri()
163 163
 								)
164 164
 							),
165 165
 							$post->post_status,
166
-							__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;'
166
+							__('View', 'give').' '.give_get_payment_status($post, true).' &raquo;'
167 167
 						);
168 168
 
169 169
 					else :
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 							esc_url(
173 173
 								add_query_arg(
174 174
 									'payment_key',
175
-									give_get_payment_key( $post->ID ),
175
+									give_get_payment_key($post->ID),
176 176
 									give_get_history_page_uri()
177 177
 								)
178 178
 							),
179
-							__( 'View Receipt &raquo;', 'give' )
179
+							__('View Receipt &raquo;', 'give')
180 180
 						);
181 181
 
182 182
 					endif;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				 * @param int   $post_id       The ID of the post.
194 194
 				 * @param mixed $donation_data Payment meta data.
195 195
 				 */
196
-				do_action( 'give_donation_history_row_end', $post->ID, $donation_data );
196
+				do_action('give_donation_history_row_end', $post->ID, $donation_data);
197 197
 				?>
198 198
 			</tr>
199 199
 		<?php endforeach; ?>
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 	<div id="give-donation-history-pagination" class="give_pagination navigation">
202 202
 		<?php
203 203
 		$big = 999999;
204
-		echo paginate_links( array(
205
-			'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
204
+		echo paginate_links(array(
205
+			'base'    => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
206 206
 			'format'  => '?paged=%#%',
207
-			'current' => max( 1, get_query_var( 'paged' ) ),
208
-			'total'   => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page
209
-		) );
207
+			'current' => max(1, get_query_var('paged')),
208
+			'total'   => ceil(give_count_donations_of_donor() / 20) // 20 items per page
209
+		));
210 210
 		?>
211 211
 	</div>
212 212
 	<?php wp_reset_postdata(); ?>
213 213
 <?php else : ?>
214
-	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
214
+	<?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?>
215 215
 <?php endif;
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -166,7 +166,8 @@  discard block
 block discarded – undo
166 166
 							__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;'
167 167
 						);
168 168
 
169
-					else :
169
+					else {
170
+						:
170 171
 						echo sprintf(
171 172
 							'<a href="%1$s">%2$s</a>',
172 173
 							esc_url(
@@ -178,6 +179,7 @@  discard block
 block discarded – undo
178 179
 							),
179 180
 							__( 'View Receipt &raquo;', 'give' )
180 181
 						);
182
+					}
181 183
 
182 184
 					endif;
183 185
 					?>
@@ -210,6 +212,9 @@  discard block
 block discarded – undo
210 212
 		?>
211 213
 	</div>
212 214
 	<?php wp_reset_postdata(); ?>
213
-<?php else : ?>
214
-	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
215
+<?php else {
216
+	: ?>
217
+	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' );
218
+}
219
+?>
215 220
 <?php endif;
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +107 added lines, -107 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,33 +23,33 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string
25 25
  */
26
-function give_donation_history( $atts ) {
26
+function give_donation_history($atts) {
27 27
 
28
-	$donation_history_args = shortcode_atts( array(
28
+	$donation_history_args = shortcode_atts(array(
29 29
 		'id'             => true,
30 30
 		'date'           => true,
31 31
 		'donor'          => false,
32 32
 		'amount'         => true,
33 33
 		'status'         => false,
34 34
 		'payment_method' => false,
35
-	), $atts, 'donation_history' );
35
+	), $atts, 'donation_history');
36 36
 
37 37
 	// Always show receipt link.
38 38
 	$donation_history_args['details'] = true;
39 39
 
40 40
 	// Set Donation History Shortcode Arguments in session variable.
41
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
41
+	Give()->session->set('give_donation_history_args', $donation_history_args);
42 42
 
43 43
 	// If payment_key query arg exists, return receipt instead of donation history.
44
-	if ( isset( $_GET['payment_key'] ) ) {
44
+	if (isset($_GET['payment_key'])) {
45 45
 		ob_start();
46
-		echo give_receipt_shortcode( array() );
47
-		echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">&laquo; ' . __( 'Return to All Donations', 'give' ) . '</a>';
46
+		echo give_receipt_shortcode(array());
47
+		echo '<a href="'.esc_url(give_get_history_page_uri()).'">&laquo; '.__('Return to All Donations', 'give').'</a>';
48 48
 
49 49
 		return ob_get_clean();
50 50
 	}
51 51
 
52
-	$email_access = give_get_option( 'email_access' );
52
+	$email_access = give_get_option('email_access');
53 53
 
54 54
 	/**
55 55
 	 * Determine access
@@ -59,30 +59,30 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	if (
61 61
 		is_user_logged_in() || false !== Give()->session->get_session_expiration()
62
-		|| ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists )
62
+		|| (give_is_setting_enabled($email_access) && Give()->email_access->token_exists)
63 63
 	) {
64 64
 		ob_start();
65
-		give_get_template_part( 'history', 'donations' );
65
+		give_get_template_part('history', 'donations');
66 66
 
67 67
 		return ob_get_clean();
68 68
 
69
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
69
+	} elseif (give_is_setting_enabled($email_access)) {
70 70
 		// Is Email-based access enabled?
71 71
 		ob_start();
72
-		give_get_template_part( 'email', 'login-form' );
72
+		give_get_template_part('email', 'login-form');
73 73
 
74 74
 		return ob_get_clean();
75 75
 
76 76
 	} else {
77 77
 
78
-		$output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
79
-		$output .= do_shortcode( '[give_login]' );
78
+		$output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
79
+		$output .= do_shortcode('[give_login]');
80 80
 
81 81
 		return $output;
82 82
 	}
83 83
 }
84 84
 
85
-add_shortcode( 'donation_history', 'give_donation_history' );
85
+add_shortcode('donation_history', 'give_donation_history');
86 86
 
87 87
 /**
88 88
  * Donation Form Shortcode
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @return string
97 97
  */
98
-function give_form_shortcode( $atts ) {
99
-	$atts = shortcode_atts( array(
98
+function give_form_shortcode($atts) {
99
+	$atts = shortcode_atts(array(
100 100
 		'id'                    => '',
101 101
 		'show_title'            => true,
102 102
 		'show_goal'             => true,
@@ -104,21 +104,21 @@  discard block
 block discarded – undo
104 104
 		'float_labels'          => '',
105 105
 		'display_style'         => '',
106 106
 		'continue_button_title' => '',
107
-	), $atts, 'give_form' );
107
+	), $atts, 'give_form');
108 108
 
109 109
 	// Convert string to bool.
110
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
111
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
110
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
111
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
112 112
 
113 113
 	//get the Give Form
114 114
 	ob_start();
115
-	give_get_donation_form( $atts );
115
+	give_get_donation_form($atts);
116 116
 	$final_output = ob_get_clean();
117 117
 
118
-	return apply_filters( 'give_donate_form', $final_output, $atts );
118
+	return apply_filters('give_donate_form', $final_output, $atts);
119 119
 }
120 120
 
121
-add_shortcode( 'give_form', 'give_form_shortcode' );
121
+add_shortcode('give_form', 'give_form_shortcode');
122 122
 
123 123
 /**
124 124
  * Donation Form Goal Shortcode.
@@ -131,37 +131,37 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return string
133 133
  */
134
-function give_goal_shortcode( $atts ) {
135
-	$atts = shortcode_atts( array(
134
+function give_goal_shortcode($atts) {
135
+	$atts = shortcode_atts(array(
136 136
 		'id'        => '',
137 137
 		'show_text' => true,
138 138
 		'show_bar'  => true,
139
-	), $atts, 'give_goal' );
139
+	), $atts, 'give_goal');
140 140
 
141 141
 
142 142
 	//get the Give Form.
143 143
 	ob_start();
144 144
 
145 145
 	//Sanity check 1: ensure there is an ID Provided.
146
-	if ( empty( $atts['id'] ) ) {
147
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
146
+	if (empty($atts['id'])) {
147
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
148 148
 	}
149 149
 
150 150
 	//Sanity check 2: Check the form even has Goals enabled.
151
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
151
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
152 152
 
153
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
153
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
154 154
 	} else {
155 155
 		//Passed all sanity checks: output Goal.
156
-		give_show_goal_progress( $atts['id'], $atts );
156
+		give_show_goal_progress($atts['id'], $atts);
157 157
 	}
158 158
 
159 159
 	$final_output = ob_get_clean();
160 160
 
161
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
161
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
162 162
 }
163 163
 
164
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
164
+add_shortcode('give_goal', 'give_goal_shortcode');
165 165
 
166 166
 
167 167
 /**
@@ -178,22 +178,22 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return string
180 180
  */
181
-function give_login_form_shortcode( $atts ) {
182
-	$atts = shortcode_atts( array(
181
+function give_login_form_shortcode($atts) {
182
+	$atts = shortcode_atts(array(
183 183
 		// Add backward compatibility for redirect attribute.
184 184
 		'redirect' => '',
185 185
 
186 186
 		'login-redirect'  => '',
187 187
 		'logout-redirect' => '',
188
-	), $atts, 'give_login' );
188
+	), $atts, 'give_login');
189 189
 
190 190
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
191
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
191
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
192 192
 
193
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
193
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
194 194
 }
195 195
 
196
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
196
+add_shortcode('give_login', 'give_login_form_shortcode');
197 197
 
198 198
 /**
199 199
  * Register Shortcode.
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
  *
209 209
  * @return string
210 210
  */
211
-function give_register_form_shortcode( $atts ) {
212
-	$atts = shortcode_atts( array(
211
+function give_register_form_shortcode($atts) {
212
+	$atts = shortcode_atts(array(
213 213
 		'redirect' => '',
214
-	), $atts, 'give_register' );
214
+	), $atts, 'give_register');
215 215
 
216
-	return give_register_form( $atts['redirect'] );
216
+	return give_register_form($atts['redirect']);
217 217
 }
218 218
 
219
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
219
+add_shortcode('give_register', 'give_register_form_shortcode');
220 220
 
221 221
 /**
222 222
  * Receipt Shortcode.
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return string
231 231
  */
232
-function give_receipt_shortcode( $atts ) {
232
+function give_receipt_shortcode($atts) {
233 233
 
234 234
 	global $give_receipt_args, $payment;
235 235
 
236
-	$give_receipt_args = shortcode_atts( array(
237
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
236
+	$give_receipt_args = shortcode_atts(array(
237
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
238 238
 		'price'          => true,
239 239
 		'donor'          => true,
240 240
 		'date'           => true,
@@ -243,50 +243,50 @@  discard block
 block discarded – undo
243 243
 		'payment_id'     => true,
244 244
 		'payment_status' => false,
245 245
 		'status_notice'  => true,
246
-	), $atts, 'give_receipt' );
246
+	), $atts, 'give_receipt');
247 247
 
248 248
 	//set $session var
249 249
 	$session = give_get_purchase_session();
250 250
 
251 251
 	//set payment key var
252
-	if ( isset( $_GET['payment_key'] ) ) {
253
-		$payment_key = urldecode( $_GET['payment_key'] );
254
-	} elseif ( $session ) {
252
+	if (isset($_GET['payment_key'])) {
253
+		$payment_key = urldecode($_GET['payment_key']);
254
+	} elseif ($session) {
255 255
 		$payment_key = $session['purchase_key'];
256
-	} elseif ( $give_receipt_args['payment_key'] ) {
256
+	} elseif ($give_receipt_args['payment_key']) {
257 257
 		$payment_key = $give_receipt_args['payment_key'];
258 258
 	}
259 259
 
260
-	$email_access = give_get_option( 'email_access' );
260
+	$email_access = give_get_option('email_access');
261 261
 
262 262
 	// No payment_key found & Email Access is Turned on:
263
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
263
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
264 264
 
265 265
 		ob_start();
266 266
 
267
-		give_get_template_part( 'email-login-form' );
267
+		give_get_template_part('email-login-form');
268 268
 
269 269
 		return ob_get_clean();
270 270
 
271
-	} elseif ( ! isset( $payment_key ) ) {
271
+	} elseif ( ! isset($payment_key)) {
272 272
 
273
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
273
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
274 274
 
275 275
 	}
276 276
 
277
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
278
-	$user_can_view = give_can_view_receipt( $payment_key );
277
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
278
+	$user_can_view = give_can_view_receipt($payment_key);
279 279
 
280 280
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
281
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
281
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
282 282
 
283 283
 		ob_start();
284 284
 
285
-		give_get_template_part( 'email-login-form' );
285
+		give_get_template_part('email-login-form');
286 286
 
287 287
 		return ob_get_clean();
288 288
 
289
-	} elseif ( ! $user_can_view ) {
289
+	} elseif ( ! $user_can_view) {
290 290
 
291 291
 		global $give_login_redirect;
292 292
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 
295 295
 		ob_start();
296 296
 
297
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
297
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
298 298
 
299
-		give_get_template_part( 'shortcode', 'login' );
299
+		give_get_template_part('shortcode', 'login');
300 300
 
301 301
 		$login_form = ob_get_clean();
302 302
 
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
311 311
 	 * or if user is logged in and the user can view sensitive shop data.
312 312
 	 */
313
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
314
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
313
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
314
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
315 315
 	}
316 316
 
317 317
 	ob_start();
318 318
 
319
-	give_get_template_part( 'shortcode', 'receipt' );
319
+	give_get_template_part('shortcode', 'receipt');
320 320
 
321 321
 	$display = ob_get_clean();
322 322
 
323 323
 	return $display;
324 324
 }
325 325
 
326
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
326
+add_shortcode('give_receipt', 'give_receipt_shortcode');
327 327
 
328 328
 /**
329 329
  * Profile Editor Shortcode.
@@ -342,25 +342,25 @@  discard block
 block discarded – undo
342 342
  *
343 343
  * @return string Output generated from the profile editor
344 344
  */
345
-function give_profile_editor_shortcode( $atts ) {
345
+function give_profile_editor_shortcode($atts) {
346 346
 
347 347
 	ob_start();
348 348
 
349 349
 	// Restrict access to donor profile, if donor and user are disconnected.
350
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
351
-	if( is_user_logged_in() && $is_donor_disconnected ) {
352
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
350
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
351
+	if (is_user_logged_in() && $is_donor_disconnected) {
352
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
353 353
 		return false;
354 354
 	}
355 355
 
356
-	give_get_template_part( 'shortcode', 'profile-editor' );
356
+	give_get_template_part('shortcode', 'profile-editor');
357 357
 
358 358
 	$display = ob_get_clean();
359 359
 
360 360
 	return $display;
361 361
 }
362 362
 
363
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
363
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
364 364
 
365 365
 /**
366 366
  * Process Profile Updater Form.
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool
375 375
  */
376
-function give_process_profile_editor_updates( $data ) {
376
+function give_process_profile_editor_updates($data) {
377 377
 	// Profile field change request
378
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
378
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
379 379
 		return false;
380 380
 	}
381 381
 
382 382
 	// Nonce security
383
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
383
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
384 384
 		return false;
385 385
 	}
386 386
 
387 387
 	$user_id       = get_current_user_id();
388
-	$old_user_data = get_userdata( $user_id );
389
-
390
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
391
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
392
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
393
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
394
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
395
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
396
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
397
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
398
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
399
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
388
+	$old_user_data = get_userdata($user_id);
389
+
390
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
391
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
392
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
393
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
394
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
395
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
396
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
397
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
398
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
399
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
400 400
 
401 401
 	$userdata = array(
402 402
 		'ID'           => $user_id,
@@ -424,40 +424,40 @@  discard block
 block discarded – undo
424 424
 	 * @param int $user_id The ID of the user.
425 425
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
426 426
 	 */
427
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
427
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
428 428
 
429 429
 	// Make sure to validate passwords for existing Donors
430
-	give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] );
430
+	give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']);
431 431
 
432
-	if ( empty( $email ) ) {
432
+	if (empty($email)) {
433 433
 		// Make sure email should not be empty.
434
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
434
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
435 435
 
436
-	} else if ( ! is_email( $email ) ) {
436
+	} else if ( ! is_email($email)) {
437 437
 		// Make sure email should be valid.
438
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
438
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
439 439
 
440
-	} else if ( $email != $old_user_data->user_email ) {
440
+	} else if ($email != $old_user_data->user_email) {
441 441
 		// Make sure the new email doesn't belong to another user
442
-		if ( email_exists( $email ) ) {
443
-			give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
442
+		if (email_exists($email)) {
443
+			give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
444 444
 		}
445 445
 	}
446 446
 
447 447
 	// Check for errors
448 448
 	$errors = give_get_errors();
449 449
 
450
-	if ( $errors ) {
450
+	if ($errors) {
451 451
 		// Send back to the profile editor if there are errors
452
-		wp_redirect( $data['give_redirect'] );
452
+		wp_redirect($data['give_redirect']);
453 453
 		give_die();
454 454
 	}
455 455
 
456 456
 	// Update the user
457
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
458
-	$updated = wp_update_user( $userdata );
457
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
458
+	$updated = wp_update_user($userdata);
459 459
 
460
-	if ( $updated ) {
460
+	if ($updated) {
461 461
 
462 462
 		/**
463 463
 		 * Fires after updating user profile.
@@ -467,12 +467,12 @@  discard block
 block discarded – undo
467 467
 		 * @param int $user_id The ID of the user.
468 468
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
469 469
 		 */
470
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
471
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
470
+		do_action('give_user_profile_updated', $user_id, $userdata);
471
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
472 472
 		give_die();
473 473
 	}
474 474
 
475 475
 	return false;
476 476
 }
477 477
 
478
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
478
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +402 added lines, -403 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,50 +23,50 @@  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
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int $form_id The form ID.
79 79
 	 * @param array $args An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args );
81
+	do_action('give_pre_form_output', $form->ID, $args);
82 82
 
83 83
 	?>
84 84
     <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103
-				( isset( $args['show_title'] ) && $args['show_title'] == true )
104
-				&& ! doing_action( 'give_single_form_summary' )
103
+				(isset($args['show_title']) && $args['show_title'] == true)
104
+				&& ! doing_action('give_single_form_summary')
105 105
 			) {
106 106
 				echo $form_title;
107 107
 			}
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
 			 * @param int $form_id The form ID.
115 115
 			 * @param array $args An array of form arguments.
116 116
 			 */
117
-			do_action( 'give_pre_form', $form->ID, $args );
117
+			do_action('give_pre_form', $form->ID, $args);
118 118
 			?>
119 119
 
120 120
             <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
121
-                  action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
121
+                  action="<?php echo esc_url_raw($form_action); ?>" method="post">
122 122
                 <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
123
-                <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
123
+                <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
124 124
                 <input type="hidden" name="give-current-url"
125
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
125
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
126 126
                 <input type="hidden" name="give-form-url"
127
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
127
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
128 128
                 <input type="hidden" name="give-form-minimum"
129
-                       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ), array( 'sanitize' => false ) ); ?>"/>
129
+                       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID), array('sanitize' => false)); ?>"/>
130 130
 
131 131
                 <!-- The following field is for robots only, invisible to humans: -->
132 132
                 <span class="give-hidden" style="display: none !important;">
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 				<?php
139 139
 
140 140
 				// Price ID hidden field for variable (multi-level) donation forms.
141
-				if ( give_has_variable_prices( $form_id ) ) {
141
+				if (give_has_variable_prices($form_id)) {
142 142
 					// Get default selected price ID.
143
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
143
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
144 144
 					$price_id = 0;
145 145
 					//loop through prices.
146
-					foreach ( $prices as $price ) {
147
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
146
+					foreach ($prices as $price) {
147
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
148 148
 							$price_id = $price['_give_id']['level_id'];
149 149
 						};
150 150
 					}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				 * @param int $form_id The form ID.
161 161
 				 * @param array $args An array of form arguments.
162 162
 				 */
163
-				do_action( 'give_donation_form_top', $form->ID, $args );
163
+				do_action('give_donation_form_top', $form->ID, $args);
164 164
 
165 165
 				/**
166 166
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				 * @param int $form_id The form ID.
171 171
 				 * @param array $args An array of form arguments.
172 172
 				 */
173
-				do_action( 'give_payment_mode_select', $form->ID, $args );
173
+				do_action('give_payment_mode_select', $form->ID, $args);
174 174
 
175 175
 				/**
176 176
 				 * Fires while outputting donation form, after all other fields.
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 				 * @param int $form_id The form ID.
181 181
 				 * @param array $args An array of form arguments.
182 182
 				 */
183
-				do_action( 'give_donation_form_bottom', $form->ID, $args );
183
+				do_action('give_donation_form_bottom', $form->ID, $args);
184 184
 
185 185
 				?>
186 186
             </form>
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 			 * @param int $form_id The form ID.
195 195
 			 * @param array $args An array of form arguments.
196 196
 			 */
197
-			do_action( 'give_post_form', $form->ID, $args );
197
+			do_action('give_post_form', $form->ID, $args);
198 198
 
199 199
 		}
200 200
 		?>
201 201
 
202
-    </div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
202
+    </div><!--end #give-form-<?php echo absint($form->ID); ?>-->
203 203
 	<?php
204 204
 
205 205
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @param int $form_id The form ID.
211 211
 	 * @param array $args An array of form arguments.
212 212
 	 */
213
-	do_action( 'give_post_form_output', $form->ID, $args );
213
+	do_action('give_post_form_output', $form->ID, $args);
214 214
 
215 215
 	$final_output = ob_get_clean();
216 216
 
217
-	echo apply_filters( 'give_donate_form', $final_output, $args );
217
+	echo apply_filters('give_donate_form', $final_output, $args);
218 218
 }
219 219
 
220 220
 /**
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return string
233 233
  */
234
-function give_show_purchase_form( $form_id ) {
234
+function give_show_purchase_form($form_id) {
235 235
 
236
-	$payment_mode = give_get_chosen_gateway( $form_id );
236
+	$payment_mode = give_get_chosen_gateway($form_id);
237 237
 
238
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
238
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
239 239
 		$form_id = $_POST['give_form_id'];
240 240
 	}
241 241
 
@@ -244,33 +244,33 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @since 1.7
246 246
 	 */
247
-	do_action( 'give_payment_fields_top', $form_id );
247
+	do_action('give_payment_fields_top', $form_id);
248 248
 
249
-	if ( give_can_checkout() && isset( $form_id ) ) {
249
+	if (give_can_checkout() && isset($form_id)) {
250 250
 
251 251
 		/**
252 252
 		 * Fires while displaying donation form, before registration login.
253 253
 		 *
254 254
 		 * @since 1.7
255 255
 		 */
256
-		do_action( 'give_donation_form_before_register_login', $form_id );
256
+		do_action('give_donation_form_before_register_login', $form_id);
257 257
 
258 258
 		/**
259 259
 		 * Fire when register/login form fields render.
260 260
 		 *
261 261
 		 * @since 1.7
262 262
 		 */
263
-		do_action( 'give_donation_form_register_login_fields', $form_id );
263
+		do_action('give_donation_form_register_login_fields', $form_id);
264 264
 
265 265
 		/**
266 266
 		 * Fire when credit card form fields render.
267 267
 		 *
268 268
 		 * @since 1.7
269 269
 		 */
270
-		do_action( 'give_donation_form_before_cc_form', $form_id );
270
+		do_action('give_donation_form_before_cc_form', $form_id);
271 271
 
272 272
 		// Load the credit card form and allow gateways to load their own if they wish.
273
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
273
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
274 274
 			/**
275 275
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
276 276
 			 *
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			 *
279 279
 			 * @param int $form_id The form ID.
280 280
 			 */
281
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
281
+			do_action("give_{$payment_mode}_cc_form", $form_id);
282 282
 		} else {
283 283
 			/**
284 284
 			 * Fires while displaying donation form, credit card form fields.
@@ -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_cc_form', $form_id );
290
+			do_action('give_cc_form', $form_id);
291 291
 		}
292 292
 
293 293
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 1.7
297 297
 		 */
298
-		do_action( 'give_donation_form_after_cc_form', $form_id );
298
+		do_action('give_donation_form_after_cc_form', $form_id);
299 299
 
300 300
 	} else {
301 301
 		/**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @since 1.7
305 305
 		 */
306
-		do_action( 'give_donation_form_no_access', $form_id );
306
+		do_action('give_donation_form_no_access', $form_id);
307 307
 
308 308
 	}
309 309
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 1.7
314 314
 	 */
315
-	do_action( 'give_payment_fields_bottom', $form_id );
315
+	do_action('give_payment_fields_bottom', $form_id);
316 316
 }
317 317
 
318
-add_action( 'give_donation_form', 'give_show_purchase_form' );
318
+add_action('give_donation_form', 'give_show_purchase_form');
319 319
 
320 320
 /**
321 321
  * Give Show Login/Register Form Fields.
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @return void
328 328
  */
329
-function give_show_register_login_fields( $form_id ) {
329
+function give_show_register_login_fields($form_id) {
330 330
 
331
-	$show_register_form = give_show_login_register_option( $form_id );
331
+	$show_register_form = give_show_login_register_option($form_id);
332 332
 
333
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
333
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
334 334
 		?>
335 335
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
336 336
 			<?php
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 			 *
340 340
 			 * @since 1.7
341 341
 			 */
342
-			do_action( 'give_donation_form_register_fields', $form_id );
342
+			do_action('give_donation_form_register_fields', $form_id);
343 343
 			?>
344 344
         </div>
345 345
 		<?php
346
-    elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
346
+    elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
347 347
 		?>
348 348
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
349 349
 			<?php
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
 			 *
353 353
 			 * @since 1.7
354 354
 			 */
355
-			do_action( 'give_donation_form_login_fields', $form_id );
355
+			do_action('give_donation_form_login_fields', $form_id);
356 356
 			?>
357 357
         </div>
358 358
 		<?php
359 359
 	endif;
360 360
 
361
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
361
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
362 362
 		/**
363 363
 		 * Fire when user info render.
364 364
 		 *
365 365
 		 * @since 1.7
366 366
 		 */
367
-		do_action( 'give_donation_form_after_user_info', $form_id );
367
+		do_action('give_donation_form_after_user_info', $form_id);
368 368
 	}
369 369
 }
370 370
 
371
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
371
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
372 372
 
373 373
 /**
374 374
  * Donation Amount Field.
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return void
385 385
  */
386
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
386
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
387 387
 
388 388
 	$give_options        = give_get_settings();
389
-	$variable_pricing    = give_has_variable_prices( $form_id );
390
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
391
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
392
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
393
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
394
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false ) );
395
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
389
+	$variable_pricing    = give_has_variable_prices($form_id);
390
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
391
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
392
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
393
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
394
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false));
395
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
396 396
 
397 397
 	/**
398 398
 	 * Fires while displaying donation form, before donation level fields.
@@ -402,20 +402,20 @@  discard block
 block discarded – undo
402 402
 	 * @param int $form_id The form ID.
403 403
 	 * @param array $args An array of form arguments.
404 404
 	 */
405
-	do_action( 'give_before_donation_levels', $form_id, $args );
405
+	do_action('give_before_donation_levels', $form_id, $args);
406 406
 
407 407
 	//Set Price, No Custom Amount Allowed means hidden price field
408
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
408
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
409 409
 		?>
410
-        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
410
+        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
411 411
         <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
412 412
                value="<?php echo $default_amount; ?>" required aria-required="true"/>
413 413
         <div class="set-price give-donation-amount form-row-wide">
414
-			<?php if ( $currency_position == 'before' ) {
414
+			<?php if ($currency_position == 'before') {
415 415
 				echo $currency_output;
416 416
 			} ?>
417 417
             <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
418
-			<?php if ( $currency_position == 'after' ) {
418
+			<?php if ($currency_position == 'after') {
419 419
 				echo $currency_output;
420 420
 			} ?>
421 421
         </div>
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 		?>
426 426
         <div class="give-total-wrap">
427 427
             <div class="give-donation-amount form-row-wide">
428
-				<?php if ( $currency_position == 'before' ) {
428
+				<?php if ($currency_position == 'before') {
429 429
 					echo $currency_output;
430 430
 				} ?>
431
-                <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
431
+                <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
432 432
                 <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
433 433
                        placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
434
-				<?php if ( $currency_position == 'after' ) {
434
+				<?php if ($currency_position == 'after') {
435 435
 					echo $currency_output;
436 436
 				} ?>
437 437
             </div>
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
 	 * @param int $form_id The form ID.
447 447
 	 * @param array $args An array of form arguments.
448 448
 	 */
449
-	do_action( 'give_after_donation_amount', $form_id, $args );
449
+	do_action('give_after_donation_amount', $form_id, $args);
450 450
 
451 451
 	//Custom Amount Text
452
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
452
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
453 453
         <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
454 454
 	<?php }
455 455
 
456 456
 	//Output Variable Pricing Levels.
457
-	if ( $variable_pricing ) {
458
-		give_output_levels( $form_id );
457
+	if ($variable_pricing) {
458
+		give_output_levels($form_id);
459 459
 	}
460 460
 
461 461
 	/**
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	 * @param int $form_id The form ID.
467 467
 	 * @param array $args An array of form arguments.
468 468
 	 */
469
-	do_action( 'give_after_donation_levels', $form_id, $args );
469
+	do_action('give_after_donation_levels', $form_id, $args);
470 470
 }
471 471
 
472
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
472
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
473 473
 
474 474
 /**
475 475
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -480,30 +480,30 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @return string Donation levels.
482 482
  */
483
-function give_output_levels( $form_id ) {
483
+function give_output_levels($form_id) {
484 484
 
485 485
 	//Get variable pricing.
486
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
487
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
488
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
489
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
490
-	if ( empty( $custom_amount_text ) ) {
491
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
486
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
487
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
488
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
489
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
490
+	if (empty($custom_amount_text)) {
491
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
492 492
 	}
493 493
 
494 494
 	$output = '';
495 495
 
496
-	switch ( $display_style ) {
496
+	switch ($display_style) {
497 497
 		case 'buttons':
498 498
 
499 499
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
500 500
 
501
-			foreach ( $prices as $price ) {
502
-				$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 ) ) ), $form_id, $price );
503
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
501
+			foreach ($prices as $price) {
502
+				$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))), $form_id, $price);
503
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
504 504
 
505 505
 				$output .= '<li>';
506
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
506
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
507 507
 				$output .= $level_text;
508 508
 				$output .= '</button>';
509 509
 				$output .= '</li>';
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			}
512 512
 
513 513
 			//Custom Amount.
514
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
514
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
515 515
 				$output .= '<li>';
516 516
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
517 517
 				$output .= $custom_amount_text;
@@ -527,22 +527,22 @@  discard block
 block discarded – undo
527 527
 
528 528
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
529 529
 
530
-			foreach ( $prices as $price ) {
531
-				$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 ) ) ), $form_id, $price );
532
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
530
+			foreach ($prices as $price) {
531
+				$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))), $form_id, $price);
532
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
533 533
 
534 534
 				$output .= '<li>';
535
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
536
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
535
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
536
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
537 537
 				$output .= '</li>';
538 538
 
539 539
 			}
540 540
 
541 541
 			//Custom Amount.
542
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
542
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
543 543
 				$output .= '<li>';
544 544
 				$output .= '<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">';
545
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
545
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
546 546
 				$output .= '</li>';
547 547
 			}
548 548
 
@@ -552,23 +552,23 @@  discard block
 block discarded – undo
552 552
 
553 553
 		case 'dropdown':
554 554
 
555
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
556
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
555
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
556
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
557 557
 
558 558
 			//first loop through prices.
559
-			foreach ( $prices as $price ) {
560
-				$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 ) ) ), $form_id, $price );
561
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
559
+			foreach ($prices as $price) {
560
+				$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))), $form_id, $price);
561
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
562 562
 
563
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
563
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
564 564
 				$output .= $level_text;
565 565
 				$output .= '</option>';
566 566
 
567 567
 			}
568 568
 
569 569
 			//Custom Amount.
570
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
571
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
570
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
571
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
572 572
 			}
573 573
 
574 574
 			$output .= '</select>';
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			break;
577 577
 	}
578 578
 
579
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
579
+	echo apply_filters('give_form_level_output', $output, $form_id);
580 580
 }
581 581
 
582 582
 /**
@@ -591,27 +591,27 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @return string Checkout button.
593 593
  */
594
-function give_display_checkout_button( $form_id, $args ) {
594
+function give_display_checkout_button($form_id, $args) {
595 595
 
596
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
596
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
597 597
 		? $args['display_style']
598
-		: give_get_meta( $form_id, '_give_payment_display', true );
598
+		: give_get_meta($form_id, '_give_payment_display', true);
599 599
 
600
-	if ( 'button' === $display_option ) {
600
+	if ('button' === $display_option) {
601 601
 		$display_option = 'modal';
602
-	} elseif ( $display_option === 'onpage' ) {
602
+	} elseif ($display_option === 'onpage') {
603 603
 		return '';
604 604
 	}
605 605
 
606
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
607
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
606
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
607
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
608 608
 
609
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
609
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
610 610
 
611
-	echo apply_filters( 'give_display_checkout_button', $output );
611
+	echo apply_filters('give_display_checkout_button', $output);
612 612
 }
613 613
 
614
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
614
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
615 615
 
616 616
 /**
617 617
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -622,57 +622,57 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return void
624 624
  */
625
-function give_user_info_fields( $form_id ) {
625
+function give_user_info_fields($form_id) {
626 626
 	// Get user info.
627
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
627
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
628 628
 
629 629
 	/**
630 630
 	 * Fire before user personal information fields
631 631
 	 *
632 632
 	 * @since 1.7
633 633
 	 */
634
-	do_action( 'give_donation_form_before_personal_info', $form_id );
634
+	do_action('give_donation_form_before_personal_info', $form_id);
635 635
 	?>
636 636
     <fieldset id="give_checkout_user_info">
637
-        <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
637
+        <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
638 638
         <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
639 639
             <label class="give-label" for="give-first">
640
-				<?php esc_html_e( 'First Name', 'give' ); ?>
641
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
640
+				<?php esc_html_e('First Name', 'give'); ?>
641
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
642 642
                     <span class="give-required-indicator">*</span>
643 643
 				<?php endif ?>
644 644
                 <span class="give-tooltip give-icon give-icon-question"
645
-                      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
645
+                      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
646 646
             </label>
647 647
             <input
648 648
                     class="give-input required"
649 649
                     type="text"
650 650
                     name="give_first"
651
-                    placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
651
+                    placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
652 652
                     id="give-first"
653
-                    value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+                    value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
             />
656 656
         </p>
657 657
 
658 658
         <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
659 659
             <label class="give-label" for="give-last">
660
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php esc_html_e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
                     <span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664 664
                 <span class="give-tooltip give-icon give-icon-question"
665
-                      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
665
+                      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
666 666
             </label>
667 667
 
668 668
             <input
669
-                    class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
669
+                    class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
670 670
                     type="text"
671 671
                     name="give_last"
672 672
                     id="give-last"
673
-                    placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
674
-                    value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
675
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
673
+                    placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
674
+                    value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
675
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
676 676
             />
677 677
         </p>
678 678
 
@@ -682,26 +682,26 @@  discard block
 block discarded – undo
682 682
 		 *
683 683
 		 * @since 1.7
684 684
 		 */
685
-		do_action( 'give_donation_form_before_email', $form_id );
685
+		do_action('give_donation_form_before_email', $form_id);
686 686
 		?>
687 687
         <p id="give-email-wrap" class="form-row form-row-wide">
688 688
             <label class="give-label" for="give-email">
689
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
690
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
689
+				<?php esc_html_e('Email Address', 'give'); ?>
690
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
691 691
                     <span class="give-required-indicator">*</span>
692 692
 				<?php } ?>
693 693
                 <span class="give-tooltip give-icon give-icon-question"
694
-                      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
694
+                      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
695 695
             </label>
696 696
 
697 697
             <input
698 698
                     class="give-input required"
699 699
                     type="email"
700 700
                     name="give_email"
701
-                    placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
701
+                    placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
702 702
                     id="give-email"
703
-                    value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
704
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
703
+                    value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
704
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
705 705
             />
706 706
 
707 707
         </p>
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 		 *
712 712
 		 * @since 1.7
713 713
 		 */
714
-		do_action( 'give_donation_form_after_email', $form_id );
714
+		do_action('give_donation_form_after_email', $form_id);
715 715
 
716 716
 		/**
717 717
 		 * Fire after personal email field
718 718
 		 *
719 719
 		 * @since 1.7
720 720
 		 */
721
-		do_action( 'give_donation_form_user_info', $form_id );
721
+		do_action('give_donation_form_user_info', $form_id);
722 722
 		?>
723 723
     </fieldset>
724 724
 	<?php
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @since 1.7
729 729
 	 */
730
-	do_action( 'give_donation_form_after_personal_info', $form_id );
730
+	do_action('give_donation_form_after_personal_info', $form_id);
731 731
 }
732 732
 
733
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
734
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
733
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
734
+add_action('give_register_fields_before', 'give_user_info_fields');
735 735
 
736 736
 /**
737 737
  * Renders the credit card info form.
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return void
744 744
  */
745
-function give_get_cc_form( $form_id ) {
745
+function give_get_cc_form($form_id) {
746 746
 
747 747
 	ob_start();
748 748
 
@@ -753,53 +753,53 @@  discard block
 block discarded – undo
753 753
 	 *
754 754
 	 * @param int $form_id The form ID.
755 755
 	 */
756
-	do_action( 'give_before_cc_fields', $form_id );
756
+	do_action('give_before_cc_fields', $form_id);
757 757
 	?>
758 758
     <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
759
-        <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
760
-		<?php if ( is_ssl() ) : ?>
759
+        <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
760
+		<?php if (is_ssl()) : ?>
761 761
             <div id="give_secure_site_wrapper-<?php echo $form_id ?>">
762 762
                 <span class="give-icon padlock"></span>
763
-                <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
763
+                <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
764 764
             </div>
765 765
 		<?php endif; ?>
766 766
         <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
767 767
             <label for="card_number-<?php echo $form_id ?>" class="give-label">
768
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
768
+				<?php esc_html_e('Card Number', 'give'); ?>
769 769
                 <span class="give-required-indicator">*</span>
770 770
                 <span class="give-tooltip give-icon give-icon-question"
771
-                      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
771
+                      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
772 772
                 <span class="card-type"></span>
773 773
             </label>
774 774
 
775 775
             <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
776
-                   class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
776
+                   class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
777 777
                    required aria-required="true"/>
778 778
         </p>
779 779
 
780 780
         <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
781 781
             <label for="card_cvc-<?php echo $form_id ?>" class="give-label">
782
-				<?php esc_html_e( 'CVC', 'give' ); ?>
782
+				<?php esc_html_e('CVC', 'give'); ?>
783 783
                 <span class="give-required-indicator">*</span>
784 784
                 <span class="give-tooltip give-icon give-icon-question"
785
-                      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
785
+                      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
786 786
             </label>
787 787
 
788 788
             <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
789
-                   class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
789
+                   class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
790 790
                    required aria-required="true"/>
791 791
         </p>
792 792
 
793 793
         <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
794 794
             <label for="card_name-<?php echo $form_id ?>" class="give-label">
795
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
795
+				<?php esc_html_e('Name on the Card', 'give'); ?>
796 796
                 <span class="give-required-indicator">*</span>
797 797
                 <span class="give-tooltip give-icon give-icon-question"
798
-                      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
798
+                      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
799 799
             </label>
800 800
 
801 801
             <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
802
-                   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
802
+                   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
803 803
                    required aria-required="true"/>
804 804
         </p>
805 805
 		<?php
@@ -810,14 +810,14 @@  discard block
 block discarded – undo
810 810
 		 *
811 811
 		 * @param int $form_id The form ID.
812 812
 		 */
813
-		do_action( 'give_before_cc_expiration' );
813
+		do_action('give_before_cc_expiration');
814 814
 		?>
815 815
         <p class="card-expiration form-row form-row-one-third form-row-responsive">
816 816
             <label for="card_expiry-<?php echo $form_id ?>" class="give-label">
817
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
817
+				<?php esc_html_e('Expiration', 'give'); ?>
818 818
                 <span class="give-required-indicator">*</span>
819 819
                 <span class="give-tooltip give-icon give-icon-question"
820
-                      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
820
+                      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
821 821
             </label>
822 822
 
823 823
             <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
                    class="card-expiry-year"/>
827 827
 
828 828
             <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
829
-                   class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
829
+                   class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
830 830
                    required aria-required="true"/>
831 831
         </p>
832 832
 		<?php
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		 *
838 838
 		 * @param int $form_id The form ID.
839 839
 		 */
840
-		do_action( 'give_after_cc_expiration', $form_id );
840
+		do_action('give_after_cc_expiration', $form_id);
841 841
 		?>
842 842
     </fieldset>
843 843
 	<?php
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @param int $form_id The form ID.
850 850
 	 */
851
-	do_action( 'give_after_cc_fields', $form_id );
851
+	do_action('give_after_cc_fields', $form_id);
852 852
 
853 853
 	echo ob_get_clean();
854 854
 }
855 855
 
856
-add_action( 'give_cc_form', 'give_get_cc_form' );
856
+add_action('give_cc_form', 'give_get_cc_form');
857 857
 
858 858
 /**
859 859
  * Outputs the default credit card address fields.
@@ -864,24 +864,24 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return void
866 866
  */
867
-function give_default_cc_address_fields( $form_id ) {
867
+function give_default_cc_address_fields($form_id) {
868 868
 	// Get user info.
869
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
869
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
870 870
 
871 871
 	$logged_in = is_user_logged_in();
872 872
 
873
-	if ( $logged_in ) {
874
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
873
+	if ($logged_in) {
874
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
875 875
 	}
876
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
877
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
878
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
879
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
876
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
877
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
878
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
879
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
880 880
 
881 881
 	ob_start();
882 882
 	?>
883 883
     <fieldset id="give_cc_address" class="cc-address">
884
-        <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
884
+        <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
885 885
 		<?php
886 886
 		/**
887 887
 		 * Fires while rendering credit card billing form, before address fields.
@@ -890,38 +890,38 @@  discard block
 block discarded – undo
890 890
 		 *
891 891
 		 * @param int $form_id The form ID.
892 892
 		 */
893
-		do_action( 'give_cc_billing_top' );
893
+		do_action('give_cc_billing_top');
894 894
 
895 895
 
896 896
 
897 897
 		// For Country.
898 898
 		$selected_country = give_get_country();
899
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
899
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
900 900
 			$selected_country = $give_user_info['billing_country'];
901 901
 		}
902 902
 		$countries = give_get_country_list();
903 903
 
904 904
 		// For state
905 905
 		$selected_state = '';
906
-		if ( $selected_country === give_get_country() ) {
906
+		if ($selected_country === give_get_country()) {
907 907
 			// Get defalut selected state by admin.
908 908
 			$selected_state = give_get_state();
909 909
 		}
910 910
 		// Get the last payment made by user states.
911
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
911
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
912 912
 			$selected_state = $give_user_info['card_state'];
913 913
 		}
914 914
 		// Get the country code
915
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
915
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
916 916
 			$selected_country = $give_user_info['billing_country'];
917 917
 		}
918
-		$label        = __( 'State', 'give' );
918
+		$label        = __('State', 'give');
919 919
 		$states_label = give_get_states_label();
920 920
 		// Check if $country code exists in the array key for states label.
921
-		if ( array_key_exists( $selected_country, $states_label ) ) {
922
-			$label = $states_label[ $selected_country ];
921
+		if (array_key_exists($selected_country, $states_label)) {
922
+			$label = $states_label[$selected_country];
923 923
 		}
924
-		$states = give_get_states( $selected_country );
924
+		$states = give_get_states($selected_country);
925 925
 		// Get the country list that do not have any states init.
926 926
 		$no_states_country = give_no_states_country_list();
927 927
 		// Get the country list that does not require states.
@@ -930,23 +930,23 @@  discard block
 block discarded – undo
930 930
 		?>
931 931
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
932 932
 		    <label for="billing_country" class="give-label">
933
-			    <?php esc_html_e( 'Country', 'give' ); ?>
934
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
933
+			    <?php esc_html_e('Country', 'give'); ?>
934
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
935 935
 				    <span class="give-required-indicator">*</span>
936 936
 			    <?php endif; ?>
937 937
 			    <span class="give-tooltip give-icon give-icon-question"
938
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
938
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
939 939
 		    </label>
940 940
 
941 941
 		    <select
942 942
 				    name="billing_country"
943 943
 				    id="billing_country"
944
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
945
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
944
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
945
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
946 946
 		    >
947 947
 			    <?php
948
-			    foreach ( $countries as $country_code => $country ) {
949
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
948
+			    foreach ($countries as $country_code => $country) {
949
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
950 950
 			    }
951 951
 			    ?>
952 952
 		    </select>
@@ -954,69 +954,69 @@  discard block
 block discarded – undo
954 954
 
955 955
 	    <p id="give-card-address-wrap" class="form-row form-row-wide">
956 956
 		    <label for="card_address" class="give-label">
957
-			    <?php esc_html_e( 'Address 1', 'give' ); ?>
957
+			    <?php esc_html_e('Address 1', 'give'); ?>
958 958
 			    <?php
959
-			    if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
959
+			    if (give_field_is_required('card_address', $form_id)) : ?>
960 960
 				    <span class="give-required-indicator">*</span>
961 961
 			    <?php endif; ?>
962 962
 			    <span class="give-tooltip give-icon give-icon-question"
963
-			          data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
963
+			          data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
964 964
 		    </label>
965 965
 
966 966
 		    <input
967 967
 				    type="text"
968 968
 				    id="card_address"
969 969
 				    name="card_address"
970
-				    class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
971
-				    placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
972
-				    value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
973
-			    <?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
970
+				    class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
971
+				    placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
972
+				    value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
973
+			    <?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
974 974
 		    />
975 975
 	    </p>
976 976
 
977 977
 	    <p id="give-card-address-2-wrap" class="form-row form-row-wide">
978 978
 		    <label for="card_address_2" class="give-label">
979
-			    <?php esc_html_e( 'Address 2', 'give' ); ?>
980
-			    <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
979
+			    <?php esc_html_e('Address 2', 'give'); ?>
980
+			    <?php if (give_field_is_required('card_address_2', $form_id)) : ?>
981 981
 				    <span class="give-required-indicator">*</span>
982 982
 			    <?php endif; ?>
983 983
 			    <span class="give-tooltip give-icon give-icon-question"
984
-			          data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
984
+			          data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
985 985
 		    </label>
986 986
 
987 987
 		    <input
988 988
 				    type="text"
989 989
 				    id="card_address_2"
990 990
 				    name="card_address_2"
991
-				    class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
992
-				    placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
993
-				    value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
994
-			    <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
991
+				    class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
992
+				    placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
993
+				    value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
994
+			    <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
 		    />
996 996
 	    </p>
997 997
 
998 998
 	    <p id="give-card-state-wrap"
999
-	       class="form-row form-row-wide <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
999
+	       class="form-row form-row-wide <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1002
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1003 1003
 				    ?>
1004
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1004
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
1007
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1007
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+		    if ( ! empty($states)) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1015
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1016
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1018
+				    foreach ($states as $state_code => $state) {
1019
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
@@ -1028,32 +1028,32 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 	    <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive">
1030 1030
 		    <label for="card_city" class="give-label">
1031
-			    <?php esc_html_e( 'City', 'give' ); ?>
1032
-			    <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
1031
+			    <?php esc_html_e('City', 'give'); ?>
1032
+			    <?php if (give_field_is_required('card_city', $form_id)) : ?>
1033 1033
 				    <span class="give-required-indicator">*</span>
1034 1034
 			    <?php endif; ?>
1035 1035
 			    <span class="give-tooltip give-icon give-icon-question"
1036
-			          data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
1036
+			          data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
1037 1037
 		    </label>
1038 1038
 		    <input
1039 1039
 				    type="text"
1040 1040
 				    id="card_city"
1041 1041
 				    name="card_city"
1042
-				    class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1043
-				    placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
1044
-				    value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1045
-			    <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1042
+				    class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1043
+				    placeholder="<?php esc_attr_e('City', 'give'); ?>"
1044
+				    value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1045
+			    <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1046 1046
 		    />
1047 1047
 	    </p>
1048 1048
 
1049 1049
 	    <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1050 1050
 		    <label for="card_zip" class="give-label">
1051
-			    <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
1052
-			    <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1051
+			    <?php esc_html_e('Zip / Postal Code', 'give'); ?>
1052
+			    <?php if (give_field_is_required('card_zip', $form_id)) : ?>
1053 1053
 				    <span class="give-required-indicator">*</span>
1054 1054
 			    <?php endif; ?>
1055 1055
 			    <span class="give-tooltip give-icon give-icon-question"
1056
-			          data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
1056
+			          data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
1057 1057
 		    </label>
1058 1058
 
1059 1059
 		    <input
@@ -1061,10 +1061,10 @@  discard block
 block discarded – undo
1061 1061
 				    size="4"
1062 1062
 				    id="card_zip"
1063 1063
 				    name="card_zip"
1064
-				    class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1065
-				    placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
1066
-				    value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1067
-			    <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1064
+				    class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1065
+				    placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
1066
+				    value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1067
+			    <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1068 1068
 		    />
1069 1069
 	    </p>
1070 1070
 		<?php
@@ -1075,14 +1075,14 @@  discard block
 block discarded – undo
1075 1075
 		 *
1076 1076
 		 * @param int $form_id The form ID.
1077 1077
 		 */
1078
-		do_action( 'give_cc_billing_bottom' );
1078
+		do_action('give_cc_billing_bottom');
1079 1079
 		?>
1080 1080
     </fieldset>
1081 1081
 	<?php
1082 1082
 	echo ob_get_clean();
1083 1083
 }
1084 1084
 
1085
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1085
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1086 1086
 
1087 1087
 
1088 1088
 /**
@@ -1095,24 +1095,24 @@  discard block
 block discarded – undo
1095 1095
  *
1096 1096
  * @return string
1097 1097
  */
1098
-function give_get_register_fields( $form_id ) {
1098
+function give_get_register_fields($form_id) {
1099 1099
 
1100 1100
 	global $user_ID;
1101 1101
 
1102
-	if ( is_user_logged_in() ) {
1103
-		$user_data = get_userdata( $user_ID );
1102
+	if (is_user_logged_in()) {
1103
+		$user_data = get_userdata($user_ID);
1104 1104
 	}
1105 1105
 
1106
-	$show_register_form = give_show_login_register_option( $form_id );
1106
+	$show_register_form = give_show_login_register_option($form_id);
1107 1107
 
1108 1108
 	ob_start(); ?>
1109 1109
     <fieldset id="give-register-fields-<?php echo $form_id; ?>">
1110 1110
 
1111
-		<?php if ( $show_register_form == 'both' ) { ?>
1111
+		<?php if ($show_register_form == 'both') { ?>
1112 1112
             <div class="give-login-account-wrap">
1113
-                <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1114
-                    <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1115
-                       data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1113
+                <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1114
+                    <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1115
+                       data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1116 1116
                 </p>
1117 1117
                 <p class="give-loading-text">
1118 1118
                     <span class="give-loading-animation"></span>
@@ -1128,15 +1128,15 @@  discard block
 block discarded – undo
1128 1128
 		 *
1129 1129
 		 * @param int $form_id The form ID.
1130 1130
 		 */
1131
-		do_action( 'give_register_fields_before', $form_id );
1131
+		do_action('give_register_fields_before', $form_id);
1132 1132
 		?>
1133 1133
 
1134 1134
         <fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1135 1135
             <legend>
1136 1136
 				<?php
1137
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1138
-				if ( ! give_logged_in_only( $form_id ) ) {
1139
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1137
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1138
+				if ( ! give_logged_in_only($form_id)) {
1139
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1140 1140
 				}
1141 1141
 				?>
1142 1142
             </legend>
@@ -1148,54 +1148,54 @@  discard block
 block discarded – undo
1148 1148
 			 *
1149 1149
 			 * @param int $form_id The form ID.
1150 1150
 			 */
1151
-			do_action( 'give_register_account_fields_before', $form_id );
1151
+			do_action('give_register_account_fields_before', $form_id);
1152 1152
 			?>
1153 1153
             <div id="give-user-login-wrap-<?php echo $form_id; ?>"
1154 1154
                  class="form-row form-row-one-third form-row-first form-row-responsive">
1155 1155
                 <label for="give-user-login-<?php echo $form_id; ?>">
1156
-					<?php esc_html_e( 'Username', 'give' ); ?>
1157
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1156
+					<?php esc_html_e('Username', 'give'); ?>
1157
+					<?php if (give_logged_in_only($form_id)) { ?>
1158 1158
                         <span class="give-required-indicator">*</span>
1159 1159
 					<?php } ?>
1160 1160
                     <span class="give-tooltip give-icon give-icon-question"
1161
-                          data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1161
+                          data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1162 1162
                 </label>
1163 1163
 
1164 1164
                 <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1165 1165
                        type="text"
1166
-                       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1166
+                       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1167 1167
             </div>
1168 1168
 
1169 1169
             <div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1170 1170
                  class="form-row form-row-one-third form-row-responsive">
1171 1171
                 <label for="give-user-pass-<?php echo $form_id; ?>">
1172
-					<?php esc_html_e( 'Password', 'give' ); ?>
1173
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1172
+					<?php esc_html_e('Password', 'give'); ?>
1173
+					<?php if (give_logged_in_only($form_id)) { ?>
1174 1174
                         <span class="give-required-indicator">*</span>
1175 1175
 					<?php } ?>
1176 1176
                     <span class="give-tooltip give-icon give-icon-question"
1177
-                          data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1177
+                          data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1178 1178
                 </label>
1179 1179
 
1180 1180
                 <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1181
-                       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1182
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1181
+                       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1182
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1183 1183
             </div>
1184 1184
 
1185 1185
             <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1186 1186
                  class="give-register-password form-row form-row-one-third form-row-responsive">
1187 1187
                 <label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1188
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1189
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1188
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1189
+					<?php if (give_logged_in_only($form_id)) { ?>
1190 1190
                         <span class="give-required-indicator">*</span>
1191 1191
 					<?php } ?>
1192 1192
                     <span class="give-tooltip give-icon give-icon-question"
1193
-                          data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1193
+                          data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1194 1194
                 </label>
1195 1195
 
1196 1196
                 <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1197
-                       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1198
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1197
+                       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1198
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1199 1199
             </div>
1200 1200
 			<?php
1201 1201
 			/**
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 			 *
1206 1206
 			 * @param int $form_id The form ID.
1207 1207
 			 */
1208
-			do_action( 'give_register_account_fields_after', $form_id );
1208
+			do_action('give_register_account_fields_after', $form_id);
1209 1209
 			?>
1210 1210
         </fieldset>
1211 1211
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		 *
1218 1218
 		 * @param int $form_id The form ID.
1219 1219
 		 */
1220
-		do_action( 'give_register_fields_after', $form_id );
1220
+		do_action('give_register_fields_after', $form_id);
1221 1221
 		?>
1222 1222
 
1223 1223
         <input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 		 *
1229 1229
 		 * @since 1.7
1230 1230
 		 */
1231
-		do_action( 'give_donation_form_user_info', $form_id );
1231
+		do_action('give_donation_form_user_info', $form_id);
1232 1232
 		?>
1233 1233
 
1234 1234
     </fieldset>
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	echo ob_get_clean();
1237 1237
 }
1238 1238
 
1239
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1239
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1240 1240
 
1241 1241
 /**
1242 1242
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1249,27 +1249,27 @@  discard block
 block discarded – undo
1249 1249
  *
1250 1250
  * @return string
1251 1251
  */
1252
-function give_get_login_fields( $form_id ) {
1252
+function give_get_login_fields($form_id) {
1253 1253
 
1254
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1255
-	$show_register_form = give_show_login_register_option( $form_id );
1254
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1255
+	$show_register_form = give_show_login_register_option($form_id);
1256 1256
 
1257 1257
 	ob_start();
1258 1258
 	?>
1259 1259
     <fieldset id="give-login-fields-<?php echo $form_id; ?>">
1260
-        <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1261
-			if ( ! give_logged_in_only( $form_id ) ) {
1262
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1260
+        <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1261
+			if ( ! give_logged_in_only($form_id)) {
1262
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1263 1263
 			} ?>
1264 1264
         </legend>
1265
-		<?php if ( $show_register_form == 'both' ) { ?>
1265
+		<?php if ($show_register_form == 'both') { ?>
1266 1266
             <p class="give-new-account-link">
1267
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1268
-                <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1267
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1268
+                <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1269 1269
                    data-action="give_checkout_register">
1270
-					<?php esc_html_e( 'Register', 'give' );
1271
-					if ( ! give_logged_in_only( $form_id ) ) {
1272
-						echo ' ' . esc_html__( 'and donate as a guest &raquo;', 'give' );
1270
+					<?php esc_html_e('Register', 'give');
1271
+					if ( ! give_logged_in_only($form_id)) {
1272
+						echo ' '.esc_html__('and donate as a guest &raquo;', 'give');
1273 1273
 					} ?>
1274 1274
                 </a>
1275 1275
             </p>
@@ -1285,49 +1285,49 @@  discard block
 block discarded – undo
1285 1285
 		 *
1286 1286
 		 * @param int $form_id The form ID.
1287 1287
 		 */
1288
-		do_action( 'give_checkout_login_fields_before', $form_id );
1288
+		do_action('give_checkout_login_fields_before', $form_id);
1289 1289
 		?>
1290 1290
         <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1291 1291
             <label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1292
-				<?php esc_html_e( 'Username', 'give' ); ?>
1293
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1292
+				<?php esc_html_e('Username', 'give'); ?>
1293
+				<?php if (give_logged_in_only($form_id)) { ?>
1294 1294
                     <span class="give-required-indicator">*</span>
1295 1295
 				<?php } ?>
1296 1296
             </label>
1297 1297
 
1298
-            <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1298
+            <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1299 1299
                    name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1300
-                   placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1300
+                   placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1301 1301
         </div>
1302 1302
 
1303 1303
         <div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1304 1304
              class="give_login_password form-row form-row-last form-row-responsive">
1305 1305
             <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1306
-				<?php esc_html_e( 'Password', 'give' ); ?>
1307
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1306
+				<?php esc_html_e('Password', 'give'); ?>
1307
+				<?php if (give_logged_in_only($form_id)) { ?>
1308 1308
                     <span class="give-required-indicator">*</span>
1309 1309
 				<?php } ?>
1310 1310
             </label>
1311
-            <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1311
+            <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1312 1312
                    type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1313
-                   placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1313
+                   placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1314 1314
             <input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1315 1315
         </div>
1316 1316
 
1317 1317
         <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1318 1318
 			 <span class="give-forgot-password ">
1319 1319
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1320
-                    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1320
+                    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1321 1321
 			 </span>
1322 1322
         </div>
1323 1323
 
1324 1324
         <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1325 1325
             <input type="submit" class="give-submit give-btn button" name="give_login_submit"
1326
-                   value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1327
-			<?php if ( $show_register_form !== 'login' ) { ?>
1326
+                   value="<?php esc_attr_e('Login', 'give'); ?>"/>
1327
+			<?php if ($show_register_form !== 'login') { ?>
1328 1328
                 <input type="button" data-action="give_cancel_login"
1329 1329
                        class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1330
-                       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1330
+                       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1331 1331
 			<?php } ?>
1332 1332
             <span class="give-loading-animation"></span>
1333 1333
         </div>
@@ -1339,14 +1339,14 @@  discard block
 block discarded – undo
1339 1339
 		 *
1340 1340
 		 * @param int $form_id The form ID.
1341 1341
 		 */
1342
-		do_action( 'give_checkout_login_fields_after', $form_id );
1342
+		do_action('give_checkout_login_fields_after', $form_id);
1343 1343
 		?>
1344 1344
     </fieldset><!--end #give-login-fields-->
1345 1345
 	<?php
1346 1346
 	echo ob_get_clean();
1347 1347
 }
1348 1348
 
1349
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1349
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1350 1350
 
1351 1351
 /**
1352 1352
  * Payment Mode Select.
@@ -1362,9 +1362,9 @@  discard block
 block discarded – undo
1362 1362
  *
1363 1363
  * @return void
1364 1364
  */
1365
-function give_payment_mode_select( $form_id ) {
1365
+function give_payment_mode_select($form_id) {
1366 1366
 
1367
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1367
+	$gateways = give_get_enabled_payment_gateways($form_id);
1368 1368
 
1369 1369
 	/**
1370 1370
 	 * Fires while selecting payment gateways, before the fields.
@@ -1373,10 +1373,10 @@  discard block
 block discarded – undo
1373 1373
 	 *
1374 1374
 	 * @param int $form_id The form ID.
1375 1375
 	 */
1376
-	do_action( 'give_payment_mode_top', $form_id );
1376
+	do_action('give_payment_mode_top', $form_id);
1377 1377
 	?>
1378 1378
 
1379
-    <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1379
+    <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1380 1380
 		echo 'style="display: none;"';
1381 1381
 	} ?>>
1382 1382
 		<?php
@@ -1387,10 +1387,10 @@  discard block
 block discarded – undo
1387 1387
 		 *
1388 1388
 		 * @param int $form_id The form ID.
1389 1389
 		 */
1390
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1390
+		do_action('give_payment_mode_before_gateways_wrap');
1391 1391
 		?>
1392 1392
         <legend
1393
-                class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1393
+                class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1394 1394
             <span class="give-loading-text"><span
1395 1395
                         class="give-loading-animation"></span>
1396 1396
             </span>
@@ -1403,26 +1403,26 @@  discard block
 block discarded – undo
1403 1403
 			 *
1404 1404
 			 * @since 1.7
1405 1405
 			 */
1406
-			do_action( 'give_payment_mode_before_gateways' )
1406
+			do_action('give_payment_mode_before_gateways')
1407 1407
 			?>
1408 1408
             <ul id="give-gateway-radio-list">
1409 1409
 				<?php
1410 1410
 				/**
1411 1411
 				 * Loop through the active payment gateways.
1412 1412
 				 */
1413
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1413
+				$selected_gateway = give_get_chosen_gateway($form_id);
1414 1414
 
1415
-				foreach ( $gateways as $gateway_id => $gateway ) :
1415
+				foreach ($gateways as $gateway_id => $gateway) :
1416 1416
 					//Determine the default gateway.
1417
-					$checked = checked( $gateway_id, $selected_gateway, false );
1417
+					$checked = checked($gateway_id, $selected_gateway, false);
1418 1418
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1419 1419
                     <li<?php echo $checked_class ?>>
1420 1420
                         <input type="radio" name="payment-mode" class="give-gateway"
1421
-                               id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1422
-                               value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1423
-                        <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1421
+                               id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1422
+                               value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1423
+                        <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1424 1424
                                class="give-gateway-option"
1425
-                               id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1425
+                               id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1426 1426
                     </li>
1427 1427
 					<?php
1428 1428
 				endforeach;
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 			 *
1435 1435
 			 * @since 1.7
1436 1436
 			 */
1437
-			do_action( 'give_payment_mode_after_gateways' );
1437
+			do_action('give_payment_mode_after_gateways');
1438 1438
 			?>
1439 1439
         </div>
1440 1440
 		<?php
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		 *
1446 1446
 		 * @param int $form_id The form ID.
1447 1447
 		 */
1448
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1448
+		do_action('give_payment_mode_after_gateways_wrap');
1449 1449
 		?>
1450 1450
     </fieldset>
1451 1451
 
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 	 *
1458 1458
 	 * @param int $form_id The form ID.
1459 1459
 	 */
1460
-	do_action( 'give_payment_mode_bottom', $form_id );
1460
+	do_action('give_payment_mode_bottom', $form_id);
1461 1461
 	?>
1462 1462
 
1463 1463
     <div id="give_purchase_form_wrap">
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
 		 *
1469 1469
 		 * @since 1.7
1470 1470
 		 */
1471
-		do_action( 'give_donation_form', $form_id );
1471
+		do_action('give_donation_form', $form_id);
1472 1472
 		?>
1473 1473
 
1474 1474
     </div>
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 	 *
1480 1480
 	 * @since 1.7
1481 1481
 	 */
1482
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1482
+	do_action('give_donation_form_wrap_bottom', $form_id);
1483 1483
 }
1484 1484
 
1485
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1485
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1486 1486
 
1487 1487
 /**
1488 1488
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1495,31 +1495,31 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return bool
1497 1497
  */
1498
-function give_terms_agreement( $form_id ) {
1499
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1498
+function give_terms_agreement($form_id) {
1499
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1500 1500
 
1501 1501
 	// Bailout if per form and global term and conditions is not setup.
1502 1502
 	if (
1503
-		give_is_setting_enabled( $form_option, 'global' )
1504
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1503
+		give_is_setting_enabled($form_option, 'global')
1504
+		&& give_is_setting_enabled(give_get_option('terms'))
1505 1505
 	) {
1506
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1507
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1508
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1506
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1507
+		$terms         = $terms = give_get_option('agreement_text', '');
1508
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1509 1509
 
1510
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1511
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1512
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1513
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1510
+	} elseif (give_is_setting_enabled($form_option)) {
1511
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1512
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1513
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1514 1514
 
1515 1515
 	} else {
1516 1516
 		return false;
1517 1517
 	}
1518 1518
 
1519 1519
 	// Bailout: Check if term and conditions text is empty or not.
1520
-	if ( empty( $terms ) ) {
1521
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1522
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1520
+	if (empty($terms)) {
1521
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1522
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1523 1523
 		}
1524 1524
 
1525 1525
 		return false;
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
 	?>
1529 1529
     <fieldset id="give_terms_agreement">
1530
-        <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1530
+        <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1531 1531
         <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1532 1532
 			<?php
1533 1533
 			/**
@@ -1535,22 +1535,22 @@  discard block
 block discarded – undo
1535 1535
 			 *
1536 1536
 			 * @since 1.0
1537 1537
 			 */
1538
-			do_action( 'give_before_terms' );
1538
+			do_action('give_before_terms');
1539 1539
 
1540
-			echo wpautop( stripslashes( $terms ) );
1540
+			echo wpautop(stripslashes($terms));
1541 1541
 			/**
1542 1542
 			 * Fires while rendering terms of agreement, after the fields.
1543 1543
 			 *
1544 1544
 			 * @since 1.0
1545 1545
 			 */
1546
-			do_action( 'give_after_terms' );
1546
+			do_action('give_after_terms');
1547 1547
 			?>
1548 1548
         </div>
1549 1549
         <div id="give_show_terms">
1550 1550
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1551
-               aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1551
+               aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1552 1552
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1553
-               aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1553
+               aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1554 1554
         </div>
1555 1555
 
1556 1556
         <input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 	<?php
1562 1562
 }
1563 1563
 
1564
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1564
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1565 1565
 
1566 1566
 /**
1567 1567
  * Checkout Final Total.
@@ -1574,31 +1574,30 @@  discard block
 block discarded – undo
1574 1574
  *
1575 1575
  * @return void
1576 1576
  */
1577
-function give_checkout_final_total( $form_id ) {
1577
+function give_checkout_final_total($form_id) {
1578 1578
 
1579
-	$total = isset( $_POST['give_total'] ) ?
1580
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1581
-		give_get_default_form_amount( $form_id );
1579
+	$total = isset($_POST['give_total']) ?
1580
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1582 1581
 
1583 1582
 
1584 1583
 	//Only proceed if give_total available.
1585
-	if ( empty( $total ) ) {
1584
+	if (empty($total)) {
1586 1585
 		return;
1587 1586
 	}
1588 1587
 	?>
1589 1588
     <p id="give-final-total-wrap" class="form-wrap ">
1590 1589
 		<span class="give-donation-total-label">
1591
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1590
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1592 1591
 		</span>
1593 1592
         <span class="give-final-total-amount"
1594
-              data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1595
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), give_get_currency( $form_id ) ); ?>
1593
+              data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1594
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), give_get_currency($form_id)); ?>
1596 1595
 		</span>
1597 1596
     </p>
1598 1597
 	<?php
1599 1598
 }
1600 1599
 
1601
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1600
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1602 1601
 
1603 1602
 /**
1604 1603
  * Renders the Checkout Submit section.
@@ -1609,7 +1608,7 @@  discard block
 block discarded – undo
1609 1608
  *
1610 1609
  * @return void
1611 1610
  */
1612
-function give_checkout_submit( $form_id ) {
1611
+function give_checkout_submit($form_id) {
1613 1612
 	?>
1614 1613
     <fieldset id="give_purchase_submit">
1615 1614
 		<?php
@@ -1618,24 +1617,24 @@  discard block
 block discarded – undo
1618 1617
 		 *
1619 1618
 		 * @since 1.7
1620 1619
 		 */
1621
-		do_action( 'give_donation_form_before_submit', $form_id );
1620
+		do_action('give_donation_form_before_submit', $form_id);
1622 1621
 
1623
-		give_checkout_hidden_fields( $form_id );
1622
+		give_checkout_hidden_fields($form_id);
1624 1623
 
1625
-		echo give_get_donation_form_submit_button( $form_id );
1624
+		echo give_get_donation_form_submit_button($form_id);
1626 1625
 
1627 1626
 		/**
1628 1627
 		 * Fire after donation form submit.
1629 1628
 		 *
1630 1629
 		 * @since 1.7
1631 1630
 		 */
1632
-		do_action( 'give_donation_form_after_submit', $form_id );
1631
+		do_action('give_donation_form_after_submit', $form_id);
1633 1632
 		?>
1634 1633
     </fieldset>
1635 1634
 	<?php
1636 1635
 }
1637 1636
 
1638
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1637
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1639 1638
 
1640 1639
 /**
1641 1640
  * Give Donation form submit button.
@@ -1646,10 +1645,10 @@  discard block
 block discarded – undo
1646 1645
  *
1647 1646
  * @return string
1648 1647
  */
1649
-function give_get_donation_form_submit_button( $form_id ) {
1648
+function give_get_donation_form_submit_button($form_id) {
1650 1649
 
1651
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1652
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1650
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1651
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1653 1652
 	ob_start();
1654 1653
 	?>
1655 1654
     <div class="give-submit-button-wrap give-clearfix">
@@ -1658,7 +1657,7 @@  discard block
 block discarded – undo
1658 1657
         <span class="give-loading-animation"></span>
1659 1658
     </div>
1660 1659
 	<?php
1661
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1660
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1662 1661
 }
1663 1662
 
1664 1663
 /**
@@ -1673,17 +1672,17 @@  discard block
 block discarded – undo
1673 1672
  *
1674 1673
  * @return mixed
1675 1674
  */
1676
-function give_show_goal_progress( $form_id, $args ) {
1675
+function give_show_goal_progress($form_id, $args) {
1677 1676
 
1678 1677
 	ob_start();
1679
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1678
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1680 1679
 
1681
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1680
+	echo apply_filters('give_goal_output', ob_get_clean());
1682 1681
 
1683 1682
 	return true;
1684 1683
 }
1685 1684
 
1686
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1685
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1687 1686
 
1688 1687
 
1689 1688
 /**
@@ -1696,10 +1695,10 @@  discard block
 block discarded – undo
1696 1695
  *
1697 1696
  * @return mixed|string
1698 1697
  */
1699
-function give_get_form_content_placement( $form_id, $args ) {
1698
+function give_get_form_content_placement($form_id, $args) {
1700 1699
 	$show_content = '';
1701 1700
 
1702
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1701
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1703 1702
 		// Content positions.
1704 1703
 		$content_placement = array(
1705 1704
 			'above' => 'give_pre_form',
@@ -1707,18 +1706,18 @@  discard block
 block discarded – undo
1707 1706
 		);
1708 1707
 
1709 1708
 		// Check if content position already decoded.
1710
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1709
+		if (in_array($args['show_content'], $content_placement)) {
1711 1710
 			return $args['show_content'];
1712 1711
 		}
1713 1712
 
1714
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1713
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1715 1714
 
1716
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1717
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1715
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1716
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1718 1717
 
1719
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1718
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1720 1719
 		// Backward compatibility for _give_content_option for v18.
1721
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1720
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1722 1721
 	}
1723 1722
 
1724 1723
 	return $show_content;
@@ -1734,20 +1733,20 @@  discard block
 block discarded – undo
1734 1733
  *
1735 1734
  * @return void|bool
1736 1735
  */
1737
-function give_form_content( $form_id, $args ) {
1736
+function give_form_content($form_id, $args) {
1738 1737
 
1739
-	$show_content = give_get_form_content_placement( $form_id, $args );
1738
+	$show_content = give_get_form_content_placement($form_id, $args);
1740 1739
 
1741 1740
 	// Bailout.
1742
-	if ( empty( $show_content ) ) {
1741
+	if (empty($show_content)) {
1743 1742
 		return false;
1744 1743
 	}
1745 1744
 
1746 1745
 	// Add action according to value.
1747
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1746
+	add_action($show_content, 'give_form_display_content', 10, 2);
1748 1747
 }
1749 1748
 
1750
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1749
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1751 1750
 
1752 1751
 /**
1753 1752
  * Renders Post Form Content.
@@ -1761,22 +1760,22 @@  discard block
 block discarded – undo
1761 1760
  *
1762 1761
  * @return void
1763 1762
  */
1764
-function give_form_display_content( $form_id, $args ) {
1763
+function give_form_display_content($form_id, $args) {
1765 1764
 
1766
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1767
-	$show_content = give_get_form_content_placement( $form_id, $args );
1765
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1766
+	$show_content = give_get_form_content_placement($form_id, $args);
1768 1767
 
1769
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1770
-		$content = apply_filters( 'the_content', $content );
1768
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1769
+		$content = apply_filters('the_content', $content);
1771 1770
 	}
1772 1771
 
1773
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1772
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1774 1773
 
1775
-	echo apply_filters( 'give_form_content_output', $output );
1774
+	echo apply_filters('give_form_content_output', $output);
1776 1775
 
1777 1776
 	//remove action to prevent content output on addition forms on page.
1778 1777
 	//@see: https://github.com/WordImpress/Give/issues/634.
1779
-	remove_action( $show_content, 'give_form_display_content' );
1778
+	remove_action($show_content, 'give_form_display_content');
1780 1779
 }
1781 1780
 
1782 1781
 /**
@@ -1788,7 +1787,7 @@  discard block
 block discarded – undo
1788 1787
  *
1789 1788
  * @return void
1790 1789
  */
1791
-function give_checkout_hidden_fields( $form_id ) {
1790
+function give_checkout_hidden_fields($form_id) {
1792 1791
 
1793 1792
 	/**
1794 1793
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1797,13 +1796,13 @@  discard block
 block discarded – undo
1797 1796
 	 *
1798 1797
 	 * @param int $form_id The form ID.
1799 1798
 	 */
1800
-	do_action( 'give_hidden_fields_before', $form_id );
1799
+	do_action('give_hidden_fields_before', $form_id);
1801 1800
 
1802
-	if ( is_user_logged_in() ) { ?>
1801
+	if (is_user_logged_in()) { ?>
1803 1802
         <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1804 1803
 	<?php } ?>
1805 1804
     <input type="hidden" name="give_action" value="purchase"/>
1806
-    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1805
+    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1807 1806
 	<?php
1808 1807
 	/**
1809 1808
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1812,7 +1811,7 @@  discard block
 block discarded – undo
1812 1811
 	 *
1813 1812
 	 * @param int $form_id The form ID.
1814 1813
 	 */
1815
-	do_action( 'give_hidden_fields_after', $form_id );
1814
+	do_action('give_hidden_fields_after', $form_id);
1816 1815
 
1817 1816
 }
1818 1817
 
@@ -1827,20 +1826,20 @@  discard block
 block discarded – undo
1827 1826
  *
1828 1827
  * @return string $content Filtered content.
1829 1828
  */
1830
-function give_filter_success_page_content( $content ) {
1829
+function give_filter_success_page_content($content) {
1831 1830
 
1832 1831
 	$give_options = give_get_settings();
1833 1832
 
1834
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1835
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1836
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1833
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1834
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1835
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1837 1836
 		}
1838 1837
 	}
1839 1838
 
1840 1839
 	return $content;
1841 1840
 }
1842 1841
 
1843
-add_filter( 'the_content', 'give_filter_success_page_content' );
1842
+add_filter('the_content', 'give_filter_success_page_content');
1844 1843
 
1845 1844
 /**
1846 1845
  * Test Mode Frontend Warning.
@@ -1851,12 +1850,12 @@  discard block
 block discarded – undo
1851 1850
  */
1852 1851
 function give_test_mode_frontend_warning() {
1853 1852
 
1854
-	if ( give_is_test_mode() ) {
1855
-		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>';
1853
+	if (give_is_test_mode()) {
1854
+		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>';
1856 1855
 	}
1857 1856
 }
1858 1857
 
1859
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1858
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1860 1859
 
1861 1860
 /**
1862 1861
  * Members-only Form.
@@ -1870,21 +1869,21 @@  discard block
 block discarded – undo
1870 1869
  *
1871 1870
  * @return string
1872 1871
  */
1873
-function give_members_only_form( $final_output, $args ) {
1872
+function give_members_only_form($final_output, $args) {
1874 1873
 
1875
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1874
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1876 1875
 
1877 1876
 	//Sanity Check: Must have form_id & not be logged in.
1878
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1877
+	if (empty($form_id) || is_user_logged_in()) {
1879 1878
 		return $final_output;
1880 1879
 	}
1881 1880
 
1882 1881
 	//Logged in only and Register / Login set to none.
1883
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1882
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1884 1883
 
1885
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1884
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1886 1885
 
1887
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1886
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1888 1887
 
1889 1888
 	}
1890 1889
 
@@ -1892,4 +1891,4 @@  discard block
 block discarded – undo
1892 1891
 
1893 1892
 }
1894 1893
 
1895
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1894
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,44 +32,44 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
49 49
 		'purchase_key'    => $purchase_data['purchase_key'],
50
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
50
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
51 51
 		'user_info'       => $purchase_data['user_info'],
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool
24 24
  */
25
-function give_paypal_standard_billing_fields( $form_id ) {
25
+function give_paypal_standard_billing_fields($form_id) {
26 26
 
27
-	if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) {
28
-		give_default_cc_address_fields( $form_id );
27
+	if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) {
28
+		give_default_cc_address_fields($form_id);
29 29
 
30 30
 		return true;
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 }
36 36
 
37
-add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' );
37
+add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields');
38 38
 
39 39
 /**
40 40
  * Process PayPal Payment.
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @return void
47 47
  */
48
-function give_process_paypal_payment( $payment_data ) {
48
+function give_process_paypal_payment($payment_data) {
49 49
 
50 50
 	// Validate nonce.
51
-	give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' );
51
+	give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway');
52 52
 
53
-	$payment_id = give_create_payment( $payment_data );
53
+	$payment_id = give_create_payment($payment_data);
54 54
 
55 55
 	// Check payment.
56
-	if ( empty( $payment_id ) ) {
56
+	if (empty($payment_id)) {
57 57
 		// Record the error.
58
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */
59
-			__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id );
58
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */
59
+			__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id);
60 60
 		// Problems? Send back.
61
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
61
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
62 62
 	}
63 63
 
64 64
 	// Redirect to PayPal.
65
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
65
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
69
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
70 70
 
71 71
 /**
72 72
  * Listens for a PayPal IPN requests and then sends to the processing function.
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 function give_listen_for_paypal_ipn() {
78 78
 
79 79
 	// Regular PayPal IPN.
80
-	if ( isset( $_GET['give-listener'] ) && 'IPN' === $_GET['give-listener'] ) {
80
+	if (isset($_GET['give-listener']) && 'IPN' === $_GET['give-listener']) {
81 81
 		/**
82 82
 		 * Fires while verifying PayPal IPN
83 83
 		 *
84 84
 		 * @since 1.0
85 85
 		 */
86
-		do_action( 'give_verify_paypal_ipn' );
86
+		do_action('give_verify_paypal_ipn');
87 87
 	}
88 88
 }
89 89
 
90
-add_action( 'init', 'give_listen_for_paypal_ipn' );
90
+add_action('init', 'give_listen_for_paypal_ipn');
91 91
 
92 92
 /**
93 93
  * Process PayPal IPN
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 function give_process_paypal_ipn() {
99 99
 
100 100
 	// Check the request method is POST.
101
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
101
+	if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) {
102 102
 		return;
103 103
 	}
104 104
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	$post_data = '';
107 107
 
108 108
 	// Fallback just in case post_max_size is lower than needed.
109
-	if ( ini_get( 'allow_url_fopen' ) ) {
110
-		$post_data = file_get_contents( 'php://input' );
109
+	if (ini_get('allow_url_fopen')) {
110
+		$post_data = file_get_contents('php://input');
111 111
 	} else {
112 112
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough.
113
-		ini_set( 'post_max_size', '12M' );
113
+		ini_set('post_max_size', '12M');
114 114
 	}
115 115
 	// Start the encoded data collection with notification command.
116 116
 	$encoded_data = 'cmd=_notify-validate';
@@ -119,39 +119,39 @@  discard block
 block discarded – undo
119 119
 	$arg_separator = give_get_php_arg_separator_output();
120 120
 
121 121
 	// Verify there is a post_data.
122
-	if ( $post_data || strlen( $post_data ) > 0 ) {
122
+	if ($post_data || strlen($post_data) > 0) {
123 123
 		// Append the data.
124
-		$encoded_data .= $arg_separator . $post_data;
124
+		$encoded_data .= $arg_separator.$post_data;
125 125
 	} else {
126 126
 		// Check if POST is empty.
127
-		if ( empty( $_POST ) ) {
127
+		if (empty($_POST)) {
128 128
 			// Nothing to do.
129 129
 			return;
130 130
 		} else {
131 131
 			// Loop through each POST.
132
-			foreach ( $_POST as $key => $value ) {
132
+			foreach ($_POST as $key => $value) {
133 133
 				// Encode the value and append the data.
134
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
134
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
135 135
 			}
136 136
 		}
137 137
 	}
138 138
 
139 139
 	// Convert collected post data to an array.
140
-	parse_str( $encoded_data, $encoded_data_array );
140
+	parse_str($encoded_data, $encoded_data_array);
141 141
 
142
-	foreach ( $encoded_data_array as $key => $value ) {
142
+	foreach ($encoded_data_array as $key => $value) {
143 143
 
144
-		if ( false !== strpos( $key, 'amp;' ) ) {
145
-			$new_key = str_replace( '&amp;', '&', $key );
146
-			$new_key = str_replace( 'amp;', '&', $new_key );
144
+		if (false !== strpos($key, 'amp;')) {
145
+			$new_key = str_replace('&amp;', '&', $key);
146
+			$new_key = str_replace('amp;', '&', $new_key);
147 147
 
148
-			unset( $encoded_data_array[ $key ] );
149
-			$encoded_data_array[ $new_key ] = $value;
148
+			unset($encoded_data_array[$key]);
149
+			$encoded_data_array[$new_key] = $value;
150 150
 		}
151 151
 	}
152 152
 
153 153
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure.
154
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
154
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
155 155
 
156 156
 		$remote_post_vars = array(
157 157
 			'method'      => 'POST',
@@ -171,25 +171,25 @@  discard block
 block discarded – undo
171 171
 		);
172 172
 
173 173
 		// Validate the IPN.
174
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
174
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
175 175
 
176
-		if ( is_wp_error( $api_response ) ) {
177
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
178
-				__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
176
+		if (is_wp_error($api_response)) {
177
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
178
+				__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
179 179
 
180 180
 			return; // Something went wrong.
181 181
 		}
182 182
 
183
-		if ( 'VERIFIED' !== $api_response['body'] ) {
184
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
185
-				__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
183
+		if ('VERIFIED' !== $api_response['body']) {
184
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
185
+				__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
186 186
 
187 187
 			return; // Response not okay.
188 188
 		}
189 189
 	}// End if().
190 190
 
191 191
 	// Check if $post_data_array has been populated.
192
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
192
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
193 193
 		return;
194 194
 	}
195 195
 
@@ -198,28 +198,28 @@  discard block
 block discarded – undo
198 198
 		'payment_status' => '',
199 199
 	);
200 200
 
201
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
201
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
202 202
 
203
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
203
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
204 204
 	$txn_type   = $encoded_data_array['txn_type'];
205 205
 
206 206
 	// Check for PayPal IPN Notifications and update data based on it.
207
-	$current_timestamp = current_time( 'timestamp' );
207
+	$current_timestamp = current_time('timestamp');
208 208
 	$paypal_ipn_vars = array(
209
-		'auth_status'    => ( $api_response['body'] ) ? $api_response['body'] : 'N/A',
209
+		'auth_status'    => ($api_response['body']) ? $api_response['body'] : 'N/A',
210 210
 		'transaction_id' => $encoded_data_array['txn_id'],
211 211
 		'payment_id'     => $payment_id,
212 212
 	);
213
-	update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars );
214
-	give_insert_payment_note( $payment_id, sprintf(
215
-			__( 'Last IPN received on %s at %s', 'give' ),
216
-			date_i18n( 'm/d/Y', $current_timestamp ),
217
-			date_i18n( 'H:i', $current_timestamp )
213
+	update_option('give_last_paypal_ipn_received', $paypal_ipn_vars);
214
+	give_insert_payment_note($payment_id, sprintf(
215
+			__('Last IPN received on %s at %s', 'give'),
216
+			date_i18n('m/d/Y', $current_timestamp),
217
+			date_i18n('H:i', $current_timestamp)
218 218
 		)
219 219
 	);
220
-	give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp );
220
+	give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp);
221 221
 
222
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
222
+	if (has_action('give_paypal_'.$txn_type)) {
223 223
 		/**
224 224
 		 * Fires while processing PayPal IPN $txn_type.
225 225
 		 *
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		 * @param array $encoded_data_array Encoded data.
231 231
 		 * @param int   $payment_id         Payment id.
232 232
 		 */
233
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
233
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
234 234
 	} else {
235 235
 		/**
236 236
 		 * Fires while process PayPal IPN.
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 		 * @param array $encoded_data_array Encoded data.
243 243
 		 * @param int   $payment_id         Payment id.
244 244
 		 */
245
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
245
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
246 246
 	}
247 247
 	exit;
248 248
 }
249 249
 
250
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
250
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
251 251
 
252 252
 /**
253 253
  * Process web accept (one time) payment IPNs.
@@ -259,99 +259,99 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return void
261 261
  */
262
-function give_process_paypal_web_accept( $data, $payment_id ) {
262
+function give_process_paypal_web_accept($data, $payment_id) {
263 263
 
264 264
 	// Only allow through these transaction types.
265
-	if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) {
265
+	if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) {
266 266
 		return;
267 267
 	}
268 268
 
269 269
 	// Need $payment_id to continue.
270
-	if ( empty( $payment_id ) ) {
270
+	if (empty($payment_id)) {
271 271
 		return;
272 272
 	}
273 273
 
274 274
 	// Collect donation payment details.
275 275
 	$paypal_amount  = $data['mc_gross'];
276
-	$payment_status = strtolower( $data['payment_status'] );
277
-	$currency_code  = strtolower( $data['mc_currency'] );
278
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
279
-	$payment_meta   = give_get_payment_meta( $payment_id );
276
+	$payment_status = strtolower($data['payment_status']);
277
+	$currency_code  = strtolower($data['mc_currency']);
278
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
279
+	$payment_meta   = give_get_payment_meta($payment_id);
280 280
 
281 281
 	// Must be a PayPal standard IPN.
282
-	if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) {
282
+	if ('paypal' !== give_get_payment_gateway($payment_id)) {
283 283
 		return;
284 284
 	}
285 285
 
286 286
 	// Verify payment recipient.
287
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) {
287
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) {
288 288
 
289
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
290
-			__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
291
-		give_update_payment_status( $payment_id, 'failed' );
292
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
289
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
290
+			__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
291
+		give_update_payment_status($payment_id, 'failed');
292
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
293 293
 
294 294
 		return;
295 295
 	}
296 296
 
297 297
 	// Verify payment currency.
298
-	if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) {
298
+	if ($currency_code !== strtolower($payment_meta['currency'])) {
299 299
 
300
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
301
-			__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
302
-		give_update_payment_status( $payment_id, 'failed' );
303
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
300
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
301
+			__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
302
+		give_update_payment_status($payment_id, 'failed');
303
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
304 304
 
305 305
 		return;
306 306
 	}
307 307
 
308 308
 	// Process refunds & reversed.
309
-	if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
310
-		give_process_paypal_refund( $data, $payment_id );
309
+	if ('refunded' === $payment_status || 'reversed' === $payment_status) {
310
+		give_process_paypal_refund($data, $payment_id);
311 311
 
312 312
 		return;
313 313
 	}
314 314
 
315 315
 	// Only complete payments once.
316
-	if ( 'publish' === get_post_status( $payment_id ) ) {
316
+	if ('publish' === get_post_status($payment_id)) {
317 317
 		return;
318 318
 	}
319 319
 
320 320
 	// Retrieve the total donation amount (before PayPal).
321
-	$payment_amount = give_get_payment_amount( $payment_id );
321
+	$payment_amount = give_get_payment_amount($payment_id);
322 322
 
323 323
 	// Check that the donation PP and local db amounts match.
324
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
324
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
325 325
 		// The prices don't match
326
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
327
-			__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
328
-		give_update_payment_status( $payment_id, 'failed' );
329
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
326
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
327
+			__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
328
+		give_update_payment_status($payment_id, 'failed');
329
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
330 330
 
331 331
 		return;
332 332
 	}
333 333
 
334 334
 	// Process completed donations.
335
-	if ( 'completed' === $payment_status || give_is_test_mode() ) {
335
+	if ('completed' === $payment_status || give_is_test_mode()) {
336 336
 
337
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
338
-			__( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
339
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
340
-		give_update_payment_status( $payment_id, 'publish' );
337
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
338
+			__('PayPal Transaction ID: %s', 'give'), $data['txn_id'] ));
339
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
340
+		give_update_payment_status($payment_id, 'publish');
341 341
 
342
-	} elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) {
342
+	} elseif ('pending' === $payment_status && isset($data['pending_reason'])) {
343 343
 
344 344
 		// Look for possible pending reasons, such as an echeck.
345
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
345
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
346 346
 
347
-		if ( ! empty( $note ) ) {
348
-			give_insert_payment_note( $payment_id, $note );
347
+		if ( ! empty($note)) {
348
+			give_insert_payment_note($payment_id, $note);
349 349
 		}
350 350
 	}
351 351
 
352 352
 }
353 353
 
354
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 );
354
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2);
355 355
 
356 356
 /**
357 357
  * Process PayPal IPN Refunds
@@ -363,35 +363,35 @@  discard block
 block discarded – undo
363 363
  *
364 364
  * @return void
365 365
  */
366
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
366
+function give_process_paypal_refund($data, $payment_id = 0) {
367 367
 
368 368
 	// Collect payment details.
369
-	if ( empty( $payment_id ) ) {
369
+	if (empty($payment_id)) {
370 370
 		return;
371 371
 	}
372 372
 
373 373
 	// Only refund payments once.
374
-	if ( 'refunded' === get_post_status( $payment_id ) ) {
374
+	if ('refunded' === get_post_status($payment_id)) {
375 375
 		return;
376 376
 	}
377 377
 
378
-	$payment_amount = give_get_payment_amount( $payment_id );
378
+	$payment_amount = give_get_payment_amount($payment_id);
379 379
 	$refund_amount  = $data['payment_gross'] * - 1;
380 380
 
381
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
381
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
382 382
 
383
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
384
-			__( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
383
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
384
+			__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] ));
385 385
 
386 386
 		return; // This is a partial refund
387 387
 
388 388
 	}
389 389
 
390
-	give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
391
-		__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
392
-	give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
393
-		__( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
394
-	give_update_payment_status( $payment_id, 'refunded' );
390
+	give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
391
+		__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] ));
392
+	give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
393
+		__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] ));
394
+	give_update_payment_status($payment_id, 'refunded');
395 395
 }
396 396
 
397 397
 /**
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
  *
404 404
  * @return string
405 405
  */
406
-function give_get_paypal_redirect( $ssl_check = false ) {
406
+function give_get_paypal_redirect($ssl_check = false) {
407 407
 
408
-	if ( is_ssl() || ! $ssl_check ) {
408
+	if (is_ssl() || ! $ssl_check) {
409 409
 		$protocol = 'https://';
410 410
 	} else {
411 411
 		$protocol = 'http://';
412 412
 	}
413 413
 
414 414
 	// Check the current payment mode
415
-	if ( give_is_test_mode() ) {
415
+	if (give_is_test_mode()) {
416 416
 		// Test mode
417
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
417
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
418 418
 	} else {
419 419
 		// Live mode
420
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
420
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
421 421
 	}
422 422
 
423
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
423
+	return apply_filters('give_paypal_uri', $paypal_uri);
424 424
 }
425 425
 
426 426
 /**
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
  * @return string
431 431
  */
432 432
 function give_get_paypal_page_style() {
433
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
433
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
434 434
 
435
-	return apply_filters( 'give_paypal_page_style', $page_style );
435
+	return apply_filters('give_paypal_page_style', $page_style);
436 436
 }
437 437
 
438 438
 /**
@@ -446,26 +446,26 @@  discard block
 block discarded – undo
446 446
  *
447 447
  * @return string
448 448
  */
449
-function give_paypal_success_page_content( $content ) {
449
+function give_paypal_success_page_content($content) {
450 450
 
451
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
451
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
452 452
 		return $content;
453 453
 	}
454 454
 
455
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
455
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
456 456
 
457
-	if ( ! $payment_id ) {
457
+	if ( ! $payment_id) {
458 458
 		$session    = give_get_purchase_session();
459
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
459
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
460 460
 	}
461 461
 
462
-	$payment = get_post( $payment_id );
463
-	if ( $payment && 'pending' === $payment->post_status ) {
462
+	$payment = get_post($payment_id);
463
+	if ($payment && 'pending' === $payment->post_status) {
464 464
 
465 465
 		// Payment is still pending so show processing indicator to fix the race condition.
466 466
 		ob_start();
467 467
 
468
-		give_get_template_part( 'payment', 'processing' );
468
+		give_get_template_part('payment', 'processing');
469 469
 
470 470
 		$content = ob_get_clean();
471 471
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
 }
477 477
 
478
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
478
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
479 479
 
480 480
 /**
481 481
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -487,16 +487,16 @@  discard block
 block discarded – undo
487 487
  *
488 488
  * @return string                 A link to the PayPal transaction details
489 489
  */
490
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
490
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
491 491
 
492 492
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
493
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
493
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
494 494
 
495
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
495
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
496 496
 
497 497
 }
498 498
 
499
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
499
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
500 500
 
501 501
 
502 502
 /**
@@ -508,64 +508,64 @@  discard block
 block discarded – undo
508 508
  *
509 509
  * @return string
510 510
  */
511
-function give_paypal_get_pending_donation_note( $pending_reason ) {
511
+function give_paypal_get_pending_donation_note($pending_reason) {
512 512
 
513 513
 	$note = '';
514 514
 
515
-	switch ( $pending_reason ) {
515
+	switch ($pending_reason) {
516 516
 
517 517
 		case 'echeck' :
518 518
 
519
-			$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
519
+			$note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
520 520
 
521 521
 			break;
522 522
 
523 523
 		case 'address' :
524 524
 
525
-			$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
525
+			$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
526 526
 
527 527
 			break;
528 528
 
529 529
 		case 'intl' :
530 530
 
531
-			$note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
531
+			$note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
532 532
 
533 533
 			break;
534 534
 
535 535
 		case 'multi-currency' :
536 536
 
537
-			$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
537
+			$note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
538 538
 
539 539
 			break;
540 540
 
541 541
 		case 'paymentreview' :
542 542
 		case 'regulatory_review' :
543 543
 
544
-			$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
544
+			$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
545 545
 
546 546
 			break;
547 547
 
548 548
 		case 'unilateral' :
549 549
 
550
-			$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
550
+			$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
551 551
 
552 552
 			break;
553 553
 
554 554
 		case 'upgrade' :
555 555
 
556
-			$note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
556
+			$note = __('PayPal account must be upgraded before this payment can be accepted.', 'give');
557 557
 
558 558
 			break;
559 559
 
560 560
 		case 'verify' :
561 561
 
562
-			$note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
562
+			$note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
563 563
 
564 564
 			break;
565 565
 
566 566
 		case 'other' :
567 567
 
568
-			$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
568
+			$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
569 569
 
570 570
 			break;
571 571
 
@@ -583,49 +583,49 @@  discard block
 block discarded – undo
583 583
  *
584 584
  * @return mixed|string
585 585
  */
586
-function give_build_paypal_url( $payment_id, $payment_data ) {
586
+function give_build_paypal_url($payment_id, $payment_data) {
587 587
 	// Only send to PayPal if the pending payment is created successfully.
588
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
588
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
589 589
 
590 590
 	// Get the success url.
591
-	$return_url = add_query_arg( array(
591
+	$return_url = add_query_arg(array(
592 592
 		'payment-confirmation' => 'paypal',
593 593
 		'payment-id'           => $payment_id,
594 594
 
595
-	), get_permalink( give_get_option( 'success_page' ) ) );
595
+	), get_permalink(give_get_option('success_page')));
596 596
 
597 597
 	// Get the PayPal redirect uri.
598
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
598
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
599 599
 
600 600
 	// Item name.
601
-	$item_name = give_payment_gateway_item_title( $payment_data );
601
+	$item_name = give_payment_gateway_item_title($payment_data);
602 602
 
603 603
 	// Setup PayPal API params.
604 604
 	$paypal_args = array(
605
-		'business'      => give_get_option( 'paypal_email', false ),
605
+		'business'      => give_get_option('paypal_email', false),
606 606
 		'first_name'    => $payment_data['user_info']['first_name'],
607 607
 		'last_name'     => $payment_data['user_info']['last_name'],
608 608
 		'email'         => $payment_data['user_email'],
609 609
 		'invoice'       => $payment_data['purchase_key'],
610 610
 		'amount'        => $payment_data['price'],
611
-		'item_name'     => stripslashes( $item_name ),
611
+		'item_name'     => stripslashes($item_name),
612 612
 		'no_shipping'   => '1',
613 613
 		'shipping'      => '0',
614 614
 		'no_note'       => '1',
615
-		'currency_code' => give_get_currency( $payment_id, $payment_data ),
616
-		'charset'       => get_bloginfo( 'charset' ),
615
+		'currency_code' => give_get_currency($payment_id, $payment_data),
616
+		'charset'       => get_bloginfo('charset'),
617 617
 		'custom'        => $payment_id,
618 618
 		'rm'            => '2',
619 619
 		'return'        => $return_url,
620
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
620
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
621 621
 		'notify_url'    => $listener_url,
622 622
 		'page_style'    => give_get_paypal_page_style(),
623
-		'cbt'           => get_bloginfo( 'name' ),
623
+		'cbt'           => get_bloginfo('name'),
624 624
 		'bn'            => 'givewp_SP',
625 625
 	);
626 626
 
627 627
 	// Add user address if present.
628
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
628
+	if ( ! empty($payment_data['user_info']['address'])) {
629 629
 		$default_address = array(
630 630
 			'line1'   => '',
631 631
 			'line2'   => '',
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			'country' => '',
636 636
 		);
637 637
 
638
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
638
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
639 639
 
640 640
 		$paypal_args['address1'] = $address['line1'];
641 641
 		$paypal_args['address2'] = $address['line2'];
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
 	 *
657 657
 	 * @since 1.8
658 658
 	 */
659
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
659
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
660 660
 
661 661
 	// Build query.
662
-	$paypal_redirect .= http_build_query( $paypal_args );
662
+	$paypal_redirect .= http_build_query($paypal_args);
663 663
 
664 664
 	// Fix for some sites that encode the entities.
665
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
665
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
666 666
 
667 667
 	return $paypal_redirect;
668 668
 }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 function give_get_paypal_button_type() {
678 678
 	// paypal_button_type can be donation or standard.
679 679
 	$paypal_button_type = '_donations';
680
-	if ( 'standard' === give_get_option( 'paypal_button_type' ) ) {
680
+	if ('standard' === give_get_option('paypal_button_type')) {
681 681
 		$paypal_button_type = '_xclick';
682 682
 	}
683 683
 
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
     <fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
     </fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89 89
 	if (
90
-		( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) )
91
-		|| ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) )
90
+		(give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields))
91
+		|| (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields))
92 92
 	) {
93
-		give_default_cc_address_fields( $form_id );
93
+		give_default_cc_address_fields($form_id);
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
97
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
98 98
 
99 99
 /**
100 100
  * Process the payment
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return void
107 107
  */
108
-function give_offline_process_payment( $purchase_data ) {
108
+function give_offline_process_payment($purchase_data) {
109 109
 
110 110
 	// Setup the payment details.
111 111
 	$payment_data = array(
112 112
 		'price'           => $purchase_data['price'],
113 113
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
114
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
115
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
114
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
115
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
116 116
 		'date'            => $purchase_data['date'],
117 117
 		'user_email'      => $purchase_data['user_email'],
118 118
 		'purchase_key'    => $purchase_data['purchase_key'],
119
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
119
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
120 120
 		'user_info'       => $purchase_data['user_info'],
121 121
 		'status'          => 'pending',
122 122
 		'gateway'         => 'offline'
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 	// record the pending payment
127
-	$payment = give_insert_payment( $payment_data );
127
+	$payment = give_insert_payment($payment_data);
128 128
 
129
-	if ( $payment ) {
130
-		give_offline_send_admin_notice( $payment );
131
-		give_offline_send_donor_instructions( $payment );
129
+	if ($payment) {
130
+		give_offline_send_admin_notice($payment);
131
+		give_offline_send_donor_instructions($payment);
132 132
 		give_send_to_success_page();
133 133
 	} else {
134 134
 		// if errors are present, send the user back to the donation form so they can be corrected
135
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
135
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
136 136
 	}
137 137
 
138 138
 }
139 139
 
140
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
140
+add_action('give_gateway_offline', 'give_offline_process_payment');
141 141
 
142 142
 
143 143
 /**
@@ -150,59 +150,59 @@  discard block
 block discarded – undo
150 150
  * @since       1.0
151 151
  * @return void
152 152
  */
153
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
153
+function give_offline_send_donor_instructions($payment_id = 0) {
154 154
 
155
-	$payment_data                      = give_get_payment_meta( $payment_id );
156
-	$post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
155
+	$payment_data                      = give_get_payment_meta($payment_id);
156
+	$post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
157 157
 
158 158
 	//Customize email content depending on whether the single form has been customized
159
-	$email_content = give_get_option( 'global_offline_donation_email' );
159
+	$email_content = give_get_option('global_offline_donation_email');
160 160
 
161
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
162
-		$email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
161
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
162
+		$email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true);
163 163
 	}
164 164
 
165
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
165
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
166 166
 
167 167
 	/**
168 168
 	 * Filters the from name.
169 169
 	 *
170 170
 	 * @since 1.7
171 171
 	 */
172
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
172
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
173 173
 
174
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
174
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
175 175
 
176 176
 	/**
177 177
 	 * Filters the from email.
178 178
 	 *
179 179
 	 * @since 1.7
180 180
 	 */
181
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
181
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
182 182
 
183
-	$to_email = give_get_payment_user_email( $payment_id );
183
+	$to_email = give_get_payment_user_email($payment_id);
184 184
 
185
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
186
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
187
-		$subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
185
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
186
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
187
+		$subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
188 188
 	}
189 189
 
190
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
191
-	$subject = give_do_email_tags( $subject, $payment_id );
190
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
191
+	$subject = give_do_email_tags($subject, $payment_id);
192 192
 
193
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
194
-	$message     = give_do_email_tags( $email_content, $payment_id );
193
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
194
+	$message     = give_do_email_tags($email_content, $payment_id);
195 195
 
196 196
 	$emails = Give()->emails;
197 197
 
198
-	$emails->__set( 'from_name', $from_name );
199
-	$emails->__set( 'from_email', $from_email );
200
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
198
+	$emails->__set('from_name', $from_name);
199
+	$emails->__set('from_email', $from_email);
200
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
201 201
 
202
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
203
-	$emails->__set( 'headers', $headers );
202
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
203
+	$emails->__set('headers', $headers);
204 204
 
205
-	$emails->send( $to_email, $subject, $message, $attachments );
205
+	$emails->send($to_email, $subject, $message, $attachments);
206 206
 
207 207
 }
208 208
 
@@ -219,54 +219,54 @@  discard block
 block discarded – undo
219 219
  * @return void
220 220
  *
221 221
  */
222
-function give_offline_send_admin_notice( $payment_id = 0 ) {
222
+function give_offline_send_admin_notice($payment_id = 0) {
223 223
 
224 224
 	/* Send an email notification to the admin */
225 225
 	$admin_email = give_get_admin_notice_emails();
226
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
226
+	$user_info   = give_get_payment_meta_user_info($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $user_info['email'];
235 235
 	}
236 236
 
237
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) );
237
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false)));
238 238
 
239
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
239
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
240 240
 
241
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
242
-	$admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n";
243
-	$admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
241
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
242
+	$admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n";
243
+	$admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
244 244
 
245 245
 
246
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
247
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
246
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
247
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
248 248
 
249 249
 	$admin_message .= sprintf(
250 250
 		                  '<a href="%1$s">%2$s</a>',
251
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
252
-		                  __( 'View Donation Details &raquo;', 'give' )
253
-	                  ) . "\n\n";
251
+		                  admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id),
252
+		                  __('View Donation Details &raquo;', 'give')
253
+	                  )."\n\n";
254 254
 
255
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
256
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
255
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
256
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
257 257
 
258
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
259
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
258
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
259
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
260 260
 
261 261
 	//Send Email
262 262
 	$emails = Give()->emails;
263
-	$emails->__set( 'heading', __( 'New Offline Donation', 'give' ) );
263
+	$emails->__set('heading', __('New Offline Donation', 'give'));
264 264
 
265
-	if ( ! empty( $admin_headers ) ) {
266
-		$emails->__set( 'headers', $admin_headers );
265
+	if ( ! empty($admin_headers)) {
266
+		$emails->__set('headers', $admin_headers);
267 267
 	}
268 268
 
269
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
269
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
270 270
 
271 271
 }
272 272
 
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
  *
279 279
  * @return array
280 280
  */
281
-function give_offline_add_settings( $settings ) {
281
+function give_offline_add_settings($settings) {
282 282
 
283 283
 	// Bailout: Do not show offline gateways setting in to metabox if its disabled globally.
284
-	if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) {
284
+	if (in_array('offline', give_get_option('gateways'))) {
285 285
 		return $settings;
286 286
 	}
287 287
 
288 288
 	//Vars
289 289
 	$prefix = '_give_';
290 290
 
291
-	$is_gateway_active = give_is_gateway_active( 'offline' );
291
+	$is_gateway_active = give_is_gateway_active('offline');
292 292
 
293 293
 	//this gateway isn't active
294
-	if ( ! $is_gateway_active ) {
294
+	if ( ! $is_gateway_active) {
295 295
 		//return settings and bounce
296 296
 		return $settings;
297 297
 	}
@@ -300,34 +300,34 @@  discard block
 block discarded – undo
300 300
 	$check_settings = array(
301 301
 
302 302
 		array(
303
-			'name'    => __( 'Offline Donations', 'give' ),
304
-			'desc'    => __( 'Do you want to customize the donation instructions for this form?', 'give' ),
305
-			'id'      => $prefix . 'customize_offline_donations',
303
+			'name'    => __('Offline Donations', 'give'),
304
+			'desc'    => __('Do you want to customize the donation instructions for this form?', 'give'),
305
+			'id'      => $prefix.'customize_offline_donations',
306 306
 			'type'    => 'radio_inline',
307 307
 			'default' => 'global',
308
-			'options' => apply_filters( 'give_forms_content_options_select', array(
309
-					'global'   => __( 'Global Option', 'give' ),
310
-					'enabled'  => __( 'Customize', 'give' ),
311
-					'disabled' => __( 'Disable', 'give' ),
308
+			'options' => apply_filters('give_forms_content_options_select', array(
309
+					'global'   => __('Global Option', 'give'),
310
+					'enabled'  => __('Customize', 'give'),
311
+					'disabled' => __('Disable', 'give'),
312 312
 				)
313 313
 			),
314 314
 		),
315 315
 		array(
316
-			'name'        => __( 'Billing Fields', 'give' ),
317
-			'desc'        => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
318
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
316
+			'name'        => __('Billing Fields', 'give'),
317
+			'desc'        => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
318
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
319 319
 			'row_classes' => 'give-subfield give-hidden',
320 320
 			'type'        => 'radio_inline',
321 321
 			'default'     => 'disabled',
322 322
 			'options'     => array(
323
-				'enabled'  => __( 'Enabled', 'give' ),
324
-				'disabled' => __( 'Disabled', 'give' ),
323
+				'enabled'  => __('Enabled', 'give'),
324
+				'disabled' => __('Disabled', 'give'),
325 325
 			),
326 326
 		),
327 327
 		array(
328
-			'id'          => $prefix . 'offline_checkout_notes',
329
-			'name'        => __( 'Donation Instructions', 'give' ),
330
-			'desc'        => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
328
+			'id'          => $prefix.'offline_checkout_notes',
329
+			'name'        => __('Donation Instructions', 'give'),
330
+			'desc'        => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
331 331
 			'default'     => give_get_default_offline_donation_content(),
332 332
 			'type'        => 'wysiwyg',
333 333
 			'row_classes' => 'give-subfield give-hidden',
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 			),
337 337
 		),
338 338
 		array(
339
-			'id'          => $prefix . 'offline_donation_subject',
340
-			'name'        => __( 'Email Subject', 'give' ),
341
-			'desc'        => __( 'Enter the subject line for the donation receipt email.', 'give' ),
342
-			'default'     => __( '{form_title} - Offline Donation Instructions', 'give' ),
339
+			'id'          => $prefix.'offline_donation_subject',
340
+			'name'        => __('Email Subject', 'give'),
341
+			'desc'        => __('Enter the subject line for the donation receipt email.', 'give'),
342
+			'default'     => __('{form_title} - Offline Donation Instructions', 'give'),
343 343
 			'row_classes' => 'give-subfield give-hidden',
344 344
 			'type'        => 'text',
345 345
 		),
346 346
 		array(
347
-			'id'          => $prefix . 'offline_donation_email',
348
-			'name'        => __( 'Email Instructions', 'give' ),
349
-			'desc'        => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
347
+			'id'          => $prefix.'offline_donation_email',
348
+			'name'        => __('Email Instructions', 'give'),
349
+			'desc'        => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
350 350
 			'default'     => give_get_default_offline_donation_email_content(),
351 351
 			'type'        => 'wysiwyg',
352 352
 			'row_classes' => 'give-subfield give-hidden',
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 			'name'  => 'offline_docs',
359 359
 			'type'  => 'docs_link',
360 360
 			'url'   => 'http://docs.givewp.com/settings-gateway-offline-donations',
361
-			'title' => __( 'Offline Donations', 'give' ),
361
+			'title' => __('Offline Donations', 'give'),
362 362
 		),
363 363
 	);
364 364
 
365
-	return array_merge( $settings, $check_settings );
365
+	return array_merge($settings, $check_settings);
366 366
 }
367 367
 
368
-add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' );
368
+add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings');
369 369
 
370 370
 
371 371
 /**
@@ -377,32 +377,32 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_get_default_offline_donation_content() {
379 379
 
380
-	$sitename = get_bloginfo( 'sitename' );
380
+	$sitename = get_bloginfo('sitename');
381 381
 
382
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
382
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
383 383
 	$default_text .= '<ol>';
384 384
 	$default_text .= '<li>';
385 385
 	$default_text .= sprintf(
386 386
 	/* translators: %s: site name */
387
-		__( 'Make a check payable to "%s"', 'give' ),
387
+		__('Make a check payable to "%s"', 'give'),
388 388
 		$sitename
389 389
 	);
390 390
 	$default_text .= '</li>';
391 391
 	$default_text .= '<li>';
392 392
 	$default_text .= sprintf(
393 393
 	/* translators: %s: site name */
394
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
394
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
395 395
 		$sitename
396 396
 	);
397 397
 	$default_text .= '</li>';
398
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
398
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
399 399
 	$default_text .= '</ol>';
400
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
400
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
401 401
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
402 402
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
403
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
403
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
404 404
 
405
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
405
+	return apply_filters('give_default_offline_donation_content', $default_text);
406 406
 
407 407
 }
408 408
 
@@ -415,34 +415,34 @@  discard block
 block discarded – undo
415 415
  */
416 416
 function give_get_default_offline_donation_email_content() {
417 417
 
418
-	$sitename     = get_bloginfo( 'sitename' );
419
-	$default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
420
-	$default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
418
+	$sitename     = get_bloginfo('sitename');
419
+	$default_text = '<p>'.__('Dear {name},', 'give').'</p>';
420
+	$default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
421 421
 	$default_text .= '<ol>';
422 422
 	$default_text .= '<li>';
423 423
 	$default_text .= sprintf(
424 424
 	/* translators: %s: site name */
425
-		__( 'Make a check payable to "%s"', 'give' ),
425
+		__('Make a check payable to "%s"', 'give'),
426 426
 		$sitename
427 427
 	);
428 428
 	$default_text .= '</li>';
429 429
 	$default_text .= '<li>';
430 430
 	$default_text .= sprintf(
431 431
 	/* translators: %s: site name */
432
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
432
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
433 433
 		$sitename
434 434
 	);
435 435
 	$default_text .= '</li>';
436
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
436
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
437 437
 	$default_text .= '</ol>';
438
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
438
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
439 439
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
440 440
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
441
-	$default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
442
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
443
-	$default_text .= '<p>' . $sitename . '</p>';
441
+	$default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
442
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
443
+	$default_text .= '<p>'.$sitename.'</p>';
444 444
 
445
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
445
+	return apply_filters('give_default_offline_donation_content', $default_text);
446 446
 
447 447
 }
448 448
 
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
  *
457 457
  * @return string
458 458
  */
459
-function give_offline_donation_receipt_status_notice( $notice, $id ) {
460
-	$payment = new Give_Payment( $id );
459
+function give_offline_donation_receipt_status_notice($notice, $id) {
460
+	$payment = new Give_Payment($id);
461 461
 
462
-	if ( 'offline' !== $payment->gateway || $payment->is_completed() ) {
462
+	if ('offline' !== $payment->gateway || $payment->is_completed()) {
463 463
 		return $notice;
464 464
 	}
465 465
 
466
-	return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' );
466
+	return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning');
467 467
 }
468 468
 
469
-add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 );
469
+add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2);
470 470
 
471 471
 /**
472 472
  * Get offline payment instructions.
@@ -478,27 +478,27 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @return string
480 480
  */
481
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
481
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
482 482
 	// Bailout.
483
-	if ( ! $form_id ) {
483
+	if ( ! $form_id) {
484 484
 		return '';
485 485
 	}
486 486
 
487
-	$post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
488
-	$post_offline_instructions         = give_get_meta( $form_id, '_give_offline_checkout_notes', true );
489
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
487
+	$post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
488
+	$post_offline_instructions         = give_get_meta($form_id, '_give_offline_checkout_notes', true);
489
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
490 490
 	$offline_instructions              = $global_offline_instruction;
491 491
 
492
-	if ( give_is_setting_enabled( $post_offline_customization_option ) ) {
492
+	if (give_is_setting_enabled($post_offline_customization_option)) {
493 493
 		$offline_instructions = $post_offline_instructions;
494 494
 	}
495 495
 
496
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
496
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
497 497
 
498 498
 	/* translators: %s: form settings url */
499
-	$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
499
+	$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
500 500
 
501
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
501
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
502 502
 }
503 503
 
504 504
 
@@ -512,24 +512,24 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @return array
514 514
  */
515
-function give_filter_offline_gateway( $gateway_list, $form_id ) {
515
+function give_filter_offline_gateway($gateway_list, $form_id) {
516 516
 	if (
517 517
 		// Show offline payment gateway if enable for new donation form.
518
-		( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) )
518
+		(false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms'))
519 519
 		&& $form_id
520
-		&& ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array(
520
+		&& ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array(
521 521
 			'enabled',
522 522
 			'global',
523
-		) )
523
+		))
524 524
 	) {
525
-		unset( $gateway_list['offline'] );
525
+		unset($gateway_list['offline']);
526 526
 	}
527 527
 
528 528
 	// Output.
529 529
 	return $gateway_list;
530 530
 }
531 531
 
532
-add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 );
532
+add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2);
533 533
 
534 534
 /**
535 535
  * Set default gateway to global default payment gateway
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
  *
544 544
  * @return void
545 545
  */
546
-function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) {
547
-	if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) {
548
-		give_update_meta( $postid, '_give_default_gateway', 'global' );
546
+function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) {
547
+	if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) {
548
+		give_update_meta($postid, '_give_default_gateway', 'global');
549 549
 	}
550 550
 }
551 551
 
552
-add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 );
552
+add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3);
Please login to merge, or discard this patch.
includes/class-notices.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.8.9
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 );
57
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
56
+		add_action('admin_notices', array($this, 'render_admin_notices'), 999);
57
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
58 58
 
59
-		add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 );
60
-		add_action( 'give_donation_form_before_personal_info', array( $this, 'render_frontend_notices' ) );
61
-		add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) );
59
+		add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999);
60
+		add_action('give_donation_form_before_personal_info', array($this, 'render_frontend_notices'));
61
+		add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices'));
62 62
 
63 63
 		/**
64 64
 		 * Backward compatibility for deprecated params.
65 65
 		 *
66 66
 		 * @since 1.8.14
67 67
 		 */
68
-		add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) );
69
-		add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) );
70
-		add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) );
68
+		add_filter('give_register_notice_args', array($this, 'bc_deprecated_params'));
69
+		add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params'));
70
+		add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public function bc_deprecated_params( $args ) {
83
+	public function bc_deprecated_params($args) {
84 84
 		/**
85 85
 		 *  Param: auto_dismissible
86 86
 		 *  deprecated in 1.8.14
87 87
 		 *
88 88
 		 *  Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto
89 89
 		 */
90
-		if ( isset( $args['auto_dismissible'] ) ) {
91
-			if ( ! empty( $args['auto_dismissible'] ) ) {
90
+		if (isset($args['auto_dismissible'])) {
91
+			if ( ! empty($args['auto_dismissible'])) {
92 92
 				$args['dismissible'] = 'auto';
93 93
 			}
94 94
 			// unset auto_dismissible as it has been deprecated.
95
-			unset( $args['auto_dismissible'] );
95
+			unset($args['auto_dismissible']);
96 96
 		}
97 97
 
98 98
 		return $args;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function register_notice( $notice_args ) {
111
+	public function register_notice($notice_args) {
112 112
 		// Bailout.
113
-		if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) {
113
+		if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.14
150 150
 		 */
151
-		$notice_args = apply_filters( 'give_register_notice_args', $notice_args );
151
+		$notice_args = apply_filters('give_register_notice_args', $notice_args);
152 152
 
153 153
 		// Set extra dismiss links if any.
154
-		if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) {
154
+		if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) {
155 155
 
156
-			preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link );
156
+			preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link);
157 157
 
158
-			if ( ! empty( $extra_notice_dismiss_link ) ) {
159
-				$extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 );
160
-				foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) {
158
+			if ( ! empty($extra_notice_dismiss_link)) {
159
+				$extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3);
160
+				foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) {
161 161
 					// Create array og key ==> value by parsing query string created after renaming data attributes.
162
-					$data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array(
162
+					$data_attribute_query_str = str_replace(array('data-', '-', '"'), array(
163 163
 						'',
164 164
 						'_',
165 165
 						'',
166
-					), implode( '&', $extra_notice_dismiss_link ) );
166
+					), implode('&', $extra_notice_dismiss_link));
167 167
 
168
-					$notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str );
168
+					$notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str);
169 169
 				}
170 170
 			}
171 171
 		}
172 172
 
173 173
 
174
-		self::$notices[ $notice_args['id'] ] = $notice_args;
174
+		self::$notices[$notice_args['id']] = $notice_args;
175 175
 
176 176
 		// Auto set show param if not already set.
177
-		if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) {
178
-			self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true;
177
+		if ( ! isset(self::$notices[$notice_args['id']]['show'])) {
178
+			self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true;
179 179
 		}
180 180
 
181 181
 		// Auto set time interval for shortly.
182
-		if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) {
183
-			self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS;
182
+		if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) {
183
+			self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS;
184 184
 		}
185 185
 
186 186
 		return true;
@@ -194,44 +194,44 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function render_admin_notices() {
196 196
 		// Bailout.
197
-		if ( empty( self::$notices ) ) {
197
+		if (empty(self::$notices)) {
198 198
 			return;
199 199
 		}
200 200
 
201 201
 		$output = '';
202 202
 
203
-		foreach ( self::$notices as $notice_id => $notice ) {
203
+		foreach (self::$notices as $notice_id => $notice) {
204 204
 			// Check flag set to true to show notice.
205
-			if ( ! $notice['show'] ) {
205
+			if ( ! $notice['show']) {
206 206
 				continue;
207 207
 			}
208 208
 
209 209
 			// Check if notice dismissible or not.
210
-			if ( ! self::$has_auto_dismissible_notice ) {
211
-				self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] );
210
+			if ( ! self::$has_auto_dismissible_notice) {
211
+				self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']);
212 212
 			}
213 213
 
214 214
 			// Check if notice dismissible or not.
215
-			if ( ! self::$has_dismiss_interval_notice ) {
215
+			if ( ! self::$has_dismiss_interval_notice) {
216 216
 				self::$has_dismiss_interval_notice = $notice['dismiss_interval'];
217 217
 			}
218 218
 
219
-			$css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] );
219
+			$css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']);
220 220
 
221
-			$css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}";
222
-			$output    .= sprintf(
223
-				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n",
221
+			$css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}";
222
+			$output .= sprintf(
223
+				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n",
224 224
 				$css_id,
225 225
 				$css_class,
226
-				give_clean( $notice['dismissible'] ),
226
+				give_clean($notice['dismissible']),
227 227
 				$notice['dismissible_type'],
228 228
 				$notice['dismiss_interval'],
229 229
 				$notice['id'],
230
-				empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ),
230
+				empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"),
231 231
 				$notice['dismiss_interval_time']
232 232
 			);
233 233
 
234
-			$output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" );
234
+			$output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>");
235 235
 			$output .= "</div> \n";
236 236
 		}
237 237
 
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param int $form_id
251 251
 	 */
252
-	public function render_frontend_notices( $form_id = 0 ) {
252
+	public function render_frontend_notices($form_id = 0) {
253 253
 		$errors = give_get_errors();
254 254
 
255
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0;
255
+		$request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0;
256 256
 
257 257
 		// Sanity checks first: Ensure that gateway returned errors display on the appropriate form.
258
-		if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
258
+		if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
259 259
 			return;
260 260
 		}
261 261
 
262
-		if ( $errors ) {
263
-			self::print_frontend_errors( $errors );
262
+		if ($errors) {
263
+			self::print_frontend_errors($errors);
264 264
 
265 265
 			give_clear_errors();
266 266
 		}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @access private
274 274
 	 */
275 275
 	private function print_js() {
276
-		if ( self::$has_auto_dismissible_notice ) :
276
+		if (self::$has_auto_dismissible_notice) :
277 277
 			?>
278 278
 			<script>
279 279
 				jQuery(document).ready(function () {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			<?php
290 290
 		endif;
291 291
 
292
-		if ( self::$has_dismiss_interval_notice ) :
292
+		if (self::$has_dismiss_interval_notice) :
293 293
 			?>
294 294
 			<script>
295 295
 				jQuery(document).ready(function () {
@@ -368,29 +368,29 @@  discard block
 block discarded – undo
368 368
 	 * @access public
369 369
 	 */
370 370
 	public function dismiss_notices() {
371
-		$_post     = give_clean( $_POST );
372
-		$notice_id = esc_attr( $_post['notice_id'] );
371
+		$_post     = give_clean($_POST);
372
+		$notice_id = esc_attr($_post['notice_id']);
373 373
 
374 374
 		// Bailout.
375 375
 		if (
376
-			empty( $notice_id ) ||
377
-			empty( $_post['dismissible_type'] ) ||
378
-			empty( $_post['dismiss_interval'] ) ||
379
-			! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' )
376
+			empty($notice_id) ||
377
+			empty($_post['dismissible_type']) ||
378
+			empty($_post['dismiss_interval']) ||
379
+			! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce')
380 380
 		) {
381 381
 			wp_send_json_error();
382 382
 		}
383 383
 
384
-		$notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] );
385
-		if ( 'user' === $_post['dismissible_type'] ) {
384
+		$notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']);
385
+		if ('user' === $_post['dismissible_type']) {
386 386
 			$current_user = wp_get_current_user();
387
-			$notice_key   = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID );
387
+			$notice_key   = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID);
388 388
 		}
389 389
 
390
-		$notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null;
390
+		$notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null;
391 391
 
392 392
 		// Save option to hide notice.
393
-		Give_Cache::set( $notice_key, true, $notice_dismiss_time, true );
393
+		Give_Cache::set($notice_key, true, $notice_dismiss_time, true);
394 394
 
395 395
 		wp_send_json_success();
396 396
 	}
@@ -408,18 +408,18 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return string
410 410
 	 */
411
-	public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) {
411
+	public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) {
412 412
 		$notice_key = "_give_notice_{$notice_id}";
413 413
 
414
-		if ( ! empty( $dismiss_interval ) ) {
414
+		if ( ! empty($dismiss_interval)) {
415 415
 			$notice_key .= "_{$dismiss_interval}";
416 416
 		}
417 417
 
418
-		if ( $user_id ) {
418
+		if ($user_id) {
419 419
 			$notice_key .= "_{$user_id}";
420 420
 		}
421 421
 
422
-		$notice_key = sanitize_key( $notice_key );
422
+		$notice_key = sanitize_key($notice_key);
423 423
 
424 424
 		return $notice_key;
425 425
 	}
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
 	 *
433 433
 	 * @return string
434 434
 	 */
435
-	public function get_dismiss_link( $notice_args ) {
435
+	public function get_dismiss_link($notice_args) {
436 436
 		$notice_args = wp_parse_args(
437 437
 			$notice_args,
438 438
 			array(
439
-				'title'                 => __( 'Click here', 'give' ),
439
+				'title'                 => __('Click here', 'give'),
440 440
 				'dismissible_type'      => '',
441 441
 				'dismiss_interval'      => '',
442 442
 				'dismiss_interval_time' => null,
@@ -463,31 +463,31 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @return bool|null
465 465
 	 */
466
-	public function is_notice_dismissed( $notice ) {
467
-		$notice_key          = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] );
466
+	public function is_notice_dismissed($notice) {
467
+		$notice_key          = $this->get_notice_key($notice['id'], $notice['dismiss_interval']);
468 468
 		$is_notice_dismissed = false;
469 469
 
470
-		if ( 'user' === $notice['dismissible_type'] ) {
470
+		if ('user' === $notice['dismissible_type']) {
471 471
 			$current_user = wp_get_current_user();
472
-			$notice_key   = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID );
472
+			$notice_key   = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID);
473 473
 		}
474 474
 
475
-		$notice_data = Give_Cache::get( $notice_key, true );
475
+		$notice_data = Give_Cache::get($notice_key, true);
476 476
 
477 477
 		// Find notice dismiss link status if notice has extra dismissible links.
478
-		if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) {
478
+		if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) {
479 479
 
480
-			foreach ( $notice['extra_links'] as $extra_link ) {
481
-				$new_notice_data = wp_parse_args( $extra_link, $notice );
482
-				unset( $new_notice_data['extra_links'] );
480
+			foreach ($notice['extra_links'] as $extra_link) {
481
+				$new_notice_data = wp_parse_args($extra_link, $notice);
482
+				unset($new_notice_data['extra_links']);
483 483
 
484
-				if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) {
484
+				if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) {
485 485
 					return $is_notice_dismissed;
486 486
 				}
487 487
 			}
488 488
 		}
489 489
 
490
-		$is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data );
490
+		$is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data);
491 491
 
492 492
 		return $is_notice_dismissed;
493 493
 	}
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @param array $errors
503 503
 	 */
504
-	public static function print_frontend_errors( $errors ) {
504
+	public static function print_frontend_errors($errors) {
505 505
 		// Bailout.
506
-		if ( ! $errors ) {
506
+		if ( ! $errors) {
507 507
 			return;
508 508
 		}
509 509
 
@@ -518,37 +518,37 @@  discard block
 block discarded – undo
518 518
 		);
519 519
 
520 520
 		// Note: we will remove give_errors class in future.
521
-		$classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) );
521
+		$classes = apply_filters('give_error_class', array('give_notices', 'give_errors'));
522 522
 
523
-		echo sprintf( '<div class="%s">', implode( ' ', $classes ) );
523
+		echo sprintf('<div class="%s">', implode(' ', $classes));
524 524
 
525 525
 		// Loop error codes and display errors.
526
-		foreach ( $errors as $error_id => $error ) {
526
+		foreach ($errors as $error_id => $error) {
527 527
 			// Backward compatibility v<1.8.11
528
-			if ( is_string( $error ) ) {
528
+			if (is_string($error)) {
529 529
 				$error = array(
530 530
 					'message'     => $error,
531 531
 					'notice_args' => array(),
532 532
 				);
533 533
 			}
534 534
 
535
-			$notice_args = wp_parse_args( $error['notice_args'], $default_notice_args );
535
+			$notice_args = wp_parse_args($error['notice_args'], $default_notice_args);
536 536
 
537 537
 			/**
538 538
 			 * Filter to modify Frontend Errors args before errors is display.
539 539
 			 *
540 540
 			 * @since 1.8.14
541 541
 			 */
542
-			$notice_args = apply_filters( 'give_frontend_errors_args', $notice_args );
542
+			$notice_args = apply_filters('give_frontend_errors_args', $notice_args);
543 543
 
544 544
 			echo sprintf(
545 545
 				'<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d">
546 546
 						<p><strong>%4$s</strong>: %5$s</p>
547 547
 					</div>',
548 548
 				$error_id,
549
-				give_clean( $notice_args['dismissible'] ),
550
-				absint( $notice_args['dismiss_interval'] ),
551
-				esc_html__( 'Error', 'give' ),
549
+				give_clean($notice_args['dismissible']),
550
+				absint($notice_args['dismiss_interval']),
551
+				esc_html__('Error', 'give'),
552 552
 				$error['message']
553 553
 			);
554 554
 		}
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @return  string
572 572
 	 */
573
-	public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) {
574
-		if ( empty( $message ) ) {
573
+	public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) {
574
+		if (empty($message)) {
575 575
 			return '';
576 576
 		}
577 577
 
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 			'dismiss_interval' => 5000,
586 586
 		);
587 587
 
588
-		$notice_args = wp_parse_args( $notice_args, $default_notice_args );
588
+		$notice_args = wp_parse_args($notice_args, $default_notice_args);
589 589
 
590 590
 		/**
591 591
 		 * Filter to modify Frontend notice args before notices is display.
592 592
 		 *
593 593
 		 * @since 1.8.14
594 594
 		 */
595
-		$notice_args = apply_filters( 'give_frontend_notice_args', $notice_args );
595
+		$notice_args = apply_filters('give_frontend_notice_args', $notice_args);
596 596
 
597 597
 		// Note: we will remove give_errors class in future.
598 598
 		$error = sprintf(
@@ -602,12 +602,12 @@  discard block
 block discarded – undo
602 602
 				</p>
603 603
 			</div>',
604 604
 			$notice_type,
605
-			give_clean( $notice_args['dismissible'] ),
606
-			absint( $notice_args['dismiss_interval'] ),
605
+			give_clean($notice_args['dismissible']),
606
+			absint($notice_args['dismiss_interval']),
607 607
 			$message
608 608
 		);
609 609
 
610
-		if ( ! $echo ) {
610
+		if ( ! $echo) {
611 611
 			return $error;
612 612
 		}
613 613
 
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +151 added lines, -151 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function donations_dropdown( $args = array() ) {
38
+	public function donations_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'donations',
@@ -45,32 +45,32 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => __( 'Select a donation', 'give' ),
48
+			'placeholder' => __('Select a donation', 'give'),
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number'],
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		// Provide nice human readable options.
62
-		if ( $payments ) {
62
+		if ($payments) {
63 63
 			$options[0] = $args['placeholder'];
64
-			foreach ( $payments as $payment ) {
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = __( 'No donations found.', 'give' );
70
+			$options[0] = __('No donations found.', 'give');
71 71
 		}
72 72
 
73
-		$output = $this->select( array(
73
+		$output = $this->select(array(
74 74
 			'name'             => $args['name'],
75 75
 			'selected'         => $args['selected'],
76 76
 			'id'               => $args['id'],
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			'select_atts'      => $args['select_atts'],
83 83
 			'show_option_all'  => false,
84 84
 			'show_option_none' => false,
85
-		) );
85
+		));
86 86
 
87 87
 		return $output;
88 88
 	}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return string      Give forms dropdown.
101 101
 	 */
102
-	public function forms_dropdown( $args = array() ) {
102
+	public function forms_dropdown($args = array()) {
103 103
 
104 104
 		$defaults = array(
105 105
 			'name'        => 'forms',
@@ -109,39 +109,39 @@  discard block
 block discarded – undo
109 109
 			'selected'    => 0,
110 110
 			'chosen'      => false,
111 111
 			'number'      => 30,
112
-			'placeholder' => esc_attr__( 'All Forms', 'give' ),
112
+			'placeholder' => esc_attr__('All Forms', 'give'),
113 113
 			'data'        => array(
114 114
 				'search-type' => 'form',
115 115
 			),
116 116
 		);
117 117
 
118
-		$args = wp_parse_args( $args, $defaults );
118
+		$args = wp_parse_args($args, $defaults);
119 119
 
120
-		$forms = get_posts( array(
120
+		$forms = get_posts(array(
121 121
 			'post_type'      => 'give_forms',
122 122
 			'orderby'        => 'title',
123 123
 			'order'          => 'ASC',
124 124
 			'posts_per_page' => $args['number'],
125
-		) );
125
+		));
126 126
 
127 127
 		$options = array();
128 128
 
129 129
 		// Ensure the selected.
130
-		if ( false !== $args['selected'] && $args['selected'] !== 0 ) {
131
-			$options[ $args['selected'] ] = get_the_title( $args['selected'] );
130
+		if (false !== $args['selected'] && $args['selected'] !== 0) {
131
+			$options[$args['selected']] = get_the_title($args['selected']);
132 132
 		}
133 133
 
134
-		if ( $forms ) {
134
+		if ($forms) {
135 135
 			$options[0] = $args['placeholder'];
136
-			foreach ( $forms as $form ) {
137
-				$form_title                     = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
138
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
136
+			foreach ($forms as $form) {
137
+				$form_title                     = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
138
+				$options[absint($form->ID)] = esc_html($form_title);
139 139
 			}
140 140
 		} else {
141
-			$options[0] = esc_html__( 'No forms found.', 'give' );
141
+			$options[0] = esc_html__('No forms found.', 'give');
142 142
 		}
143 143
 
144
-		$output = $this->select( array(
144
+		$output = $this->select(array(
145 145
 			'name'             => $args['name'],
146 146
 			'selected'         => $args['selected'],
147 147
 			'id'               => $args['id'],
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			'show_option_all'  => false,
154 154
 			'show_option_none' => false,
155 155
 			'data'             => $args['data'],
156
-		) );
156
+		));
157 157
 
158 158
 		return $output;
159 159
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string      Donors dropdown.
172 172
 	 */
173
-	public function donor_dropdown( $args = array() ) {
173
+	public function donor_dropdown($args = array()) {
174 174
 
175 175
 		$defaults = array(
176 176
 			'name'        => 'donors',
@@ -179,57 +179,57 @@  discard block
 block discarded – undo
179 179
 			'multiple'    => false,
180 180
 			'selected'    => 0,
181 181
 			'chosen'      => true,
182
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
182
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
183 183
 			'number'      => 30,
184 184
 			'data'        => array(
185 185
 				'search-type' => 'donor',
186 186
 			),
187 187
 		);
188 188
 
189
-		$args = wp_parse_args( $args, $defaults );
189
+		$args = wp_parse_args($args, $defaults);
190 190
 
191
-		$donors = Give()->donors->get_donors( array(
191
+		$donors = Give()->donors->get_donors(array(
192 192
 			'number' => $args['number']
193
-		) );
193
+		));
194 194
 
195 195
 		$options = array();
196 196
 
197
-		if ( $donors ) {
198
-			$options[0] = esc_html__( 'No donor attached', 'give' );
199
-			foreach ( $donors as $donor ) {
200
-				$options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
197
+		if ($donors) {
198
+			$options[0] = esc_html__('No donor attached', 'give');
199
+			foreach ($donors as $donor) {
200
+				$options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')');
201 201
 			}
202 202
 		} else {
203
-			$options[0] = esc_html__( 'No donors found.', 'give' );
203
+			$options[0] = esc_html__('No donors found.', 'give');
204 204
 		}
205 205
 
206
-		if ( ! empty( $args['selected'] ) ) {
206
+		if ( ! empty($args['selected'])) {
207 207
 
208 208
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
209
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
209
+			if ( ! array_key_exists($args['selected'], $options)) {
210 210
 
211
-				$donor = new Give_Donor( $args['selected'] );
211
+				$donor = new Give_Donor($args['selected']);
212 212
 
213
-				if ( $donor ) {
213
+				if ($donor) {
214 214
 
215
-					$options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
215
+					$options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')');
216 216
 
217 217
 				}
218 218
 			}
219 219
 		}
220 220
 
221
-		$output = $this->select( array(
221
+		$output = $this->select(array(
222 222
 			'name'             => $args['name'],
223 223
 			'selected'         => $args['selected'],
224 224
 			'id'               => $args['id'],
225
-			'class'            => $args['class'] . ' give-customer-select',
225
+			'class'            => $args['class'].' give-customer-select',
226 226
 			'options'          => $options,
227 227
 			'multiple'         => $args['multiple'],
228 228
 			'chosen'           => $args['chosen'],
229 229
 			'show_option_all'  => false,
230 230
 			'show_option_none' => false,
231 231
 			'data'             => $args['data'],
232
-		) );
232
+		));
233 233
 
234 234
 		return $output;
235 235
 	}
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return string           Categories dropdown.
250 250
 	 */
251
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
252
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
251
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
252
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
253 253
 		$options    = array();
254 254
 
255
-		foreach ( $categories as $category ) {
256
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
255
+		foreach ($categories as $category) {
256
+			$options[absint($category->term_id)] = esc_html($category->name);
257 257
 		}
258 258
 
259
-		$output = $this->select( wp_parse_args( $args, array(
259
+		$output = $this->select(wp_parse_args($args, array(
260 260
 			'name'             => $name,
261 261
 			'selected'         => $selected,
262 262
 			'options'          => $options,
263
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
263
+			'show_option_all'  => esc_html__('All Categories', 'give'),
264 264
 			'show_option_none' => false,
265
-		) ) );
265
+		)));
266 266
 
267 267
 		return $output;
268 268
 	}
@@ -281,21 +281,21 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return string           Tags dropdown.
283 283
 	 */
284
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
285
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
284
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
285
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
286 286
 		$options = array();
287 287
 
288
-		foreach ( $tags as $tag ) {
289
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
288
+		foreach ($tags as $tag) {
289
+			$options[absint($tag->term_id)] = esc_html($tag->name);
290 290
 		}
291 291
 
292
-		$output = $this->select( wp_parse_args( $args, array(
292
+		$output = $this->select(wp_parse_args($args, array(
293 293
 			'name'             => $name,
294 294
 			'selected'         => $selected,
295 295
 			'options'          => $options,
296
-			'show_option_all'  => esc_html__( 'All Tags', 'give' ),
296
+			'show_option_all'  => esc_html__('All Tags', 'give'),
297 297
 			'show_option_none' => false,
298
-		) ) );
298
+		)));
299 299
 
300 300
 		return $output;
301 301
 	}
@@ -315,25 +315,25 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return string               Years dropdown.
317 317
 	 */
318
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
319
-		$current    = date( 'Y' );
320
-		$start_year = $current - absint( $years_before );
321
-		$end_year   = $current + absint( $years_after );
322
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
318
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
319
+		$current    = date('Y');
320
+		$start_year = $current - absint($years_before);
321
+		$end_year   = $current + absint($years_after);
322
+		$selected   = empty($selected) ? date('Y') : $selected;
323 323
 		$options    = array();
324 324
 
325
-		while ( $start_year <= $end_year ) {
326
-			$options[ absint( $start_year ) ] = $start_year;
327
-			$start_year ++;
325
+		while ($start_year <= $end_year) {
326
+			$options[absint($start_year)] = $start_year;
327
+			$start_year++;
328 328
 		}
329 329
 
330
-		$output = $this->select( array(
330
+		$output = $this->select(array(
331 331
 			'name'             => $name,
332 332
 			'selected'         => $selected,
333 333
 			'options'          => $options,
334 334
 			'show_option_all'  => false,
335 335
 			'show_option_none' => false,
336
-		) );
336
+		));
337 337
 
338 338
 		return $output;
339 339
 	}
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return string           Months dropdown.
353 353
 	 */
354
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
354
+	public function month_dropdown($name = 'month', $selected = 0) {
355 355
 		$month    = 1;
356 356
 		$options  = array();
357
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
357
+		$selected = empty($selected) ? date('n') : $selected;
358 358
 
359
-		while ( $month <= 12 ) {
360
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
361
-			$month ++;
359
+		while ($month <= 12) {
360
+			$options[absint($month)] = give_month_num_to_name($month);
361
+			$month++;
362 362
 		}
363 363
 
364
-		$output = $this->select( array(
364
+		$output = $this->select(array(
365 365
 			'name'             => $name,
366 366
 			'selected'         => $selected,
367 367
 			'options'          => $options,
368 368
 			'show_option_all'  => false,
369 369
 			'show_option_none' => false,
370
-		) );
370
+		));
371 371
 
372 372
 		return $output;
373 373
 	}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 *
385 385
 	 * @return string      The dropdown.
386 386
 	 */
387
-	public function select( $args = array() ) {
387
+	public function select($args = array()) {
388 388
 		$defaults = array(
389 389
 			'options'          => array(),
390 390
 			'name'             => null,
@@ -395,67 +395,67 @@  discard block
 block discarded – undo
395 395
 			'placeholder'      => null,
396 396
 			'multiple'         => false,
397 397
 			'select_atts'      => false,
398
-			'show_option_all'  => __( 'All', 'give' ),
399
-			'show_option_none' => __( 'None', 'give' ),
398
+			'show_option_all'  => __('All', 'give'),
399
+			'show_option_none' => __('None', 'give'),
400 400
 			'data'             => array(),
401 401
 			'readonly'         => false,
402 402
 			'disabled'         => false,
403 403
 		);
404 404
 
405
-		$args = wp_parse_args( $args, $defaults );
405
+		$args = wp_parse_args($args, $defaults);
406 406
 
407 407
 		$data_elements = '';
408
-		foreach ( $args['data'] as $key => $value ) {
409
-			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
408
+		foreach ($args['data'] as $key => $value) {
409
+			$data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"';
410 410
 		}
411 411
 
412
-		if ( $args['multiple'] ) {
412
+		if ($args['multiple']) {
413 413
 			$multiple = ' MULTIPLE';
414 414
 		} else {
415 415
 			$multiple = '';
416 416
 		}
417 417
 
418
-		if ( $args['chosen'] ) {
418
+		if ($args['chosen']) {
419 419
 			$args['class'] .= ' give-select-chosen';
420 420
 		}
421 421
 
422
-		if ( $args['placeholder'] ) {
422
+		if ($args['placeholder']) {
423 423
 			$placeholder = $args['placeholder'];
424 424
 		} else {
425 425
 			$placeholder = '';
426 426
 		}
427 427
 
428
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
428
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>';
429 429
 
430
-		if ( $args['show_option_all'] ) {
431
-			if ( $args['multiple'] ) {
432
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
430
+		if ($args['show_option_all']) {
431
+			if ($args['multiple']) {
432
+				$selected = selected(true, in_array(0, $args['selected']), false);
433 433
 			} else {
434
-				$selected = selected( $args['selected'], 0, false );
434
+				$selected = selected($args['selected'], 0, false);
435 435
 			}
436
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
436
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
437 437
 		}
438 438
 
439
-		if ( ! empty( $args['options'] ) ) {
439
+		if ( ! empty($args['options'])) {
440 440
 
441
-			if ( $args['show_option_none'] ) {
442
-				if ( $args['multiple'] ) {
443
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
441
+			if ($args['show_option_none']) {
442
+				if ($args['multiple']) {
443
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
444 444
 				} else {
445
-					$selected = selected( $args['selected'], - 1, false );
445
+					$selected = selected($args['selected'], - 1, false);
446 446
 				}
447
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
447
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
448 448
 			}
449 449
 
450
-			foreach ( $args['options'] as $key => $option ) {
450
+			foreach ($args['options'] as $key => $option) {
451 451
 
452
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
453
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
452
+				if ($args['multiple'] && is_array($args['selected'])) {
453
+					$selected = selected(true, in_array($key, $args['selected']), false);
454 454
 				} else {
455
-					$selected = selected( $args['selected'], $key, false );
455
+					$selected = selected($args['selected'], $key, false);
456 456
 				}
457 457
 
458
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
458
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
459 459
 			}
460 460
 		}
461 461
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return string      The checkbox.
478 478
 	 */
479
-	public function checkbox( $args = array() ) {
479
+	public function checkbox($args = array()) {
480 480
 		$defaults = array(
481 481
 			'name'    => null,
482 482
 			'current' => null,
@@ -487,16 +487,16 @@  discard block
 block discarded – undo
487 487
 			),
488 488
 		);
489 489
 
490
-		$args = wp_parse_args( $args, $defaults );
490
+		$args = wp_parse_args($args, $defaults);
491 491
 
492 492
 		$options = '';
493
-		if ( ! empty( $args['options']['disabled'] ) ) {
493
+		if ( ! empty($args['options']['disabled'])) {
494 494
 			$options .= ' disabled="disabled"';
495
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
495
+		} elseif ( ! empty($args['options']['readonly'])) {
496 496
 			$options .= ' readonly';
497 497
 		}
498 498
 
499
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
499
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
500 500
 
501 501
 		return $output;
502 502
 	}
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 	 *
514 514
 	 * @return string      The text field.
515 515
 	 */
516
-	public function text( $args = array() ) {
516
+	public function text($args = array()) {
517 517
 		// Backwards compatibility.
518
-		if ( func_num_args() > 1 ) {
518
+		if (func_num_args() > 1) {
519 519
 			$args = func_get_args();
520 520
 
521 521
 			$name  = $args[0];
522
-			$value = isset( $args[1] ) ? $args[1] : '';
523
-			$label = isset( $args[2] ) ? $args[2] : '';
524
-			$desc  = isset( $args[3] ) ? $args[3] : '';
522
+			$value = isset($args[1]) ? $args[1] : '';
523
+			$label = isset($args[2]) ? $args[2] : '';
524
+			$desc  = isset($args[3]) ? $args[3] : '';
525 525
 		}
526 526
 
527 527
 		$defaults = array(
528
-			'name'         => isset( $name ) ? $name : 'text',
529
-			'value'        => isset( $value ) ? $value : null,
530
-			'label'        => isset( $label ) ? $label : null,
531
-			'desc'         => isset( $desc ) ? $desc : null,
528
+			'name'         => isset($name) ? $name : 'text',
529
+			'value'        => isset($value) ? $value : null,
530
+			'label'        => isset($label) ? $label : null,
531
+			'desc'         => isset($desc) ? $desc : null,
532 532
 			'placeholder'  => '',
533 533
 			'class'        => 'regular-text',
534 534
 			'disabled'     => false,
@@ -536,29 +536,29 @@  discard block
 block discarded – undo
536 536
 			'data'         => false,
537 537
 		);
538 538
 
539
-		$args = wp_parse_args( $args, $defaults );
539
+		$args = wp_parse_args($args, $defaults);
540 540
 
541 541
 		$disabled = '';
542
-		if ( $args['disabled'] ) {
542
+		if ($args['disabled']) {
543 543
 			$disabled = ' disabled="disabled"';
544 544
 		}
545 545
 
546 546
 		$data = '';
547
-		if ( ! empty( $args['data'] ) ) {
548
-			foreach ( $args['data'] as $key => $value ) {
549
-				$data .= 'data-' . $key . '="' . $value . '" ';
547
+		if ( ! empty($args['data'])) {
548
+			foreach ($args['data'] as $key => $value) {
549
+				$data .= 'data-'.$key.'="'.$value.'" ';
550 550
 			}
551 551
 		}
552 552
 
553
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
553
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
554 554
 
555
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
555
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
556 556
 
557
-		if ( ! empty( $args['desc'] ) ) {
558
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
557
+		if ( ! empty($args['desc'])) {
558
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
559 559
 		}
560 560
 
561
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
561
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
562 562
 
563 563
 		$output .= '</span>';
564 564
 
@@ -577,15 +577,15 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @return string      The date picker.
579 579
 	 */
580
-	public function date_field( $args = array() ) {
580
+	public function date_field($args = array()) {
581 581
 
582
-		if ( empty( $args['class'] ) ) {
582
+		if (empty($args['class'])) {
583 583
 			$args['class'] = 'give_datepicker';
584
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
584
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
585 585
 			$args['class'] .= ' give_datepicker';
586 586
 		}
587 587
 
588
-		return $this->text( $args );
588
+		return $this->text($args);
589 589
 	}
590 590
 
591 591
 	/**
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 *
601 601
 	 * @return string      The textarea.
602 602
 	 */
603
-	public function textarea( $args = array() ) {
603
+	public function textarea($args = array()) {
604 604
 		$defaults = array(
605 605
 			'name'     => 'textarea',
606 606
 			'value'    => null,
@@ -610,21 +610,21 @@  discard block
 block discarded – undo
610 610
 			'disabled' => false,
611 611
 		);
612 612
 
613
-		$args = wp_parse_args( $args, $defaults );
613
+		$args = wp_parse_args($args, $defaults);
614 614
 
615 615
 		$disabled = '';
616
-		if ( $args['disabled'] ) {
616
+		if ($args['disabled']) {
617 617
 			$disabled = ' disabled="disabled"';
618 618
 		}
619 619
 
620
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
620
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
621 621
 
622
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
622
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
623 623
 
624
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
624
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
625 625
 
626
-		if ( ! empty( $args['desc'] ) ) {
627
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
626
+		if ( ! empty($args['desc'])) {
627
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
628 628
 		}
629 629
 
630 630
 		$output .= '</span>';
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	 *
645 645
 	 * @return string      The text field with ajax search.
646 646
 	 */
647
-	public function ajax_user_search( $args = array() ) {
647
+	public function ajax_user_search($args = array()) {
648 648
 
649 649
 		$defaults = array(
650 650
 			'name'        => 'users',
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 			'chosen'      => true,
656 656
 			'number'      => 30,
657 657
 			'select_atts' => '',
658
-			'placeholder' => __( 'Select a user', 'give' ),
658
+			'placeholder' => __('Select a user', 'give'),
659 659
 			'data'        => array(
660 660
 				'search-type' => 'user',
661 661
 			),
662 662
 		);
663 663
 
664
-		$args = wp_parse_args( $args, $defaults );
664
+		$args = wp_parse_args($args, $defaults);
665 665
 
666 666
 		// Set initial args.
667 667
 		$get_users_args = array(
@@ -670,31 +670,31 @@  discard block
 block discarded – undo
670 670
 
671 671
 		// Ensure selected user is not included in initial query.
672 672
 		// This is because sites with many users, it's not a guarantee the selected user will be returned.
673
-		if ( ! empty( $args['selected'] ) ) {
673
+		if ( ! empty($args['selected'])) {
674 674
 			$get_users_args['exclude'] = $args['selected'];
675 675
 		}
676 676
 
677 677
 		// Initial users array.
678
-		$users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args );
678
+		$users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args);
679 679
 
680 680
 		// Now add the selected user to the $users array if the arg is present.
681
-		if ( ! empty( $args['selected'] ) ) {
682
-			$selected_user =  apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );;
683
-			$users         = array_merge( $users, $selected_user );
681
+		if ( ! empty($args['selected'])) {
682
+			$selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ;
683
+			$users         = array_merge($users, $selected_user);
684 684
 		}
685 685
 
686 686
 		$options = array();
687 687
 
688
-		if ( $users ) {
688
+		if ($users) {
689 689
 			$options[0] = $args['placeholder'];
690
-			foreach ( $users as $user ) {
691
-				$options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' );
690
+			foreach ($users as $user) {
691
+				$options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')');
692 692
 			}
693 693
 		} else {
694
-			$options[0] = __( 'No users found.', 'give' );
694
+			$options[0] = __('No users found.', 'give');
695 695
 		}
696 696
 
697
-		$output = $this->select( array(
697
+		$output = $this->select(array(
698 698
 			'name'             => $args['name'],
699 699
 			'selected'         => $args['selected'],
700 700
 			'id'               => $args['id'],
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			'show_option_all'  => false,
708 708
 			'show_option_none' => false,
709 709
 			'data'             => $args['data'],
710
-		) );
710
+		));
711 711
 
712 712
 		return $output;
713 713
 
Please login to merge, or discard this patch.