Test Failed
Push — master ( f098b0...602e9b )
by Devin
10:54 queued 05:19
created
includes/forms/functions.php 2 patches
Spacing   +214 added lines, -215 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -372,12 +371,12 @@  discard block
 block discarded – undo
372 371
  *
373 372
  * @return void
374 373
  */
375
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
374
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
376 375
 	$log_data = array(
377 376
 		'log_parent'   => $payment_id,
378 377
 		'log_type'     => 'sale',
379
-		'log_date'     => isset( $donation_date ) ? $donation_date : null,
380
-		'log_date_gmt' => isset( $donation_date ) ? $donation_date : null,
378
+		'log_date'     => isset($donation_date) ? $donation_date : null,
379
+		'log_date_gmt' => isset($donation_date) ? $donation_date : null,
381 380
 	);
382 381
 
383 382
 	$log_meta = array(
@@ -385,7 +384,7 @@  discard block
 block discarded – undo
385 384
 		'price_id' => (int) $price_id,
386 385
 	);
387 386
 
388
-	Give()->logs->insert_log( $log_data, $log_meta );
387
+	Give()->logs->insert_log($log_data, $log_meta);
389 388
 }
390 389
 
391 390
 
@@ -399,11 +398,11 @@  discard block
 block discarded – undo
399 398
  *
400 399
  * @return bool|int
401 400
  */
402
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
401
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
403 402
 	$quantity = (int) $quantity;
404
-	$form     = new Give_Donate_Form( $form_id );
403
+	$form     = new Give_Donate_Form($form_id);
405 404
 
406
-	return $form->increase_sales( $quantity );
405
+	return $form->increase_sales($quantity);
407 406
 }
408 407
 
409 408
 /**
@@ -416,11 +415,11 @@  discard block
 block discarded – undo
416 415
  *
417 416
  * @return bool|int
418 417
  */
419
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
418
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
420 419
 	$quantity = (int) $quantity;
421
-	$form     = new Give_Donate_Form( $form_id );
420
+	$form     = new Give_Donate_Form($form_id);
422 421
 
423
-	return $form->decrease_sales( $quantity );
422
+	return $form->decrease_sales($quantity);
424 423
 }
425 424
 
426 425
 /**
@@ -433,10 +432,10 @@  discard block
 block discarded – undo
433 432
  *
434 433
  * @return bool|int
435 434
  */
436
-function give_increase_earnings( $give_form_id = 0, $amount ) {
437
-	$form = new Give_Donate_Form( $give_form_id );
435
+function give_increase_earnings($give_form_id = 0, $amount) {
436
+	$form = new Give_Donate_Form($give_form_id);
438 437
 
439
-	return $form->increase_earnings( $amount );
438
+	return $form->increase_earnings($amount);
440 439
 }
441 440
 
442 441
 /**
@@ -451,11 +450,11 @@  discard block
 block discarded – undo
451 450
  *
452 451
  * @return bool|int
453 452
  */
454
-function give_decrease_form_earnings( $form_id = 0, $amount ) {
453
+function give_decrease_form_earnings($form_id = 0, $amount) {
455 454
 
456
-	$form = new Give_Donate_Form( $form_id );
455
+	$form = new Give_Donate_Form($form_id);
457 456
 
458
-	return $form->decrease_earnings( $amount );
457
+	return $form->decrease_earnings($amount);
459 458
 }
460 459
 
461 460
 
@@ -468,15 +467,15 @@  discard block
 block discarded – undo
468 467
  *
469 468
  * @return int $earnings Earnings for a certain form
470 469
  */
471
-function give_get_form_earnings_stats( $form_id = 0 ) {
472
-	$give_form = new Give_Donate_Form( $form_id );
470
+function give_get_form_earnings_stats($form_id = 0) {
471
+	$give_form = new Give_Donate_Form($form_id);
473 472
 
474 473
 	/**
475 474
 	 * Filter the form earnings
476 475
 	 *
477 476
 	 * @since 1.8.17
478 477
 	 */
479
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
478
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
480 479
 }
481 480
 
482 481
 
@@ -489,8 +488,8 @@  discard block
 block discarded – undo
489 488
  *
490 489
  * @return int $sales Amount of sales for a certain form
491 490
  */
492
-function give_get_form_sales_stats( $give_form_id = 0 ) {
493
-	$give_form = new Give_Donate_Form( $give_form_id );
491
+function give_get_form_sales_stats($give_form_id = 0) {
492
+	$give_form = new Give_Donate_Form($give_form_id);
494 493
 
495 494
 	return $give_form->sales;
496 495
 }
@@ -505,16 +504,16 @@  discard block
 block discarded – undo
505 504
  *
506 505
  * @return float $sales Average monthly sales
507 506
  */
508
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
509
-	$sales        = give_get_form_sales_stats( $form_id );
510
-	$release_date = get_post_field( 'post_date', $form_id );
507
+function give_get_average_monthly_form_sales($form_id = 0) {
508
+	$sales        = give_get_form_sales_stats($form_id);
509
+	$release_date = get_post_field('post_date', $form_id);
511 510
 
512
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
511
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
513 512
 
514
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
513
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
515 514
 
516
-	if ( $months > 0 ) {
517
-		$sales = ( $sales / $months );
515
+	if ($months > 0) {
516
+		$sales = ($sales / $months);
518 517
 	}
519 518
 
520 519
 	return $sales;
@@ -530,16 +529,16 @@  discard block
 block discarded – undo
530 529
  *
531 530
  * @return float $earnings Average monthly earnings
532 531
  */
533
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
534
-	$earnings     = give_get_form_earnings_stats( $form_id );
535
-	$release_date = get_post_field( 'post_date', $form_id );
532
+function give_get_average_monthly_form_earnings($form_id = 0) {
533
+	$earnings     = give_get_form_earnings_stats($form_id);
534
+	$release_date = get_post_field('post_date', $form_id);
536 535
 
537
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
536
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
538 537
 
539
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
538
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
540 539
 
541
-	if ( $months > 0 ) {
542
-		$earnings = ( $earnings / $months );
540
+	if ($months > 0) {
541
+		$earnings = ($earnings / $months);
543 542
 	}
544 543
 
545 544
 	return $earnings < 0 ? 0 : $earnings;
@@ -560,34 +559,34 @@  discard block
 block discarded – undo
560 559
  *
561 560
  * @return string $price_name Name of the price option
562 561
  */
563
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
562
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
564 563
 
565
-	$prices     = give_get_variable_prices( $form_id );
564
+	$prices     = give_get_variable_prices($form_id);
566 565
 	$price_name = '';
567 566
 
568
-	if ( false === $prices ) {
567
+	if (false === $prices) {
569 568
 		return $price_name;
570 569
 	}
571 570
 
572
-	foreach ( $prices as $price ) {
571
+	foreach ($prices as $price) {
573 572
 
574
-		if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) {
573
+		if (intval($price['_give_id']['level_id']) === intval($price_id)) {
575 574
 
576
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
575
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
577 576
 			$price_fallback = $use_fallback ?
578 577
 				give_currency_filter(
579 578
 					give_format_amount(
580 579
 						$price['_give_amount'],
581
-						array( 'sanitize' => false )
580
+						array('sanitize' => false)
582 581
 					),
583
-					array( 'decode_currency' => true )
582
+					array('decode_currency' => true)
584 583
 				) : '';
585
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
584
+			$price_name = ! empty($price_text) ? $price_text : $price_fallback;
586 585
 
587 586
 		}
588 587
 	}
589 588
 
590
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
589
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
591 590
 }
592 591
 
593 592
 
@@ -601,25 +600,25 @@  discard block
 block discarded – undo
601 600
  *
602 601
  * @return string $range A fully formatted price range
603 602
  */
604
-function give_price_range( $form_id = 0, $formatted = true ) {
605
-	$low        = give_get_lowest_price_option( $form_id );
606
-	$high       = give_get_highest_price_option( $form_id );
607
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
603
+function give_price_range($form_id = 0, $formatted = true) {
604
+	$low        = give_get_lowest_price_option($form_id);
605
+	$high       = give_get_highest_price_option($form_id);
606
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
608 607
 
609 608
 	$range = sprintf(
610 609
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
611 610
 		'asc' === $order_type ? 'low' : 'high',
612
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
611
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
613 612
 		'asc' === $order_type ? 'high' : 'low',
614
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
613
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
615 614
 
616 615
 	);
617 616
 
618
-	if ( ! $formatted ) {
619
-		$range = wp_strip_all_tags( $range );
617
+	if ( ! $formatted) {
618
+		$range = wp_strip_all_tags($range);
620 619
 	}
621 620
 
622
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
621
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
623 622
 }
624 623
 
625 624
 
@@ -634,35 +633,35 @@  discard block
 block discarded – undo
634 633
  *
635 634
  * @return int ID of the lowest price
636 635
  */
637
-function give_get_lowest_price_id( $form_id = 0 ) {
636
+function give_get_lowest_price_id($form_id = 0) {
638 637
 
639
-	if ( empty( $form_id ) ) {
638
+	if (empty($form_id)) {
640 639
 		$form_id = get_the_ID();
641 640
 	}
642 641
 
643
-	if ( ! give_has_variable_prices( $form_id ) ) {
644
-		return give_get_form_price( $form_id );
642
+	if ( ! give_has_variable_prices($form_id)) {
643
+		return give_get_form_price($form_id);
645 644
 	}
646 645
 
647
-	$prices = give_get_variable_prices( $form_id );
646
+	$prices = give_get_variable_prices($form_id);
648 647
 
649 648
 	$min = $min_id = 0;
650 649
 
651
-	if ( ! empty( $prices ) ) {
650
+	if ( ! empty($prices)) {
652 651
 
653
-		foreach ( $prices as $key => $price ) {
652
+		foreach ($prices as $key => $price) {
654 653
 
655
-			if ( empty( $price['_give_amount'] ) ) {
654
+			if (empty($price['_give_amount'])) {
656 655
 				continue;
657 656
 			}
658 657
 
659
-			if ( ! isset( $min ) ) {
658
+			if ( ! isset($min)) {
660 659
 				$min = $price['_give_amount'];
661 660
 			} else {
662
-				$min = min( $min, $price['_give_amount'] );
661
+				$min = min($min, $price['_give_amount']);
663 662
 			}
664 663
 
665
-			if ( $price['_give_amount'] == $min ) {
664
+			if ($price['_give_amount'] == $min) {
666 665
 				$min_id = $price['_give_id']['level_id'];
667 666
 			}
668 667
 		}
@@ -680,22 +679,22 @@  discard block
 block discarded – undo
680 679
  *
681 680
  * @return float Amount of the lowest price
682 681
  */
683
-function give_get_lowest_price_option( $form_id = 0 ) {
684
-	if ( empty( $form_id ) ) {
682
+function give_get_lowest_price_option($form_id = 0) {
683
+	if (empty($form_id)) {
685 684
 		$form_id = get_the_ID();
686 685
 	}
687 686
 
688
-	if ( ! give_has_variable_prices( $form_id ) ) {
689
-		return give_get_form_price( $form_id );
687
+	if ( ! give_has_variable_prices($form_id)) {
688
+		return give_get_form_price($form_id);
690 689
 	}
691 690
 
692
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
691
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
693 692
 		// Backward compatibility.
694
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
695
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
693
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
694
+		$low    = ! empty($prices) ? min($prices) : 0;
696 695
 	}
697 696
 
698
-	return give_maybe_sanitize_amount( $low );
697
+	return give_maybe_sanitize_amount($low);
699 698
 }
700 699
 
701 700
 /**
@@ -707,23 +706,23 @@  discard block
 block discarded – undo
707 706
  *
708 707
  * @return float Amount of the highest price
709 708
  */
710
-function give_get_highest_price_option( $form_id = 0 ) {
709
+function give_get_highest_price_option($form_id = 0) {
711 710
 
712
-	if ( empty( $form_id ) ) {
711
+	if (empty($form_id)) {
713 712
 		$form_id = get_the_ID();
714 713
 	}
715 714
 
716
-	if ( ! give_has_variable_prices( $form_id ) ) {
717
-		return give_get_form_price( $form_id );
715
+	if ( ! give_has_variable_prices($form_id)) {
716
+		return give_get_form_price($form_id);
718 717
 	}
719 718
 
720
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
719
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
721 720
 		// Backward compatibility.
722
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
723
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
721
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
722
+		$high   = ! empty($prices) ? max($prices) : 0;
724 723
 	}
725 724
 
726
-	return give_maybe_sanitize_amount( $high );
725
+	return give_maybe_sanitize_amount($high);
727 726
 }
728 727
 
729 728
 /**
@@ -735,15 +734,15 @@  discard block
 block discarded – undo
735 734
  *
736 735
  * @return mixed string|int Price of the form
737 736
  */
738
-function give_get_form_price( $form_id = 0 ) {
737
+function give_get_form_price($form_id = 0) {
739 738
 
740
-	if ( empty( $form_id ) ) {
739
+	if (empty($form_id)) {
741 740
 		return false;
742 741
 	}
743 742
 
744
-	$form = new Give_Donate_Form( $form_id );
743
+	$form = new Give_Donate_Form($form_id);
745 744
 
746
-	return $form->__get( 'price' );
745
+	return $form->__get('price');
747 746
 }
748 747
 
749 748
 /**
@@ -755,13 +754,13 @@  discard block
 block discarded – undo
755 754
  *
756 755
  * @return mixed string|int Minimum price of the form
757 756
  */
758
-function give_get_form_minimum_price( $form_id = 0 ) {
757
+function give_get_form_minimum_price($form_id = 0) {
759 758
 
760
-	if ( empty( $form_id ) ) {
759
+	if (empty($form_id)) {
761 760
 		return false;
762 761
 	}
763 762
 
764
-	$form = new Give_Donate_Form( $form_id );
763
+	$form = new Give_Donate_Form($form_id);
765 764
 
766 765
 	return $form->get_minimum_price();
767 766
 
@@ -778,48 +777,48 @@  discard block
 block discarded – undo
778 777
  *
779 778
  * @return int $formatted_price
780 779
  */
781
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
780
+function give_price($form_id = 0, $echo = true, $price_id = false) {
782 781
 	$price = 0;
783 782
 
784
-	if ( empty( $form_id ) ) {
783
+	if (empty($form_id)) {
785 784
 		$form_id = get_the_ID();
786 785
 	}
787 786
 
788
-	if ( give_has_variable_prices( $form_id ) ) {
787
+	if (give_has_variable_prices($form_id)) {
789 788
 
790
-		$prices = give_get_variable_prices( $form_id );
789
+		$prices = give_get_variable_prices($form_id);
791 790
 
792
-		if ( false !== $price_id ) {
791
+		if (false !== $price_id) {
793 792
 
794 793
 			// loop through multi-prices to see which is default
795
-			foreach ( $prices as $price ) {
794
+			foreach ($prices as $price) {
796 795
 				// this is the default price
797
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
796
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
798 797
 					$price = (float) $price['_give_amount'];
799 798
 				};
800 799
 			}
801 800
 		} else {
802 801
 
803
-			$price = give_get_lowest_price_option( $form_id );
802
+			$price = give_get_lowest_price_option($form_id);
804 803
 		}
805 804
 	} else {
806 805
 
807
-		$price = give_get_form_price( $form_id );
806
+		$price = give_get_form_price($form_id);
808 807
 	}
809 808
 
810
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
811
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
812
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
809
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
810
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
811
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
813 812
 
814
-	if ( $echo ) {
813
+	if ($echo) {
815 814
 		echo $formatted_price;
816 815
 	} else {
817 816
 		return $formatted_price;
818 817
 	}
819 818
 }
820 819
 
821
-add_filter( 'give_form_price', 'give_format_amount', 10 );
822
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
820
+add_filter('give_form_price', 'give_format_amount', 10);
821
+add_filter('give_form_price', 'give_currency_filter', 20);
823 822
 
824 823
 
825 824
 /**
@@ -832,19 +831,19 @@  discard block
 block discarded – undo
832 831
  *
833 832
  * @return float $amount Amount of the price option
834 833
  */
835
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
836
-	$prices = give_get_variable_prices( $form_id );
834
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
835
+	$prices = give_get_variable_prices($form_id);
837 836
 
838 837
 	$amount = 0.00;
839 838
 
840
-	foreach ( $prices as $price ) {
841
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
842
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
839
+	foreach ($prices as $price) {
840
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
841
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
843 842
 			break;
844 843
 		};
845 844
 	}
846 845
 
847
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
846
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
848 847
 }
849 848
 
850 849
 /**
@@ -856,13 +855,13 @@  discard block
 block discarded – undo
856 855
  *
857 856
  * @return mixed string|int Goal of the form
858 857
  */
859
-function give_get_form_goal( $form_id = 0 ) {
858
+function give_get_form_goal($form_id = 0) {
860 859
 
861
-	if ( empty( $form_id ) ) {
860
+	if (empty($form_id)) {
862 861
 		return false;
863 862
 	}
864 863
 
865
-	$form = new Give_Donate_Form( $form_id );
864
+	$form = new Give_Donate_Form($form_id);
866 865
 
867 866
 	return $form->goal;
868 867
 
@@ -877,13 +876,13 @@  discard block
 block discarded – undo
877 876
  *
878 877
  * @return mixed string|int Goal of the form
879 878
  */
880
-function give_get_form_goal_format( $form_id = 0 ) {
879
+function give_get_form_goal_format($form_id = 0) {
881 880
 
882
-	if ( empty( $form_id ) ) {
881
+	if (empty($form_id)) {
883 882
 		return false;
884 883
 	}
885 884
 
886
-	return give_get_meta( $form_id, '_give_goal_format', true );
885
+	return give_get_meta($form_id, '_give_goal_format', true);
887 886
 
888 887
 }
889 888
 
@@ -897,19 +896,19 @@  discard block
 block discarded – undo
897 896
  *
898 897
  * @return string $formatted_goal
899 898
  */
900
-function give_goal( $form_id = 0, $echo = true ) {
899
+function give_goal($form_id = 0, $echo = true) {
901 900
 
902
-	if ( empty( $form_id ) ) {
901
+	if (empty($form_id)) {
903 902
 		$form_id = get_the_ID();
904 903
 	}
905 904
 
906
-	$goal        = give_get_form_goal( $form_id );
905
+	$goal        = give_get_form_goal($form_id);
907 906
 	$goal_format = give_get_form_goal_format($form_id);
908 907
 
909
-	if ( 'donation' === $goal_format ) {
908
+	if ('donation' === $goal_format) {
910 909
 		$goal = "{$goal} donations";
911 910
 	} else {
912
-		$goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
911
+		$goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
913 912
 	}
914 913
 
915 914
 	$formatted_goal = sprintf(
@@ -917,17 +916,17 @@  discard block
 block discarded – undo
917 916
 		$form_id,
918 917
 		$goal
919 918
 	);
920
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
919
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
921 920
 
922
-	if ( $echo ) {
921
+	if ($echo) {
923 922
 		echo $formatted_goal;
924 923
 	} else {
925 924
 		return $formatted_goal;
926 925
 	}
927 926
 }
928 927
 
929
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
930
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
928
+add_filter('give_form_goal', 'give_format_amount', 10);
929
+add_filter('give_form_goal', 'give_currency_filter', 20);
931 930
 
932 931
 
933 932
 /**
@@ -939,15 +938,15 @@  discard block
 block discarded – undo
939 938
  *
940 939
  * @return bool  $ret Whether or not the logged_in_only setting is set
941 940
  */
942
-function give_logged_in_only( $form_id ) {
941
+function give_logged_in_only($form_id) {
943 942
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
944 943
 	// Otherwise it is member only donation form.
945
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
946
-	$val = ! empty( $val ) ? $val : 'enabled';
944
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
945
+	$val = ! empty($val) ? $val : 'enabled';
947 946
 
948
-	$ret = ! give_is_setting_enabled( $val );
947
+	$ret = ! give_is_setting_enabled($val);
949 948
 
950
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
949
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
951 950
 }
952 951
 
953 952
 
@@ -960,11 +959,11 @@  discard block
 block discarded – undo
960 959
  *
961 960
  * @return string
962 961
  */
963
-function give_show_login_register_option( $form_id ) {
962
+function give_show_login_register_option($form_id) {
964 963
 
965
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
964
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
966 965
 
967
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
966
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
968 967
 
969 968
 }
970 969
 
@@ -980,12 +979,12 @@  discard block
 block discarded – undo
980 979
  *
981 980
  * @return array
982 981
  */
983
-function _give_get_prefill_form_field_values( $form_id ) {
982
+function _give_get_prefill_form_field_values($form_id) {
984 983
 	$logged_in_donor_info = array();
985 984
 
986
-	if ( is_user_logged_in() ) :
987
-		$donor_data    = get_userdata( get_current_user_id() );
988
-		$donor_address = give_get_donor_address( get_current_user_id() );
985
+	if (is_user_logged_in()) :
986
+		$donor_data    = get_userdata(get_current_user_id());
987
+		$donor_address = give_get_donor_address(get_current_user_id());
989 988
 
990 989
 		$logged_in_donor_info = array(
991 990
 			// First name.
@@ -1019,21 +1018,21 @@  discard block
 block discarded – undo
1019 1018
 
1020 1019
 	// Bailout: Auto fill form field values only form form which donor is donating.
1021 1020
 	if (
1022
-		empty( $_GET['form-id'] )
1021
+		empty($_GET['form-id'])
1023 1022
 		|| ! $form_id
1024
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
1023
+		|| ($form_id !== absint($_GET['form-id']))
1025 1024
 	) {
1026 1025
 		return $logged_in_donor_info;
1027 1026
 	}
1028 1027
 
1029 1028
 	// Get purchase data.
1030
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
1029
+	$give_purchase_data = Give()->session->get('give_purchase');
1031 1030
 
1032 1031
 	// Get donor info from form data.
1033
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
1032
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1034 1033
 		? array()
1035 1034
 		: $give_purchase_data['post_data'];
1036 1035
 
1037 1036
 	// Output.
1038
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1037
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1039 1038
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array|string $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @since  1.0
302 302
  * @since  1.8.16 Add security check
303 303
  *
304
- * @return bool
304
+ * @return false|null
305 305
  */
306 306
 function give_listen_for_failed_payments() {
307 307
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
  *
754 754
  * @param int $form_id ID number of the form to retrieve the minimum price for
755 755
  *
756
- * @return mixed string|int Minimum price of the form
756
+ * @return string string|int Minimum price of the form
757 757
  */
758 758
 function give_get_form_minimum_price( $form_id = 0 ) {
759 759
 
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @since 1.0
21 21
  */
22
-class Give_Forms_Widget extends WP_Widget{
22
+class Give_Forms_Widget extends WP_Widget {
23 23
 	/**
24 24
 	 * The widget class name
25 25
 	 *
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * Instantiate the class
32 32
 	 */
33
-	public function __construct(){
34
-		$this->self = get_class( $this );
33
+	public function __construct() {
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			esc_html__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			esc_html__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook ){
55
+	public function admin_widget_scripts($hook) {
56 56
 		// Directories of assets
57
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
58
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
59
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
57
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
58
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
59
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
60 60
 
61 61
 		// Use minified libraries if SCRIPT_DEBUG is turned off
62
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
62
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
63 63
 
64 64
 		// Widget Script
65
-		if ( $hook == 'widgets.php' ) {
65
+		if ($hook == 'widgets.php') {
66 66
 
67
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
67
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
68 68
 		}
69 69
 	}
70 70
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 *                        before_widget, and after_widget.
76 76
 	 * @param array $instance The settings for the particular instance of the widget.
77 77
 	 */
78
-	public function widget( $args, $instance ){
79
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
80
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
78
+	public function widget($args, $instance) {
79
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
80
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
81 81
 
82 82
 		echo $args['before_widget'];
83 83
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_before_forms_widget' );
89
+		do_action('give_before_forms_widget');
90 90
 
91
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
91
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
92 92
 
93
-		give_get_donation_form( $instance );
93
+		give_get_donation_form($instance);
94 94
 
95 95
 		echo $args['after_widget'];
96 96
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @since 1.0
101 101
 		 */
102
-		do_action( 'give_after_forms_widget' );
102
+		do_action('give_after_forms_widget');
103 103
 	}
104 104
 
105 105
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string
111 111
 	 */
112
-	public function form( $instance ){
112
+	public function form($instance) {
113 113
 		$defaults = array(
114 114
 			'title'         => '',
115 115
 			'id'            => '',
@@ -119,84 +119,84 @@  discard block
 block discarded – undo
119 119
 			'continue_button_title' => '',
120 120
 		);
121 121
 
122
-		$instance = wp_parse_args( (array) $instance, $defaults );
122
+		$instance = wp_parse_args((array) $instance, $defaults);
123 123
 
124 124
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
125
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
125
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
126 126
 
127 127
 		// Query Give Forms
128 128
 		$args = array(
129 129
 			'post_type'      => 'give_forms',
130
-			'posts_per_page' => - 1,
130
+			'posts_per_page' => -1,
131 131
 			'post_status'    => 'publish',
132 132
 		);
133 133
 
134
-		$give_forms = get_posts( $args );
134
+		$give_forms = get_posts($args);
135 135
 		?>
136 136
 		<div class="give_forms_widget_container">
137 137
 
138 138
 			<?php // Widget: widget Title. ?>
139 139
 			<p>
140
-				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
141
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
142
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
140
+				<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
141
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
142
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
143 143
 			</p>
144 144
 
145 145
 			<?php // Widget: Give Form?>
146 146
 			<p>
147
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
148
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
149
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
150
-					<?php foreach ( $give_forms as $give_form ) { ?>
151
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
152
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option>
147
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
148
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
149
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
150
+					<?php foreach ($give_forms as $give_form) { ?>
151
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
152
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option>
153 153
 					<?php } ?>
154 154
 				</select><br>
155
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
155
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
156 156
 			</p>
157 157
 
158 158
 			<?php // Widget: Display Style ?>
159 159
 			<p class="give_forms_display_style_setting_row">
160
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
161
-				<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
162
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
163
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
164
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
160
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
161
+				<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
162
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
163
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
164
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
165 165
 				<small class="give-field-description">
166
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
166
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
167 167
 				</small>
168 168
 			</p>
169 169
 
170 170
 			<?php // Widget: Continue Button Title. ?>
171 171
 			<p class="give_forms_continue_button_title_setting_row">
172
-				<label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
173
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br>
174
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
172
+				<label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
173
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br>
174
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
175 175
 			</p>
176 176
 
177 177
 			<?php // Widget: Floating Labels ?>
178 178
 			<p>
179
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
180
-				<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
181
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
182
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
179
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
180
+				<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
181
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
182
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
183 183
 				<small class="give-field-description">
184 184
 					<?php
185 185
 					printf(
186 186
 					/* translators: %s: http://docs.givewp.com/form-floating-labels */
187
-						__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
188
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
187
+						__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
188
+						esc_url('http://docs.givewp.com/form-floating-labels')
189 189
 					);
190 190
 					?></small>
191 191
 			</p>
192 192
 
193 193
 			<?php // Widget: Display Content ?>
194 194
 			<p>
195
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
196
-				<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
197
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
198
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
199
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
195
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
196
+				<label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
197
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
198
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
199
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
200 200
 		</div>
201 201
 		<?php
202 202
 	}
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return void
208 208
 	 */
209
-	function widget_init(){
210
-		register_widget( $this->self );
209
+	function widget_init() {
210
+		register_widget($this->self);
211 211
 	}
212 212
 
213 213
 	/**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return array
220 220
 	 */
221
-	public function update( $new_instance, $old_instance ){
221
+	public function update($new_instance, $old_instance) {
222 222
 		$this->flush_widget_cache();
223 223
 
224 224
 		return $new_instance;
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @return void
231 231
 	 */
232
-	public function flush_widget_cache(){
233
-		wp_cache_delete( $this->self, 'widget' );
232
+	public function flush_widget_cache() {
233
+		wp_cache_delete($this->self, 'widget');
234 234
 	}
235 235
 }
236 236
 
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET )
31
-	if ( empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49 49
 
50 50
 /**
51 51
  * Hooks Give actions, when present in the $_POST super global. Every give_action
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function give_post_actions() {
60 60
 
61
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
61
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
62 62
 
63 63
 	// Add backward compatibility to give-action param ( $_POST ).
64
-	if ( empty( $_post_action ) ) {
65
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
64
+	if (empty($_post_action)) {
65
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
66 66
 	}
67 67
 
68
-	if ( isset( $_post_action ) ) {
68
+	if (isset($_post_action)) {
69 69
 		/**
70 70
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
71 71
 		 *
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @param array $_POST Array of HTTP POST variables.
75 75
 		 */
76
-		do_action( "give_{$_post_action}", $_POST );
76
+		do_action("give_{$_post_action}", $_POST);
77 77
 	}
78 78
 
79 79
 }
80 80
 
81
-add_action( 'init', 'give_post_actions' );
81
+add_action('init', 'give_post_actions');
82 82
 
83 83
 /**
84 84
  * Connect WordPress user with Donor.
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return void
92 92
  */
93
-function give_connect_donor_to_wpuser( $user_id, $user_data ) {
93
+function give_connect_donor_to_wpuser($user_id, $user_data) {
94 94
 	/* @var Give_Donor $donor */
95
-	$donor = new Give_Donor( $user_data['user_email'] );
95
+	$donor = new Give_Donor($user_data['user_email']);
96 96
 
97 97
 	// Validate donor id and check if do nor is already connect to wp user or not.
98
-	if ( $donor->id && ! $donor->user_id ) {
98
+	if ($donor->id && ! $donor->user_id) {
99 99
 
100 100
 		// Update donor user_id.
101
-		if ( $donor->update( array( 'user_id' => $user_id ) ) ) {
102
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
103
-			$donor->add_note( $donor_note );
101
+		if ($donor->update(array('user_id' => $user_id))) {
102
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
103
+			$donor->add_note($donor_note);
104 104
 
105 105
 			// Update user_id meta in payments.
106 106
 			// if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
116
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
117 117
 
118 118
 
119 119
 /**
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_validate_license_when_site_migrated() {
129 129
 	// Store current site address if not already stored.
130
-	$home_url_parts              = parse_url( home_url() );
131
-	$home_url                    = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false;
132
-	$home_url                    .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : '';
133
-	$site_address_before_migrate = get_option( 'give_site_address_before_migrate' );
130
+	$home_url_parts              = parse_url(home_url());
131
+	$home_url                    = isset($home_url_parts['host']) ? $home_url_parts['host'] : false;
132
+	$home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : '';
133
+	$site_address_before_migrate = get_option('give_site_address_before_migrate');
134 134
 
135 135
 	// Need $home_url to proceed.
136
-	if ( ! $home_url ) {
136
+	if ( ! $home_url) {
137 137
 		return;
138 138
 	}
139 139
 
140 140
 	// Save site address.
141
-	if ( ! $site_address_before_migrate ) {
141
+	if ( ! $site_address_before_migrate) {
142 142
 		// Update site address.
143
-		update_option( 'give_site_address_before_migrate', $home_url );
143
+		update_option('give_site_address_before_migrate', $home_url);
144 144
 
145 145
 		return;
146 146
 	}
147 147
 
148 148
 	// Backwards compat. for before when we were storing URL scheme.
149
-	if ( strpos( $site_address_before_migrate, 'http' ) ) {
150
-		$site_address_before_migrate = parse_url( $site_address_before_migrate );
151
-		$site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false;
149
+	if (strpos($site_address_before_migrate, 'http')) {
150
+		$site_address_before_migrate = parse_url($site_address_before_migrate);
151
+		$site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false;
152 152
 
153 153
 		// Add path for multisite installs.
154
-		$site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : '';
154
+		$site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : '';
155 155
 	}
156 156
 
157 157
 	// If the two URLs don't match run CRON.
158
-	if ( $home_url !== $site_address_before_migrate ) {
158
+	if ($home_url !== $site_address_before_migrate) {
159 159
 		// Immediately run cron.
160
-		wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' );
160
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
161 161
 
162 162
 		// Update site address.
163
-		update_option( 'give_site_address_before_migrate', $home_url );
163
+		update_option('give_site_address_before_migrate', $home_url);
164 164
 	}
165 165
 
166 166
 }
167 167
 
168
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
168
+add_action('admin_init', 'give_validate_license_when_site_migrated');
169 169
 
170 170
 
171 171
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @param $data
177 177
  */
178
-function give_donor_batch_export_complete( $data ) {
178
+function give_donor_batch_export_complete($data) {
179 179
 	// Remove donor ids cache.
180 180
 	if (
181
-		isset( $data['class'] )
181
+		isset($data['class'])
182 182
 		&& 'Give_Batch_Donors_Export' === $data['class']
183
-		&& ! empty( $data['forms'] )
184
-		&& isset( $data['give_export_option']['query_id'] )
183
+		&& ! empty($data['forms'])
184
+		&& isset($data['give_export_option']['query_id'])
185 185
 	) {
186
-		Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
186
+		Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id']));
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' );
190
+add_action('give_file_export_complete', 'give_donor_batch_export_complete');
191 191
 
192 192
 /**
193 193
  * Print css for wordpress setting pages.
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	/* @var WP_Screen $screen */
199 199
 	$screen = get_current_screen();
200 200
 
201
-	if ( ! ( $screen instanceof WP_Screen ) ) {
201
+	if ( ! ($screen instanceof WP_Screen)) {
202 202
 		return false;
203 203
 	}
204 204
 
205
-	switch ( true ) {
206
-		case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
205
+	switch (true) {
206
+		case ('plugins' === $screen->base || 'plugins-network' === $screen->base):
207 207
 			?>
208 208
 			<style>
209 209
 				tr.active.update + tr.give-addon-notice-tr td {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 }
242 242
 
243
-add_action( 'admin_head', 'give_admin_quick_css' );
243
+add_action('admin_head', 'give_admin_quick_css');
244 244
 
245 245
 
246 246
 /**
@@ -252,31 +252,31 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return void
254 254
  */
255
-function give_set_donation_levels_max_min_amount( $form_id ) {
255
+function give_set_donation_levels_max_min_amount($form_id) {
256 256
 	if (
257
-		( 'set' === $_POST['_give_price_option'] ) ||
258
-		( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) ||
259
-		! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) )
257
+		('set' === $_POST['_give_price_option']) ||
258
+		(in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) ||
259
+		! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount'))
260 260
 	) {
261 261
 		// Delete old meta.
262
-		give_delete_meta( $form_id, '_give_levels_minimum_amount' );
263
-		give_delete_meta( $form_id, '_give_levels_maximum_amount' );
262
+		give_delete_meta($form_id, '_give_levels_minimum_amount');
263
+		give_delete_meta($form_id, '_give_levels_maximum_amount');
264 264
 
265 265
 		return;
266 266
 	}
267 267
 
268 268
 	// Sanitize donation level amounts.
269
-	$donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts );
269
+	$donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts);
270 270
 
271
-	$min_amount = min( $donation_levels_amounts );
272
-	$max_amount = max( $donation_levels_amounts );
271
+	$min_amount = min($donation_levels_amounts);
272
+	$max_amount = max($donation_levels_amounts);
273 273
 
274 274
 	// Set Minimum and Maximum amount for Multi Level Donation Forms.
275
-	give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
276
-	give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 );
275
+	give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0);
276
+	give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0);
277 277
 }
278 278
 
279
-add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
279
+add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30);
280 280
 
281 281
 
282 282
 /**
@@ -286,24 +286,24 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @param int $payment_id
288 288
  */
289
-function _give_save_donor_billing_address( $payment_id ) {
289
+function _give_save_donor_billing_address($payment_id) {
290 290
 	/* @var Give_Payment $donation */
291
-	$donation = new Give_Payment( $payment_id );
291
+	$donation = new Give_Payment($payment_id);
292 292
 
293 293
 	// Bailout
294
-	if ( ! $donation->customer_id ) {
294
+	if ( ! $donation->customer_id) {
295 295
 		return;
296 296
 	}
297 297
 
298 298
 
299 299
 	/* @var Give_Donor $donor */
300
-	$donor = new Give_Donor( $donation->customer_id );
300
+	$donor = new Give_Donor($donation->customer_id);
301 301
 
302 302
 	// Save address.
303
-	$donor->add_address( 'billing[]', $donation->address );
303
+	$donor->add_address('billing[]', $donation->address);
304 304
 }
305 305
 
306
-add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 );
306
+add_action('give_complete_donation', '_give_save_donor_billing_address', 9999);
307 307
 
308 308
 
309 309
 /**
@@ -313,25 +313,25 @@  discard block
 block discarded – undo
313 313
  *
314 314
  * @param array $args
315 315
  */
316
-function give_update_log_form_id( $args ) {
317
-	$new_form_id = absint( $args[0] );
318
-	$payment_id  = absint( $args[1] );
319
-	$logs        = Give()->logs->get_logs( $payment_id );
316
+function give_update_log_form_id($args) {
317
+	$new_form_id = absint($args[0]);
318
+	$payment_id  = absint($args[1]);
319
+	$logs        = Give()->logs->get_logs($payment_id);
320 320
 
321 321
 	// Bailout.
322
-	if ( empty( $logs ) ) {
322
+	if (empty($logs)) {
323 323
 		return;
324 324
 	}
325 325
 
326 326
 	/* @var object $log */
327
-	foreach ( $logs as $log ) {
328
-		Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id );
327
+	foreach ($logs as $log) {
328
+		Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id);
329 329
 	}
330 330
 
331 331
 	// Delete cache.
332 332
 	Give()->logs->delete_cache();
333 333
 }
334 334
 
335
-add_action( 'give_update_log_form_id', 'give_update_log_form_id' );
335
+add_action('give_update_log_form_id', 'give_update_log_form_id');
336 336
 
337 337
 
Please login to merge, or discard this patch.
includes/class-give-tooltips.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array
22 22
 	 */
23
-	private function set_toottip_args( $args ) {
23
+	private function set_toottip_args($args) {
24 24
 		$args = wp_parse_args(
25 25
 			$args,
26 26
 			array(
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Auto set width of tooltip.
64 64
 		if (
65
-			! empty( $args['auto_width'] ) &&
66
-			! empty( $args['label'] ) &&
67
-			empty( $args['size'] )
65
+			! empty($args['auto_width']) &&
66
+			! empty($args['label']) &&
67
+			empty($args['size'])
68 68
 		) {
69
-			if ( 15 < str_word_count( $args['label'] ) ) {
69
+			if (15 < str_word_count($args['label'])) {
70 70
 				$args['size'] = 'large';
71
-			} elseif ( 7 < str_word_count( $args['label'] ) ) {
71
+			} elseif (7 < str_word_count($args['label'])) {
72 72
 				$args['size'] = 'medium';
73 73
 			}
74 74
 		}
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string
89 89
 	 */
90
-	public function render( $args ) {
91
-		$args = $this->set_toottip_args( $args );
90
+	public function render($args) {
91
+		$args = $this->set_toottip_args($args);
92 92
 
93 93
 		$tooltip_pos = array(
94 94
 			'top'          => 'hint--top',
@@ -118,21 +118,21 @@  discard block
 block discarded – undo
118 118
 		$args['attributes']['aria-label'] = $args['label'];
119 119
 
120 120
 		// Set classes.
121
-		$args['attributes']['class'] = ! empty( $args['attributes']['class'] ) ? $args['attributes']['class'] : '';
122
-		$args['attributes']['class'] .= " {$tooltip_pos[ $args['position'] ]}";
123
-		$args['attributes']['class'] .= ! empty( $args['status'] ) ? " {$tooltip_status[ $args['status'] ]}" : '';
124
-		$args['attributes']['class'] .= ! empty( $args['size'] ) ? " {$tooltip_size[ $args['size'] ]}" : '';
121
+		$args['attributes']['class'] = ! empty($args['attributes']['class']) ? $args['attributes']['class'] : '';
122
+		$args['attributes']['class'] .= " {$tooltip_pos[$args['position']]}";
123
+		$args['attributes']['class'] .= ! empty($args['status']) ? " {$tooltip_status[$args['status']]}" : '';
124
+		$args['attributes']['class'] .= ! empty($args['size']) ? " {$tooltip_size[$args['size']]}" : '';
125 125
 		$args['attributes']['class'] .= $args['show_always'] ? ' hint--always' : '';
126 126
 		$args['attributes']['class'] .= $args['round_edges'] ? ' hint--rounded' : '';
127 127
 		$args['attributes']['class'] .= $args['animate'] ? ' hint--bounce' : ' hint--no-animate';
128
-		$args['attributes']['class'] = trim( $args['attributes']['class'] );
128
+		$args['attributes']['class'] = trim($args['attributes']['class']);
129 129
 
130 130
 		// Set link attribute in tooltip has anchor tag.
131
-		if ( 'a' === $args['tag'] && ! empty( $args['link'] ) ) {
132
-			$args['attributes']['href'] = esc_url( $args['link'] );
131
+		if ('a' === $args['tag'] && ! empty($args['link'])) {
132
+			$args['attributes']['href'] = esc_url($args['link']);
133 133
 		}
134 134
 
135
-		return sprintf( '<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str( $args['attributes'] ), $args['tag_content'] );
135
+		return sprintf('<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str($args['attributes']), $args['tag_content']);
136 136
 	}
137 137
 
138 138
 
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string
148 148
 	 */
149
-	function render_link( $args ) {
149
+	function render_link($args) {
150 150
 		$args['tag']    = 'a';
151
-		$tooltip_markup = $this->render( $args );
151
+		$tooltip_markup = $this->render($args);
152 152
 
153 153
 		return $tooltip_markup;
154 154
 	}
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return string
165 165
 	 */
166
-	function render_span( $args ) {
166
+	function render_span($args) {
167 167
 		// Set tooltip args from string.
168
-		if ( is_string( $args ) ) {
169
-			$args = array( 'label' => $args );
168
+		if (is_string($args)) {
169
+			$args = array('label' => $args);
170 170
 		}
171 171
 
172 172
 		$args['tag']    = 'span';
173
-		$tooltip_markup = $this->render( $args );
173
+		$tooltip_markup = $this->render($args);
174 174
 
175 175
 		return $tooltip_markup;
176 176
 	}
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	function render_help( $args ) {
188
+	function render_help($args) {
189 189
 		// Set tooltip args from string.
190
-		if ( is_string( $args ) ) {
191
-			$args = array( 'label' => $args );
190
+		if (is_string($args)) {
191
+			$args = array('label' => $args);
192 192
 		}
193 193
 
194 194
 		$args['tag_content']         = '<i class="give-icon give-icon-question"></i>';
195 195
 		$args['attributes']['class'] = 'give-tooltip';
196
-		$tooltip_markup              = $this->render_span( $args );
196
+		$tooltip_markup              = $this->render_span($args);
197 197
 
198 198
 		return $tooltip_markup;
199 199
 	}
Please login to merge, or discard this patch.
includes/error-tracking.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * @return array|bool array if errors are present, false if none found
26 26
  */
27 27
 function give_get_errors() {
28
-	return Give()->session->get( 'give_errors' );
28
+	return Give()->session->get('give_errors');
29 29
 }
30 30
 
31 31
 /**
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return void
44 44
  */
45
-function give_set_error( $error_id, $error_message, $notice_args = array() ) {
45
+function give_set_error($error_id, $error_message, $notice_args = array()) {
46 46
 	$errors = give_get_errors();
47
-	if ( ! $errors ) {
47
+	if ( ! $errors) {
48 48
 		$errors = array();
49 49
 	}
50 50
 
51
-	if( is_array( $notice_args ) && ! empty( $notice_args ) ) {
52
-		$errors[ $error_id ] = array(
51
+	if (is_array($notice_args) && ! empty($notice_args)) {
52
+		$errors[$error_id] = array(
53 53
 			'message'     => $error_message,
54 54
 			'notice_args' => $notice_args,
55 55
 		);
56 56
 	} else {
57 57
 		// Backward compatibility v<1.8.11.
58
-		$errors[ $error_id ] = $error_message;
58
+		$errors[$error_id] = $error_message;
59 59
 	}
60 60
 
61
-	Give()->session->set( 'give_errors', $errors );
61
+	Give()->session->set('give_errors', $errors);
62 62
 }
63 63
 
64 64
 /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  * @return void
70 70
  */
71 71
 function give_clear_errors() {
72
-	Give()->session->set( 'give_errors', null );
72
+	Give()->session->set('give_errors', null);
73 73
 }
74 74
 
75 75
 /**
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
  *
83 83
  * @return void
84 84
  */
85
-function give_unset_error( $error_id ) {
85
+function give_unset_error($error_id) {
86 86
 	$errors = give_get_errors();
87
-	if ( $errors ) {
87
+	if ($errors) {
88 88
 		/**
89 89
 		 * Check If $error_id exists in the array.
90 90
 		 * If exists then unset it.
91 91
 		 *
92 92
 		 * @since 1.8.13
93 93
 		 */
94
-		if ( isset( $errors[ $error_id ] ) ) {
95
-			unset( $errors[ $error_id ] );
94
+		if (isset($errors[$error_id])) {
95
+			unset($errors[$error_id]);
96 96
 		}
97
-		Give()->session->set( 'give_errors', $errors );
97
+		Give()->session->set('give_errors', $errors);
98 98
 	}
99 99
 }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  * @return string
106 106
  */
107 107
 function _give_die_handler() {
108
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
108
+	if (defined('GIVE_UNIT_TESTS')) {
109 109
 		return '_give_die_handler';
110 110
 	} else {
111 111
 		die();
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_die( $message = '', $title = '', $status = 400 ) {
129
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
130
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
131
-	wp_die( $message, $title, array( 'response' => $status ) );
128
+function give_die($message = '', $title = '', $status = 400) {
129
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
130
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
131
+	wp_die($message, $title, array('response' => $status));
132 132
 }
Please login to merge, or discard this patch.
includes/class-give-async-process.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @category Class
12 12
  * @author   WordImpress
13 13
  */
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 		 * )
53 53
 		 */
54 54
 
55
-		$_post = give_clean( $_POST );
55
+		$_post = give_clean($_POST);
56 56
 
57
-		if ( empty( $_post ) || empty( $_post['data'] ) || empty( $_post['hook'] ) ) {
57
+		if (empty($_post) || empty($_post['data']) || empty($_post['hook'])) {
58 58
 			exit();
59 59
 		}
60 60
 
61 61
 		/**
62 62
 		 * Fire the hook.
63 63
 		 */
64
-		do_action( $_post['hook'], $_post['data'] );
64
+		do_action($_post['hook'], $_post['data']);
65 65
 
66 66
 		exit();
67 67
 	}
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Create wp nonce using Ajax call.
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
  * @return void
64 64
  */
65 65
 function give_donation_form_nonce() {
66
-	if ( isset( $_POST['give_form_id'] ) ) {
66
+	if (isset($_POST['give_form_id'])) {
67 67
 
68 68
 		// Get donation form id.
69
-		$form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0;
69
+		$form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0;
70 70
 
71 71
 		// Send nonce json data.
72
-		wp_send_json_success( wp_create_nonce( "donation_form_nonce_{$form_id}" ) );
72
+		wp_send_json_success(wp_create_nonce("donation_form_nonce_{$form_id}"));
73 73
 	}
74 74
 }
75 75
 
76
-add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' );
77
-add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' );
76
+add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce');
77
+add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce');
78 78
 
79 79
 /**
80 80
  * Sets an error within the donation form if no gateways are enabled.
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 function give_no_gateway_error() {
87 87
 	$gateways = give_get_enabled_payment_gateways();
88 88
 
89
-	if ( empty( $gateways ) ) {
90
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
89
+	if (empty($gateways)) {
90
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
91 91
 	} else {
92
-		give_unset_error( 'no_gateways' );
92
+		give_unset_error('no_gateways');
93 93
 	}
94 94
 }
95 95
 
96
-add_action( 'init', 'give_no_gateway_error' );
96
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
includes/gateways/functions.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => __( 'Test Donation', 'give' ),
32
-			'checkout_label' => __( 'Test Donation', 'give' )
31
+			'admin_label'    => __('Test Donation', 'give'),
32
+			'checkout_label' => __('Test Donation', 'give')
33 33
 		),
34 34
 	);
35 35
 
36
-	return apply_filters( 'give_payment_gateways', $gateways );
36
+	return apply_filters('give_payment_gateways', $gateways);
37 37
 
38 38
 }
39 39
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array $gateway_list All the available gateways
48 48
  */
49
-function give_get_enabled_payment_gateways( $form_id = 0 ) {
49
+function give_get_enabled_payment_gateways($form_id = 0) {
50 50
 
51 51
 	$gateways = give_get_payment_gateways();
52 52
 
53
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
53
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
54 54
 
55 55
 	$gateway_list = array();
56 56
 
57
-	foreach ( $gateways as $key => $gateway ) {
58
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
59
-			$gateway_list[ $key ] = $gateway;
57
+	foreach ($gateways as $key => $gateway) {
58
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
59
+			$gateway_list[$key] = $gateway;
60 60
 		}
61 61
 	}
62 62
 
63 63
 	// Set order of payment gateway in list.
64
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
64
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
65 65
 
66
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id );
66
+	return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id);
67 67
 }
68 68
 
69 69
 /**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
  *
76 76
  * @return boolean true if enabled, false otherwise
77 77
  */
78
-function give_is_gateway_active( $gateway ) {
78
+function give_is_gateway_active($gateway) {
79 79
 	$gateways = give_get_enabled_payment_gateways();
80 80
 
81
-	$ret = array_key_exists( $gateway, $gateways );
81
+	$ret = array_key_exists($gateway, $gateways);
82 82
 
83
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
83
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
84 84
 }
85 85
 
86 86
 /**
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return string Gateway ID
94 94
  */
95
-function give_get_default_gateway( $form_id ) {
95
+function give_get_default_gateway($form_id) {
96 96
 
97
-	$enabled_gateways = array_keys( give_get_enabled_payment_gateways() );
97
+	$enabled_gateways = array_keys(give_get_enabled_payment_gateways());
98 98
 	$default_gateway  = give_get_option('default_gateway');
99
-	$default          = ! empty( $default_gateway ) && give_is_gateway_active( $default_gateway ) ? $default_gateway : $enabled_gateways[0];
100
-	$form_default     = give_get_meta( $form_id, '_give_default_gateway', true );
99
+	$default          = ! empty($default_gateway) && give_is_gateway_active($default_gateway) ? $default_gateway : $enabled_gateways[0];
100
+	$form_default     = give_get_meta($form_id, '_give_default_gateway', true);
101 101
 
102 102
 	// Single Form settings varies compared to the Global default settings.
103 103
 	if (
104
-		! empty( $form_default ) &&
104
+		! empty($form_default) &&
105 105
 		$form_id !== null &&
106 106
 		$default !== $form_default &&
107 107
 		'global' !== $form_default &&
108
-		give_is_gateway_active( $form_default )
108
+		give_is_gateway_active($form_default)
109 109
 	) {
110 110
 		$default = $form_default;
111 111
 	}
112 112
 
113
-	return apply_filters( 'give_default_gateway', $default );
113
+	return apply_filters('give_default_gateway', $default);
114 114
 }
115 115
 
116 116
 /**
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
  *
123 123
  * @return string Gateway admin label
124 124
  */
125
-function give_get_gateway_admin_label( $gateway ) {
125
+function give_get_gateway_admin_label($gateway) {
126 126
 	$gateways = give_get_payment_gateways();
127
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
128
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
127
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
128
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
129 129
 
130
-	if ( $gateway == 'manual' && $payment ) {
131
-		if ( give_donation_amount( $payment ) == 0 ) {
132
-			$label = __( 'Test Donation', 'give' );
130
+	if ($gateway == 'manual' && $payment) {
131
+		if (give_donation_amount($payment) == 0) {
132
+			$label = __('Test Donation', 'give');
133 133
 		}
134 134
 	}
135 135
 
136
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
136
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
137 137
 }
138 138
 
139 139
 /**
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
  *
146 146
  * @return string Checkout label for the gateway
147 147
  */
148
-function give_get_gateway_checkout_label( $gateway ) {
148
+function give_get_gateway_checkout_label($gateway) {
149 149
 	$gateways = give_get_payment_gateways();
150
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
150
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
151 151
 
152
-	if ( $gateway == 'manual' ) {
153
-		$label = __( 'Test Donation', 'give' );
152
+	if ($gateway == 'manual') {
153
+		$label = __('Test Donation', 'give');
154 154
 	}
155 155
 
156
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
156
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
157 157
 }
158 158
 
159 159
 /**
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
  *
166 166
  * @return array Options the gateway supports
167 167
  */
168
-function give_get_gateway_supports( $gateway ) {
168
+function give_get_gateway_supports($gateway) {
169 169
 	$gateways = give_get_enabled_payment_gateways();
170
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
170
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
171 171
 
172
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
172
+	return apply_filters('give_gateway_supports', $supports, $gateway);
173 173
 }
174 174
 
175 175
 /**
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return void
184 184
  */
185
-function give_send_to_gateway( $gateway, $payment_data ) {
185
+function give_send_to_gateway($gateway, $payment_data) {
186 186
 
187
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
187
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
188 188
 
189 189
 	/**
190 190
 	 * Fires while loading payment gateway via AJAX.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @param array $payment_data All the payment data to be sent to the gateway.
197 197
 	 */
198
-	do_action( "give_gateway_{$gateway}", $payment_data );
198
+	do_action("give_gateway_{$gateway}", $payment_data);
199 199
 }
200 200
 
201 201
 
@@ -209,34 +209,34 @@  discard block
 block discarded – undo
209 209
  *
210 210
  * @return string $enabled_gateway The slug of the gateway
211 211
  */
212
-function give_get_chosen_gateway( $form_id ) {
212
+function give_get_chosen_gateway($form_id) {
213 213
 
214
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
214
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
215 215
 
216 216
 	// Back to check if 'form-id' is present.
217
-	if ( empty( $request_form_id ) ) {
218
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
217
+	if (empty($request_form_id)) {
218
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
219 219
 	}
220 220
 
221
-	$request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
221
+	$request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
222 222
 	$chosen               = false;
223 223
 
224 224
 	// If both 'payment-mode' and 'form-id' then set for only this form.
225
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
225
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
226 226
 		$chosen = $request_payment_mode;
227
-	} elseif ( empty( $request_form_id ) && $request_payment_mode ) {
227
+	} elseif (empty($request_form_id) && $request_payment_mode) {
228 228
 		// If no 'form-id' but there is 'payment-mode'.
229 229
 		$chosen = $request_payment_mode;
230 230
 	}
231 231
 
232 232
 	// Get the enable gateway based of chosen var.
233
-	if ( $chosen && give_is_gateway_active( $chosen ) ) {
234
-		$enabled_gateway = urldecode( $chosen );
233
+	if ($chosen && give_is_gateway_active($chosen)) {
234
+		$enabled_gateway = urldecode($chosen);
235 235
 	} else {
236
-		$enabled_gateway = give_get_default_gateway( $form_id );
236
+		$enabled_gateway = give_get_default_gateway($form_id);
237 237
 	}
238 238
 
239
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
239
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
240 240
 
241 241
 }
242 242
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
  *
256 256
  * @return int             ID of the new log entry.
257 257
  */
258
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
259
-	return Give()->logs->add( $title, $message, $parent, $type );
258
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
259
+	return Give()->logs->add($title, $message, $parent, $type);
260 260
 }
261 261
 
262 262
 /**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
  *
274 274
  * @return int ID of the new log entry
275 275
  */
276
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
277
-	$title = empty( $title ) ? esc_html__( 'Payment Error', 'give' ) : $title;
276
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
277
+	$title = empty($title) ? esc_html__('Payment Error', 'give') : $title;
278 278
 
279
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
279
+	return give_record_log($title, $message, $parent, 'gateway_error');
280 280
 }
281 281
 
282 282
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
  *
290 290
  * @return int
291 291
  */
292
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
292
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
293 293
 
294 294
 	$ret  = 0;
295 295
 	$args = array(
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 		'fields'      => 'ids',
302 302
 	);
303 303
 
304
-	$payments = new WP_Query( $args );
304
+	$payments = new WP_Query($args);
305 305
 
306
-	if ( $payments ) {
306
+	if ($payments) {
307 307
 		$ret = $payments->post_count;
308 308
 	}
309 309
 
@@ -320,27 +320,27 @@  discard block
 block discarded – undo
320 320
  *
321 321
  * @return array $gateways All the available gateways
322 322
  */
323
-function give_get_ordered_payment_gateways( $gateways ) {
323
+function give_get_ordered_payment_gateways($gateways) {
324 324
 
325 325
 	// Get gateways setting.
326
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
326
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
327 327
 
328 328
 	// Return from here if we do not have gateways setting.
329
-	if ( empty( $gateways_setting ) ) {
329
+	if (empty($gateways_setting)) {
330 330
 		return $gateways;
331 331
 	}
332 332
 
333 333
 	// Reverse array to order payment gateways.
334
-	$gateways_setting = array_reverse( $gateways_setting );
334
+	$gateways_setting = array_reverse($gateways_setting);
335 335
 
336 336
 	// Reorder gateways array
337
-	foreach ( $gateways_setting as $gateway_key => $value ) {
337
+	foreach ($gateways_setting as $gateway_key => $value) {
338 338
 
339
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
340
-		unset( $gateways[ $gateway_key ] );
339
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
340
+		unset($gateways[$gateway_key]);
341 341
 
342
-		if ( ! empty( $new_gateway_value ) ) {
343
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
342
+		if ( ! empty($new_gateway_value)) {
343
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
344 344
 		}
345 345
 	}
346 346
 
@@ -351,5 +351,5 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @param array $gateways All the available gateways
353 353
 	 */
354
-	return apply_filters( 'give_payment_gateways_order', $gateways );
354
+	return apply_filters('give_payment_gateways_order', $gateways);
355 355
 }
356 356
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +156 added lines, -156 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,13 +109,13 @@  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 120
 		$form_args = array(
121 121
 			'post_type'      => 'give_forms',
@@ -124,34 +124,34 @@  discard block
 block discarded – undo
124 124
 			'posts_per_page' => $args['number'],
125 125
 		);
126 126
 
127
-		$cache_key   = Give_Cache::get_key( 'give_forms', $form_args, false );
127
+		$cache_key = Give_Cache::get_key('give_forms', $form_args, false);
128 128
 
129 129
 		// Get forms from cache.
130
-		$forms = Give_Cache::get_db_query( $cache_key );
130
+		$forms = Give_Cache::get_db_query($cache_key);
131 131
 
132
-		if ( is_null( $forms ) ) {
133
-			$forms = get_posts( $form_args );
134
-			Give_Cache::set_db_query( $cache_key, $forms );
132
+		if (is_null($forms)) {
133
+			$forms = get_posts($form_args);
134
+			Give_Cache::set_db_query($cache_key, $forms);
135 135
 		}
136 136
 
137 137
 		$options = array();
138 138
 
139 139
 		// Ensure the selected.
140
-		if ( false !== $args['selected'] && $args['selected'] !== 0 ) {
141
-			$options[ $args['selected'] ] = get_the_title( $args['selected'] );
140
+		if (false !== $args['selected'] && $args['selected'] !== 0) {
141
+			$options[$args['selected']] = get_the_title($args['selected']);
142 142
 		}
143 143
 
144
-		if ( $forms ) {
144
+		if ($forms) {
145 145
 			$options[0] = $args['placeholder'];
146
-			foreach ( $forms as $form ) {
147
-				$form_title                     = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
148
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
146
+			foreach ($forms as $form) {
147
+				$form_title                     = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
148
+				$options[absint($form->ID)] = esc_html($form_title);
149 149
 			}
150 150
 		} else {
151
-			$options[0] = esc_html__( 'No forms found.', 'give' );
151
+			$options[0] = esc_html__('No forms found.', 'give');
152 152
 		}
153 153
 
154
-		$output = $this->select( array(
154
+		$output = $this->select(array(
155 155
 			'name'             => $args['name'],
156 156
 			'selected'         => $args['selected'],
157 157
 			'id'               => $args['id'],
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			'show_option_all'  => false,
164 164
 			'show_option_none' => false,
165 165
 			'data'             => $args['data'],
166
-		) );
166
+		));
167 167
 
168 168
 		return $output;
169 169
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string      Donors dropdown.
182 182
 	 */
183
-	public function donor_dropdown( $args = array() ) {
183
+	public function donor_dropdown($args = array()) {
184 184
 
185 185
 		$defaults = array(
186 186
 			'name'        => 'donors',
@@ -189,57 +189,57 @@  discard block
 block discarded – undo
189 189
 			'multiple'    => false,
190 190
 			'selected'    => 0,
191 191
 			'chosen'      => true,
192
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
192
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
193 193
 			'number'      => 30,
194 194
 			'data'        => array(
195 195
 				'search-type' => 'donor',
196 196
 			),
197 197
 		);
198 198
 
199
-		$args = wp_parse_args( $args, $defaults );
199
+		$args = wp_parse_args($args, $defaults);
200 200
 
201
-		$donors = Give()->donors->get_donors( array(
201
+		$donors = Give()->donors->get_donors(array(
202 202
 			'number' => $args['number']
203
-		) );
203
+		));
204 204
 
205 205
 		$options = array();
206 206
 
207
-		if ( $donors ) {
208
-			$options[0] = esc_html__( 'No donor attached', 'give' );
209
-			foreach ( $donors as $donor ) {
210
-				$options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
207
+		if ($donors) {
208
+			$options[0] = esc_html__('No donor attached', 'give');
209
+			foreach ($donors as $donor) {
210
+				$options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')');
211 211
 			}
212 212
 		} else {
213
-			$options[0] = esc_html__( 'No donors found.', 'give' );
213
+			$options[0] = esc_html__('No donors found.', 'give');
214 214
 		}
215 215
 
216
-		if ( ! empty( $args['selected'] ) ) {
216
+		if ( ! empty($args['selected'])) {
217 217
 
218 218
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
219
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
219
+			if ( ! array_key_exists($args['selected'], $options)) {
220 220
 
221
-				$donor = new Give_Donor( $args['selected'] );
221
+				$donor = new Give_Donor($args['selected']);
222 222
 
223
-				if ( $donor ) {
223
+				if ($donor) {
224 224
 
225
-					$options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
225
+					$options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')');
226 226
 
227 227
 				}
228 228
 			}
229 229
 		}
230 230
 
231
-		$output = $this->select( array(
231
+		$output = $this->select(array(
232 232
 			'name'             => $args['name'],
233 233
 			'selected'         => $args['selected'],
234 234
 			'id'               => $args['id'],
235
-			'class'            => $args['class'] . ' give-customer-select',
235
+			'class'            => $args['class'].' give-customer-select',
236 236
 			'options'          => $options,
237 237
 			'multiple'         => $args['multiple'],
238 238
 			'chosen'           => $args['chosen'],
239 239
 			'show_option_all'  => false,
240 240
 			'show_option_none' => false,
241 241
 			'data'             => $args['data'],
242
-		) );
242
+		));
243 243
 
244 244
 		return $output;
245 245
 	}
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
 	 *
259 259
 	 * @return string           Categories dropdown.
260 260
 	 */
261
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
262
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
261
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
262
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
263 263
 		$options    = array();
264 264
 
265
-		foreach ( $categories as $category ) {
266
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
265
+		foreach ($categories as $category) {
266
+			$options[absint($category->term_id)] = esc_html($category->name);
267 267
 		}
268 268
 
269
-		$output = $this->select( wp_parse_args( $args, array(
269
+		$output = $this->select(wp_parse_args($args, array(
270 270
 			'name'             => $name,
271 271
 			'selected'         => $selected,
272 272
 			'options'          => $options,
273
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
273
+			'show_option_all'  => esc_html__('All Categories', 'give'),
274 274
 			'show_option_none' => false,
275
-		) ) );
275
+		)));
276 276
 
277 277
 		return $output;
278 278
 	}
@@ -291,21 +291,21 @@  discard block
 block discarded – undo
291 291
 	 *
292 292
 	 * @return string           Tags dropdown.
293 293
 	 */
294
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
295
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
294
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
295
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
296 296
 		$options = array();
297 297
 
298
-		foreach ( $tags as $tag ) {
299
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
298
+		foreach ($tags as $tag) {
299
+			$options[absint($tag->term_id)] = esc_html($tag->name);
300 300
 		}
301 301
 
302
-		$output = $this->select( wp_parse_args( $args, array(
302
+		$output = $this->select(wp_parse_args($args, array(
303 303
 			'name'             => $name,
304 304
 			'selected'         => $selected,
305 305
 			'options'          => $options,
306
-			'show_option_all'  => esc_html__( 'All Tags', 'give' ),
306
+			'show_option_all'  => esc_html__('All Tags', 'give'),
307 307
 			'show_option_none' => false,
308
-		) ) );
308
+		)));
309 309
 
310 310
 		return $output;
311 311
 	}
@@ -325,25 +325,25 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @return string               Years dropdown.
327 327
 	 */
328
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
329
-		$current    = date( 'Y' );
330
-		$start_year = $current - absint( $years_before );
331
-		$end_year   = $current + absint( $years_after );
332
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
328
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
329
+		$current    = date('Y');
330
+		$start_year = $current - absint($years_before);
331
+		$end_year   = $current + absint($years_after);
332
+		$selected   = empty($selected) ? date('Y') : $selected;
333 333
 		$options    = array();
334 334
 
335
-		while ( $start_year <= $end_year ) {
336
-			$options[ absint( $start_year ) ] = $start_year;
337
-			$start_year ++;
335
+		while ($start_year <= $end_year) {
336
+			$options[absint($start_year)] = $start_year;
337
+			$start_year++;
338 338
 		}
339 339
 
340
-		$output = $this->select( array(
340
+		$output = $this->select(array(
341 341
 			'name'             => $name,
342 342
 			'selected'         => $selected,
343 343
 			'options'          => $options,
344 344
 			'show_option_all'  => false,
345 345
 			'show_option_none' => false,
346
-		) );
346
+		));
347 347
 
348 348
 		return $output;
349 349
 	}
@@ -361,23 +361,23 @@  discard block
 block discarded – undo
361 361
 	 *
362 362
 	 * @return string           Months dropdown.
363 363
 	 */
364
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
364
+	public function month_dropdown($name = 'month', $selected = 0) {
365 365
 		$month    = 1;
366 366
 		$options  = array();
367
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
367
+		$selected = empty($selected) ? date('n') : $selected;
368 368
 
369
-		while ( $month <= 12 ) {
370
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
371
-			$month ++;
369
+		while ($month <= 12) {
370
+			$options[absint($month)] = give_month_num_to_name($month);
371
+			$month++;
372 372
 		}
373 373
 
374
-		$output = $this->select( array(
374
+		$output = $this->select(array(
375 375
 			'name'             => $name,
376 376
 			'selected'         => $selected,
377 377
 			'options'          => $options,
378 378
 			'show_option_all'  => false,
379 379
 			'show_option_none' => false,
380
-		) );
380
+		));
381 381
 
382 382
 		return $output;
383 383
 	}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return string      The dropdown.
396 396
 	 */
397
-	public function select( $args = array() ) {
397
+	public function select($args = array()) {
398 398
 		$defaults = array(
399 399
 			'options'          => array(),
400 400
 			'name'             => null,
@@ -405,74 +405,74 @@  discard block
 block discarded – undo
405 405
 			'placeholder'      => null,
406 406
 			'multiple'         => false,
407 407
 			'select_atts'      => false,
408
-			'show_option_all'  => __( 'All', 'give' ),
409
-			'show_option_none' => __( 'None', 'give' ),
408
+			'show_option_all'  => __('All', 'give'),
409
+			'show_option_none' => __('None', 'give'),
410 410
 			'data'             => array(),
411 411
 			'readonly'         => false,
412 412
 			'disabled'         => false,
413 413
 		);
414 414
 
415
-		$args = wp_parse_args( $args, $defaults );
415
+		$args = wp_parse_args($args, $defaults);
416 416
 
417 417
 		$data_elements = '';
418
-		foreach ( $args['data'] as $key => $value ) {
419
-			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
418
+		foreach ($args['data'] as $key => $value) {
419
+			$data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"';
420 420
 		}
421 421
 
422 422
 		$multiple = '';
423
-		if ( $args['multiple'] ) {
423
+		if ($args['multiple']) {
424 424
 			$multiple = 'MULTIPLE';
425 425
 		}
426 426
 
427
-		if ( $args['chosen'] ) {
427
+		if ($args['chosen']) {
428 428
 			$args['class'] .= ' give-select-chosen';
429 429
 		}
430 430
 
431 431
 		$placeholder = '';
432
-		if ( $args['placeholder'] ) {
432
+		if ($args['placeholder']) {
433 433
 			$placeholder = $args['placeholder'];
434 434
 		}
435 435
 
436 436
 		$output = sprintf(
437 437
 			'<select name="%1$s" id="%2$s" class="give-select %3$s" %4$s %5$s placeholder="%6$s" data-placeholder="%6$s" %7$s>',
438
-			esc_attr( $args['name'] ),
439
-			esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ),
440
-			esc_attr( $args['class'] ),
438
+			esc_attr($args['name']),
439
+			esc_attr(sanitize_key(str_replace('-', '_', $args['id']))),
440
+			esc_attr($args['class']),
441 441
 			$multiple,
442 442
 			$args['select_atts'],
443 443
 			$placeholder,
444 444
 			$data_elements
445 445
 		);
446 446
 
447
-		if ( $args['show_option_all'] ) {
448
-			if ( $args['multiple'] ) {
449
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
447
+		if ($args['show_option_all']) {
448
+			if ($args['multiple']) {
449
+				$selected = selected(true, in_array(0, $args['selected']), false);
450 450
 			} else {
451
-				$selected = selected( $args['selected'], 0, false );
451
+				$selected = selected($args['selected'], 0, false);
452 452
 			}
453
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
453
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
454 454
 		}
455 455
 
456
-		if ( ! empty( $args['options'] ) ) {
456
+		if ( ! empty($args['options'])) {
457 457
 
458
-			if ( $args['show_option_none'] ) {
459
-				if ( $args['multiple'] ) {
460
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
458
+			if ($args['show_option_none']) {
459
+				if ($args['multiple']) {
460
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
461 461
 				} else {
462
-					$selected = selected( $args['selected'], - 1, false );
462
+					$selected = selected($args['selected'], - 1, false);
463 463
 				}
464
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
464
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
465 465
 			}
466 466
 
467
-			foreach ( $args['options'] as $key => $option ) {
467
+			foreach ($args['options'] as $key => $option) {
468 468
 
469
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
470
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
469
+				if ($args['multiple'] && is_array($args['selected'])) {
470
+					$selected = selected(true, in_array($key, $args['selected']), false);
471 471
 				} else {
472
-					$selected = selected( $args['selected'], $key, false );
472
+					$selected = selected($args['selected'], $key, false);
473 473
 				}
474 474
 
475
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
475
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
476 476
 			}
477 477
 		}
478 478
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return string      The checkbox.
495 495
 	 */
496
-	public function checkbox( $args = array() ) {
496
+	public function checkbox($args = array()) {
497 497
 		$defaults = array(
498 498
 			'name'    => null,
499 499
 			'current' => null,
@@ -504,16 +504,16 @@  discard block
 block discarded – undo
504 504
 			),
505 505
 		);
506 506
 
507
-		$args = wp_parse_args( $args, $defaults );
507
+		$args = wp_parse_args($args, $defaults);
508 508
 
509 509
 		$options = '';
510
-		if ( ! empty( $args['options']['disabled'] ) ) {
510
+		if ( ! empty($args['options']['disabled'])) {
511 511
 			$options .= ' disabled="disabled"';
512
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
512
+		} elseif ( ! empty($args['options']['readonly'])) {
513 513
 			$options .= ' readonly';
514 514
 		}
515 515
 
516
-		$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 ) . ' />';
516
+		$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).' />';
517 517
 
518 518
 		return $output;
519 519
 	}
@@ -530,22 +530,22 @@  discard block
 block discarded – undo
530 530
 	 *
531 531
 	 * @return string      The text field.
532 532
 	 */
533
-	public function text( $args = array() ) {
533
+	public function text($args = array()) {
534 534
 		// Backwards compatibility.
535
-		if ( func_num_args() > 1 ) {
535
+		if (func_num_args() > 1) {
536 536
 			$args = func_get_args();
537 537
 
538 538
 			$name  = $args[0];
539
-			$value = isset( $args[1] ) ? $args[1] : '';
540
-			$label = isset( $args[2] ) ? $args[2] : '';
541
-			$desc  = isset( $args[3] ) ? $args[3] : '';
539
+			$value = isset($args[1]) ? $args[1] : '';
540
+			$label = isset($args[2]) ? $args[2] : '';
541
+			$desc  = isset($args[3]) ? $args[3] : '';
542 542
 		}
543 543
 
544 544
 		$defaults = array(
545
-			'name'         => isset( $name ) ? $name : 'text',
546
-			'value'        => isset( $value ) ? $value : null,
547
-			'label'        => isset( $label ) ? $label : null,
548
-			'desc'         => isset( $desc ) ? $desc : null,
545
+			'name'         => isset($name) ? $name : 'text',
546
+			'value'        => isset($value) ? $value : null,
547
+			'label'        => isset($label) ? $label : null,
548
+			'desc'         => isset($desc) ? $desc : null,
549 549
 			'placeholder'  => '',
550 550
 			'class'        => 'regular-text',
551 551
 			'disabled'     => false,
@@ -553,29 +553,29 @@  discard block
 block discarded – undo
553 553
 			'data'         => false,
554 554
 		);
555 555
 
556
-		$args = wp_parse_args( $args, $defaults );
556
+		$args = wp_parse_args($args, $defaults);
557 557
 
558 558
 		$disabled = '';
559
-		if ( $args['disabled'] ) {
559
+		if ($args['disabled']) {
560 560
 			$disabled = ' disabled="disabled"';
561 561
 		}
562 562
 
563 563
 		$data = '';
564
-		if ( ! empty( $args['data'] ) ) {
565
-			foreach ( $args['data'] as $key => $value ) {
566
-				$data .= 'data-' . $key . '="' . $value . '" ';
564
+		if ( ! empty($args['data'])) {
565
+			foreach ($args['data'] as $key => $value) {
566
+				$data .= 'data-'.$key.'="'.$value.'" ';
567 567
 			}
568 568
 		}
569 569
 
570
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
570
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
571 571
 
572
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
572
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
573 573
 
574
-		if ( ! empty( $args['desc'] ) ) {
575
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
574
+		if ( ! empty($args['desc'])) {
575
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
576 576
 		}
577 577
 
578
-		$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 . '/>';
578
+		$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.'/>';
579 579
 
580 580
 		$output .= '</span>';
581 581
 
@@ -594,15 +594,15 @@  discard block
 block discarded – undo
594 594
 	 *
595 595
 	 * @return string      The date picker.
596 596
 	 */
597
-	public function date_field( $args = array() ) {
597
+	public function date_field($args = array()) {
598 598
 
599
-		if ( empty( $args['class'] ) ) {
599
+		if (empty($args['class'])) {
600 600
 			$args['class'] = 'give_datepicker';
601
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
601
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
602 602
 			$args['class'] .= ' give_datepicker';
603 603
 		}
604 604
 
605
-		return $this->text( $args );
605
+		return $this->text($args);
606 606
 	}
607 607
 
608 608
 	/**
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 *
618 618
 	 * @return string      The textarea.
619 619
 	 */
620
-	public function textarea( $args = array() ) {
620
+	public function textarea($args = array()) {
621 621
 		$defaults = array(
622 622
 			'name'     => 'textarea',
623 623
 			'value'    => null,
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 			'disabled' => false,
628 628
 		);
629 629
 
630
-		$args = wp_parse_args( $args, $defaults );
630
+		$args = wp_parse_args($args, $defaults);
631 631
 
632 632
 		$disabled = '';
633
-		if ( $args['disabled'] ) {
633
+		if ($args['disabled']) {
634 634
 			$disabled = ' disabled="disabled"';
635 635
 		}
636 636
 
637
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
637
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
638 638
 
639
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
639
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
640 640
 
641
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
641
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
642 642
 
643
-		if ( ! empty( $args['desc'] ) ) {
644
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
643
+		if ( ! empty($args['desc'])) {
644
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
645 645
 		}
646 646
 
647 647
 		$output .= '</span>';
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	 *
662 662
 	 * @return string      The text field with ajax search.
663 663
 	 */
664
-	public function ajax_user_search( $args = array() ) {
664
+	public function ajax_user_search($args = array()) {
665 665
 
666 666
 		$defaults = array(
667 667
 			'name'        => 'users',
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
 			'chosen'      => true,
673 673
 			'number'      => 30,
674 674
 			'select_atts' => '',
675
-			'placeholder' => __( 'Select a user', 'give' ),
675
+			'placeholder' => __('Select a user', 'give'),
676 676
 			'data'        => array(
677 677
 				'search-type' => 'user',
678 678
 			),
679 679
 		);
680 680
 
681
-		$args = wp_parse_args( $args, $defaults );
681
+		$args = wp_parse_args($args, $defaults);
682 682
 
683 683
 		// Set initial args.
684 684
 		$get_users_args = array(
@@ -687,31 +687,31 @@  discard block
 block discarded – undo
687 687
 
688 688
 		// Ensure selected user is not included in initial query.
689 689
 		// This is because sites with many users, it's not a guarantee the selected user will be returned.
690
-		if ( ! empty( $args['selected'] ) ) {
690
+		if ( ! empty($args['selected'])) {
691 691
 			$get_users_args['exclude'] = $args['selected'];
692 692
 		}
693 693
 
694 694
 		// Initial users array.
695
-		$users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args );
695
+		$users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args);
696 696
 
697 697
 		// Now add the selected user to the $users array if the arg is present.
698
-		if ( ! empty( $args['selected'] ) ) {
699
-			$selected_user =  apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );;
700
-			$users         = array_merge( $users, $selected_user );
698
+		if ( ! empty($args['selected'])) {
699
+			$selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ;
700
+			$users         = array_merge($users, $selected_user);
701 701
 		}
702 702
 
703 703
 		$options = array();
704 704
 
705
-		if ( $users ) {
705
+		if ($users) {
706 706
 			$options[0] = $args['placeholder'];
707
-			foreach ( $users as $user ) {
708
-				$options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' );
707
+			foreach ($users as $user) {
708
+				$options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')');
709 709
 			}
710 710
 		} else {
711
-			$options[0] = __( 'No users found.', 'give' );
711
+			$options[0] = __('No users found.', 'give');
712 712
 		}
713 713
 
714
-		$output = $this->select( array(
714
+		$output = $this->select(array(
715 715
 			'name'             => $args['name'],
716 716
 			'selected'         => $args['selected'],
717 717
 			'id'               => $args['id'],
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 			'show_option_all'  => false,
725 725
 			'show_option_none' => false,
726 726
 			'data'             => $args['data'],
727
-		) );
727
+		));
728 728
 
729 729
 		return $output;
730 730
 
Please login to merge, or discard this patch.