Completed
Branch master (34b06a)
by Devin
20:06
created
includes/forms/template.php 1 patch
Spacing   +394 added lines, -394 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,23 +78,23 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args );
81
+	do_action('give_pre_form_output', $form->ID, $args);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			//Get Goal thank you message.
89
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
89
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
91 91
 
92 92
 			//Print thank you message.
93
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
93
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
94 94
 
95 95
 		} else {
96 96
 
97
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
97
+			if (isset($args['show_title']) && $args['show_title'] == true) {
98 98
 
99 99
 				/**
100 100
 				 * Filter the title
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				 * @param int              $form_id
105 105
 				 * @param Give_Donate_Form $form
106 106
 				 */
107
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>', $form_id,  $form );
107
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>', $form_id, $form);
108 108
 
109 109
 			}
110 110
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 			 * @param int   $form_id The form ID.
117 117
 			 * @param array $args    An array of form arguments.
118 118
 			 */
119
-			do_action( 'give_pre_form', $form->ID, $args );
119
+			do_action('give_pre_form', $form->ID, $args);
120 120
 			?>
121 121
 
122 122
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
123
-			      action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
123
+			      action="<?php echo esc_url_raw($form_action); ?>" method="post">
124 124
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
125
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
125
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
126 126
 				<input type="hidden" name="give-current-url"
127
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
127
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
128 128
 				<input type="hidden" name="give-form-url"
129
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
129
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
130 130
 				<input type="hidden" name="give-form-minimum"
131
-				       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
131
+				       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
132 132
 
133 133
 				<!-- The following field is for robots only, invisible to humans: -->
134 134
 				<span class="give-hidden" style="display: none !important;">
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 				<?php
141 141
 
142 142
 				//Price ID hidden field for variable (mult-level) donation forms.
143
-				if ( give_has_variable_prices( $form_id ) ) {
143
+				if (give_has_variable_prices($form_id)) {
144 144
 					//get default selected price ID.
145
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
145
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
146 146
 					$price_id = 0;
147 147
 					//loop through prices.
148
-					foreach ( $prices as $price ) {
149
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
148
+					foreach ($prices as $price) {
149
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
150 150
 							$price_id = $price['_give_id']['level_id'];
151 151
 						};
152 152
 					}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 				 * @param int   $form_id The form ID.
163 163
 				 * @param array $args    An array of form arguments.
164 164
 				 */
165
-				do_action( 'give_checkout_form_top', $form->ID, $args );
165
+				do_action('give_checkout_form_top', $form->ID, $args);
166 166
 
167 167
 				/**
168 168
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 				 * @param int   $form_id The form ID.
173 173
 				 * @param array $args    An array of form arguments.
174 174
 				 */
175
-				do_action( 'give_payment_mode_select', $form->ID, $args );
175
+				do_action('give_payment_mode_select', $form->ID, $args);
176 176
 
177 177
 				/**
178 178
 				 * Fires while outputing donation form, after all other fields.
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				 * @param int   $form_id The form ID.
183 183
 				 * @param array $args    An array of form arguments.
184 184
 				 */
185
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
185
+				do_action('give_checkout_form_bottom', $form->ID, $args);
186 186
 
187 187
 				?>
188 188
 			</form>
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 			 * @param int   $form_id The form ID.
197 197
 			 * @param array $args    An array of form arguments.
198 198
 			 */
199
-			do_action( 'give_post_form', $form->ID, $args );
199
+			do_action('give_post_form', $form->ID, $args);
200 200
 
201 201
 		}
202 202
 		?>
203 203
 
204
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
204
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
205 205
 	<?php
206 206
 
207 207
 	/**
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 * @param int   $form_id The form ID.
213 213
 	 * @param array $args    An array of form arguments.
214 214
 	 */
215
-	do_action( 'give_post_form_output', $form->ID, $args );
215
+	do_action('give_post_form_output', $form->ID, $args);
216 216
 
217 217
 	$final_output = ob_get_clean();
218 218
 
219
-	echo apply_filters( 'give_donate_form', $final_output, $args );
219
+	echo apply_filters('give_donate_form', $final_output, $args);
220 220
 }
221 221
 
222 222
 /**
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
  *
234 234
  * @return string
235 235
  */
236
-function give_show_purchase_form( $form_id ) {
236
+function give_show_purchase_form($form_id) {
237 237
 
238
-	$payment_mode = give_get_chosen_gateway( $form_id );
238
+	$payment_mode = give_get_chosen_gateway($form_id);
239 239
 
240
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
240
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
241 241
 		$form_id = $_POST['give_form_id'];
242 242
 	}
243 243
 
@@ -246,33 +246,33 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @since 1.7
248 248
 	 */
249
-	do_action( 'give_donation_form_top', $form_id );
249
+	do_action('give_donation_form_top', $form_id);
250 250
 
251
-	if ( give_can_checkout() && isset( $form_id ) ) {
251
+	if (give_can_checkout() && isset($form_id)) {
252 252
 
253 253
 		/**
254 254
 		 * Fires while displaying donation form, before registration login.
255 255
 		 *
256 256
 		 * @since 1.7
257 257
 		 */
258
-		do_action( 'give_donation_form_before_register_login', $form_id );
258
+		do_action('give_donation_form_before_register_login', $form_id);
259 259
 
260 260
 		/**
261 261
 		 * Fire when register/login form fields render.
262 262
 		 *
263 263
 		 * @since 1.7
264 264
 		 */
265
-		do_action( 'give_donation_form_register_login_fields', $form_id );
265
+		do_action('give_donation_form_register_login_fields', $form_id);
266 266
 
267 267
 		/**
268 268
 		 * Fire when credit card form fields render.
269 269
 		 *
270 270
 		 * @since 1.7
271 271
 		 */
272
-		do_action( 'give_donation_form_before_cc_form', $form_id );
272
+		do_action('give_donation_form_before_cc_form', $form_id);
273 273
 
274 274
 		// Load the credit card form and allow gateways to load their own if they wish.
275
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
275
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
276 276
 			/**
277 277
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
278 278
 			 *
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			 *
281 281
 			 * @param int $form_id The form ID.
282 282
 			 */
283
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
283
+			do_action("give_{$payment_mode}_cc_form", $form_id);
284 284
 		} else {
285 285
 			/**
286 286
 			 * Fires while displaying donation form, credit card form fields.
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			 *
290 290
 			 * @param int $form_id The form ID.
291 291
 			 */
292
-			do_action( 'give_cc_form', $form_id );
292
+			do_action('give_cc_form', $form_id);
293 293
 		}
294 294
 
295 295
 		/**
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		 *
298 298
 		 * @since 1.7
299 299
 		 */
300
-		do_action( 'give_donation_form_after_cc_form', $form_id );
300
+		do_action('give_donation_form_after_cc_form', $form_id);
301 301
 
302 302
 	} else {
303 303
 		/**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @since 1.7
307 307
 		 */
308
-		do_action( 'give_donation_form_no_access', $form_id );
308
+		do_action('give_donation_form_no_access', $form_id);
309 309
 
310 310
 	}
311 311
 
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @since 1.7
316 316
 	 */
317
-	do_action( 'give_donation_form_bottom', $form_id );
317
+	do_action('give_donation_form_bottom', $form_id);
318 318
 }
319 319
 
320
-add_action( 'give_donation_form', 'give_show_purchase_form' );
320
+add_action('give_donation_form', 'give_show_purchase_form');
321 321
 
322 322
 /**
323 323
  * Give Show Login/Register Form Fields.
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
  *
329 329
  * @return void
330 330
  */
331
-function give_show_register_login_fields( $form_id ) {
331
+function give_show_register_login_fields($form_id) {
332 332
 
333
-	$show_register_form = give_show_login_register_option( $form_id );
333
+	$show_register_form = give_show_login_register_option($form_id);
334 334
 
335
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
335
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
336 336
 		?>
337 337
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
338 338
 			<?php
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			 *
342 342
 			 * @since 1.7
343 343
 			 */
344
-			do_action( 'give_donation_form_register_fields', $form_id );
344
+			do_action('give_donation_form_register_fields', $form_id);
345 345
 			?>
346 346
 		</div>
347 347
 		<?php
348
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
348
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
349 349
 		?>
350 350
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
351 351
 			<?php
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 			 *
355 355
 			 * @since 1.7
356 356
 			 */
357
-			do_action( 'give_donation_form_login_fields', $form_id );
357
+			do_action('give_donation_form_login_fields', $form_id);
358 358
 			?>
359 359
 		</div>
360 360
 		<?php
361 361
 	endif;
362 362
 
363
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
363
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
364 364
 		/**
365 365
 		 * Fire when user info render.
366 366
 		 *
367 367
 		 * @since 1.7
368 368
 		 */
369
-		do_action( 'give_donation_form_after_user_info', $form_id );
369
+		do_action('give_donation_form_after_user_info', $form_id);
370 370
 	}
371 371
 }
372 372
 
373
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
373
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
374 374
 
375 375
 /**
376 376
  * Donation Amount Field.
@@ -384,16 +384,16 @@  discard block
 block discarded – undo
384 384
  *
385 385
  * @return void
386 386
  */
387
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
387
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
388 388
 
389 389
 	$give_options        = give_get_settings();
390
-	$variable_pricing    = give_has_variable_prices( $form_id );
391
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
392
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
393
-	$symbol              = give_currency_symbol( give_get_currency() );
394
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
395
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
396
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
390
+	$variable_pricing    = give_has_variable_prices($form_id);
391
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
392
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
393
+	$symbol              = give_currency_symbol(give_get_currency());
394
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
395
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
396
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
397 397
 
398 398
 	/**
399 399
 	 * Fires while displaying donation form, before donation level fields.
@@ -403,20 +403,20 @@  discard block
 block discarded – undo
403 403
 	 * @param int   $form_id The form ID.
404 404
 	 * @param array $args    An array of form arguments.
405 405
 	 */
406
-	do_action( 'give_before_donation_levels', $form_id, $args );
406
+	do_action('give_before_donation_levels', $form_id, $args);
407 407
 
408 408
 	//Set Price, No Custom Amount Allowed means hidden price field.
409
-	if ( $allow_custom_amount == 'no' ) {
409
+	if ($allow_custom_amount == 'no') {
410 410
 		?>
411
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
411
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
412 412
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
413 413
 		       value="<?php echo $default_amount; ?>" required aria-required="true"/>
414 414
 		<div class="set-price give-donation-amount form-row-wide">
415
-			<?php if ( $currency_position == 'before' ) {
415
+			<?php if ($currency_position == 'before') {
416 416
 				echo $currency_output;
417 417
 			} ?>
418 418
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
419
-			<?php if ( $currency_position == 'after' ) {
419
+			<?php if ($currency_position == 'after') {
420 420
 				echo $currency_output;
421 421
 			} ?>
422 422
 		</div>
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
 		?>
427 427
 		<div class="give-total-wrap">
428 428
 			<div class="give-donation-amount form-row-wide">
429
-				<?php if ( $currency_position == 'before' ) {
429
+				<?php if ($currency_position == 'before') {
430 430
 					echo $currency_output;
431 431
 				} ?>
432
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
432
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
433 433
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
434 434
 				       placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
435
-				<?php if ( $currency_position == 'after' ) {
435
+				<?php if ($currency_position == 'after') {
436 436
 					echo $currency_output;
437 437
 				} ?>
438 438
 			</div>
@@ -447,16 +447,16 @@  discard block
 block discarded – undo
447 447
 	 * @param int   $form_id The form ID.
448 448
 	 * @param array $args    An array of form arguments.
449 449
 	 */
450
-	do_action( 'give_after_donation_amount', $form_id, $args );
450
+	do_action('give_after_donation_amount', $form_id, $args);
451 451
 
452 452
 	//Custom Amount Text.
453
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
453
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
454 454
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
455 455
 	<?php }
456 456
 
457 457
 	//Output Variable Pricing Levels.
458
-	if ( $variable_pricing ) {
459
-		give_output_levels( $form_id );
458
+	if ($variable_pricing) {
459
+		give_output_levels($form_id);
460 460
 	}
461 461
 
462 462
 	/**
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 * @param int   $form_id The form ID.
468 468
 	 * @param array $args    An array of form arguments.
469 469
 	 */
470
-	do_action( 'give_after_donation_levels', $form_id, $args );
470
+	do_action('give_after_donation_levels', $form_id, $args);
471 471
 }
472 472
 
473
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
473
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
474 474
 
475 475
 /**
476 476
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -481,32 +481,32 @@  discard block
 block discarded – undo
481 481
  *
482 482
  * @return string Donation levels.
483 483
  */
484
-function give_output_levels( $form_id ) {
484
+function give_output_levels($form_id) {
485 485
 
486 486
 	//Get variable pricing.
487
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
488
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
489
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
490
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
491
-	if ( empty( $custom_amount_text ) ) {
492
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
487
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
488
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
489
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
490
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
491
+	if (empty($custom_amount_text)) {
492
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
493 493
 	}
494 494
 
495 495
 	$output  = '';
496 496
 	$counter = 0;
497 497
 
498
-	switch ( $display_style ) {
498
+	switch ($display_style) {
499 499
 		case 'buttons':
500 500
 
501 501
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
502 502
 
503
-			foreach ( $prices as $price ) {
504
-				$counter ++;
505
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
506
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
503
+			foreach ($prices as $price) {
504
+				$counter++;
505
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
506
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
507 507
 
508 508
 				$output .= '<li>';
509
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
509
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
510 510
 				$output .= $level_text;
511 511
 				$output .= '</button>';
512 512
 				$output .= '</li>';
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			}
515 515
 
516 516
 			//Custom Amount.
517
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
517
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
518 518
 				$output .= '<li>';
519 519
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
520 520
 				$output .= $custom_amount_text;
@@ -530,23 +530,23 @@  discard block
 block discarded – undo
530 530
 
531 531
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
532 532
 
533
-			foreach ( $prices as $price ) {
534
-				$counter ++;
535
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
536
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
533
+			foreach ($prices as $price) {
534
+				$counter++;
535
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
536
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
537 537
 
538 538
 				$output .= '<li>';
539
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
540
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
539
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
540
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
541 541
 				$output .= '</li>';
542 542
 
543 543
 			}
544 544
 
545 545
 			//Custom Amount.
546
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
546
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
547 547
 				$output .= '<li>';
548 548
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
549
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
549
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
550 550
 				$output .= '</li>';
551 551
 			}
552 552
 
@@ -556,23 +556,23 @@  discard block
 block discarded – undo
556 556
 
557 557
 		case 'dropdown':
558 558
 
559
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
560
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
559
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
560
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
561 561
 
562 562
 			//first loop through prices.
563
-			foreach ( $prices as $price ) {
564
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
565
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
563
+			foreach ($prices as $price) {
564
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
565
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
566 566
 
567
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
567
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
568 568
 				$output .= $level_text;
569 569
 				$output .= '</option>';
570 570
 
571 571
 			}
572 572
 
573 573
 			//Custom Amount.
574
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
575
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
574
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
575
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
576 576
 			}
577 577
 
578 578
 			$output .= '</select>';
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			break;
581 581
 	}
582 582
 
583
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
583
+	echo apply_filters('give_form_level_output', $output, $form_id);
584 584
 }
585 585
 
586 586
 /**
@@ -595,26 +595,26 @@  discard block
 block discarded – undo
595 595
  *
596 596
  * @return string Checkout button.
597 597
  */
598
-function give_display_checkout_button( $form_id, $args ) {
598
+function give_display_checkout_button($form_id, $args) {
599 599
 
600
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
600
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
601 601
 		? $args['display_style']
602
-		: get_post_meta( $form_id, '_give_payment_display', true );
602
+		: get_post_meta($form_id, '_give_payment_display', true);
603 603
 
604 604
 	//no btn for onpage.
605
-	if ( $display_option === 'onpage' ) {
605
+	if ($display_option === 'onpage') {
606 606
 		return;
607 607
 	}
608 608
 
609
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
610
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
609
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
610
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
611 611
 
612
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
612
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
613 613
 
614
-	echo apply_filters( 'give_display_checkout_button', $output );
614
+	echo apply_filters('give_display_checkout_button', $output);
615 615
 }
616 616
 
617
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
617
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
618 618
 
619 619
 /**
620 620
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -625,57 +625,57 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_user_info_fields( $form_id ) {
628
+function give_user_info_fields($form_id) {
629 629
 	// Get user info.
630
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
630
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
631 631
 
632 632
 	/**
633 633
 	 * Fire before user personal information fields
634 634
 	 *
635 635
 	 * @since 1.7
636 636
 	 */
637
-	do_action( 'give_donation_form_before_personal_info', $form_id );
637
+	do_action('give_donation_form_before_personal_info', $form_id);
638 638
 	?>
639 639
 	<fieldset id="give_checkout_user_info">
640
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
640
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
641 641
 		<p id="give-first-name-wrap" class="form-row form-row-first">
642 642
 			<label class="give-label" for="give-first">
643
-				<?php esc_html_e( 'First Name', 'give' ); ?>
644
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
643
+				<?php esc_html_e('First Name', 'give'); ?>
644
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
645 645
 					<span class="give-required-indicator">*</span>
646 646
 				<?php endif ?>
647 647
 				<span class="give-tooltip give-icon give-icon-question"
648
-				      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
648
+				      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
649 649
 			</label>
650 650
 			<input
651 651
 				class="give-input required"
652 652
 				type="text"
653 653
 				name="give_first"
654
-				placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
654
+				placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
655 655
 				id="give-first"
656
-				value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
657
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
656
+				value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
657
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
658 658
 			/>
659 659
 		</p>
660 660
 
661 661
 		<p id="give-last-name-wrap" class="form-row form-row-last">
662 662
 			<label class="give-label" for="give-last">
663
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
664
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
663
+				<?php esc_html_e('Last Name', 'give'); ?>
664
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
665 665
 					<span class="give-required-indicator">*</span>
666 666
 				<?php endif ?>
667 667
 				<span class="give-tooltip give-icon give-icon-question"
668
-				      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
668
+				      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671 671
 			<input
672
-				class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
672
+				class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
673 673
 				type="text"
674 674
 				name="give_last"
675 675
 				id="give-last"
676
-				placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
677
-				value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
678
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
676
+				placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
677
+				value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
678
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
679 679
 			/>
680 680
 		</p>
681 681
 
@@ -685,26 +685,26 @@  discard block
 block discarded – undo
685 685
 		 *
686 686
 		 * @since 1.7
687 687
 		 */
688
-		do_action( 'give_donation_form_before_email', $form_id );
688
+		do_action('give_donation_form_before_email', $form_id);
689 689
 		?>
690 690
 		<p id="give-email-wrap" class="form-row form-row-wide">
691 691
 			<label class="give-label" for="give-email">
692
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
693
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
692
+				<?php esc_html_e('Email Address', 'give'); ?>
693
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
694 694
 					<span class="give-required-indicator">*</span>
695 695
 				<?php } ?>
696 696
 				<span class="give-tooltip give-icon give-icon-question"
697
-				      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
697
+				      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
698 698
 			</label>
699 699
 
700 700
 			<input
701 701
 				class="give-input required"
702 702
 				type="email"
703 703
 				name="give_email"
704
-				placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
704
+				placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
705 705
 				id="give-email"
706
-				value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
707
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
706
+				value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
707
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
708 708
 			/>
709 709
 
710 710
 		</p>
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
 		 *
715 715
 		 * @since 1.7
716 716
 		 */
717
-		do_action( 'give_donation_form_after_email', $form_id );
717
+		do_action('give_donation_form_after_email', $form_id);
718 718
 
719 719
 		/**
720 720
 		 * Fire after personal email field
721 721
 		 *
722 722
 		 * @since 1.7
723 723
 		 */
724
-		do_action( 'give_donation_form_user_info', $form_id );
724
+		do_action('give_donation_form_user_info', $form_id);
725 725
 		?>
726 726
 	</fieldset>
727 727
 	<?php
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 	 *
731 731
 	 * @since 1.7
732 732
 	 */
733
-	do_action( 'give_donation_form_after_personal_info', $form_id );
733
+	do_action('give_donation_form_after_personal_info', $form_id);
734 734
 }
735 735
 
736
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
737
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
736
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
737
+add_action('give_register_fields_before', 'give_user_info_fields');
738 738
 
739 739
 /**
740 740
  * Renders the credit card info form.
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
  *
746 746
  * @return void
747 747
  */
748
-function give_get_cc_form( $form_id ) {
748
+function give_get_cc_form($form_id) {
749 749
 
750 750
 	ob_start();
751 751
 
@@ -756,53 +756,53 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param int $form_id The form ID.
758 758
 	 */
759
-	do_action( 'give_before_cc_fields', $form_id );
759
+	do_action('give_before_cc_fields', $form_id);
760 760
 	?>
761 761
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
762
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
763
-		<?php if ( is_ssl() ) : ?>
762
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
763
+		<?php if (is_ssl()) : ?>
764 764
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
765 765
 				<span class="give-icon padlock"></span>
766
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
766
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
767 767
 			</div>
768 768
 		<?php endif; ?>
769 769
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
770 770
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
771
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
771
+				<?php esc_html_e('Card Number', 'give'); ?>
772 772
 				<span class="give-required-indicator">*</span>
773 773
 				<span class="give-tooltip give-icon give-icon-question"
774
-				      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
774
+				      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
775 775
 				<span class="card-type"></span>
776 776
 			</label>
777 777
 
778 778
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
779
-			       class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
779
+			       class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
780 780
 			       required aria-required="true"/>
781 781
 		</p>
782 782
 
783 783
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
784 784
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
785
-				<?php esc_html_e( 'CVC', 'give' ); ?>
785
+				<?php esc_html_e('CVC', 'give'); ?>
786 786
 				<span class="give-required-indicator">*</span>
787 787
 				<span class="give-tooltip give-icon give-icon-question"
788
-				      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
788
+				      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
789 789
 			</label>
790 790
 
791 791
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
792
-			       class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
792
+			       class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
793 793
 			       required aria-required="true"/>
794 794
 		</p>
795 795
 
796 796
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
797 797
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
798
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
798
+				<?php esc_html_e('Name on the Card', 'give'); ?>
799 799
 				<span class="give-required-indicator">*</span>
800 800
 				<span class="give-tooltip give-icon give-icon-question"
801
-				      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
801
+				      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
802 802
 			</label>
803 803
 
804 804
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
805
-			       class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
805
+			       class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
806 806
 			       required aria-required="true"/>
807 807
 		</p>
808 808
 		<?php
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 		 *
814 814
 		 * @param int $form_id The form ID.
815 815
 		 */
816
-		do_action( 'give_before_cc_expiration' );
816
+		do_action('give_before_cc_expiration');
817 817
 		?>
818 818
 		<p class="card-expiration form-row form-row-one-third">
819 819
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
820
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
820
+				<?php esc_html_e('Expiration', 'give'); ?>
821 821
 				<span class="give-required-indicator">*</span>
822 822
 				<span class="give-tooltip give-icon give-icon-question"
823
-				      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
823
+				      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
824 824
 			</label>
825 825
 
826 826
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 			       class="card-expiry-year"/>
830 830
 
831 831
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
832
-			       class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
832
+			       class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
833 833
 			       required aria-required="true"/>
834 834
 		</p>
835 835
 		<?php
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 		 *
841 841
 		 * @param int $form_id The form ID.
842 842
 		 */
843
-		do_action( 'give_after_cc_expiration', $form_id );
843
+		do_action('give_after_cc_expiration', $form_id);
844 844
 		?>
845 845
 	</fieldset>
846 846
 	<?php
@@ -851,12 +851,12 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @param int $form_id The form ID.
853 853
 	 */
854
-	do_action( 'give_after_cc_fields', $form_id );
854
+	do_action('give_after_cc_fields', $form_id);
855 855
 
856 856
 	echo ob_get_clean();
857 857
 }
858 858
 
859
-add_action( 'give_cc_form', 'give_get_cc_form' );
859
+add_action('give_cc_form', 'give_get_cc_form');
860 860
 
861 861
 /**
862 862
  * Outputs the default credit card address fields.
@@ -867,24 +867,24 @@  discard block
 block discarded – undo
867 867
  *
868 868
  * @return void
869 869
  */
870
-function give_default_cc_address_fields( $form_id ) {
870
+function give_default_cc_address_fields($form_id) {
871 871
 	// Get user info.
872
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
872
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
873 873
 
874 874
 	$logged_in = is_user_logged_in();
875 875
 
876
-	if ( $logged_in ) {
877
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
876
+	if ($logged_in) {
877
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
878 878
 	}
879
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
880
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
881
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
882
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
879
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
880
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
881
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
882
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
883 883
 
884 884
 	ob_start();
885 885
 	?>
886 886
 	<fieldset id="give_cc_address" class="cc-address">
887
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
887
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
888 888
 		<?php
889 889
 		/**
890 890
 		 * Fires while rendering credit card billing form, before address fields.
@@ -893,79 +893,79 @@  discard block
 block discarded – undo
893 893
 		 *
894 894
 		 * @param int $form_id The form ID.
895 895
 		 */
896
-		do_action( 'give_cc_billing_top' );
896
+		do_action('give_cc_billing_top');
897 897
 		?>
898 898
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
899 899
 			<label for="card_address" class="give-label">
900
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
900
+				<?php esc_html_e('Address 1', 'give'); ?>
901 901
 				<?php
902
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
902
+				if (give_field_is_required('card_address', $form_id)) : ?>
903 903
 					<span class="give-required-indicator">*</span>
904 904
 				<?php endif; ?>
905 905
 				<span class="give-tooltip give-icon give-icon-question"
906
-				      data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
906
+				      data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
907 907
 			</label>
908 908
 
909 909
 			<input
910 910
 				type="text"
911 911
 				id="card_address"
912 912
 				name="card_address"
913
-				class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
914
-				placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
915
-				value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
916
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
913
+				class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
914
+				placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
915
+				value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
916
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
917 917
 			/>
918 918
 		</p>
919 919
 
920 920
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
921 921
 			<label for="card_address_2" class="give-label">
922
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
923
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
922
+				<?php esc_html_e('Address 2', 'give'); ?>
923
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
924 924
 					<span class="give-required-indicator">*</span>
925 925
 				<?php endif; ?>
926 926
 				<span class="give-tooltip give-icon give-icon-question"
927
-				      data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
927
+				      data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
928 928
 			</label>
929 929
 
930 930
 			<input
931 931
 				type="text"
932 932
 				id="card_address_2"
933 933
 				name="card_address_2"
934
-				class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
935
-				placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
936
-				value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
937
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
934
+				class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
935
+				placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
936
+				value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
937
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
938 938
 			/>
939 939
 		</p>
940 940
 
941 941
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
942 942
 			<label for="card_city" class="give-label">
943
-				<?php esc_html_e( 'City', 'give' ); ?>
944
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
943
+				<?php esc_html_e('City', 'give'); ?>
944
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
945 945
 					<span class="give-required-indicator">*</span>
946 946
 				<?php endif; ?>
947 947
 				<span class="give-tooltip give-icon give-icon-question"
948
-				      data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
948
+				      data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
949 949
 			</label>
950 950
 			<input
951 951
 				type="text"
952 952
 				id="card_city"
953 953
 				name="card_city"
954
-				class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
955
-				placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
956
-				value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
957
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
954
+				class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
955
+				placeholder="<?php esc_attr_e('City', 'give'); ?>"
956
+				value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
957
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
958 958
 			/>
959 959
 		</p>
960 960
 
961 961
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
962 962
 			<label for="card_zip" class="give-label">
963
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
964
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
963
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
964
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
965 965
 					<span class="give-required-indicator">*</span>
966 966
 				<?php endif; ?>
967 967
 				<span class="give-tooltip give-icon give-icon-question"
968
-				      data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
968
+				      data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
969 969
 			</label>
970 970
 
971 971
 			<input
@@ -973,40 +973,40 @@  discard block
 block discarded – undo
973 973
 				size="4"
974 974
 				id="card_zip"
975 975
 				name="card_zip"
976
-				class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
977
-				placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
978
-				value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
979
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
976
+				class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
977
+				placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
978
+				value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
979
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
980 980
 			/>
981 981
 		</p>
982 982
 
983 983
 		<p id="give-card-country-wrap" class="form-row form-row-first">
984 984
 			<label for="billing_country" class="give-label">
985
-				<?php esc_html_e( 'Country', 'give' ); ?>
986
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
985
+				<?php esc_html_e('Country', 'give'); ?>
986
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
987 987
 					<span class="give-required-indicator">*</span>
988 988
 				<?php endif; ?>
989 989
 				<span class="give-tooltip give-icon give-icon-question"
990
-				      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
990
+				      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
991 991
 			</label>
992 992
 
993 993
 			<select
994 994
 				name="billing_country"
995 995
 				id="billing_country"
996
-				class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
997
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
996
+				class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
997
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
998 998
 			>
999 999
 				<?php
1000 1000
 
1001 1001
 				$selected_country = give_get_country();
1002 1002
 
1003
-				if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1003
+				if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1004 1004
 					$selected_country = $give_user_info['billing_country'];
1005 1005
 				}
1006 1006
 
1007 1007
 				$countries = give_get_country_list();
1008
-				foreach ( $countries as $country_code => $country ) {
1009
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1008
+				foreach ($countries as $country_code => $country) {
1009
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1010 1010
 				}
1011 1011
 				?>
1012 1012
 			</select>
@@ -1014,39 +1014,39 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
 		<p id="give-card-state-wrap" class="form-row form-row-last">
1016 1016
 			<label for="card_state" class="give-label">
1017
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
1018
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?>
1017
+				<?php esc_html_e('State / Province', 'give'); ?>
1018
+				<?php if (give_field_is_required('card_state', $form_id)) : ?>
1019 1019
 					<span class="give-required-indicator">*</span>
1020 1020
 				<?php endif; ?>
1021 1021
 				<span class="give-tooltip give-icon give-icon-question"
1022
-				      data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
1022
+				      data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
1023 1023
 			</label>
1024 1024
 
1025 1025
 			<?php
1026 1026
 			$selected_state = give_get_state();
1027
-			$states         = give_get_states( $selected_country );
1027
+			$states         = give_get_states($selected_country);
1028 1028
 
1029
-			if ( ! empty( $give_user_info['card_state'] ) ) {
1029
+			if ( ! empty($give_user_info['card_state'])) {
1030 1030
 				$selected_state = $give_user_info['card_state'];
1031 1031
 			}
1032 1032
 
1033
-			if ( ! empty( $states ) ) : ?>
1033
+			if ( ! empty($states)) : ?>
1034 1034
 				<select
1035 1035
 					name="card_state"
1036 1036
 					id="card_state"
1037
-					class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1038
-					<?php if ( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ) {
1037
+					class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1038
+					<?php if (give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : '') {
1039 1039
 						;
1040 1040
 					} ?>>
1041 1041
 					<?php
1042
-					foreach ( $states as $state_code => $state ) {
1043
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1042
+					foreach ($states as $state_code => $state) {
1043
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1044 1044
 					}
1045 1045
 					?>
1046 1046
 				</select>
1047 1047
 			<?php else : ?>
1048 1048
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1049
-				       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1049
+				       placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
1050 1050
 			<?php endif; ?>
1051 1051
 		</p>
1052 1052
 		<?php
@@ -1057,14 +1057,14 @@  discard block
 block discarded – undo
1057 1057
 		 *
1058 1058
 		 * @param int $form_id The form ID.
1059 1059
 		 */
1060
-		do_action( 'give_cc_billing_bottom' );
1060
+		do_action('give_cc_billing_bottom');
1061 1061
 		?>
1062 1062
 	</fieldset>
1063 1063
 	<?php
1064 1064
 	echo ob_get_clean();
1065 1065
 }
1066 1066
 
1067
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1067
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1068 1068
 
1069 1069
 
1070 1070
 /**
@@ -1076,27 +1076,27 @@  discard block
 block discarded – undo
1076 1076
  *
1077 1077
  * @return string
1078 1078
  */
1079
-function give_get_register_fields( $form_id ) {
1079
+function give_get_register_fields($form_id) {
1080 1080
 
1081 1081
 	global $user_ID;
1082 1082
 
1083
-	if ( is_user_logged_in() ) {
1084
-		$user_data = get_userdata( $user_ID );
1083
+	if (is_user_logged_in()) {
1084
+		$user_data = get_userdata($user_ID);
1085 1085
 	}
1086 1086
 
1087
-	$show_register_form = give_show_login_register_option( $form_id );
1087
+	$show_register_form = give_show_login_register_option($form_id);
1088 1088
 
1089 1089
 	ob_start(); ?>
1090 1090
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1091 1091
 
1092
-		<?php if ( $show_register_form == 'both' ) { ?>
1092
+		<?php if ($show_register_form == 'both') { ?>
1093 1093
 			<div class="give-login-account-wrap">
1094
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1095
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1096
-					   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1094
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1095
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1096
+					   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1097 1097
 				</p>
1098 1098
 				<p class="give-loading-text">
1099
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
1099
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
1100 1100
 			</div>
1101 1101
 		<?php } ?>
1102 1102
 
@@ -1108,15 +1108,15 @@  discard block
 block discarded – undo
1108 1108
 		 *
1109 1109
 		 * @param int $form_id The form ID.
1110 1110
 		 */
1111
-		do_action( 'give_register_fields_before', $form_id );
1111
+		do_action('give_register_fields_before', $form_id);
1112 1112
 		?>
1113 1113
 
1114 1114
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1115 1115
 			<legend>
1116 1116
 				<?php
1117
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1118
-				if ( ! give_logged_in_only( $form_id ) ) {
1119
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1117
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1118
+				if ( ! give_logged_in_only($form_id)) {
1119
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1120 1120
 				}
1121 1121
 				?>
1122 1122
 			</legend>
@@ -1128,52 +1128,52 @@  discard block
 block discarded – undo
1128 1128
 			 *
1129 1129
 			 * @param int $form_id The form ID.
1130 1130
 			 */
1131
-			do_action( 'give_register_account_fields_before', $form_id );
1131
+			do_action('give_register_account_fields_before', $form_id);
1132 1132
 			?>
1133 1133
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
1134 1134
 				<label for="give-user-login-<?php echo $form_id; ?>">
1135
-					<?php esc_html_e( 'Username', 'give' ); ?>
1136
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1135
+					<?php esc_html_e('Username', 'give'); ?>
1136
+					<?php if (give_logged_in_only($form_id)) { ?>
1137 1137
 						<span class="give-required-indicator">*</span>
1138 1138
 					<?php } ?>
1139 1139
 					<span class="give-tooltip give-icon give-icon-question"
1140
-					      data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1140
+					      data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1141 1141
 				</label>
1142 1142
 
1143 1143
 				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1144 1144
 				       type="text"
1145
-				       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1145
+				       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1146 1146
 			</div>
1147 1147
 
1148 1148
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
1149 1149
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1150
-					<?php esc_html_e( 'Password', 'give' ); ?>
1151
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1150
+					<?php esc_html_e('Password', 'give'); ?>
1151
+					<?php if (give_logged_in_only($form_id)) { ?>
1152 1152
 						<span class="give-required-indicator">*</span>
1153 1153
 					<?php } ?>
1154 1154
 					<span class="give-tooltip give-icon give-icon-question"
1155
-					      data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1155
+					      data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1156 1156
 				</label>
1157 1157
 
1158 1158
 				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1159
-				       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1160
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1159
+				       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1160
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1161 1161
 			</div>
1162 1162
 
1163 1163
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1164 1164
 			     class="give-register-password form-row form-row-one-third">
1165 1165
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1166
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1167
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1166
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1167
+					<?php if (give_logged_in_only($form_id)) { ?>
1168 1168
 						<span class="give-required-indicator">*</span>
1169 1169
 					<?php } ?>
1170 1170
 					<span class="give-tooltip give-icon give-icon-question"
1171
-					      data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1171
+					      data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1172 1172
 				</label>
1173 1173
 
1174 1174
 				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1175
-				       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1176
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1175
+				       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1176
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1177 1177
 			</div>
1178 1178
 			<?php
1179 1179
 			/**
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 			 *
1184 1184
 			 * @param int $form_id The form ID.
1185 1185
 			 */
1186
-			do_action( 'give_register_account_fields_after', $form_id );
1186
+			do_action('give_register_account_fields_after', $form_id);
1187 1187
 			?>
1188 1188
 		</fieldset>
1189 1189
 
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		 *
1196 1196
 		 * @param int $form_id The form ID.
1197 1197
 		 */
1198
-		do_action( 'give_register_fields_after', $form_id );
1198
+		do_action('give_register_fields_after', $form_id);
1199 1199
 		?>
1200 1200
 
1201 1201
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 		 *
1207 1207
 		 * @since 1.7
1208 1208
 		 */
1209
-		do_action( 'give_donation_form_user_info', $form_id );
1209
+		do_action('give_donation_form_user_info', $form_id);
1210 1210
 		?>
1211 1211
 
1212 1212
 	</fieldset>
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	echo ob_get_clean();
1215 1215
 }
1216 1216
 
1217
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1217
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1218 1218
 
1219 1219
 /**
1220 1220
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1227,32 +1227,32 @@  discard block
 block discarded – undo
1227 1227
  *
1228 1228
  * @return string
1229 1229
  */
1230
-function give_get_login_fields( $form_id ) {
1230
+function give_get_login_fields($form_id) {
1231 1231
 
1232
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1233
-	$show_register_form = give_show_login_register_option( $form_id );
1232
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1233
+	$show_register_form = give_show_login_register_option($form_id);
1234 1234
 
1235 1235
 	ob_start();
1236 1236
 	?>
1237 1237
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1238
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1239
-			if ( ! give_logged_in_only( $form_id ) ) {
1240
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1238
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1239
+			if ( ! give_logged_in_only($form_id)) {
1240
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1241 1241
 			} ?>
1242 1242
 		</legend>
1243
-		<?php if ( $show_register_form == 'both' ) { ?>
1243
+		<?php if ($show_register_form == 'both') { ?>
1244 1244
 			<p class="give-new-account-link">
1245
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1246
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1245
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1246
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1247 1247
 				   data-action="give_checkout_register">
1248
-					<?php esc_html_e( 'Register', 'give' );
1249
-					if ( ! give_logged_in_only( $form_id ) ) {
1250
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1248
+					<?php esc_html_e('Register', 'give');
1249
+					if ( ! give_logged_in_only($form_id)) {
1250
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1251 1251
 					} ?>
1252 1252
 				</a>
1253 1253
 			</p>
1254 1254
 			<p class="give-loading-text">
1255
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
1255
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
1256 1256
 		<?php } ?>
1257 1257
 		<?php
1258 1258
 		/**
@@ -1262,48 +1262,48 @@  discard block
 block discarded – undo
1262 1262
 		 *
1263 1263
 		 * @param int $form_id The form ID.
1264 1264
 		 */
1265
-		do_action( 'give_checkout_login_fields_before', $form_id );
1265
+		do_action('give_checkout_login_fields_before', $form_id);
1266 1266
 		?>
1267 1267
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
1268 1268
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1269
-				<?php esc_html_e( 'Username', 'give' ); ?>
1270
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1269
+				<?php esc_html_e('Username', 'give'); ?>
1270
+				<?php if (give_logged_in_only($form_id)) { ?>
1271 1271
 					<span class="give-required-indicator">*</span>
1272 1272
 				<?php } ?>
1273 1273
 			</label>
1274 1274
 
1275
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1275
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1276 1276
 			       name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1277
-			       placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1277
+			       placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1278 1278
 		</div>
1279 1279
 
1280 1280
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
1281 1281
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1282
-				<?php esc_html_e( 'Password', 'give' ); ?>
1283
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1282
+				<?php esc_html_e('Password', 'give'); ?>
1283
+				<?php if (give_logged_in_only($form_id)) { ?>
1284 1284
 					<span class="give-required-indicator">*</span>
1285 1285
 				<?php } ?>
1286 1286
 			</label>
1287
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1287
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1288 1288
 			       type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1289
-			       placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1289
+			       placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1290 1290
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1291 1291
 		</div>
1292 1292
 
1293 1293
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1294 1294
 			 <span class="give-forgot-password ">
1295 1295
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1296
-				    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1296
+				    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1297 1297
 			 </span>
1298 1298
 		</div>
1299 1299
 
1300 1300
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1301 1301
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1302
-			       value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1303
-			<?php if ( $show_register_form !== 'login' ) { ?>
1302
+			       value="<?php esc_attr_e('Login', 'give'); ?>"/>
1303
+			<?php if ($show_register_form !== 'login') { ?>
1304 1304
 				<input type="button" data-action="give_cancel_login"
1305 1305
 				       class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1306
-				       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1306
+				       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1307 1307
 			<?php } ?>
1308 1308
 			<span class="give-loading-animation"></span>
1309 1309
 		</div>
@@ -1315,14 +1315,14 @@  discard block
 block discarded – undo
1315 1315
 		 *
1316 1316
 		 * @param int $form_id The form ID.
1317 1317
 		 */
1318
-		do_action( 'give_checkout_login_fields_after', $form_id );
1318
+		do_action('give_checkout_login_fields_after', $form_id);
1319 1319
 		?>
1320 1320
 	</fieldset><!--end #give-login-fields-->
1321 1321
 	<?php
1322 1322
 	echo ob_get_clean();
1323 1323
 }
1324 1324
 
1325
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1325
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1326 1326
 
1327 1327
 /**
1328 1328
  * Payment Mode Select.
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
  *
1339 1339
  * @return void
1340 1340
  */
1341
-function give_payment_mode_select( $form_id ) {
1341
+function give_payment_mode_select($form_id) {
1342 1342
 
1343 1343
 	$gateways = give_get_enabled_payment_gateways();
1344 1344
 
@@ -1349,10 +1349,10 @@  discard block
 block discarded – undo
1349 1349
 	 *
1350 1350
 	 * @param int $form_id The form ID.
1351 1351
 	 */
1352
-	do_action( 'give_payment_mode_top', $form_id );
1352
+	do_action('give_payment_mode_top', $form_id);
1353 1353
 	?>
1354 1354
 
1355
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1355
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1356 1356
 		echo 'style="display: none;"';
1357 1357
 	} ?>>
1358 1358
 		<?php
@@ -1363,14 +1363,14 @@  discard block
 block discarded – undo
1363 1363
 		 *
1364 1364
 		 * @param int $form_id The form ID.
1365 1365
 		 */
1366
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1366
+		do_action('give_payment_mode_before_gateways_wrap');
1367 1367
 		?>
1368 1368
 		<legend
1369
-			class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend>
1369
+			class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend>
1370 1370
 
1371 1371
 		<div id="give-payment-mode-wrap">
1372 1372
 			<span class="give-loading-text"><span
1373
-					class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1373
+					class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1374 1374
 
1375 1375
 			<?php
1376 1376
 			/**
@@ -1378,26 +1378,26 @@  discard block
 block discarded – undo
1378 1378
 			 *
1379 1379
 			 * @since 1.7
1380 1380
 			 */
1381
-			do_action( 'give_payment_mode_before_gateways' )
1381
+			do_action('give_payment_mode_before_gateways')
1382 1382
 			?>
1383 1383
 			<ul id="give-gateway-radio-list">
1384 1384
 				<?php
1385 1385
 				/**
1386 1386
 				 * Loop through the active payment gateways.
1387 1387
 				 */
1388
-				$selected_gateway = give_get_chosen_gateway( $form_id );
1388
+				$selected_gateway = give_get_chosen_gateway($form_id);
1389 1389
 
1390
-				foreach ( $gateways as $gateway_id => $gateway ) :
1390
+				foreach ($gateways as $gateway_id => $gateway) :
1391 1391
 					//Determine the default gateway.
1392
-					$checked       = checked( $gateway_id, $selected_gateway, false );
1392
+					$checked       = checked($gateway_id, $selected_gateway, false);
1393 1393
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1394 1394
 					<li<?php echo $checked_class?>>
1395 1395
 						<input type="radio" name="payment-mode" class="give-gateway"
1396
-						       id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1397
-						       value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1398
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1396
+						       id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1397
+						       value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1398
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1399 1399
 						       class="give-gateway-option"
1400
-						       id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1400
+						       id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1401 1401
 					</li>
1402 1402
 					<?php
1403 1403
 				endforeach;
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 			 *
1410 1410
 			 * @since 1.7
1411 1411
 			 */
1412
-			do_action( 'give_payment_mode_after_gateways' );
1412
+			do_action('give_payment_mode_after_gateways');
1413 1413
 			?>
1414 1414
 		</div>
1415 1415
 		<?php
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 		 *
1421 1421
 		 * @param int $form_id The form ID.
1422 1422
 		 */
1423
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1423
+		do_action('give_payment_mode_after_gateways_wrap');
1424 1424
 		?>
1425 1425
 	</fieldset>
1426 1426
 
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 	 *
1433 1433
 	 * @param int $form_id The form ID.
1434 1434
 	 */
1435
-	do_action( 'give_payment_mode_bottom', $form_id );
1435
+	do_action('give_payment_mode_bottom', $form_id);
1436 1436
 	?>
1437 1437
 
1438 1438
 	<div id="give_purchase_form_wrap">
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 		 *
1444 1444
 		 * @since 1.7
1445 1445
 		 */
1446
-		do_action( 'give_donation_form', $form_id );
1446
+		do_action('give_donation_form', $form_id);
1447 1447
 		?>
1448 1448
 
1449 1449
 	</div>
@@ -1454,10 +1454,10 @@  discard block
 block discarded – undo
1454 1454
 	 *
1455 1455
 	 * @since 1.7
1456 1456
 	 */
1457
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1457
+	do_action('give_donation_form_wrap_bottom', $form_id);
1458 1458
 }
1459 1459
 
1460
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1460
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1461 1461
 
1462 1462
 /**
1463 1463
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1470,25 +1470,25 @@  discard block
 block discarded – undo
1470 1470
  *
1471 1471
  * @return void|bool
1472 1472
  */
1473
-function give_terms_agreement( $form_id ) {
1474
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1473
+function give_terms_agreement($form_id) {
1474
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1475 1475
 
1476 1476
 	// Bailout if per form and global term and conditions is not setup.
1477
-	if ( 'yes' !== $form_option ) {
1477
+	if ('yes' !== $form_option) {
1478 1478
 		return false;
1479 1479
 	}
1480 1480
 
1481
-	$label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1482
-	$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1481
+	$label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1482
+	$terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', '');
1483 1483
 
1484 1484
 	// Set term and conditions label and text on basis of per form and global setting.
1485 1485
 	// $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1486 1486
 	// $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1487 1487
 
1488 1488
 	// Bailout: Check if term and conditions text is empty or not.
1489
-	if ( empty( $terms ) ) {
1490
-		if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
1491
-			echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) );
1489
+	if (empty($terms)) {
1490
+		if (is_user_logged_in() && current_user_can('manage_options')) {
1491
+			echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit'));
1492 1492
 		}
1493 1493
 
1494 1494
 		return false;
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 
1497 1497
 	?>
1498 1498
 	<fieldset id="give_terms_agreement">
1499
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1499
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1500 1500
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1501 1501
 			<?php
1502 1502
 			/**
@@ -1504,22 +1504,22 @@  discard block
 block discarded – undo
1504 1504
 			 *
1505 1505
 			 * @since 1.0
1506 1506
 			 */
1507
-			do_action( 'give_before_terms' );
1507
+			do_action('give_before_terms');
1508 1508
 
1509
-			echo wpautop( stripslashes( $terms ) );
1509
+			echo wpautop(stripslashes($terms));
1510 1510
 			/**
1511 1511
 			 * Fires while rendering terms of agreement, after the fields.
1512 1512
 			 *
1513 1513
 			 * @since 1.0
1514 1514
 			 */
1515
-			do_action( 'give_after_terms' );
1515
+			do_action('give_after_terms');
1516 1516
 			?>
1517 1517
 		</div>
1518 1518
 		<div id="give_show_terms">
1519 1519
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1520
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1520
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1521 1521
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1522
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1522
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1523 1523
 		</div>
1524 1524
 
1525 1525
 		<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" />
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 	<?php
1530 1530
 }
1531 1531
 
1532
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1532
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1533 1533
 
1534 1534
 /**
1535 1535
  * Checkout Final Total.
@@ -1542,29 +1542,29 @@  discard block
 block discarded – undo
1542 1542
  *
1543 1543
  * @return void
1544 1544
  */
1545
-function give_checkout_final_total( $form_id ) {
1545
+function give_checkout_final_total($form_id) {
1546 1546
 
1547
-	if ( isset( $_POST['give_total'] ) ) {
1548
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1547
+	if (isset($_POST['give_total'])) {
1548
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1549 1549
 	} else {
1550 1550
 		//default total.
1551
-		$total = give_get_default_form_amount( $form_id );
1551
+		$total = give_get_default_form_amount($form_id);
1552 1552
 	}
1553 1553
 	//Only proceed if give_total available.
1554
-	if ( empty( $total ) ) {
1554
+	if (empty($total)) {
1555 1555
 		return;
1556 1556
 	}
1557 1557
 	?>
1558 1558
 	<p id="give-final-total-wrap" class="form-wrap ">
1559 1559
 		<span
1560
-			class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1560
+			class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1561 1561
 		<span class="give-final-total-amount"
1562
-		      data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1562
+		      data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1563 1563
 	</p>
1564 1564
 	<?php
1565 1565
 }
1566 1566
 
1567
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1567
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1568 1568
 
1569 1569
 /**
1570 1570
  * Renders the Checkout Submit section.
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
  *
1576 1576
  * @return void
1577 1577
  */
1578
-function give_checkout_submit( $form_id ) {
1578
+function give_checkout_submit($form_id) {
1579 1579
 	?>
1580 1580
 	<fieldset id="give_purchase_submit">
1581 1581
 		<?php
@@ -1584,24 +1584,24 @@  discard block
 block discarded – undo
1584 1584
 		 *
1585 1585
 		 * @since 1.7
1586 1586
 		 */
1587
-		do_action( 'give_donation_form_before_submit', $form_id );
1587
+		do_action('give_donation_form_before_submit', $form_id);
1588 1588
 
1589
-		give_checkout_hidden_fields( $form_id );
1589
+		give_checkout_hidden_fields($form_id);
1590 1590
 
1591
-		echo give_checkout_button_purchase( $form_id );
1591
+		echo give_checkout_button_purchase($form_id);
1592 1592
 
1593 1593
 		/**
1594 1594
 		 * Fire after donation form submit.
1595 1595
 		 *
1596 1596
 		 * @since 1.7
1597 1597
 		 */
1598
-		do_action( 'give_donation_form_after_submit', $form_id );
1598
+		do_action('give_donation_form_after_submit', $form_id);
1599 1599
 		?>
1600 1600
 	</fieldset>
1601 1601
 	<?php
1602 1602
 }
1603 1603
 
1604
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1604
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1605 1605
 
1606 1606
 /**
1607 1607
  * Give Checkout Button.
@@ -1614,10 +1614,10 @@  discard block
 block discarded – undo
1614 1614
  *
1615 1615
  * @return string
1616 1616
  */
1617
-function give_checkout_button_purchase( $form_id ) {
1617
+function give_checkout_button_purchase($form_id) {
1618 1618
 
1619
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1620
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1619
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1620
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1621 1621
 	ob_start(); ?>
1622 1622
 	<div class="give-submit-button-wrap give-clearfix">
1623 1623
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		<span class="give-loading-animation"></span>
1626 1626
 	</div>
1627 1627
 	<?php
1628
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1628
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1629 1629
 }
1630 1630
 
1631 1631
 /**
@@ -1639,18 +1639,18 @@  discard block
 block discarded – undo
1639 1639
  *
1640 1640
  * @return void
1641 1641
  */
1642
-function give_agree_to_terms_js( $form_id ) {
1642
+function give_agree_to_terms_js($form_id) {
1643 1643
 
1644
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1644
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1645 1645
 
1646
-	if ( $form_option === 'yes' ) {
1646
+	if ($form_option === 'yes') {
1647 1647
 		?>
1648 1648
 		<script type="text/javascript">
1649 1649
 			jQuery(document).ready(function ($) {
1650
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1650
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1651 1651
 					e.preventDefault();
1652
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1653
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1652
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1653
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1654 1654
 					return false;
1655 1655
 				});
1656 1656
 			});
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
 	}
1660 1660
 }
1661 1661
 
1662
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1662
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1663 1663
 
1664 1664
 /**
1665 1665
  * Show Give Goals.
@@ -1673,17 +1673,17 @@  discard block
 block discarded – undo
1673 1673
  *
1674 1674
  * @return mixed
1675 1675
  */
1676
-function give_show_goal_progress( $form_id, $args ) {
1676
+function give_show_goal_progress($form_id, $args) {
1677 1677
 
1678 1678
 	ob_start();
1679
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1679
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1680 1680
 
1681
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1681
+	echo apply_filters('give_goal_output', ob_get_clean());
1682 1682
 
1683 1683
 	return true;
1684 1684
 }
1685 1685
 
1686
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1686
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1687 1687
 
1688 1688
 /**
1689 1689
  * Adds Actions to Render Form Content.
@@ -1695,19 +1695,19 @@  discard block
 block discarded – undo
1695 1695
  *
1696 1696
  * @return void
1697 1697
  */
1698
-function give_form_content( $form_id, $args ) {
1698
+function give_form_content($form_id, $args) {
1699 1699
 
1700
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1700
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1701 1701
 		? $args['show_content']
1702
-		: get_post_meta( $form_id, '_give_content_option', true );
1702
+		: get_post_meta($form_id, '_give_content_option', true);
1703 1703
 
1704
-	if ( $show_content !== 'none' ) {
1704
+	if ($show_content !== 'none') {
1705 1705
 		//add action according to value.
1706
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1706
+		add_action($show_content, 'give_form_display_content', 10, 2);
1707 1707
 	}
1708 1708
 }
1709 1709
 
1710
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1710
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1711 1711
 
1712 1712
 /**
1713 1713
  * Renders Post Form Content.
@@ -1721,24 +1721,24 @@  discard block
 block discarded – undo
1721 1721
  *
1722 1722
  * @return void
1723 1723
  */
1724
-function give_form_display_content( $form_id, $args ) {
1724
+function give_form_display_content($form_id, $args) {
1725 1725
 
1726
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1727
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1726
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1727
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1728 1728
 		? $args['show_content']
1729
-		: get_post_meta( $form_id, '_give_content_option', true );
1729
+		: get_post_meta($form_id, '_give_content_option', true);
1730 1730
 
1731
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1732
-		$content = apply_filters( 'the_content', $content );
1731
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1732
+		$content = apply_filters('the_content', $content);
1733 1733
 	}
1734 1734
 
1735
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1735
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1736 1736
 
1737
-	echo apply_filters( 'give_form_content_output', $output );
1737
+	echo apply_filters('give_form_content_output', $output);
1738 1738
 
1739 1739
 	//remove action to prevent content output on addition forms on page.
1740 1740
 	//@see: https://github.com/WordImpress/Give/issues/634.
1741
-	remove_action( $show_content, 'give_form_display_content' );
1741
+	remove_action($show_content, 'give_form_display_content');
1742 1742
 }
1743 1743
 
1744 1744
 /**
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
  *
1751 1751
  * @return void
1752 1752
  */
1753
-function give_checkout_hidden_fields( $form_id ) {
1753
+function give_checkout_hidden_fields($form_id) {
1754 1754
 
1755 1755
 	/**
1756 1756
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1759,13 +1759,13 @@  discard block
 block discarded – undo
1759 1759
 	 *
1760 1760
 	 * @param int $form_id The form ID.
1761 1761
 	 */
1762
-	do_action( 'give_hidden_fields_before', $form_id );
1762
+	do_action('give_hidden_fields_before', $form_id);
1763 1763
 
1764
-	if ( is_user_logged_in() ) { ?>
1764
+	if (is_user_logged_in()) { ?>
1765 1765
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1766 1766
 	<?php } ?>
1767 1767
 	<input type="hidden" name="give_action" value="purchase"/>
1768
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1768
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1769 1769
 	<?php
1770 1770
 	/**
1771 1771
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
 	 *
1775 1775
 	 * @param int $form_id The form ID.
1776 1776
 	 */
1777
-	do_action( 'give_hidden_fields_after', $form_id );
1777
+	do_action('give_hidden_fields_after', $form_id);
1778 1778
 
1779 1779
 }
1780 1780
 
@@ -1789,20 +1789,20 @@  discard block
 block discarded – undo
1789 1789
  *
1790 1790
  * @return string $content Filtered content.
1791 1791
  */
1792
-function give_filter_success_page_content( $content ) {
1792
+function give_filter_success_page_content($content) {
1793 1793
 
1794 1794
 	$give_options = give_get_settings();
1795 1795
 
1796
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1797
-		if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) {
1798
-			$content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content );
1796
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1797
+		if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) {
1798
+			$content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content);
1799 1799
 		}
1800 1800
 	}
1801 1801
 
1802 1802
 	return $content;
1803 1803
 }
1804 1804
 
1805
-add_filter( 'the_content', 'give_filter_success_page_content' );
1805
+add_filter('the_content', 'give_filter_success_page_content');
1806 1806
 
1807 1807
 /**
1808 1808
  * Test Mode Frontend Warning.
@@ -1813,12 +1813,12 @@  discard block
 block discarded – undo
1813 1813
  */
1814 1814
 function give_test_mode_frontend_warning() {
1815 1815
 
1816
-	if ( give_is_test_mode() ) {
1817
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1816
+	if (give_is_test_mode()) {
1817
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1818 1818
 	}
1819 1819
 }
1820 1820
 
1821
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1821
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1822 1822
 
1823 1823
 /**
1824 1824
  * Members-only Form.
@@ -1832,21 +1832,21 @@  discard block
 block discarded – undo
1832 1832
  *
1833 1833
  * @return string
1834 1834
  */
1835
-function give_members_only_form( $final_output, $args ) {
1835
+function give_members_only_form($final_output, $args) {
1836 1836
 
1837
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1837
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1838 1838
 
1839 1839
 	//Sanity Check: Must have form_id & not be logged in.
1840
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1840
+	if (empty($form_id) || is_user_logged_in()) {
1841 1841
 		return $final_output;
1842 1842
 	}
1843 1843
 
1844 1844
 	//Logged in only and Register / Login set to none.
1845
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1845
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1846 1846
 
1847
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1847
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1848 1848
 
1849
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1849
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1850 1850
 
1851 1851
 	}
1852 1852
 
@@ -1854,4 +1854,4 @@  discard block
 block discarded – undo
1854 1854
 
1855 1855
 }
1856 1856
 
1857
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1857
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Payment.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_payment( $payment_data ) {
35
+function give_process_paypal_payment($payment_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $payment_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($payment_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
42
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect Give's payment data.
45 45
 	$insert_payment_args = array(
@@ -57,101 +57,101 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment_id = give_insert_payment( $insert_payment_args );
60
+	$payment_id = give_insert_payment($insert_payment_args);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment_id ) {
63
+	if ( ! $payment_id) {
64 64
 		// Record the error.
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 			/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment_id
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
76 76
 
77 77
 	} else {
78 78
 
79 79
 		// Only send to PayPal if the pending payment is created successfully.
80
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
80
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
81 81
 
82 82
 		// Get the success url.
83
-		$return_url = add_query_arg( array(
83
+		$return_url = add_query_arg(array(
84 84
 			'payment-confirmation' => 'paypal',
85 85
 			'payment-id'           => $payment_id
86 86
 
87
-		), get_permalink( give_get_option( 'success_page' ) ) );
87
+		), get_permalink(give_get_option('success_page')));
88 88
 
89 89
 		// Get the PayPal redirect uri.
90
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
90
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
91 91
 
92 92
 		//Item name - pass level name if variable priced.
93 93
 		$item_name = $payment_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices.
96
-		if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
101 101
 
102 102
 			//Donation given doesn't match selected level (must be a custom amount).
103
-			if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
104
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 				//user custom amount text if any, fallback to default if not.
106
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
106
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
107 107
 
108 108
 			} //Is there any donation level text?
109
-			elseif ( ! empty( $item_price_level_text ) ) {
110
-				$item_name .= ' - ' . $item_price_level_text;
109
+			elseif ( ! empty($item_price_level_text)) {
110
+				$item_name .= ' - '.$item_price_level_text;
111 111
 			}
112 112
 
113 113
 		} //Single donation: Custom Amount.
114
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
115
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
114
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
115
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
116 116
 			//user custom amount text if any, fallback to default if not.
117
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
117
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
118 118
 		}
119 119
 
120 120
 		// Setup PayPal API params.
121 121
 		$paypal_args = array(
122
-			'business'      => give_get_option( 'paypal_email', false ),
122
+			'business'      => give_get_option('paypal_email', false),
123 123
 			'first_name'    => $payment_data['user_info']['first_name'],
124 124
 			'last_name'     => $payment_data['user_info']['last_name'],
125 125
 			'email'         => $payment_data['user_email'],
126 126
 			'invoice'       => $payment_data['purchase_key'],
127 127
 			'amount'        => $payment_data['price'],
128
-			'item_name'     => stripslashes( $item_name ),
128
+			'item_name'     => stripslashes($item_name),
129 129
 			'no_shipping'   => '1',
130 130
 			'shipping'      => '0',
131 131
 			'no_note'       => '1',
132 132
 			'currency_code' => give_get_currency(),
133
-			'charset'       => get_bloginfo( 'charset' ),
133
+			'charset'       => get_bloginfo('charset'),
134 134
 			'custom'        => $payment_id,
135 135
 			'rm'            => '2',
136 136
 			'return'        => $return_url,
137
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
137
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
138 138
 			'notify_url'    => $listener_url,
139 139
 			'page_style'    => give_get_paypal_page_style(),
140
-			'cbt'           => get_bloginfo( 'name' ),
140
+			'cbt'           => get_bloginfo('name'),
141 141
 			'bn'            => 'givewp_SP'
142 142
 		);
143 143
 
144 144
 		//Add user address if present.
145
-		if ( ! empty( $payment_data['user_info']['address'] ) ) {
146
-			$paypal_args['address1'] = isset( $payment_data['user_info']['address']['line1'] ) ? $payment_data['user_info']['address']['line1'] : '';
147
-			$paypal_args['address2'] = isset( $payment_data['user_info']['address']['line2'] ) ? $payment_data['user_info']['address']['line2'] : '';
148
-			$paypal_args['city']     = isset( $payment_data['user_info']['address']['city'] ) ? $payment_data['user_info']['address']['city'] : '';
149
-			$paypal_args['state']    = isset( $payment_data['user_info']['address']['state'] ) ? $payment_data['user_info']['address']['state'] : '';
150
-			$paypal_args['country']  = isset( $payment_data['user_info']['address']['country'] ) ? $payment_data['user_info']['address']['country'] : '';
145
+		if ( ! empty($payment_data['user_info']['address'])) {
146
+			$paypal_args['address1'] = isset($payment_data['user_info']['address']['line1']) ? $payment_data['user_info']['address']['line1'] : '';
147
+			$paypal_args['address2'] = isset($payment_data['user_info']['address']['line2']) ? $payment_data['user_info']['address']['line2'] : '';
148
+			$paypal_args['city']     = isset($payment_data['user_info']['address']['city']) ? $payment_data['user_info']['address']['city'] : '';
149
+			$paypal_args['state']    = isset($payment_data['user_info']['address']['state']) ? $payment_data['user_info']['address']['state'] : '';
150
+			$paypal_args['country']  = isset($payment_data['user_info']['address']['country']) ? $payment_data['user_info']['address']['country'] : '';
151 151
 		}
152 152
 
153 153
 		//Donations or regular transactions?
154
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
154
+		if (give_get_option('paypal_button_type') === 'standard') {
155 155
 			$paypal_extra_args = array(
156 156
 				'cmd' => '_xclick',
157 157
 			);
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 			);
162 162
 		}
163 163
 
164
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
165
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
164
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
165
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
166 166
 
167 167
 		// Build query.
168
-		$paypal_redirect .= http_build_query( $paypal_args );
168
+		$paypal_redirect .= http_build_query($paypal_args);
169 169
 
170 170
 		// Fix for some sites that encode the entities.
171
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
171
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
172 172
 
173 173
 		// Redirect to PayPal.
174
-		wp_redirect( $paypal_redirect );
174
+		wp_redirect($paypal_redirect);
175 175
 		exit;
176 176
 	}
177 177
 
178 178
 }
179 179
 
180
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
180
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
181 181
 
182 182
 /**
183 183
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function give_listen_for_paypal_ipn() {
189 189
 	// Regular PayPal IPN
190
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
190
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
191 191
 		/**
192 192
 		 * Fires while verifying PayPal IPN
193 193
 		 *
194 194
 		 * @since 1.0
195 195
 		 */
196
-		do_action( 'give_verify_paypal_ipn' );
196
+		do_action('give_verify_paypal_ipn');
197 197
 	}
198 198
 }
199 199
 
200
-add_action( 'init', 'give_listen_for_paypal_ipn' );
200
+add_action('init', 'give_listen_for_paypal_ipn');
201 201
 
202 202
 /**
203 203
  * Process PayPal IPN
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 function give_process_paypal_ipn() {
209 209
 
210 210
 	// Check the request method is POST
211
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
211
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
212 212
 		return;
213 213
 	}
214 214
 
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	$post_data = '';
217 217
 
218 218
 	// Fallback just in case post_max_size is lower than needed
219
-	if ( ini_get( 'allow_url_fopen' ) ) {
220
-		$post_data = file_get_contents( 'php://input' );
219
+	if (ini_get('allow_url_fopen')) {
220
+		$post_data = file_get_contents('php://input');
221 221
 	} else {
222 222
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
223
-		ini_set( 'post_max_size', '12M' );
223
+		ini_set('post_max_size', '12M');
224 224
 	}
225 225
 	// Start the encoded data collection with notification command
226 226
 	$encoded_data = 'cmd=_notify-validate';
@@ -229,40 +229,40 @@  discard block
 block discarded – undo
229 229
 	$arg_separator = give_get_php_arg_separator_output();
230 230
 
231 231
 	// Verify there is a post_data
232
-	if ( $post_data || strlen( $post_data ) > 0 ) {
232
+	if ($post_data || strlen($post_data) > 0) {
233 233
 		// Append the data
234
-		$encoded_data .= $arg_separator . $post_data;
234
+		$encoded_data .= $arg_separator.$post_data;
235 235
 	} else {
236 236
 		// Check if POST is empty
237
-		if ( empty( $_POST ) ) {
237
+		if (empty($_POST)) {
238 238
 			// Nothing to do
239 239
 			return;
240 240
 		} else {
241 241
 			// Loop through each POST
242
-			foreach ( $_POST as $key => $value ) {
242
+			foreach ($_POST as $key => $value) {
243 243
 				// Encode the value and append the data.
244
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
244
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
245 245
 			}
246 246
 		}
247 247
 	}
248 248
 
249 249
 	// Convert collected post data to an array.
250
-	parse_str( $encoded_data, $encoded_data_array );
250
+	parse_str($encoded_data, $encoded_data_array);
251 251
 
252
-	foreach ( $encoded_data_array as $key => $value ) {
252
+	foreach ($encoded_data_array as $key => $value) {
253 253
 
254
-		if ( false !== strpos( $key, 'amp;' ) ) {
255
-			$new_key = str_replace( '&amp;', '&', $key );
256
-			$new_key = str_replace( 'amp;', '&', $new_key );
254
+		if (false !== strpos($key, 'amp;')) {
255
+			$new_key = str_replace('&amp;', '&', $key);
256
+			$new_key = str_replace('amp;', '&', $new_key);
257 257
 
258
-			unset( $encoded_data_array[ $key ] );
259
-			$encoded_data_array[ $new_key ] = $value;
258
+			unset($encoded_data_array[$key]);
259
+			$encoded_data_array[$new_key] = $value;
260 260
 		}
261 261
 
262 262
 	}
263 263
 
264 264
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure.
265
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
265
+	if ( ! give_get_option('disable_paypal_verification')) {
266 266
 
267 267
 		$remote_post_vars = array(
268 268
 			'method'      => 'POST',
@@ -282,28 +282,28 @@  discard block
 block discarded – undo
282 282
 		);
283 283
 
284 284
 		// Validate the IPN.
285
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
285
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
286 286
 
287
-		if ( is_wp_error( $api_response ) ) {
287
+		if (is_wp_error($api_response)) {
288 288
 			give_record_gateway_error(
289
-				esc_html__( 'IPN Error', 'give' ),
289
+				esc_html__('IPN Error', 'give'),
290 290
 				sprintf(
291 291
 				/* translators: %s: Paypal IPN response */
292
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
293
-					json_encode( $api_response )
292
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
293
+					json_encode($api_response)
294 294
 				)
295 295
 			);
296 296
 
297 297
 			return; // Something went wrong
298 298
 		}
299 299
 
300
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
300
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
301 301
 			give_record_gateway_error(
302
-				esc_html__( 'IPN Error', 'give' ),
302
+				esc_html__('IPN Error', 'give'),
303 303
 				sprintf(
304 304
 				/* translators: %s: Paypal IPN response */
305
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
306
-					json_encode( $api_response )
305
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
306
+					json_encode($api_response)
307 307
 				)
308 308
 			);
309 309
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	}
314 314
 
315 315
 	// Check if $post_data_array has been populated
316
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
316
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
317 317
 		return;
318 318
 	}
319 319
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		'payment_status' => ''
323 323
 	);
324 324
 
325
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
325
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
326 326
 
327
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
327
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
328 328
 	$txn_type   = $encoded_data_array['txn_type'];
329 329
 
330
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
330
+	if (has_action('give_paypal_'.$txn_type)) {
331 331
 		/**
332 332
 		 * Fires while processing PayPal IPN $txn_type.
333 333
 		 *
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @param array $encoded_data_array Encoded data.
339 339
 		 * @param int   $payment_id         Payment id.
340 340
 		 */
341
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
341
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
342 342
 	} else {
343 343
 		/**
344 344
 		 * Fires while process PayPal IPN.
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 		 * @param array $encoded_data_array Encoded data.
351 351
 		 * @param int   $payment_id         Payment id.
352 352
 		 */
353
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
353
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
354 354
 	}
355 355
 	exit;
356 356
 }
357 357
 
358
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
358
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
359 359
 
360 360
 /**
361 361
  * Process web accept (one time) payment IPNs.
@@ -367,128 +367,128 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @return void
369 369
  */
370
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
370
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
371 371
 
372 372
 	//Only allow through these transaction types.
373
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) {
373
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
374 374
 		return;
375 375
 	}
376 376
 
377 377
 	//Need $payment_id to continue.
378
-	if ( empty( $payment_id ) ) {
378
+	if (empty($payment_id)) {
379 379
 		return;
380 380
 	}
381 381
 
382 382
 	// Collect donation payment details.
383 383
 	$paypal_amount  = $data['mc_gross'];
384
-	$payment_status = strtolower( $data['payment_status'] );
385
-	$currency_code  = strtolower( $data['mc_currency'] );
386
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
387
-	$payment_meta   = give_get_payment_meta( $payment_id );
384
+	$payment_status = strtolower($data['payment_status']);
385
+	$currency_code  = strtolower($data['mc_currency']);
386
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
387
+	$payment_meta   = give_get_payment_meta($payment_id);
388 388
 
389 389
 	// Must be a PayPal standard IPN.
390
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
390
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
391 391
 		return;
392 392
 	}
393 393
 
394 394
 	// Verify payment recipient
395
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
395
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
396 396
 
397 397
 		give_record_gateway_error(
398
-			esc_html__( 'IPN Error', 'give' ),
398
+			esc_html__('IPN Error', 'give'),
399 399
 			sprintf(
400 400
 			/* translators: %s: Paypal IPN response */
401
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
402
-				json_encode( $data )
401
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
402
+				json_encode($data)
403 403
 			),
404 404
 			$payment_id
405 405
 		);
406
-		give_update_payment_status( $payment_id, 'failed' );
407
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
406
+		give_update_payment_status($payment_id, 'failed');
407
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
408 408
 
409 409
 		return;
410 410
 	}
411 411
 
412 412
 	// Verify payment currency.
413
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
413
+	if ($currency_code != strtolower($payment_meta['currency'])) {
414 414
 
415 415
 		give_record_gateway_error(
416
-			esc_html__( 'IPN Error', 'give' ),
416
+			esc_html__('IPN Error', 'give'),
417 417
 			sprintf(
418 418
 			/* translators: %s: Paypal IPN response */
419
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
420
-				json_encode( $data )
419
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
420
+				json_encode($data)
421 421
 			),
422 422
 			$payment_id
423 423
 		);
424
-		give_update_payment_status( $payment_id, 'failed' );
425
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
424
+		give_update_payment_status($payment_id, 'failed');
425
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
426 426
 
427 427
 		return;
428 428
 	}
429 429
 
430 430
 	//Process refunds & reversed.
431
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
432
-		give_process_paypal_refund( $data, $payment_id );
431
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
432
+		give_process_paypal_refund($data, $payment_id);
433 433
 
434 434
 		return;
435 435
 	}
436 436
 
437 437
 	// Only complete payments once.
438
-	if ( get_post_status( $payment_id ) == 'publish' ) {
438
+	if (get_post_status($payment_id) == 'publish') {
439 439
 		return;
440 440
 	}
441 441
 
442 442
 	// Retrieve the total donation amount (before PayPal).
443
-	$payment_amount = give_get_payment_amount( $payment_id );
443
+	$payment_amount = give_get_payment_amount($payment_id);
444 444
 
445 445
 	//Check that the donation PP and local db amounts match.
446
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
446
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
447 447
 		// The prices don't match
448 448
 		give_record_gateway_error(
449
-			esc_html__( 'IPN Error', 'give' ),
449
+			esc_html__('IPN Error', 'give'),
450 450
 			sprintf(
451 451
 			/* translators: %s: Paypal IPN response */
452
-				esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
453
-				json_encode( $data )
452
+				esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
453
+				json_encode($data)
454 454
 			),
455 455
 			$payment_id
456 456
 		);
457
-		give_update_payment_status( $payment_id, 'failed' );
458
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
457
+		give_update_payment_status($payment_id, 'failed');
458
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
459 459
 
460 460
 		return;
461 461
 	}
462 462
 
463 463
 	//Process completed donations.
464
-	if ( $payment_status == 'completed' || give_is_test_mode() ) {
464
+	if ($payment_status == 'completed' || give_is_test_mode()) {
465 465
 
466 466
 		give_insert_payment_note(
467 467
 			$payment_id,
468 468
 			sprintf(
469 469
 			/* translators: %s: Paypal transaction ID */
470
-				esc_html__( 'PayPal Transaction ID: %s', 'give' ),
470
+				esc_html__('PayPal Transaction ID: %s', 'give'),
471 471
 				$data['txn_id']
472 472
 			)
473 473
 		);
474
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
475
-		give_update_payment_status( $payment_id, 'publish' );
474
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
475
+		give_update_payment_status($payment_id, 'publish');
476 476
 
477
-	} elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
477
+	} elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
478 478
 
479 479
 		// Look for possible pending reasons, such as an echeck.
480
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
480
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
481 481
 
482
-		if ( ! empty( $note ) ) {
482
+		if ( ! empty($note)) {
483 483
 
484
-			give_insert_payment_note( $payment_id, $note );
484
+			give_insert_payment_note($payment_id, $note);
485 485
 
486 486
 		}
487 487
 	}
488 488
 
489 489
 }
490 490
 
491
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
491
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
492 492
 
493 493
 /**
494 494
  * Process PayPal IPN Refunds
@@ -500,28 +500,28 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return void
502 502
  */
503
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
503
+function give_process_paypal_refund($data, $payment_id = 0) {
504 504
 
505 505
 	// Collect payment details
506 506
 
507
-	if ( empty( $payment_id ) ) {
507
+	if (empty($payment_id)) {
508 508
 		return;
509 509
 	}
510 510
 
511
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
511
+	if (get_post_status($payment_id) == 'refunded') {
512 512
 		return; // Only refund payments once
513 513
 	}
514 514
 
515
-	$payment_amount = give_get_payment_amount( $payment_id );
515
+	$payment_amount = give_get_payment_amount($payment_id);
516 516
 	$refund_amount  = $data['payment_gross'] * - 1;
517 517
 
518
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
518
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
519 519
 
520 520
 		give_insert_payment_note(
521 521
 			$payment_id,
522 522
 			sprintf(
523 523
 			/* translators: %s: Paypal parent transaction ID */
524
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
524
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
525 525
 				$data['parent_txn_id']
526 526
 			)
527 527
 		);
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		$payment_id,
535 535
 		sprintf(
536 536
 		/* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
537
-			esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ),
537
+			esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'),
538 538
 			$data['parent_txn_id'],
539 539
 			$data['reason_code']
540 540
 		)
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		$payment_id,
544 544
 		sprintf(
545 545
 		/* translators: %s: Paypal transaction ID */
546
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
546
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
547 547
 			$data['txn_id']
548 548
 		)
549 549
 	);
550
-	give_update_payment_status( $payment_id, 'refunded' );
550
+	give_update_payment_status($payment_id, 'refunded');
551 551
 }
552 552
 
553 553
 /**
@@ -559,24 +559,24 @@  discard block
 block discarded – undo
559 559
  *
560 560
  * @return string
561 561
  */
562
-function give_get_paypal_redirect( $ssl_check = false ) {
562
+function give_get_paypal_redirect($ssl_check = false) {
563 563
 
564
-	if ( is_ssl() || ! $ssl_check ) {
564
+	if (is_ssl() || ! $ssl_check) {
565 565
 		$protocal = 'https://';
566 566
 	} else {
567 567
 		$protocal = 'http://';
568 568
 	}
569 569
 
570 570
 	// Check the current payment mode
571
-	if ( give_is_test_mode() ) {
571
+	if (give_is_test_mode()) {
572 572
 		// Test mode
573
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
573
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
574 574
 	} else {
575 575
 		// Live mode
576
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
576
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
577 577
 	}
578 578
 
579
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
579
+	return apply_filters('give_paypal_uri', $paypal_uri);
580 580
 }
581 581
 
582 582
 /**
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
  * @return string
587 587
  */
588 588
 function give_get_paypal_page_style() {
589
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
589
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
590 590
 
591
-	return apply_filters( 'give_paypal_page_style', $page_style );
591
+	return apply_filters('give_paypal_page_style', $page_style);
592 592
 }
593 593
 
594 594
 /**
@@ -603,26 +603,26 @@  discard block
 block discarded – undo
603 603
  * @return string
604 604
  *
605 605
  */
606
-function give_paypal_success_page_content( $content ) {
606
+function give_paypal_success_page_content($content) {
607 607
 
608
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
608
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
609 609
 		return $content;
610 610
 	}
611 611
 
612
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
612
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
613 613
 
614
-	if ( ! $payment_id ) {
614
+	if ( ! $payment_id) {
615 615
 		$session    = give_get_purchase_session();
616
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
616
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
617 617
 	}
618 618
 
619
-	$payment = get_post( $payment_id );
620
-	if ( $payment && 'pending' == $payment->post_status ) {
619
+	$payment = get_post($payment_id);
620
+	if ($payment && 'pending' == $payment->post_status) {
621 621
 
622 622
 		// Payment is still pending so show processing indicator to fix the race condition.
623 623
 		ob_start();
624 624
 
625
-		give_get_template_part( 'payment', 'processing' );
625
+		give_get_template_part('payment', 'processing');
626 626
 
627 627
 		$content = ob_get_clean();
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
 }
634 634
 
635
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
635
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
636 636
 
637 637
 /**
638 638
  * Given a Payment ID, extract the transaction ID
@@ -643,22 +643,22 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return string                   Transaction ID
645 645
  */
646
-function give_paypal_get_payment_transaction_id( $payment_id ) {
646
+function give_paypal_get_payment_transaction_id($payment_id) {
647 647
 
648 648
 	$transaction_id = '';
649
-	$notes          = give_get_payment_notes( $payment_id );
649
+	$notes          = give_get_payment_notes($payment_id);
650 650
 
651
-	foreach ( $notes as $note ) {
652
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
651
+	foreach ($notes as $note) {
652
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
653 653
 			$transaction_id = $match[1];
654 654
 			continue;
655 655
 		}
656 656
 	}
657 657
 
658
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
658
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
659 659
 }
660 660
 
661
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
661
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
662 662
 
663 663
 /**
664 664
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -670,16 +670,16 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string                 A link to the PayPal transaction details
672 672
  */
673
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
673
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
674 674
 
675 675
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
676
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
676
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
677 677
 
678
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
678
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
679 679
 
680 680
 }
681 681
 
682
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
682
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
683 683
 
684 684
 
685 685
 /**
@@ -691,64 +691,64 @@  discard block
 block discarded – undo
691 691
  *
692 692
  * @return string
693 693
  */
694
-function give_paypal_get_pending_donation_note( $pending_reason ) {
694
+function give_paypal_get_pending_donation_note($pending_reason) {
695 695
 
696 696
 	$note = '';
697 697
 
698
-	switch ( $pending_reason ) {
698
+	switch ($pending_reason) {
699 699
 
700 700
 		case 'echeck' :
701 701
 
702
-			$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
702
+			$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
703 703
 
704 704
 			break;
705 705
 
706 706
 		case 'address' :
707 707
 
708
-			$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
708
+			$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
709 709
 
710 710
 			break;
711 711
 
712 712
 		case 'intl' :
713 713
 
714
-			$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
714
+			$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
715 715
 
716 716
 			break;
717 717
 
718 718
 		case 'multi-currency' :
719 719
 
720
-			$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
720
+			$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
721 721
 
722 722
 			break;
723 723
 
724 724
 		case 'paymentreview' :
725 725
 		case 'regulatory_review' :
726 726
 
727
-			$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
727
+			$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
728 728
 
729 729
 			break;
730 730
 
731 731
 		case 'unilateral' :
732 732
 
733
-			$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
733
+			$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
734 734
 
735 735
 			break;
736 736
 
737 737
 		case 'upgrade' :
738 738
 
739
-			$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
739
+			$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
740 740
 
741 741
 			break;
742 742
 
743 743
 		case 'verify' :
744 744
 
745
-			$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
745
+			$note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
746 746
 
747 747
 			break;
748 748
 
749 749
 		case 'other' :
750 750
 
751
-			$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
751
+			$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
752 752
 
753 753
 			break;
754 754
 
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +140 added lines, -140 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 transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', '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 ) {
63
-			$options[0] = esc_html__( 'Select a donation', 'give' );
64
-			foreach ( $payments as $payment ) {
62
+		if ($payments) {
63
+			$options[0] = esc_html__('Select a donation', 'give');
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] = esc_html__( 'No donations found.', 'give' );
70
+			$options[0] = esc_html__('No donations found.', 'give');
71 71
 		}
72 72
 
73 73
 
74
-		$output = $this->select( array(
74
+		$output = $this->select(array(
75 75
 			'name'             => $args['name'],
76 76
 			'selected'         => $args['selected'],
77 77
 			'id'               => $args['id'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'select_atts'      => $args['select_atts'],
84 84
 			'show_option_all'  => false,
85 85
 			'show_option_none' => false
86
-		) );
86
+		));
87 87
 
88 88
 		return $output;
89 89
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string      Give forms dropdown.
102 102
 	 */
103
-	public function forms_dropdown( $args = array() ) {
103
+	public function forms_dropdown($args = array()) {
104 104
 
105 105
 		$defaults = array(
106 106
 			'name'        => 'forms',
@@ -110,43 +110,43 @@  discard block
 block discarded – undo
110 110
 			'selected'    => 0,
111 111
 			'chosen'      => false,
112 112
 			'number'      => 30,
113
-			'placeholder' => esc_attr__( 'Select a Donation Form', 'give' )
113
+			'placeholder' => esc_attr__('Select a Donation Form', 'give')
114 114
 		);
115 115
 
116
-		$args = wp_parse_args( $args, $defaults );
116
+		$args = wp_parse_args($args, $defaults);
117 117
 
118
-		$forms = get_posts( array(
118
+		$forms = get_posts(array(
119 119
 			'post_type'      => 'give_forms',
120 120
 			'orderby'        => 'title',
121 121
 			'order'          => 'ASC',
122 122
 			'posts_per_page' => $args['number']
123
-		) );
123
+		));
124 124
 
125 125
 		$options = array();
126 126
 
127
-		if ( $forms ) {
128
-			$options[0] = esc_attr__( 'Select a Donation Form', 'give' );
129
-			foreach ( $forms as $form ) {
130
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
127
+		if ($forms) {
128
+			$options[0] = esc_attr__('Select a Donation Form', 'give');
129
+			foreach ($forms as $form) {
130
+				$options[absint($form->ID)] = esc_html($form->post_title);
131 131
 			}
132 132
 		} else {
133
-			$options[0] = esc_html__( 'No forms found.', 'give' );
133
+			$options[0] = esc_html__('No forms found.', 'give');
134 134
 		}
135 135
 
136 136
 		// This ensures that any selected forms are included in the drop down
137
-		if ( is_array( $args['selected'] ) ) {
138
-			foreach ( $args['selected'] as $item ) {
139
-				if ( ! in_array( $item, $options ) ) {
140
-					$options[ $item ] = get_the_title( $item );
137
+		if (is_array($args['selected'])) {
138
+			foreach ($args['selected'] as $item) {
139
+				if ( ! in_array($item, $options)) {
140
+					$options[$item] = get_the_title($item);
141 141
 				}
142 142
 			}
143
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
144
-			if ( ! in_array( $args['selected'], $options ) ) {
145
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
143
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
144
+			if ( ! in_array($args['selected'], $options)) {
145
+				$options[$args['selected']] = get_the_title($args['selected']);
146 146
 			}
147 147
 		}
148 148
 
149
-		$output = $this->select( array(
149
+		$output = $this->select(array(
150 150
 			'name'             => $args['name'],
151 151
 			'selected'         => $args['selected'],
152 152
 			'id'               => $args['id'],
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			'placeholder'      => $args['placeholder'],
158 158
 			'show_option_all'  => false,
159 159
 			'show_option_none' => false
160
-		) );
160
+		));
161 161
 
162 162
 		return $output;
163 163
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @return string      Donors dropdown.
176 176
 	 */
177
-	public function donor_dropdown( $args = array() ) {
177
+	public function donor_dropdown($args = array()) {
178 178
 
179 179
 		$defaults = array(
180 180
 			'name'        => 'customers',
@@ -183,38 +183,38 @@  discard block
 block discarded – undo
183 183
 			'multiple'    => false,
184 184
 			'selected'    => 0,
185 185
 			'chosen'      => true,
186
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
186
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
187 187
 			'number'      => 30
188 188
 		);
189 189
 
190
-		$args = wp_parse_args( $args, $defaults );
190
+		$args = wp_parse_args($args, $defaults);
191 191
 
192
-		$customers = Give()->customers->get_customers( array(
192
+		$customers = Give()->customers->get_customers(array(
193 193
 			'number' => $args['number']
194
-		) );
194
+		));
195 195
 
196 196
 		$options = array();
197 197
 
198
-		if ( $customers ) {
199
-			$options[0] = esc_html__( 'No donor attached', 'give' );
200
-			foreach ( $customers as $customer ) {
201
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
198
+		if ($customers) {
199
+			$options[0] = esc_html__('No donor attached', 'give');
200
+			foreach ($customers as $customer) {
201
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
202 202
 			}
203 203
 		} else {
204
-			$options[0] = esc_html__( 'No donors found.', 'give' );
204
+			$options[0] = esc_html__('No donors found.', 'give');
205 205
 		}
206 206
 
207
-		if ( ! empty( $args['selected'] ) ) {
207
+		if ( ! empty($args['selected'])) {
208 208
 
209 209
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
210 210
 
211
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
211
+			if ( ! array_key_exists($args['selected'], $options)) {
212 212
 
213
-				$customer = new Give_Customer( $args['selected'] );
213
+				$customer = new Give_Customer($args['selected']);
214 214
 
215
-				if ( $customer ) {
215
+				if ($customer) {
216 216
 
217
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
217
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
218 218
 
219 219
 				}
220 220
 
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 
223 223
 		}
224 224
 
225
-		$output = $this->select( array(
225
+		$output = $this->select(array(
226 226
 			'name'             => $args['name'],
227 227
 			'selected'         => $args['selected'],
228 228
 			'id'               => $args['id'],
229
-			'class'            => $args['class'] . ' give-customer-select',
229
+			'class'            => $args['class'].' give-customer-select',
230 230
 			'options'          => $options,
231 231
 			'multiple'         => $args['multiple'],
232 232
 			'chosen'           => $args['chosen'],
233 233
 			'show_option_all'  => false,
234 234
 			'show_option_none' => false
235
-		) );
235
+		));
236 236
 
237 237
 		return $output;
238 238
 	}
@@ -250,21 +250,21 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return string           Categories dropdown.
252 252
 	 */
253
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
254
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
253
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
254
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
255 255
 		$options    = array();
256 256
 
257
-		foreach ( $categories as $category ) {
258
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
257
+		foreach ($categories as $category) {
258
+			$options[absint($category->term_id)] = esc_html($category->name);
259 259
 		}
260 260
 
261
-		$output = $this->select( array(
261
+		$output = $this->select(array(
262 262
 			'name'             => $name,
263 263
 			'selected'         => $selected,
264 264
 			'options'          => $options,
265
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
265
+			'show_option_all'  => esc_html__('All Categories', 'give'),
266 266
 			'show_option_none' => false
267
-		) );
267
+		));
268 268
 
269 269
 		return $output;
270 270
 	}
@@ -284,25 +284,25 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return string               Years dropdown.
286 286
 	 */
287
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
288
-		$current    = date( 'Y' );
289
-		$start_year = $current - absint( $years_before );
290
-		$end_year   = $current + absint( $years_after );
291
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
287
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
288
+		$current    = date('Y');
289
+		$start_year = $current - absint($years_before);
290
+		$end_year   = $current + absint($years_after);
291
+		$selected   = empty($selected) ? date('Y') : $selected;
292 292
 		$options    = array();
293 293
 
294
-		while ( $start_year <= $end_year ) {
295
-			$options[ absint( $start_year ) ] = $start_year;
296
-			$start_year ++;
294
+		while ($start_year <= $end_year) {
295
+			$options[absint($start_year)] = $start_year;
296
+			$start_year++;
297 297
 		}
298 298
 
299
-		$output = $this->select( array(
299
+		$output = $this->select(array(
300 300
 			'name'             => $name,
301 301
 			'selected'         => $selected,
302 302
 			'options'          => $options,
303 303
 			'show_option_all'  => false,
304 304
 			'show_option_none' => false
305
-		) );
305
+		));
306 306
 
307 307
 		return $output;
308 308
 	}
@@ -320,23 +320,23 @@  discard block
 block discarded – undo
320 320
 	 *
321 321
 	 * @return string           Months dropdown.
322 322
 	 */
323
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
323
+	public function month_dropdown($name = 'month', $selected = 0) {
324 324
 		$month    = 1;
325 325
 		$options  = array();
326
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
326
+		$selected = empty($selected) ? date('n') : $selected;
327 327
 
328
-		while ( $month <= 12 ) {
329
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
330
-			$month ++;
328
+		while ($month <= 12) {
329
+			$options[absint($month)] = give_month_num_to_name($month);
330
+			$month++;
331 331
 		}
332 332
 
333
-		$output = $this->select( array(
333
+		$output = $this->select(array(
334 334
 			'name'             => $name,
335 335
 			'selected'         => $selected,
336 336
 			'options'          => $options,
337 337
 			'show_option_all'  => false,
338 338
 			'show_option_none' => false
339
-		) );
339
+		));
340 340
 
341 341
 		return $output;
342 342
 	}
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return string      The dropdown.
355 355
 	 */
356
-	public function select( $args = array() ) {
356
+	public function select($args = array()) {
357 357
 		$defaults = array(
358 358
 			'options'          => array(),
359 359
 			'name'             => null,
@@ -364,60 +364,60 @@  discard block
 block discarded – undo
364 364
 			'placeholder'      => null,
365 365
 			'multiple'         => false,
366 366
 			'select_atts'      => false,
367
-			'show_option_all'  => esc_html__( 'All', 'give' ),
368
-			'show_option_none' => esc_html__( 'None', 'give' )
367
+			'show_option_all'  => esc_html__('All', 'give'),
368
+			'show_option_none' => esc_html__('None', 'give')
369 369
 		);
370 370
 
371
-		$args = wp_parse_args( $args, $defaults );
371
+		$args = wp_parse_args($args, $defaults);
372 372
 
373
-		if ( $args['multiple'] ) {
373
+		if ($args['multiple']) {
374 374
 			$multiple = ' MULTIPLE';
375 375
 		} else {
376 376
 			$multiple = '';
377 377
 		}
378 378
 
379
-		if ( $args['chosen'] ) {
379
+		if ($args['chosen']) {
380 380
 			$args['class'] .= ' give-select-chosen';
381 381
 		}
382 382
 
383
-		if ( $args['placeholder'] ) {
383
+		if ($args['placeholder']) {
384 384
 			$placeholder = $args['placeholder'];
385 385
 		} else {
386 386
 			$placeholder = '';
387 387
 		}
388 388
 
389 389
 
390
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
390
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
391 391
 
392
-		if ( $args['show_option_all'] ) {
393
-			if ( $args['multiple'] ) {
394
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
392
+		if ($args['show_option_all']) {
393
+			if ($args['multiple']) {
394
+				$selected = selected(true, in_array(0, $args['selected']), false);
395 395
 			} else {
396
-				$selected = selected( $args['selected'], 0, false );
396
+				$selected = selected($args['selected'], 0, false);
397 397
 			}
398
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
398
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
399 399
 		}
400 400
 
401
-		if ( ! empty( $args['options'] ) ) {
401
+		if ( ! empty($args['options'])) {
402 402
 
403
-			if ( $args['show_option_none'] ) {
404
-				if ( $args['multiple'] ) {
405
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
403
+			if ($args['show_option_none']) {
404
+				if ($args['multiple']) {
405
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
406 406
 				} else {
407
-					$selected = selected( $args['selected'], - 1, false );
407
+					$selected = selected($args['selected'], - 1, false);
408 408
 				}
409
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
409
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
410 410
 			}
411 411
 
412
-			foreach ( $args['options'] as $key => $option ) {
412
+			foreach ($args['options'] as $key => $option) {
413 413
 
414
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
415
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
414
+				if ($args['multiple'] && is_array($args['selected'])) {
415
+					$selected = selected(true, in_array($key, $args['selected']), false);
416 416
 				} else {
417
-					$selected = selected( $args['selected'], $key, false );
417
+					$selected = selected($args['selected'], $key, false);
418 418
 				}
419 419
 
420
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
420
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
421 421
 			}
422 422
 		}
423 423
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return string      The checkbox.
440 440
 	 */
441
-	public function checkbox( $args = array() ) {
441
+	public function checkbox($args = array()) {
442 442
 		$defaults = array(
443 443
 			'name'    => null,
444 444
 			'current' => null,
@@ -449,16 +449,16 @@  discard block
 block discarded – undo
449 449
 			)
450 450
 		);
451 451
 
452
-		$args = wp_parse_args( $args, $defaults );
452
+		$args = wp_parse_args($args, $defaults);
453 453
 
454 454
 		$options = '';
455
-		if ( ! empty( $args['options']['disabled'] ) ) {
455
+		if ( ! empty($args['options']['disabled'])) {
456 456
 			$options .= ' disabled="disabled"';
457
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
457
+		} elseif ( ! empty($args['options']['readonly'])) {
458 458
 			$options .= ' readonly';
459 459
 		}
460 460
 
461
-		$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 ) . ' />';
461
+		$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).' />';
462 462
 
463 463
 		return $output;
464 464
 	}
@@ -475,22 +475,22 @@  discard block
 block discarded – undo
475 475
 	 *
476 476
 	 * @return string      The text field.
477 477
 	 */
478
-	public function text( $args = array() ) {
478
+	public function text($args = array()) {
479 479
 		// Backwards compatibility
480
-		if ( func_num_args() > 1 ) {
480
+		if (func_num_args() > 1) {
481 481
 			$args = func_get_args();
482 482
 
483 483
 			$name  = $args[0];
484
-			$value = isset( $args[1] ) ? $args[1] : '';
485
-			$label = isset( $args[2] ) ? $args[2] : '';
486
-			$desc  = isset( $args[3] ) ? $args[3] : '';
484
+			$value = isset($args[1]) ? $args[1] : '';
485
+			$label = isset($args[2]) ? $args[2] : '';
486
+			$desc  = isset($args[3]) ? $args[3] : '';
487 487
 		}
488 488
 
489 489
 		$defaults = array(
490
-			'name'         => isset( $name ) ? $name : 'text',
491
-			'value'        => isset( $value ) ? $value : null,
492
-			'label'        => isset( $label ) ? $label : null,
493
-			'desc'         => isset( $desc ) ? $desc : null,
490
+			'name'         => isset($name) ? $name : 'text',
491
+			'value'        => isset($value) ? $value : null,
492
+			'label'        => isset($label) ? $label : null,
493
+			'desc'         => isset($desc) ? $desc : null,
494 494
 			'placeholder'  => '',
495 495
 			'class'        => 'regular-text',
496 496
 			'disabled'     => false,
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
 			'data'         => false
499 499
 		);
500 500
 
501
-		$args = wp_parse_args( $args, $defaults );
501
+		$args = wp_parse_args($args, $defaults);
502 502
 
503 503
 		$disabled = '';
504
-		if ( $args['disabled'] ) {
504
+		if ($args['disabled']) {
505 505
 			$disabled = ' disabled="disabled"';
506 506
 		}
507 507
 
508 508
 		$data = '';
509
-		if ( ! empty( $args['data'] ) ) {
510
-			foreach ( $args['data'] as $key => $value ) {
511
-				$data .= 'data-' . $key . '="' . $value . '" ';
509
+		if ( ! empty($args['data'])) {
510
+			foreach ($args['data'] as $key => $value) {
511
+				$data .= 'data-'.$key.'="'.$value.'" ';
512 512
 			}
513 513
 		}
514 514
 
515
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
515
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
516 516
 
517
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
517
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
518 518
 
519
-		if ( ! empty( $args['desc'] ) ) {
520
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
519
+		if ( ! empty($args['desc'])) {
520
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
521 521
 		}
522 522
 
523
-		$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 . '/>';
523
+		$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.'/>';
524 524
 
525 525
 		$output .= '</span>';
526 526
 
@@ -539,15 +539,15 @@  discard block
 block discarded – undo
539 539
 	 *
540 540
 	 * @return string      The date picker.
541 541
 	 */
542
-	public function date_field( $args = array() ) {
542
+	public function date_field($args = array()) {
543 543
 
544
-		if ( empty( $args['class'] ) ) {
544
+		if (empty($args['class'])) {
545 545
 			$args['class'] = 'give_datepicker';
546
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
546
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
547 547
 			$args['class'] .= ' give_datepicker';
548 548
 		}
549 549
 
550
-		return $this->text( $args );
550
+		return $this->text($args);
551 551
 	}
552 552
 
553 553
 	/**
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return string      The textarea.
564 564
 	 */
565
-	public function textarea( $args = array() ) {
565
+	public function textarea($args = array()) {
566 566
 		$defaults = array(
567 567
 			'name'     => 'textarea',
568 568
 			'value'    => null,
@@ -572,21 +572,21 @@  discard block
 block discarded – undo
572 572
 			'disabled' => false
573 573
 		);
574 574
 
575
-		$args = wp_parse_args( $args, $defaults );
575
+		$args = wp_parse_args($args, $defaults);
576 576
 
577 577
 		$disabled = '';
578
-		if ( $args['disabled'] ) {
578
+		if ($args['disabled']) {
579 579
 			$disabled = ' disabled="disabled"';
580 580
 		}
581 581
 
582
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
582
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
583 583
 
584
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
584
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
585 585
 
586
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
586
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
587 587
 
588
-		if ( ! empty( $args['desc'] ) ) {
589
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
588
+		if ( ! empty($args['desc'])) {
589
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
590 590
 		}
591 591
 
592 592
 		$output .= '</span>';
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 *
607 607
 	 * @return string      The text field with ajax search.
608 608
 	 */
609
-	public function ajax_user_search( $args = array() ) {
609
+	public function ajax_user_search($args = array()) {
610 610
 
611 611
 		$defaults = array(
612 612
 			'name'         => 'user_id',
613 613
 			'value'        => null,
614
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
614
+			'placeholder'  => esc_attr__('Enter username', 'give'),
615 615
 			'label'        => null,
616 616
 			'desc'         => null,
617 617
 			'class'        => '',
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 			'data'         => false
621 621
 		);
622 622
 
623
-		$args = wp_parse_args( $args, $defaults );
623
+		$args = wp_parse_args($args, $defaults);
624 624
 
625
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
625
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
626 626
 
627 627
 		$output = '<span class="give_user_search_wrap">';
628
-		$output .= $this->text( $args );
629
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
628
+		$output .= $this->text($args);
629
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
630 630
 		$output .= '</span>';
631 631
 
632 632
 		return $output;
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 1 patch
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function __construct() {
47 47
 
48
-		add_action( 'admin_init', array( $this, 'init' ) );
48
+		add_action('admin_init', array($this, 'init'));
49 49
 
50 50
 		//Customize CMB2 URL
51
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
51
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
52 52
 
53 53
 		//Custom CMB2 Settings Fields
54
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
55
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
56
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
57
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
58
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
59
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
60
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
61
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
62
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
54
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
55
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
56
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
57
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
58
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
59
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
60
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
61
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
62
+		add_action('admin_notices', array($this, 'settings_notices'));
63 63
 
64 64
 		// Include CMB CSS in the head to avoid FOUC
65
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
65
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
66 66
 
67
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
67
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
68 68
 
69 69
 	}
70 70
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @since  1.0
76 76
 	 */
77 77
 	public function init() {
78
-		register_setting( $this->key, $this->key );
78
+		register_setting($this->key, $this->key);
79 79
 
80 80
 	}
81 81
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return mixed
91 91
 	 */
92
-	public function give_update_cmb_meta_box_url( $url ) {
92
+	public function give_update_cmb_meta_box_url($url) {
93 93
 		//Path to Give's CMB
94
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
94
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
95 95
 	}
96 96
 
97 97
 
@@ -103,27 +103,27 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function give_get_settings_tabs() {
105 105
 
106
-		$settings = $this->give_settings( null );
106
+		$settings = $this->give_settings(null);
107 107
 
108 108
 		$tabs             = array();
109
-		$tabs['general']  = esc_html__( 'General', 'give' );
110
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
111
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
112
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
109
+		$tabs['general']  = esc_html__('General', 'give');
110
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
111
+		$tabs['display']  = esc_html__('Display Options', 'give');
112
+		$tabs['emails']   = esc_html__('Emails', 'give');
113 113
 
114
-		if ( ! empty( $settings['addons']['fields'] ) ) {
115
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
114
+		if ( ! empty($settings['addons']['fields'])) {
115
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
116 116
 		}
117 117
 
118
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
119
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
118
+		if ( ! empty($settings['licenses']['fields'])) {
119
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
120 120
 		}
121 121
 
122
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
123
-		$tabs['api']         = esc_html__( 'API', 'give' );
124
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
122
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
123
+		$tabs['api']         = esc_html__('API', 'give');
124
+		$tabs['system_info'] = esc_html__('System Info', 'give');
125 125
 
126
-		return apply_filters( 'give_settings_tabs', $tabs );
126
+		return apply_filters('give_settings_tabs', $tabs);
127 127
 	}
128 128
 
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function admin_page_display() {
135 135
 
136
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
136
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
137 137
 
138 138
 		?>
139 139
 
@@ -143,22 +143,22 @@  discard block
 block discarded – undo
143 143
 
144 144
 			<h2 class="nav-tab-wrapper">
145 145
 				<?php
146
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
146
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
147 147
 
148
-					$tab_url = esc_url( add_query_arg( array(
148
+					$tab_url = esc_url(add_query_arg(array(
149 149
 						'settings-updated' => false,
150 150
 						'tab'              => $tab_id
151
-					) ) );
151
+					)));
152 152
 
153 153
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
154 154
 
155
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
155
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
156 156
 
157 157
 				}
158 158
 				?>
159 159
 			</h2>
160 160
 
161
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
161
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
162 162
 
163 163
 		</div><!-- .wrap -->
164 164
 
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string
182 182
 	 */
183
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
183
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
184 184
 
185 185
 		//only modify the give settings form
186
-		if ( 'give_settings' == $object_id ) {
186
+		if ('give_settings' == $object_id) {
187 187
 
188
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
188
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
189 189
 
190 190
 		}
191 191
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return array
204 204
 	 */
205
-	public function give_settings( $active_tab ) {
205
+	public function give_settings($active_tab) {
206 206
 
207 207
 		$give_settings = array(
208 208
 			/**
@@ -210,99 +210,99 @@  discard block
 block discarded – undo
210 210
 			 */
211 211
 			'general'     => array(
212 212
 				'id'         => 'general_settings',
213
-				'give_title' => esc_html__( 'General Settings', 'give' ),
214
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
215
-				'fields'     => apply_filters( 'give_settings_general', array(
213
+				'give_title' => esc_html__('General Settings', 'give'),
214
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
215
+				'fields'     => apply_filters('give_settings_general', array(
216 216
 						array(
217
-							'name' => esc_html__( 'General Settings', 'give' ),
217
+							'name' => esc_html__('General Settings', 'give'),
218 218
 							'desc' => '',
219 219
 							'type' => 'give_title',
220 220
 							'id'   => 'give_title_general_settings_1'
221 221
 						),
222 222
 						array(
223
-							'name'    => esc_html__( 'Success Page', 'give' ),
223
+							'name'    => esc_html__('Success Page', 'give'),
224 224
 							/* translators: %s: [give_receipt] */
225
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
225
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
226 226
 							'id'      => 'success_page',
227 227
 							'type'    => 'select',
228
-							'options' => give_cmb2_get_post_options( array(
228
+							'options' => give_cmb2_get_post_options(array(
229 229
 								'post_type'   => 'page',
230
-								'numberposts' => - 1
231
-							) ),
230
+								'numberposts' => -1
231
+							)),
232 232
 						),
233 233
 						array(
234
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
235
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
234
+							'name'    => esc_html__('Failed Donation Page', 'give'),
235
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
236 236
 							'id'      => 'failure_page',
237 237
 							'type'    => 'select',
238
-							'options' => give_cmb2_get_post_options( array(
238
+							'options' => give_cmb2_get_post_options(array(
239 239
 								'post_type'   => 'page',
240
-								'numberposts' => - 1
241
-							) ),
240
+								'numberposts' => -1
241
+							)),
242 242
 						),
243 243
 						array(
244
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
244
+							'name'    => esc_html__('Donation History Page', 'give'),
245 245
 							/* translators: %s: [donation_history] */
246
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
246
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
247 247
 							'id'      => 'history_page',
248 248
 							'type'    => 'select',
249
-							'options' => give_cmb2_get_post_options( array(
249
+							'options' => give_cmb2_get_post_options(array(
250 250
 								'post_type'   => 'page',
251
-								'numberposts' => - 1
252
-							) ),
251
+								'numberposts' => -1
252
+							)),
253 253
 						),
254 254
 						array(
255
-							'name'    => esc_html__( 'Base Country', 'give' ),
256
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
255
+							'name'    => esc_html__('Base Country', 'give'),
256
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
257 257
 							'id'      => 'base_country',
258 258
 							'type'    => 'select',
259 259
 							'options' => give_get_country_list(),
260 260
 						),
261 261
 						array(
262
-							'name' => esc_html__( 'Currency Settings', 'give' ),
262
+							'name' => esc_html__('Currency Settings', 'give'),
263 263
 							'desc' => '',
264 264
 							'type' => 'give_title',
265 265
 							'id'   => 'give_title_general_settings_2'
266 266
 						),
267 267
 						array(
268
-							'name'    => esc_html__( 'Currency', 'give' ),
269
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
268
+							'name'    => esc_html__('Currency', 'give'),
269
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
270 270
 							'id'      => 'currency',
271 271
 							'type'    => 'select',
272 272
 							'options' => give_get_currencies(),
273 273
 							'default' => 'USD',
274 274
 						),
275 275
 						array(
276
-							'name'    => esc_html__( 'Currency Position', 'give' ),
277
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
276
+							'name'    => esc_html__('Currency Position', 'give'),
277
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
278 278
 							'id'      => 'currency_position',
279 279
 							'type'    => 'select',
280 280
 							'options' => array(
281 281
 								/* translators: %s: currency symbol */
282
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
282
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
283 283
 								/* translators: %s: currency symbol */
284
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
284
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
285 285
 							),
286 286
 							'default' => 'before',
287 287
 						),
288 288
 						array(
289
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
290
-							'desc'            => esc_html__( 'The symbol (usually , or .) to separate thousands.', 'give' ),
289
+							'name'            => esc_html__('Thousands Separator', 'give'),
290
+							'desc'            => esc_html__('The symbol (usually , or .) to separate thousands.', 'give'),
291 291
 							'id'              => 'thousands_separator',
292 292
 							'type'            => 'text_small',
293 293
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
294 294
 							'default'         => ',',
295 295
 						),
296 296
 						array(
297
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
298
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
297
+							'name'    => esc_html__('Decimal Separator', 'give'),
298
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
299 299
 							'id'      => 'decimal_separator',
300 300
 							'type'    => 'text_small',
301 301
 							'default' => '.',
302 302
 						),
303 303
 						array(
304
-							'name'            => esc_html__( 'Number of Decimals', 'give' ),
305
-							'desc'            => esc_html__( 'The number of decimal points displayed in amounts.', 'give' ),
304
+							'name'            => esc_html__('Number of Decimals', 'give'),
305
+							'desc'            => esc_html__('The number of decimal points displayed in amounts.', 'give'),
306 306
 							'id'              => 'number_decimals',
307 307
 							'type'            => 'text_small',
308 308
 							'default'         => 2,
@@ -316,83 +316,83 @@  discard block
 block discarded – undo
316 316
 			 */
317 317
 			'gateways'    => array(
318 318
 				'id'         => 'payment_gateways',
319
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
320
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
321
-				'fields'     => apply_filters( 'give_settings_gateways', array(
319
+				'give_title' => esc_html__('Payment Gateways', 'give'),
320
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
321
+				'fields'     => apply_filters('give_settings_gateways', array(
322 322
 						array(
323
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
323
+							'name' => esc_html__('Gateways Settings', 'give'),
324 324
 							'desc' => '',
325 325
 							'id'   => 'give_title_gateway_settings_1',
326 326
 							'type' => 'give_title'
327 327
 						),
328 328
 						array(
329
-							'name' => esc_html__( 'Test Mode', 'give' ),
330
-							'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
329
+							'name' => esc_html__('Test Mode', 'give'),
330
+							'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
331 331
 							'id'   => 'test_mode',
332 332
 							'type' => 'checkbox'
333 333
 						),
334 334
 						array(
335
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
336
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
335
+							'name' => esc_html__('Enabled Gateways', 'give'),
336
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
337 337
 							'id'   => 'gateways',
338 338
 							'type' => 'enabled_gateways'
339 339
 						),
340 340
 						array(
341
-							'name' => esc_html__( 'Default Gateway', 'give' ),
342
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
341
+							'name' => esc_html__('Default Gateway', 'give'),
342
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
343 343
 							'id'   => 'default_gateway',
344 344
 							'type' => 'default_gateway'
345 345
 						),
346 346
 						array(
347
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
347
+							'name' => esc_html__('PayPal Standard', 'give'),
348 348
 							'desc' => '',
349 349
 							'type' => 'give_title',
350 350
 							'id'   => 'give_title_gateway_settings_2',
351 351
 						),
352 352
 						array(
353
-							'name' => esc_html__( 'PayPal Email', 'give' ),
354
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
353
+							'name' => esc_html__('PayPal Email', 'give'),
354
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
355 355
 							'id'   => 'paypal_email',
356 356
 							'type' => 'text_email',
357 357
 						),
358 358
 						array(
359
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
360
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
359
+							'name' => esc_html__('PayPal Page Style', 'give'),
360
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
361 361
 							'id'   => 'paypal_page_style',
362 362
 							'type' => 'text',
363 363
 						),
364 364
 						array(
365
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
366
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
365
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
366
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
367 367
 							'id'      => 'paypal_button_type',
368 368
 							'type'    => 'radio_inline',
369 369
 							'options' => array(
370
-								'donation' => esc_html__( 'Donation', 'give' ),
371
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
370
+								'donation' => esc_html__('Donation', 'give'),
371
+								'standard' => esc_html__('Standard Transaction', 'give')
372 372
 							),
373 373
 							'default' => 'donation',
374 374
 						),
375 375
 						array(
376
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
377
-							'desc' => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
376
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
377
+							'desc' => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
378 378
 							'id'   => 'disable_paypal_verification',
379 379
 							'type' => 'checkbox'
380 380
 						),
381 381
 						array(
382
-							'name' => esc_html__( 'Offline Donations', 'give' ),
382
+							'name' => esc_html__('Offline Donations', 'give'),
383 383
 							'desc' => '',
384 384
 							'type' => 'give_title',
385 385
 							'id'   => 'give_title_gateway_settings_3',
386 386
 						),
387 387
 						array(
388
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
389
-							'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
388
+							'name' => esc_html__('Collect Billing Details', 'give'),
389
+							'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
390 390
 							'id'   => 'give_offline_donation_enable_billing_fields',
391 391
 							'type' => 'checkbox'
392 392
 						),
393 393
 						array(
394
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
395
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
394
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
395
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
396 396
 							'id'      => 'global_offline_donation_content',
397 397
 							'default' => give_get_default_offline_donation_content(),
398 398
 							'type'    => 'wysiwyg',
@@ -401,15 +401,15 @@  discard block
 block discarded – undo
401 401
 							)
402 402
 						),
403 403
 						array(
404
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
405
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
404
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
405
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
406 406
 							'id'      => 'offline_donation_subject',
407
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
407
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
408 408
 							'type'    => 'text'
409 409
 						),
410 410
 						array(
411
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
412
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
411
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
412
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
413 413
 							'id'      => 'global_offline_donation_email',
414 414
 							'default' => give_get_default_offline_donation_email_content(),
415 415
 							'type'    => 'wysiwyg',
@@ -423,105 +423,105 @@  discard block
 block discarded – undo
423 423
 			/** Display Settings */
424 424
 			'display'     => array(
425 425
 				'id'         => 'display_settings',
426
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
427
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
428
-				'fields'     => apply_filters( 'give_settings_display', array(
426
+				'give_title' => esc_html__('Display Settings', 'give'),
427
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
428
+				'fields'     => apply_filters('give_settings_display', array(
429 429
 						array(
430
-							'name' => esc_html__( 'Display Settings', 'give' ),
430
+							'name' => esc_html__('Display Settings', 'give'),
431 431
 							'desc' => '',
432 432
 							'id'   => 'give_title_display_settings_1',
433 433
 							'type' => 'give_title'
434 434
 						),
435 435
 						array(
436
-							'name' => esc_html__( 'Disable CSS', 'give' ),
437
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
436
+							'name' => esc_html__('Disable CSS', 'give'),
437
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
438 438
 							'id'   => 'disable_css',
439 439
 							'type' => 'checkbox'
440 440
 						),
441 441
 						array(
442
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
442
+							'name' => esc_html__('Enable Floating Labels', 'give'),
443 443
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
444
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array(
444
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array(
445 445
 								'a' => array(
446 446
 									'href'   => array(),
447 447
 									'target' => array()
448 448
 								)
449
-							) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
449
+							)), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
450 450
 							'id'   => 'enable_floatlabels',
451 451
 							'type' => 'checkbox'
452 452
 						),
453 453
 						array(
454
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
454
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
455 455
 							/* translators: %s: about page URL */
456
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array(
456
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array(
457 457
 								'a' => array(
458 458
 									'href'   => array(),
459 459
 									'target' => array()
460 460
 								)
461
-							) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
461
+							)), esc_url(admin_url('index.php?page=give-about'))),
462 462
 							'id'   => 'disable_welcome',
463 463
 							'type' => 'checkbox'
464 464
 						),
465 465
 						array(
466
-							'name' => esc_html__( 'Post Types', 'give' ),
466
+							'name' => esc_html__('Post Types', 'give'),
467 467
 							'desc' => '',
468 468
 							'id'   => 'give_title_display_settings_2',
469 469
 							'type' => 'give_title'
470 470
 						),
471 471
 						array(
472
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
473
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
472
+							'name' => esc_html__('Disable Form Single Views', 'give'),
473
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
474 474
 							'id'   => 'disable_forms_singular',
475 475
 							'type' => 'checkbox'
476 476
 						),
477 477
 						array(
478
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
479
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
478
+							'name' => esc_html__('Disable Form Archives', 'give'),
479
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
480 480
 							'id'   => 'disable_forms_archives',
481 481
 							'type' => 'checkbox'
482 482
 						),
483 483
 						array(
484
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
485
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
484
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
485
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
486 486
 							'id'   => 'disable_forms_excerpt',
487 487
 							'type' => 'checkbox'
488 488
 						),
489 489
 
490 490
 						array(
491
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
492
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
491
+							'name'    => esc_html__('Featured Image Size', 'give'),
492
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
493 493
 							'id'      => 'featured_image_size',
494 494
 							'type'    => 'select',
495 495
 							'default' => 'large',
496 496
 							'options' => give_get_featured_image_sizes()
497 497
 						),
498 498
 						array(
499
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
500
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
499
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
500
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
501 501
 							'id'   => 'disable_form_featured_img',
502 502
 							'type' => 'checkbox'
503 503
 						),
504 504
 						array(
505
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
506
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
505
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
506
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
507 507
 							'id'   => 'disable_form_sidebar',
508 508
 							'type' => 'checkbox'
509 509
 						),
510 510
 						array(
511
-							'name' => esc_html__( 'Taxonomies', 'give' ),
511
+							'name' => esc_html__('Taxonomies', 'give'),
512 512
 							'desc' => '',
513 513
 							'id'   => 'give_title_display_settings_3',
514 514
 							'type' => 'give_title'
515 515
 						),
516 516
 						array(
517
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
518
-							'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
517
+							'name' => esc_html__('Enable Form Categories', 'give'),
518
+							'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'),
519 519
 							'id'   => 'enable_categories',
520 520
 							'type' => 'checkbox'
521 521
 						),
522 522
 						array(
523
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
524
-							'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
523
+							'name' => esc_html__('Enable Form Tags', 'give'),
524
+							'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'),
525 525
 							'id'   => 'enable_tags',
526 526
 							'type' => 'checkbox'
527 527
 						),
@@ -555,101 +555,101 @@  discard block
 block discarded – undo
555 555
 			 */
556 556
 			'emails'      => array(
557 557
 				'id'         => 'email_settings',
558
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
559
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
560
-				'fields'     => apply_filters( 'give_settings_emails', array(
558
+				'give_title' => esc_html__('Email Settings', 'give'),
559
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
560
+				'fields'     => apply_filters('give_settings_emails', array(
561 561
 						array(
562
-							'name' => esc_html__( 'Email Settings', 'give' ),
562
+							'name' => esc_html__('Email Settings', 'give'),
563 563
 							'desc' => '',
564 564
 							'id'   => 'give_title_email_settings_1',
565 565
 							'type' => 'give_title'
566 566
 						),
567 567
 						array(
568 568
 							'id'      => 'email_template',
569
-							'name'    => esc_html__( 'Email Template', 'give' ),
570
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
569
+							'name'    => esc_html__('Email Template', 'give'),
570
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
571 571
 							'type'    => 'select',
572 572
 							'options' => give_get_email_templates()
573 573
 						),
574 574
 						array(
575 575
 							'id'   => 'email_logo',
576
-							'name' => esc_html__( 'Logo', 'give' ),
577
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
576
+							'name' => esc_html__('Logo', 'give'),
577
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
578 578
 							'type' => 'file'
579 579
 						),
580 580
 						array(
581 581
 							'id'      => 'from_name',
582
-							'name'    => esc_html__( 'From Name', 'give' ),
583
-							'desc'    => esc_html__( 'The name that appears in the "From" field in donation receipt emails.', 'give' ),
584
-							'default' => get_bloginfo( 'name' ),
582
+							'name'    => esc_html__('From Name', 'give'),
583
+							'desc'    => esc_html__('The name that appears in the "From" field in donation receipt emails.', 'give'),
584
+							'default' => get_bloginfo('name'),
585 585
 							'type'    => 'text'
586 586
 						),
587 587
 						array(
588 588
 							'id'      => 'from_email',
589
-							'name'    => esc_html__( 'From Email', 'give' ),
590
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
591
-							'default' => get_bloginfo( 'admin_email' ),
589
+							'name'    => esc_html__('From Email', 'give'),
590
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
591
+							'default' => get_bloginfo('admin_email'),
592 592
 							'type'    => 'text'
593 593
 						),
594 594
 						array(
595
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
595
+							'name' => esc_html__('Donation Receipt', 'give'),
596 596
 							'desc' => '',
597 597
 							'id'   => 'give_title_email_settings_2',
598 598
 							'type' => 'give_title'
599 599
 						),
600 600
 						array(
601 601
 							'id'      => 'donation_subject',
602
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
603
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
604
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
602
+							'name'    => esc_html__('Donation Email Subject', 'give'),
603
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
604
+							'default' => esc_attr__('Donation Receipt', 'give'),
605 605
 							'type'    => 'text'
606 606
 						),
607 607
 						array(
608 608
 							'id'      => 'donation_receipt',
609
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
609
+							'name'    => esc_html__('Donation Receipt', 'give'),
610 610
 							'desc'    => sprintf(
611 611
 							/* translators: %s: emails tags list */
612
-								esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
613
-								'<br/>' . give_get_emails_tags_list()
612
+								esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
613
+								'<br/>'.give_get_emails_tags_list()
614 614
 							),
615 615
 							'type'    => 'wysiwyg',
616 616
 							'default' => give_get_default_donation_receipt_email()
617 617
 						),
618 618
 						array(
619
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
619
+							'name' => esc_html__('New Donation Notification', 'give'),
620 620
 							'desc' => '',
621 621
 							'id'   => 'give_title_email_settings_3',
622 622
 							'type' => 'give_title'
623 623
 						),
624 624
 						array(
625 625
 							'id'      => 'donation_notification_subject',
626
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
627
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
626
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
627
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
628 628
 							'type'    => 'text',
629
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
629
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
630 630
 						),
631 631
 						array(
632 632
 							'id'      => 'donation_notification',
633
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
633
+							'name'    => esc_html__('Donation Notification', 'give'),
634 634
 							'desc'    => sprintf(
635 635
 							/* translators: %s: emails tags list */
636
-								esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
637
-								'<br/>' . give_get_emails_tags_list()
636
+								esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
637
+								'<br/>'.give_get_emails_tags_list()
638 638
 							),
639 639
 							'type'    => 'wysiwyg',
640 640
 							'default' => give_get_default_donation_notification_email()
641 641
 						),
642 642
 						array(
643 643
 							'id'      => 'admin_notice_emails',
644
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
645
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
644
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
645
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
646 646
 							'type'    => 'textarea',
647
-							'default' => get_bloginfo( 'admin_email' )
647
+							'default' => get_bloginfo('admin_email')
648 648
 						),
649 649
 						array(
650 650
 							'id'   => 'disable_admin_notices',
651
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
652
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
651
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
652
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
653 653
 							'type' => 'checkbox'
654 654
 						)
655 655
 					)
@@ -658,99 +658,99 @@  discard block
 block discarded – undo
658 658
 			/** Extension Settings */
659 659
 			'addons'      => array(
660 660
 				'id'         => 'addons',
661
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
662
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
663
-				'fields'     => apply_filters( 'give_settings_addons', array()
661
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
662
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
663
+				'fields'     => apply_filters('give_settings_addons', array()
664 664
 				)
665 665
 			),
666 666
 			/** Licenses Settings */
667 667
 			'licenses'    => array(
668 668
 				'id'         => 'licenses',
669
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
670
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
671
-				'fields'     => apply_filters( 'give_settings_licenses', array()
669
+				'give_title' => esc_html__('Give Licenses', 'give'),
670
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
671
+				'fields'     => apply_filters('give_settings_licenses', array()
672 672
 				)
673 673
 			),
674 674
 			/** Advanced Options */
675 675
 			'advanced'    => array(
676 676
 				'id'         => 'advanced_options',
677
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
678
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
679
-				'fields'     => apply_filters( 'give_settings_advanced', array(
677
+				'give_title' => esc_html__('Advanced Options', 'give'),
678
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
679
+				'fields'     => apply_filters('give_settings_advanced', array(
680 680
 						array(
681
-							'name' => esc_html__( 'Access Control', 'give' ),
681
+							'name' => esc_html__('Access Control', 'give'),
682 682
 							'desc' => '',
683 683
 							'id'   => 'give_title_session_control_1',
684 684
 							'type' => 'give_title'
685 685
 						),
686 686
 						array(
687 687
 							'id'      => 'session_lifetime',
688
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
689
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
688
+							'name'    => esc_html__('Session Lifetime', 'give'),
689
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
690 690
 							'type'    => 'select',
691 691
 							'options' => array(
692
-								'86400'  => esc_html__( '24 Hours', 'give' ),
693
-								'172800' => esc_html__( '48 Hours', 'give' ),
694
-								'259200' => esc_html__( '72 Hours', 'give' ),
695
-								'604800' => esc_html__( '1 Week', 'give' ),
692
+								'86400'  => esc_html__('24 Hours', 'give'),
693
+								'172800' => esc_html__('48 Hours', 'give'),
694
+								'259200' => esc_html__('72 Hours', 'give'),
695
+								'604800' => esc_html__('1 Week', 'give'),
696 696
 							)
697 697
 						),
698 698
 						array(
699
-							'name' => esc_html__( 'Email Access', 'give' ),
700
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
699
+							'name' => esc_html__('Email Access', 'give'),
700
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
701 701
 							'id'   => 'email_access',
702 702
 							'type' => 'checkbox',
703 703
 						),
704 704
 						array(
705 705
 							'id'      => 'recaptcha_key',
706
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
706
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
707 707
 							/* translators: %s: https://www.google.com/recaptcha/ */
708
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
708
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
709 709
 							'default' => '',
710 710
 							'type'    => 'text'
711 711
 						),
712 712
 						array(
713 713
 							'id'      => 'recaptcha_secret',
714
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
715
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
714
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
715
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
716 716
 							'default' => '',
717 717
 							'type'    => 'text'
718 718
 						),
719 719
 						array(
720
-							'name' => esc_html__( 'Data Control', 'give' ),
720
+							'name' => esc_html__('Data Control', 'give'),
721 721
 							'desc' => '',
722 722
 							'id'   => 'give_title_data_control_2',
723 723
 							'type' => 'give_title'
724 724
 						),
725 725
 						array(
726
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
727
-							'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
726
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
727
+							'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'),
728 728
 							'id'   => 'uninstall_on_delete',
729 729
 							'type' => 'checkbox'
730 730
 						),
731 731
 						array(
732
-							'name' => esc_html__( 'Filter Control', 'give' ),
732
+							'name' => esc_html__('Filter Control', 'give'),
733 733
 							'desc' => '',
734 734
 							'id'   => 'give_title_filter_control',
735 735
 							'type' => 'give_title'
736 736
 						),
737 737
 						array(
738 738
 							/* translators: %s: the_content */
739
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
739
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
740 740
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
741
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
741
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
742 742
 							'id'   => 'disable_the_content_filter',
743 743
 							'type' => 'checkbox'
744 744
 						),
745 745
 						array(
746
-							'name' => esc_html__( 'Script Loading', 'give' ),
746
+							'name' => esc_html__('Script Loading', 'give'),
747 747
 							'desc' => '',
748 748
 							'id'   => 'give_title_script_control',
749 749
 							'type' => 'give_title'
750 750
 						),
751 751
 						array(
752
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
753
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
752
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
753
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
754 754
 							'id'   => 'scripts_footer',
755 755
 							'type' => 'checkbox'
756 756
 						)
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 			/** API Settings */
761 761
 			'api'         => array(
762 762
 				'id'         => 'api',
763
-				'give_title' => esc_html__( 'API', 'give' ),
764
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
763
+				'give_title' => esc_html__('API', 'give'),
764
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
765 765
 				'show_names' => false, // Hide field names on the left
766
-				'fields'     => apply_filters( 'give_settings_system', array(
766
+				'fields'     => apply_filters('give_settings_system', array(
767 767
 						array(
768 768
 							'id'   => 'api',
769
-							'name' => esc_html__( 'API', 'give' ),
769
+							'name' => esc_html__('API', 'give'),
770 770
 							'type' => 'api'
771 771
 						)
772 772
 					)
@@ -775,13 +775,13 @@  discard block
 block discarded – undo
775 775
 			/** Licenses Settings */
776 776
 			'system_info' => array(
777 777
 				'id'         => 'system_info',
778
-				'give_title' => esc_html__( 'System Info', 'give' ),
779
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
780
-				'fields'     => apply_filters( 'give_settings_system', array(
778
+				'give_title' => esc_html__('System Info', 'give'),
779
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
780
+				'fields'     => apply_filters('give_settings_system', array(
781 781
 						array(
782 782
 							'id'   => 'system-info-textarea',
783
-							'name' => esc_html__( 'System Info', 'give' ),
784
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
783
+							'name' => esc_html__('System Info', 'give'),
784
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
785 785
 							'type' => 'system_info'
786 786
 						)
787 787
 					)
@@ -790,15 +790,15 @@  discard block
 block discarded – undo
790 790
 		);
791 791
 
792 792
 		//Return all settings array if no active tab
793
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
793
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
794 794
 
795
-			return apply_filters( 'give_registered_settings', $give_settings );
795
+			return apply_filters('give_registered_settings', $give_settings);
796 796
 
797 797
 		}
798 798
 
799 799
 
800 800
 		// Add other tabs and settings fields as needed
801
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
801
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
802 802
 
803 803
 	}
804 804
 
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
 	 */
808 808
 	public function settings_notices() {
809 809
 
810
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
810
+		if ( ! isset($_POST['give_settings_saved'])) {
811 811
 			return;
812 812
 		}
813 813
 
814
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
814
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
815 815
 
816 816
 	}
817 817
 
@@ -826,17 +826,17 @@  discard block
 block discarded – undo
826 826
 	 * @return mixed         Field value or exception is thrown.
827 827
 	 * @throws Exception     Throws an exception if the field is invalid.
828 828
 	 */
829
-	public function __get( $field ) {
829
+	public function __get($field) {
830 830
 
831 831
 		// Allowed fields to retrieve
832
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
832
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
833 833
 			return $this->{$field};
834 834
 		}
835
-		if ( 'option_metabox' === $field ) {
835
+		if ('option_metabox' === $field) {
836 836
 			return $this->option_metabox();
837 837
 		}
838 838
 
839
-		throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) );
839
+		throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field));
840 840
 	}
841 841
 
842 842
 
@@ -854,12 +854,12 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return mixed        Option value
856 856
  */
857
-function give_get_option( $key = '', $default = false ) {
857
+function give_get_option($key = '', $default = false) {
858 858
 	$give_options = give_get_settings();
859
-	$value        = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
860
-	$value        = apply_filters( 'give_get_option', $value, $key, $default );
859
+	$value        = ! empty($give_options[$key]) ? $give_options[$key] : $default;
860
+	$value        = apply_filters('give_get_option', $value, $key, $default);
861 861
 
862
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
862
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
863 863
 }
864 864
 
865 865
 
@@ -877,33 +877,33 @@  discard block
 block discarded – undo
877 877
  *
878 878
  * @return boolean True if updated, false if not.
879 879
  */
880
-function give_update_option( $key = '', $value = false ) {
880
+function give_update_option($key = '', $value = false) {
881 881
 
882 882
 	// If no key, exit
883
-	if ( empty( $key ) ) {
883
+	if (empty($key)) {
884 884
 		return false;
885 885
 	}
886 886
 
887
-	if ( empty( $value ) ) {
888
-		$remove_option = give_delete_option( $key );
887
+	if (empty($value)) {
888
+		$remove_option = give_delete_option($key);
889 889
 
890 890
 		return $remove_option;
891 891
 	}
892 892
 
893 893
 	// First let's grab the current settings
894
-	$options = get_option( 'give_settings' );
894
+	$options = get_option('give_settings');
895 895
 
896 896
 	// Let's let devs alter that value coming in
897
-	$value = apply_filters( 'give_update_option', $value, $key );
897
+	$value = apply_filters('give_update_option', $value, $key);
898 898
 
899 899
 	// Next let's try to update the value
900
-	$options[ $key ] = $value;
901
-	$did_update      = update_option( 'give_settings', $options );
900
+	$options[$key] = $value;
901
+	$did_update      = update_option('give_settings', $options);
902 902
 
903 903
 	// If it updated, let's update the global variable
904
-	if ( $did_update ) {
904
+	if ($did_update) {
905 905
 		global $give_options;
906
-		$give_options[ $key ] = $value;
906
+		$give_options[$key] = $value;
907 907
 	}
908 908
 
909 909
 	return $did_update;
@@ -922,27 +922,27 @@  discard block
 block discarded – undo
922 922
  *
923 923
  * @return boolean True if updated, false if not.
924 924
  */
925
-function give_delete_option( $key = '' ) {
925
+function give_delete_option($key = '') {
926 926
 
927 927
 	// If no key, exit
928
-	if ( empty( $key ) ) {
928
+	if (empty($key)) {
929 929
 		return false;
930 930
 	}
931 931
 
932 932
 	// First let's grab the current settings
933
-	$options = get_option( 'give_settings' );
933
+	$options = get_option('give_settings');
934 934
 
935 935
 	// Next let's try to update the value
936
-	if ( isset( $options[ $key ] ) ) {
936
+	if (isset($options[$key])) {
937 937
 
938
-		unset( $options[ $key ] );
938
+		unset($options[$key]);
939 939
 
940 940
 	}
941 941
 
942
-	$did_update = update_option( 'give_settings', $options );
942
+	$did_update = update_option('give_settings', $options);
943 943
 
944 944
 	// If it updated, let's update the global variable
945
-	if ( $did_update ) {
945
+	if ($did_update) {
946 946
 		global $give_options;
947 947
 		$give_options = $options;
948 948
 	}
@@ -961,9 +961,9 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function give_get_settings() {
963 963
 
964
-	$settings = get_option( 'give_settings' );
964
+	$settings = get_option('give_settings');
965 965
 
966
-	return (array) apply_filters( 'give_get_settings', $settings );
966
+	return (array) apply_filters('give_get_settings', $settings);
967 967
 
968 968
 }
969 969
 
@@ -981,25 +981,25 @@  discard block
 block discarded – undo
981 981
  *
982 982
  * @return array
983 983
  */
984
-function give_settings_array_insert( $array, $position, $insert ) {
985
-	if ( is_int( $position ) ) {
986
-		array_splice( $array, $position, 0, $insert );
984
+function give_settings_array_insert($array, $position, $insert) {
985
+	if (is_int($position)) {
986
+		array_splice($array, $position, 0, $insert);
987 987
 	} else {
988 988
 
989
-		foreach ( $array as $index => $subarray ) {
990
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
989
+		foreach ($array as $index => $subarray) {
990
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
991 991
 				$pos = $index;
992 992
 			}
993 993
 		}
994 994
 
995
-		if ( ! isset( $pos ) ) {
995
+		if ( ! isset($pos)) {
996 996
 			return $array;
997 997
 		}
998 998
 
999 999
 		$array = array_merge(
1000
-			array_slice( $array, 0, $pos ),
1000
+			array_slice($array, 0, $pos),
1001 1001
 			$insert,
1002
-			array_slice( $array, $pos )
1002
+			array_slice($array, $pos)
1003 1003
 		);
1004 1004
 	}
1005 1005
 
@@ -1022,31 +1022,31 @@  discard block
 block discarded – undo
1022 1022
  *
1023 1023
  * @return void
1024 1024
  */
1025
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1025
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1026 1026
 
1027 1027
 	$id                = $field_type_object->field->args['id'];
1028 1028
 	$field_description = $field_type_object->field->args['desc'];
1029
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1029
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1030 1030
 
1031 1031
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1032 1032
 
1033
-	foreach ( $gateways as $key => $option ) :
1033
+	foreach ($gateways as $key => $option) :
1034 1034
 
1035
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1035
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1036 1036
 			$enabled = '1';
1037 1037
 		} else {
1038 1038
 			$enabled = null;
1039 1039
 		}
1040 1040
 
1041
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1042
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1041
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1042
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1043 1043
 
1044 1044
 	endforeach;
1045 1045
 
1046 1046
 	echo '</ul>';
1047 1047
 
1048
-	if ( $field_description ) {
1049
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1048
+	if ($field_description) {
1049
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1050 1050
 	}
1051 1051
 
1052 1052
 }
@@ -1062,31 +1062,31 @@  discard block
 block discarded – undo
1062 1062
  *
1063 1063
  * @return void
1064 1064
  */
1065
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1065
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1066 1066
 
1067 1067
 	$id                = $field_type_object->field->args['id'];
1068 1068
 	$field_description = $field_type_object->field->args['desc'];
1069 1069
 	$gateways          = give_get_enabled_payment_gateways();
1070 1070
 
1071
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1071
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1072 1072
 
1073 1073
 	//Add a field to the Give Form admin single post view of this field
1074
-	if ( $field_type_object->field->object_type === 'post' ) {
1075
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1074
+	if ($field_type_object->field->object_type === 'post') {
1075
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1076 1076
 	}
1077 1077
 
1078
-	foreach ( $gateways as $key => $option ) :
1078
+	foreach ($gateways as $key => $option) :
1079 1079
 
1080
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1080
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1081 1081
 
1082 1082
 
1083
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1083
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1084 1084
 
1085 1085
 	endforeach;
1086 1086
 
1087 1087
 	echo '</select>';
1088 1088
 
1089
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1089
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1090 1090
 
1091 1091
 }
1092 1092
 
@@ -1101,13 +1101,13 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return void
1103 1103
  */
1104
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1104
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1105 1105
 
1106 1106
 	$id                = $field_type_object->field->args['id'];
1107 1107
 	$title             = $field_type_object->field->args['name'];
1108 1108
 	$field_description = $field_type_object->field->args['desc'];
1109 1109
 
1110
-	echo '<hr>' . $field_description;
1110
+	echo '<hr>'.$field_description;
1111 1111
 
1112 1112
 }
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
  *
1123 1123
  * @return void
1124 1124
  */
1125
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1125
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1126 1126
 
1127 1127
 	$id                = $field_type_object->field->args['id'];
1128 1128
 	$title             = $field_type_object->field->args['name'];
@@ -1142,25 +1142,25 @@  discard block
 block discarded – undo
1142 1142
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1143 1143
  * @return array An array of options that matches the CMB2 options array
1144 1144
  */
1145
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1145
+function give_cmb2_get_post_options($query_args, $force = false) {
1146 1146
 
1147
-	$post_options = array( '' => '' ); // Blank option
1147
+	$post_options = array('' => ''); // Blank option
1148 1148
 
1149
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1149
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1150 1150
 		return $post_options;
1151 1151
 	}
1152 1152
 
1153
-	$args = wp_parse_args( $query_args, array(
1153
+	$args = wp_parse_args($query_args, array(
1154 1154
 		'post_type'   => 'page',
1155 1155
 		'numberposts' => 10,
1156
-	) );
1156
+	));
1157 1157
 
1158
-	$posts = get_posts( $args );
1158
+	$posts = get_posts($args);
1159 1159
 
1160
-	if ( $posts ) {
1161
-		foreach ( $posts as $post ) {
1160
+	if ($posts) {
1161
+		foreach ($posts as $post) {
1162 1162
 
1163
-			$post_options[ $post->ID ] = $post->post_title;
1163
+			$post_options[$post->ID] = $post->post_title;
1164 1164
 
1165 1165
 		}
1166 1166
 	}
@@ -1184,21 +1184,21 @@  discard block
 block discarded – undo
1184 1184
 	$get_sizes = get_intermediate_image_sizes();
1185 1185
 
1186 1186
 	// check whether intermediate image sizes exist first
1187
-	if ( empty( $get_sizes ) ) {
1188
-		$get_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
1187
+	if (empty($get_sizes)) {
1188
+		$get_sizes = array('thumbnail', 'medium', 'medium_large', 'large');
1189 1189
 	}
1190 1190
 
1191
-	foreach ( $get_sizes as $_size ) {
1191
+	foreach ($get_sizes as $_size) {
1192 1192
 
1193
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1194
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1195
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1196
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1193
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1194
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1195
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1196
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1197 1197
 		}
1198 1198
 
1199 1199
 	}
1200 1200
 
1201
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1201
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1202 1202
 }
1203 1203
 
1204 1204
 
@@ -1213,18 +1213,18 @@  discard block
 block discarded – undo
1213 1213
  *
1214 1214
  * @return void
1215 1215
  */
1216
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1216
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1217 1217
 	/* @var CMB2_Types $field_type_object */
1218 1218
 
1219 1219
 	$id                 = $field_type_object->field->args['id'];
1220 1220
 	$field_description  = $field_type_object->field->args['desc'];
1221 1221
 	$license            = $field_type_object->field->args['options']['license'];
1222 1222
 	$license_key        = $escaped_value;
1223
-	$is_license_key     = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1224
-	$is_valid_license   = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1223
+	$is_license_key     = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1224
+	$is_valid_license   = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1225 1225
 	$shortname          = $field_type_object->field->args['options']['shortname'];
1226 1226
 	$field_classes      = 'regular-text give-license-field';
1227
-	$type               = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1227
+	$type               = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1228 1228
 	$custom_html        = '';
1229 1229
 	$value              = $escaped_value;
1230 1230
 	$messages           = array();
@@ -1236,17 +1236,17 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1238 1238
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1239
-	if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1239
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1240 1240
 		$is_license_key = false;
1241 1241
 	}
1242 1242
 
1243 1243
 
1244 1244
 	// Check if current license is part of subscription or not.
1245
-	$subscriptions = get_option( 'give_subscriptions' );
1245
+	$subscriptions = get_option('give_subscriptions');
1246 1246
 
1247
-	if ( $is_license_key && $subscriptions ) {
1248
-		foreach ( $subscriptions as $subscription ) {
1249
-			if ( in_array( $license_key, $subscription['licenses'] ) ) {
1247
+	if ($is_license_key && $subscriptions) {
1248
+		foreach ($subscriptions as $subscription) {
1249
+			if (in_array($license_key, $subscription['licenses'])) {
1250 1250
 				$is_in_subscription = $subscription['id'];
1251 1251
 				break;
1252 1252
 			}
@@ -1254,122 +1254,122 @@  discard block
 block discarded – undo
1254 1254
 	}
1255 1255
 
1256 1256
 
1257
-	if ( $is_license_key ) {
1258
-		if ( $is_in_subscription ) {
1259
-			$subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] );
1260
-			$subscription_status  = esc_html__( 'renew', 'give' );
1257
+	if ($is_license_key) {
1258
+		if ($is_in_subscription) {
1259
+			$subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1260
+			$subscription_status  = esc_html__('renew', 'give');
1261 1261
 
1262
-			if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) {
1263
-				$subscription_status = esc_html__( 'expire', 'give' );
1262
+			if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1263
+				$subscription_status = esc_html__('expire', 'give');
1264 1264
 			}
1265 1265
 
1266
-			if ( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1267
-				$messages[]     = sprintf(
1268
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1269
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1270
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1271
-					$checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1266
+			if ($subscription_expires < current_time('timestamp', 1)) {
1267
+				$messages[] = sprintf(
1268
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1269
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1270
+					$subscriptions[$is_in_subscription]['payment_id'],
1271
+					$checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1272 1272
 				);
1273 1273
 				$license_status = 'license-expired';
1274
-			} elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1274
+			} elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1275 1275
 				$messages[]     = sprintf(
1276
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1277
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1278
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1276
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'),
1277
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1278
+					$subscriptions[$is_in_subscription]['payment_id'],
1279 1279
 					$subscription_status,
1280
-					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) )
1280
+					human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1281 1281
 				);
1282 1282
 				$license_status = 'license-expires-soon';
1283 1283
 			} else {
1284 1284
 				$messages[]     = sprintf(
1285
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1286
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1287
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1285
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'),
1286
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1287
+					$subscriptions[$is_in_subscription]['payment_id'],
1288 1288
 					$subscription_status,
1289
-					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) )
1289
+					date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1290 1290
 				);
1291 1291
 				$license_status = 'license-expiration-date';
1292 1292
 			}
1293 1293
 
1294 1294
 
1295
-		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1295
+		} elseif (empty($license->success) && property_exists($license, 'error')) {
1296 1296
 
1297 1297
 			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1298
-			switch ( $license->error ) {
1298
+			switch ($license->error) {
1299 1299
 				case 'expired' :
1300
-					error_log( print_r( $license->error, true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' );
1300
+					error_log(print_r($license->error, true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log');
1301 1301
 					$class          = $license->error;
1302 1302
 					$messages[]     = sprintf(
1303
-						__( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1304
-						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1305
-						$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1303
+						__('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1304
+						date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1305
+						$checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1306 1306
 					);
1307
-					$license_status = 'license-' . $class;
1307
+					$license_status = 'license-'.$class;
1308 1308
 					break;
1309 1309
 
1310 1310
 				case 'missing' :
1311 1311
 					$class          = $license->error;
1312 1312
 					$messages[]     = sprintf(
1313
-						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1314
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1313
+						__('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1314
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1315 1315
 					);
1316
-					$license_status = 'license-' . $class;
1316
+					$license_status = 'license-'.$class;
1317 1317
 					break;
1318 1318
 
1319 1319
 				case 'invalid' :
1320 1320
 					$class          = $license->error;
1321 1321
 					$messages[]     = sprintf(
1322
-						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1322
+						__('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1323 1323
 						$addon_name,
1324
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1324
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1325 1325
 					);
1326
-					$license_status = 'license-' . $class;
1326
+					$license_status = 'license-'.$class;
1327 1327
 					break;
1328 1328
 
1329 1329
 				case 'site_inactive' :
1330 1330
 					$class          = $license->error;
1331 1331
 					$messages[]     = sprintf(
1332
-						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1332
+						__('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1333 1333
 						$addon_name,
1334
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1334
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1335 1335
 					);
1336
-					$license_status = 'license-' . $class;
1336
+					$license_status = 'license-'.$class;
1337 1337
 					break;
1338 1338
 
1339 1339
 				case 'item_name_mismatch' :
1340 1340
 					$class          = $license->error;
1341
-					$messages[]     = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1342
-					$license_status = 'license-' . $class;
1341
+					$messages[]     = sprintf(__('This license %s does not belong to %s.', 'give'), $value, $addon_name);
1342
+					$license_status = 'license-'.$class;
1343 1343
 					break;
1344 1344
 
1345 1345
 				case 'no_activations_left':
1346 1346
 					$class          = $license->error;
1347
-					$messages[]     = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1348
-					$license_status = 'license-' . $class;
1347
+					$messages[]     = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1348
+					$license_status = 'license-'.$class;
1349 1349
 					break;
1350 1350
 			}
1351 1351
 		} else {
1352
-			switch ( $license->license ) {
1352
+			switch ($license->license) {
1353 1353
 				case 'valid' :
1354 1354
 				default:
1355 1355
 					$class      = 'valid';
1356
-					$now        = current_time( 'timestamp' );
1357
-					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1356
+					$now        = current_time('timestamp');
1357
+					$expiration = strtotime($license->expires, current_time('timestamp'));
1358 1358
 
1359
-					if ( 'lifetime' === $license->expires ) {
1360
-						$messages[]     = esc_html__( 'License key never expires.', 'give' );
1359
+					if ('lifetime' === $license->expires) {
1360
+						$messages[]     = esc_html__('License key never expires.', 'give');
1361 1361
 						$license_status = 'license-lifetime-notice';
1362
-					} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1362
+					} elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1363 1363
 						$messages[]     = sprintf(
1364
-							__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1365
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1366
-							$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1364
+							__('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1365
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1366
+							$checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1367 1367
 						);
1368 1368
 						$license_status = 'license-expires-soon';
1369 1369
 					} else {
1370 1370
 						$messages[]     = sprintf(
1371
-							__( 'Your license key expires on %s.', 'give' ),
1372
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1371
+							__('Your license key expires on %s.', 'give'),
1372
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1373 1373
 						);
1374 1374
 						$license_status = 'license-expiration-date';
1375 1375
 					}
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 			}
1378 1378
 		}
1379 1379
 	} else {
1380
-		$messages[]     = sprintf(
1381
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1380
+		$messages[] = sprintf(
1381
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1382 1382
 			$addon_name
1383 1383
 		);
1384 1384
 		$license_status = 'inactive';
@@ -1386,54 +1386,54 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 
1388 1388
 	// Add class for input field if license is active.
1389
-	if ( $is_valid_license ) {
1389
+	if ($is_valid_license) {
1390 1390
 		$field_classes .= ' give-license-active';
1391 1391
 	}
1392 1392
 
1393 1393
 	// Get input filed html.
1394
-	$input_field_html = $field_type_object->input( array(
1394
+	$input_field_html = $field_type_object->input(array(
1395 1395
 		'class' => $field_classes,
1396 1396
 		'type'  => $type
1397
-	) );
1397
+	));
1398 1398
 
1399 1399
 	// If license is active so show deactivate button.
1400
-	if ( $is_valid_license ) {
1400
+	if ($is_valid_license) {
1401 1401
 
1402 1402
 		// Get input filed html.
1403
-		$input_field_html = $field_type_object->input( array(
1403
+		$input_field_html = $field_type_object->input(array(
1404 1404
 			'class'    => $field_classes,
1405 1405
 			'type'     => $type,
1406 1406
 			'readonly' => 'readonly',
1407
-		) );
1407
+		));
1408 1408
 
1409
-		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1409
+		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1410 1410
 
1411 1411
 
1412 1412
 	}
1413 1413
 
1414 1414
 	// Field description.
1415
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1415
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1416 1416
 
1417 1417
 	// If no messages found then inform user that to get updated in future register yourself.
1418
-	if ( empty( $messages ) ) {
1419
-		$messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid license key.', 'give' ) );
1418
+	if (empty($messages)) {
1419
+		$messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid license key.', 'give'));
1420 1420
 	}
1421 1421
 
1422
-	foreach ( $messages as $message ) {
1423
-		$custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1424
-		$custom_html .= '<p>' . $message . '</p>';
1422
+	foreach ($messages as $message) {
1423
+		$custom_html .= '<div class="give-license-notice give-'.$license_status.'">';
1424
+		$custom_html .= '<p>'.$message.'</p>';
1425 1425
 		$custom_html .= '</div>';
1426 1426
 	}
1427 1427
 
1428 1428
 
1429 1429
 	// Field html.
1430
-	$custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object );
1430
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1431 1431
 
1432 1432
 	// Nonce.
1433
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1433
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1434 1434
 
1435 1435
 	// Print field html.
1436
-	echo '<div>' . $custom_html . '</div>';
1436
+	echo '<div>'.$custom_html.'</div>';
1437 1437
 }
1438 1438
 
1439 1439
 
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function give_api_callback() {
1447 1447
 
1448
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1448
+	if ( ! current_user_can('manage_give_settings')) {
1449 1449
 		return;
1450 1450
 	}
1451 1451
 
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
 	 *
1455 1455
 	 * @since 1.0
1456 1456
 	 */
1457
-	do_action( 'give_tools_api_keys_before' );
1457
+	do_action('give_tools_api_keys_before');
1458 1458
 
1459
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1459
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1460 1460
 
1461 1461
 	$api_keys_table = new Give_API_Keys_Table();
1462 1462
 	$api_keys_table->prepare_items();
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
 	<span class="cmb2-metabox-description api-description">
1466 1466
 		<?php echo sprintf(
1467 1467
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1468
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1469
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1470
-			esc_url( 'https://givewp.com/addons/zapier/' )
1468
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1469
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1470
+			esc_url('https://givewp.com/addons/zapier/')
1471 1471
 		); ?>
1472 1472
 	</span>
1473 1473
 	<?php
@@ -1477,10 +1477,10 @@  discard block
 block discarded – undo
1477 1477
 	 *
1478 1478
 	 * @since 1.0
1479 1479
 	 */
1480
-	do_action( 'give_tools_api_keys_after' );
1480
+	do_action('give_tools_api_keys_after');
1481 1481
 }
1482 1482
 
1483
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1483
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1484 1484
 
1485 1485
 /**
1486 1486
  * Hook Callback
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
  *
1494 1494
  * @return void
1495 1495
  */
1496
-function give_hook_callback( $args ) {
1496
+function give_hook_callback($args) {
1497 1497
 
1498 1498
 	$id = $args['id'];
1499 1499
 
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	 *
1503 1503
 	 * @since 1.0
1504 1504
 	 */
1505
-	do_action( "give_{$id}" );
1505
+	do_action("give_{$id}");
1506 1506
 
1507 1507
 }
1508 1508
 
@@ -1514,10 +1514,10 @@  discard block
 block discarded – undo
1514 1514
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1515 1515
  */
1516 1516
 
1517
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1518
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1519
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1520
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1521
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1522
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1517
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1518
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1519
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1520
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1521
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1522
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1523 1523
 }
1524 1524
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_action( 'cmb2_init', 'give_single_forms_cmb2_metaboxes', 6 );
17
+add_action('cmb2_init', 'give_single_forms_cmb2_metaboxes', 6);
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
 function give_single_forms_cmb2_metaboxes() {
23 23
 
24 24
 	$post_id               = give_get_admin_post_id();
25
-	$price                 = give_get_form_price( $post_id );
26
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
27
-	$goal                  = give_get_form_goal( $post_id );
28
-	$variable_pricing      = give_has_variable_prices( $post_id );
29
-	$prices                = give_get_variable_prices( $post_id );
25
+	$price                 = give_get_form_price($post_id);
26
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
27
+	$goal                  = give_get_form_goal($post_id);
28
+	$variable_pricing      = give_has_variable_prices($post_id);
29
+	$prices                = give_get_variable_prices($post_id);
30 30
 
31 31
 	//No empty prices - min. 1.00 for new forms
32
-	if ( empty( $price ) && is_null( $post_id ) ) {
33
-		$price = esc_attr( give_format_amount( '1.00' ) );
32
+	if (empty($price) && is_null($post_id)) {
33
+		$price = esc_attr(give_format_amount('1.00'));
34 34
 	}
35 35
 
36 36
 	//Min. $1.00 for new forms
37
-	if ( empty( $custom_amount_minimum ) ) {
38
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
37
+	if (empty($custom_amount_minimum)) {
38
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
39 39
 	}
40 40
 
41 41
 	// Start with an underscore to hide fields from custom fields list
@@ -47,327 +47,327 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * Repeatable Field Groups
49 49
 	 */
50
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
50
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
51 51
 		'id'           => 'form_field_options',
52
-		'title'        => esc_html__( 'Donation Options', 'give' ),
53
-		'object_types' => array( 'give_forms' ),
52
+		'title'        => esc_html__('Donation Options', 'give'),
53
+		'object_types' => array('give_forms'),
54 54
 		'context'      => 'normal',
55 55
 		'priority'     => 'high', //Show above Content WYSIWYG
56
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
56
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
57 57
 				//Donation Option
58 58
 				array(
59
-					'name'        => esc_html__( 'Donation Option', 'give' ),
60
-					'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
61
-					'id'          => $prefix . 'price_option',
59
+					'name'        => esc_html__('Donation Option', 'give'),
60
+					'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
61
+					'id'          => $prefix.'price_option',
62 62
 					'type'        => 'radio_inline',
63 63
 					'default'     => 'set',
64
-					'options'     => apply_filters( 'give_forms_price_options', array(
65
-						'set'   => esc_html__( 'Set Donation', 'give' ),
66
-						'multi' => esc_html__( 'Multi-level Donation', 'give' ),
67
-					) ),
64
+					'options'     => apply_filters('give_forms_price_options', array(
65
+						'set'   => esc_html__('Set Donation', 'give'),
66
+						'multi' => esc_html__('Multi-level Donation', 'give'),
67
+					)),
68 68
 				),
69 69
 				array(
70
-					'name'         => esc_html__( 'Set Donation', 'give' ),
71
-					'description'  => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
72
-					'id'           => $prefix . 'set_price',
70
+					'name'         => esc_html__('Set Donation', 'give'),
71
+					'description'  => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
72
+					'id'           => $prefix.'set_price',
73 73
 					'type'         => 'text_small',
74 74
 					'row_classes'  => 'give-subfield',
75 75
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
76 76
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
77 77
                     'attributes'   => array(
78
-						'placeholder' => give_format_decimal( '1.00' ),
79
-						'value'       => give_format_decimal( $price ),
78
+						'placeholder' => give_format_decimal('1.00'),
79
+						'value'       => give_format_decimal($price),
80 80
 						'class'       => 'cmb-type-text-small give-money-field',
81 81
 					),
82 82
 				),
83 83
 				//Donation levels: Header
84 84
 				array(
85
-					'id'   => $prefix . 'levels_header',
85
+					'id'   => $prefix.'levels_header',
86 86
 					'type' => 'levels_repeater_header',
87 87
 				),
88 88
 				//Donation Levels: Repeatable CMB2 Group
89 89
 				array(
90
-					'id'          => $prefix . 'donation_levels',
90
+					'id'          => $prefix.'donation_levels',
91 91
 					'type'        => 'group',
92 92
 					'row_classes' => 'give-subfield',
93 93
 					'options'     => array(
94
-						'add_button'    => esc_html__( 'Add Level', 'give' ),
94
+						'add_button'    => esc_html__('Add Level', 'give'),
95 95
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
96 96
 						'sortable'      => true, // beta
97 97
 					),
98 98
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
99
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
99
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
100 100
 						array(
101
-							'name' => esc_html__( 'ID', 'give' ),
102
-							'id'   => $prefix . 'id',
101
+							'name' => esc_html__('ID', 'give'),
102
+							'id'   => $prefix.'id',
103 103
 							'type' => 'levels_id',
104 104
 						),
105 105
 						array(
106
-							'name'              => esc_html__( 'Amount', 'give' ),
107
-							'id'                => $prefix . 'amount',
106
+							'name'              => esc_html__('Amount', 'give'),
107
+							'id'                => $prefix.'amount',
108 108
 							'type'              => 'text_small',
109
-							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
110
-							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
109
+							'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
110
+							'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
111 111
 							'sanitization_cb'   => 'give_sanitize_price_field_value',
112 112
                             'attributes'        => array(
113
-								'placeholder' => give_format_decimal( '1.00' ),
113
+								'placeholder' => give_format_decimal('1.00'),
114 114
 								'class'       => 'cmb-type-text-small give-money-field',
115 115
 							),
116 116
 							'before'       => 'give_format_admin_multilevel_amount',
117 117
 						),
118 118
 						array(
119
-							'name'       => esc_html__( 'Text', 'give' ),
120
-							'id'         => $prefix . 'text',
119
+							'name'       => esc_html__('Text', 'give'),
120
+							'id'         => $prefix.'text',
121 121
 							'type'       => 'text',
122 122
 							'attributes' => array(
123
-								'placeholder' => esc_html__( 'Donation Level', 'give' ),
123
+								'placeholder' => esc_html__('Donation Level', 'give'),
124 124
 								'class'       => 'give-multilevel-text-field',
125 125
 							),
126 126
 						),
127 127
 						array(
128
-							'name' => esc_html__( 'Default', 'give' ),
129
-							'id'   => $prefix . 'default',
128
+							'name' => esc_html__('Default', 'give'),
129
+							'id'   => $prefix.'default',
130 130
 							'type' => 'give_default_radio_inline'
131 131
 						),
132
-					) ),
132
+					)),
133 133
 				),
134 134
 				//Display Style
135 135
 				array(
136
-					'name'        => esc_html__( 'Display Style', 'give' ),
137
-					'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
138
-					'id'          => $prefix . 'display_style',
136
+					'name'        => esc_html__('Display Style', 'give'),
137
+					'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
138
+					'id'          => $prefix.'display_style',
139 139
 					'type'        => 'radio_inline',
140 140
 					'default'     => 'buttons',
141 141
 					'options'     => array(
142
-						'buttons'  => esc_html__( 'Buttons', 'give' ),
143
-						'radios'   => esc_html__( 'Radios', 'give' ),
144
-						'dropdown' => esc_html__( 'Dropdown', 'give' ),
142
+						'buttons'  => esc_html__('Buttons', 'give'),
143
+						'radios'   => esc_html__('Radios', 'give'),
144
+						'dropdown' => esc_html__('Dropdown', 'give'),
145 145
 					),
146 146
 				),
147 147
 				//Custom Amount
148 148
 				array(
149
-					'name'        => esc_html__( 'Custom Amount', 'give' ),
150
-					'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
151
-					'id'          => $prefix . 'custom_amount',
149
+					'name'        => esc_html__('Custom Amount', 'give'),
150
+					'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
151
+					'id'          => $prefix.'custom_amount',
152 152
 					'type'        => 'radio_inline',
153 153
 					'default'     => 'no',
154 154
 					'options'     => array(
155
-						'yes' => esc_html__( 'Yes', 'give' ),
156
-						'no'  => esc_html__( 'No', 'give' ),
155
+						'yes' => esc_html__('Yes', 'give'),
156
+						'no'  => esc_html__('No', 'give'),
157 157
 					),
158 158
 				),
159 159
 				array(
160
-					'name'              => esc_html__( 'Custom Amount Minimum', 'give' ),
161
-					'description'       => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
162
-					'id'                => $prefix . 'custom_amount_minimum',
160
+					'name'              => esc_html__('Custom Amount Minimum', 'give'),
161
+					'description'       => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
162
+					'id'                => $prefix.'custom_amount_minimum',
163 163
 					'type'              => 'text_small',
164 164
 					'row_classes'       => 'give-subfield',
165 165
 					'render_row_cb'     => 'give_cmb_amount_field_render_row_cb',
166 166
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
167 167
 					'attributes'   => array(
168 168
 						'placeholder' => give_format_decimal('1.00'),
169
-						'value'       => give_format_decimal( $custom_amount_minimum ),
169
+						'value'       => give_format_decimal($custom_amount_minimum),
170 170
 						'class'       => 'cmb-type-text-small give-money-field',
171 171
 					)
172 172
 				),
173 173
 				array(
174
-					'name'        => esc_html__( 'Custom Amount Text', 'give' ),
175
-					'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
176
-					'id'          => $prefix . 'custom_amount_text',
174
+					'name'        => esc_html__('Custom Amount Text', 'give'),
175
+					'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
176
+					'id'          => $prefix.'custom_amount_text',
177 177
 					'type'        => 'text',
178 178
 					'row_classes' => 'give-subfield',
179 179
 					'attributes'  => array(
180 180
 						'rows'        => 3,
181
-						'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
181
+						'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
182 182
 					),
183 183
 				),
184 184
 				//Goals
185 185
 				array(
186
-					'name'        => esc_html__( 'Goal', 'give' ),
187
-					'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
188
-					'id'          => $prefix . 'goal_option',
186
+					'name'        => esc_html__('Goal', 'give'),
187
+					'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
188
+					'id'          => $prefix.'goal_option',
189 189
 					'type'        => 'radio_inline',
190 190
 					'default'     => 'no',
191 191
 					'options'     => array(
192
-						'yes' => esc_html__( 'Yes', 'give' ),
193
-						'no'  => esc_html__( 'No', 'give' ),
192
+						'yes' => esc_html__('Yes', 'give'),
193
+						'no'  => esc_html__('No', 'give'),
194 194
 					),
195 195
 				),
196 196
 				array(
197
-					'name'              => esc_html__( 'Goal Amount', 'give' ),
198
-					'description'       => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
199
-					'id'                => $prefix . 'set_goal',
197
+					'name'              => esc_html__('Goal Amount', 'give'),
198
+					'description'       => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'),
199
+					'id'                => $prefix.'set_goal',
200 200
 					'type'              => 'text_small',
201 201
 					'row_classes'       => 'give-subfield',
202 202
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
203 203
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
204 204
 					'attributes'        => array(
205
-						'placeholder' => give_format_decimal( '0.00' ),
206
-						'value'       => give_format_decimal( $goal ),
205
+						'placeholder' => give_format_decimal('0.00'),
206
+						'value'       => give_format_decimal($goal),
207 207
 						'class'       => 'cmb-type-text-small give-money-field',
208 208
 					),
209 209
 				),
210 210
 
211 211
 				array(
212
-					'name'        => esc_html__( 'Goal Format', 'give' ),
213
-					'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
214
-					'id'          => $prefix . 'goal_format',
212
+					'name'        => esc_html__('Goal Format', 'give'),
213
+					'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
214
+					'id'          => $prefix.'goal_format',
215 215
 					'type'        => 'radio_inline',
216 216
 					'default'     => 'amount',
217 217
 					'row_classes' => 'give-subfield',
218 218
 					'options'     => array(
219
-						'amount'     => esc_html__( 'Amount', 'give' ),
220
-						'percentage' => esc_html__( 'Percentage', 'give' ),
219
+						'amount'     => esc_html__('Amount', 'give'),
220
+						'percentage' => esc_html__('Percentage', 'give'),
221 221
 					),
222 222
 				),
223 223
 				array(
224
-					'name'        => esc_html__( 'Goal Progress Bar Color', 'give' ),
225
-					'id'          => $prefix . 'goal_color',
224
+					'name'        => esc_html__('Goal Progress Bar Color', 'give'),
225
+					'id'          => $prefix.'goal_color',
226 226
 					'type'        => 'colorpicker',
227 227
 					'row_classes' => 'give-subfield',
228 228
 					'default'     => '#2bc253',
229 229
 				),
230 230
 
231 231
 				array(
232
-					'name'        => esc_html__( 'Close Form when Goal Achieved', 'give' ),
233
-					'desc'        => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
234
-					'id'          => $prefix . 'close_form_when_goal_achieved',
232
+					'name'        => esc_html__('Close Form when Goal Achieved', 'give'),
233
+					'desc'        => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
234
+					'id'          => $prefix.'close_form_when_goal_achieved',
235 235
 					'type'        => 'radio_inline',
236 236
 					'row_classes' => 'give-subfield',
237 237
 					'options'     => array(
238
-						'yes' => esc_html__( 'Yes', 'give' ),
239
-						'no'  => esc_html__( 'No', 'give' ),
238
+						'yes' => esc_html__('Yes', 'give'),
239
+						'no'  => esc_html__('No', 'give'),
240 240
 					),
241 241
 					'default'     => 'no',
242 242
 				),
243 243
 				array(
244
-					'name'        => esc_html__( 'Goal Achieved Message', 'give' ),
245
-					'desc'        => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
246
-					'id'          => $prefix . 'form_goal_achieved_message',
244
+					'name'        => esc_html__('Goal Achieved Message', 'give'),
245
+					'desc'        => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
246
+					'id'          => $prefix.'form_goal_achieved_message',
247 247
 					'type'        => 'textarea',
248 248
 					'row_classes' => 'give-subfield',
249 249
 					'attributes'  => array(
250
-						'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
250
+						'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
251 251
 					),
252 252
 				)
253 253
 			)
254 254
 		)
255
-	) );
255
+	));
256 256
 
257 257
 
258 258
 	/**
259 259
 	 * Content Field
260 260
 	 */
261
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
261
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
262 262
 		'id'           => 'form_content_options',
263
-		'title'        => esc_html__( 'Form Content', 'give' ),
264
-		'object_types' => array( 'give_forms' ),
263
+		'title'        => esc_html__('Form Content', 'give'),
264
+		'object_types' => array('give_forms'),
265 265
 		'context'      => 'normal',
266 266
 		'priority'     => 'high', //Show above Content WYSIWYG
267
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
267
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
268 268
 				//Donation Option
269 269
 				array(
270
-					'name'        => esc_html__( 'Display Content', 'give' ),
271
-					'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ),
272
-					'id'          => $prefix . 'content_option',
270
+					'name'        => esc_html__('Display Content', 'give'),
271
+					'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'),
272
+					'id'          => $prefix.'content_option',
273 273
 					'type'        => 'select',
274
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
275
-							'none'           => esc_html__( 'No Content', 'give' ),
276
-							'give_pre_form'  => esc_html__( 'Display content ABOVE the fields', 'give' ),
277
-							'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ),
274
+					'options'     => apply_filters('give_forms_content_options_select', array(
275
+							'none'           => esc_html__('No Content', 'give'),
276
+							'give_pre_form'  => esc_html__('Display content ABOVE the fields', 'give'),
277
+							'give_post_form' => esc_html__('Display content BELOW the fields', 'give'),
278 278
 						)
279 279
 					),
280 280
 					'default'     => 'none',
281 281
 				),
282 282
 				array(
283
-					'name'        => esc_html__( 'Content', 'give' ),
284
-					'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
285
-					'id'          => $prefix . 'form_content',
283
+					'name'        => esc_html__('Content', 'give'),
284
+					'description' => esc_html__('This content will display on the single give form page.', 'give'),
285
+					'id'          => $prefix.'form_content',
286 286
 					'row_classes' => 'give-subfield',
287 287
 					'type'        => 'wysiwyg'
288 288
 				),
289 289
 			)
290 290
 		)
291
-	) );
291
+	));
292 292
 
293 293
 
294 294
 	/**
295 295
 	 * Display Options
296 296
 	 */
297
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
297
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
298 298
 			'id'           => 'form_display_options',
299
-			'title'        => esc_html__( 'Form Display Options', 'give' ),
300
-			'object_types' => array( 'give_forms' ),
299
+			'title'        => esc_html__('Form Display Options', 'give'),
300
+			'object_types' => array('give_forms'),
301 301
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
302 302
 			'priority'     => 'high', //Show above Content WYSIWYG
303 303
 			'show_names'   => true, // Show field names on the left
304
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
304
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
305 305
 					array(
306
-						'name'    => esc_html__( 'Payment Fields', 'give' ),
307
-						'desc'    => esc_html__( 'How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
308
-						'id'      => $prefix . 'payment_display',
306
+						'name'    => esc_html__('Payment Fields', 'give'),
307
+						'desc'    => esc_html__('How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
308
+						'id'      => $prefix.'payment_display',
309 309
 						'type'    => 'select',
310 310
 						'options' => array(
311
-							'onpage' => esc_html__( 'Show on Page', 'give' ),
312
-							'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
313
-							'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
311
+							'onpage' => esc_html__('Show on Page', 'give'),
312
+							'reveal' => esc_html__('Reveal Upon Click', 'give'),
313
+							'modal'  => esc_html__('Modal Window Upon Click', 'give'),
314 314
 						),
315 315
 						'default' => 'onpage',
316 316
 					),
317 317
 					array(
318
-						'id'          => $prefix . 'reveal_label',
319
-						'name'        => esc_html__( 'Reveal / Modal Open Text', 'give' ),
320
-						'desc'        => esc_html__( 'The button label for completing the donation.', 'give' ),
318
+						'id'          => $prefix.'reveal_label',
319
+						'name'        => esc_html__('Reveal / Modal Open Text', 'give'),
320
+						'desc'        => esc_html__('The button label for completing the donation.', 'give'),
321 321
 						'type'        => 'text_small',
322 322
 						'row_classes' => 'give-subfield',
323 323
 						'attributes'  => array(
324
-							'placeholder' => esc_attr__( 'Donate Now', 'give' ),
324
+							'placeholder' => esc_attr__('Donate Now', 'give'),
325 325
 						),
326 326
 					),
327 327
 					array(
328
-						'id'         => $prefix . 'checkout_label',
329
-						'name'       => esc_html__( 'Complete Donation Text', 'give' ),
330
-						'desc'       => esc_html__( 'The button label for completing the donation.', 'give' ),
328
+						'id'         => $prefix.'checkout_label',
329
+						'name'       => esc_html__('Complete Donation Text', 'give'),
330
+						'desc'       => esc_html__('The button label for completing the donation.', 'give'),
331 331
 						'type'       => 'text_small',
332 332
 						'attributes' => array(
333
-							'placeholder' => esc_html__( 'Donate Now', 'give' ),
333
+							'placeholder' => esc_html__('Donate Now', 'give'),
334 334
 						),
335 335
 					),
336 336
 					array(
337
-						'name' => esc_html__( 'Default Gateway', 'give' ),
338
-						'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
339
-						'id'   => $prefix . 'default_gateway',
337
+						'name' => esc_html__('Default Gateway', 'give'),
338
+						'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
339
+						'id'   => $prefix.'default_gateway',
340 340
 						'type' => 'default_gateway'
341 341
 					),
342 342
 					array(
343
-						'name' => esc_html__( 'Disable Guest Donations', 'give' ),
344
-						'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
345
-						'id'   => $prefix . 'logged_in_only',
343
+						'name' => esc_html__('Disable Guest Donations', 'give'),
344
+						'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
345
+						'id'   => $prefix.'logged_in_only',
346 346
 						'type' => 'checkbox'
347 347
 					),
348 348
 					array(
349
-						'name'    => esc_html__( 'Register / Login Form', 'give' ),
350
-						'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
351
-						'id'      => $prefix . 'show_register_form',
349
+						'name'    => esc_html__('Register / Login Form', 'give'),
350
+						'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
351
+						'id'      => $prefix.'show_register_form',
352 352
 						'type'    => 'select',
353 353
 						'options' => array(
354
-							'both'         => esc_html__( 'Registration and Login Forms', 'give' ),
355
-							'registration' => esc_html__( 'Registration Form Only', 'give' ),
356
-							'login'        => esc_html__( 'Login Form Only', 'give' ),
357
-							'none'         => esc_html__( 'None', 'give' ),
354
+							'both'         => esc_html__('Registration and Login Forms', 'give'),
355
+							'registration' => esc_html__('Registration Form Only', 'give'),
356
+							'login'        => esc_html__('Login Form Only', 'give'),
357
+							'none'         => esc_html__('None', 'give'),
358 358
 						),
359 359
 						'default' => 'none',
360 360
 					),
361 361
 					array(
362
-						'name'    => esc_html__( 'Floating Labels', 'give' ),
362
+						'name'    => esc_html__('Floating Labels', 'give'),
363 363
 						/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
364
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
365
-						'id'      => $prefix . 'form_floating_labels',
364
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
365
+						'id'      => $prefix.'form_floating_labels',
366 366
 						'type'    => 'select',
367 367
 						'options' => array(
368
-							''         => esc_html__( 'Use the global setting', 'give' ),
369
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
370
-							'disabled' => esc_html__( 'Disabled', 'give' ),
368
+							''         => esc_html__('Use the global setting', 'give'),
369
+							'enabled'  => esc_html__('Enabled', 'give'),
370
+							'disabled' => esc_html__('Disabled', 'give'),
371 371
 						),
372 372
 						'default' => 'none',
373 373
 					)
@@ -379,50 +379,50 @@  discard block
 block discarded – undo
379 379
 	/**
380 380
 	 * Terms & Conditions
381 381
 	 */
382
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
382
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
383 383
 		'id'           => 'form_terms_options',
384
-		'title'        => esc_html__( 'Terms and Conditions', 'give' ),
385
-		'object_types' => array( 'give_forms' ),
384
+		'title'        => esc_html__('Terms and Conditions', 'give'),
385
+		'object_types' => array('give_forms'),
386 386
 		'context'      => 'normal',
387 387
 		'priority'     => 'high', //Show above Content WYSIWYG
388
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
388
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
389 389
 				//Donation Option
390 390
 				array(
391
-					'name'        => esc_html__( 'Terms and Conditions', 'give' ),
392
-					'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
393
-					'id'          => $prefix . 'terms_option',
391
+					'name'        => esc_html__('Terms and Conditions', 'give'),
392
+					'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
393
+					'id'          => $prefix.'terms_option',
394 394
 					'type'        => 'select',
395
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
396
-							'none' => esc_html__( 'No', 'give' ),
397
-							'yes'  => esc_html__( 'Yes', 'give' ),
395
+					'options'     => apply_filters('give_forms_content_options_select', array(
396
+							'none' => esc_html__('No', 'give'),
397
+							'yes'  => esc_html__('Yes', 'give'),
398 398
 						)
399 399
 					),
400 400
 					'default'     => 'none',
401 401
 				),
402 402
 				array(
403
-					'id'          => $prefix . 'agree_label',
404
-					'name'        => esc_html__( 'Agree to Terms Label', 'give' ),
405
-					'desc'        => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
403
+					'id'          => $prefix.'agree_label',
404
+					'name'        => esc_html__('Agree to Terms Label', 'give'),
405
+					'desc'        => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
406 406
 					'type'        => 'text',
407 407
 					'row_classes' => 'give-subfield',
408 408
 					'size'        => 'regular',
409 409
 					'attributes'  => array(
410
-						'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
410
+						'placeholder' => esc_attr__('Agree to Terms?', 'give'),
411 411
 					),
412 412
 				),
413 413
 				array(
414
-					'id'          => $prefix . 'agree_text',
414
+					'id'          => $prefix.'agree_text',
415 415
 					'row_classes' => 'give-subfield',
416
-					'name'        => esc_html__( 'Agreement Text', 'give' ),
417
-					'desc'        => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
416
+					'name'        => esc_html__('Agreement Text', 'give'),
417
+					'desc'        => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
418 418
 					'type'        => 'wysiwyg'
419 419
 				),
420 420
 			)
421 421
 		)
422
-	) );
422
+	));
423 423
 
424
-	foreach ( $meta_boxes as $box ) {
425
-		$cmb = new_cmb2_box( $box );
424
+	foreach ($meta_boxes as $box) {
425
+		$cmb = new_cmb2_box($box);
426 426
 	}
427 427
 
428 428
 }
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
 
436 436
 	<div class="table-container">
437 437
 		<div class="table-row">
438
-			<div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div>
439
-			<div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div>
440
-			<div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div>
438
+			<div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
439
+			<div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
440
+			<div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
441 441
 			<?php
442 442
 			/**
443 443
 			 * Fires in repeatable donation levels table head.
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 			 *
450 450
 			 * @since 1.0
451 451
 			 */
452
-			do_action( 'give_donation_levels_table_head' );
452
+			do_action('give_donation_levels_table_head');
453 453
 			?>
454
-			<div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div>
454
+			<div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
455 455
 
456 456
 		</div>
457 457
 	</div>
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	<?php
460 460
 }
461 461
 
462
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
462
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
463 463
 
464 464
 
465 465
 /**
@@ -476,25 +476,25 @@  discard block
 block discarded – undo
476 476
  * @param $object_type
477 477
  * @param $field_type_object
478 478
  */
479
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
479
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
480 480
 
481
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
481
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
482 482
 
483 483
 	$field_options_array = array(
484 484
 		'class' => 'give-hidden give-level-id-input',
485
-		'name'  => $field_type_object->_name( '[level_id]' ),
486
-		'id'    => $field_type_object->_id( '_level_id' ),
485
+		'name'  => $field_type_object->_name('[level_id]'),
486
+		'id'    => $field_type_object->_id('_level_id'),
487 487
 		'value' => $escaped_value,
488 488
 		'type'  => 'number',
489 489
 		'desc'  => '',
490 490
 	);
491 491
 
492
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
493
-	echo $field_type_object->input( $field_options_array );
492
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
493
+	echo $field_type_object->input($field_options_array);
494 494
 
495 495
 }
496 496
 
497
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
497
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
498 498
 
499 499
 
500 500
 /**
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
  * @param $object_type
507 507
  * @param $field_type_object
508 508
  */
509
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
510
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
511
-	echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>';
509
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
510
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
511
+	echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>';
512 512
 
513 513
 }
514 514
 
515
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
515
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
516 516
 
517 517
 
518 518
 /**
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
  */
523 523
 function give_add_shortcode_to_publish_metabox() {
524 524
 
525
-	if ( 'give_forms' !== get_post_type() ) {
525
+	if ('give_forms' !== get_post_type()) {
526 526
 		return false;
527 527
 	}
528 528
 
529 529
 	global $post;
530 530
 
531 531
 	//Only enqueue scripts for CPT on post type screen
532
-	if ( 'give_forms' === $post->post_type ) {
532
+	if ('give_forms' === $post->post_type) {
533 533
 		//Shortcode column with select all input
534
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
535
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
534
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
535
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
536 536
 
537 537
 	}
538 538
 
539 539
 }
540 540
 
541
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
541
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 1 patch
Spacing   +185 added lines, -185 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,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 		'user_id' => 0
54 54
 	);
55 55
 
56
-	$customer_info = wp_parse_args( $customer_info, $defaults );
56
+	$customer_info = wp_parse_args($customer_info, $defaults);
57 57
 
58
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
58
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
59 59
 
60 60
 		// Make sure we don't already have this user attached to a customer
61
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
62
-			give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
61
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
62
+			give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
63 63
 		}
64 64
 
65 65
 		// Make sure it's actually a user
66
-		$user = get_user_by( 'id', $customer_info['user_id'] );
67
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
68
-			give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
66
+		$user = get_user_by('id', $customer_info['user_id']);
67
+		if ( ! empty($customer_info['user_id']) && false === $user) {
68
+			give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
69 69
 		}
70 70
 
71 71
 	}
@@ -73,52 +73,52 @@  discard block
 block discarded – undo
73 73
 	// Record this for later
74 74
 	$previous_user_id = $customer->user_id;
75 75
 
76
-	if ( give_get_errors() ) {
76
+	if (give_get_errors()) {
77 77
 		return;
78 78
 	}
79 79
 
80 80
 	// Setup the customer address, if present
81 81
 	$address = array();
82
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
82
+	if (intval($customer_info['user_id']) > 0) {
83 83
 
84
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
84
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
85 85
 
86
-		if ( false === $current_address ) {
87
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
88
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
89
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
90
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
91
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
92
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
86
+		if (false === $current_address) {
87
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
88
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
89
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
90
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
91
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
92
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
93 93
 		} else {
94
-			$current_address    = wp_parse_args( $current_address, array(
94
+			$current_address    = wp_parse_args($current_address, array(
95 95
 				'line1',
96 96
 				'line2',
97 97
 				'city',
98 98
 				'zip',
99 99
 				'state',
100 100
 				'country'
101
-			) );
102
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
103
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
104
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
105
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
106
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
107
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
101
+			));
102
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
103
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
104
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
105
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
106
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
107
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
108 108
 		}
109 109
 
110 110
 	}
111 111
 
112 112
 	// Sanitize the inputs
113 113
 	$customer_data            = array();
114
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
114
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
115 115
 	$customer_data['user_id'] = $customer_info['user_id'];
116 116
 
117
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
118
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
117
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
118
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
119 119
 
120
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
121
-	$address       = array_map( 'sanitize_text_field', $address );
120
+	$customer_data = array_map('sanitize_text_field', $customer_data);
121
+	$address       = array_map('sanitize_text_field', $address);
122 122
 
123 123
 
124 124
 	/**
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 	 * @param array $customer_data The customer data.
131 131
 	 * @param array $address       The customer address.
132 132
 	 */
133
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
133
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
134 134
 
135
-	$output         = array();
135
+	$output = array();
136 136
 
137
-	if ( $customer->update( $customer_data ) ) {
137
+	if ($customer->update($customer_data)) {
138 138
 
139
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
140
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
139
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
140
+			update_user_meta($customer->user_id, '_give_user_address', $address);
141 141
 		}
142 142
 
143 143
 		// Update some donation meta if we need to
144
-		$payments_array = explode( ',', $customer->payment_ids );
144
+		$payments_array = explode(',', $customer->payment_ids);
145 145
 
146
-		if ( $customer->user_id != $previous_user_id ) {
147
-			foreach ( $payments_array as $payment_id ) {
148
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
146
+		if ($customer->user_id != $previous_user_id) {
147
+			foreach ($payments_array as $payment_id) {
148
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
149 149
 			}
150 150
 		}
151 151
 
152 152
 		$output['success']       = true;
153
-		$customer_data           = array_merge( $customer_data, $address );
153
+		$customer_data           = array_merge($customer_data, $address);
154 154
 		$output['customer_info'] = $customer_data;
155 155
 
156 156
 	} else {
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param int   $customer_id   The ID of the customer.
168 168
 	 * @param array $customer_data The customer data.
169 169
 	 */
170
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
170
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
171 171
 
172
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
173
-		header( 'Content-Type: application/json' );
174
-		echo json_encode( $output );
172
+	if (defined('DOING_AJAX') && DOING_AJAX) {
173
+		header('Content-Type: application/json');
174
+		echo json_encode($output);
175 175
 		wp_die();
176 176
 	}
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 }
181 181
 
182
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
182
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
183 183
 
184 184
 /**
185 185
  * Save a customer note being added
@@ -190,36 +190,36 @@  discard block
 block discarded – undo
190 190
  *
191 191
  * @return int         The Note ID that was saved, or 0 if nothing was saved
192 192
  */
193
-function give_customer_save_note( $args ) {
193
+function give_customer_save_note($args) {
194 194
 
195
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
195
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
196 196
 
197
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
198
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
197
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
198
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
199 199
 	}
200 200
 
201
-	if ( empty( $args ) ) {
201
+	if (empty($args)) {
202 202
 		return;
203 203
 	}
204 204
 
205
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
205
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
206 206
 	$customer_id   = (int) $args['customer_id'];
207 207
 	$nonce         = $args['add_customer_note_nonce'];
208 208
 
209
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
210
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
209
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
210
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
211 211
 	}
212 212
 
213
-	if ( empty( $customer_note ) ) {
214
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
213
+	if (empty($customer_note)) {
214
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
215 215
 	}
216 216
 
217
-	if ( give_get_errors() ) {
217
+	if (give_get_errors()) {
218 218
 		return;
219 219
 	}
220 220
 
221
-	$customer = new Give_Customer( $customer_id );
222
-	$new_note = $customer->add_note( $customer_note );
221
+	$customer = new Give_Customer($customer_id);
222
+	$new_note = $customer->add_note($customer_note);
223 223
 
224 224
 	/**
225 225
 	 * Fires before inserting customer note.
@@ -229,22 +229,22 @@  discard block
 block discarded – undo
229 229
 	 * @param int    $customer_id The ID of the customer.
230 230
 	 * @param string $new_note    Note content.
231 231
 	 */
232
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
232
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
233 233
 
234
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
234
+	if ( ! empty($new_note) && ! empty($customer->id)) {
235 235
 
236 236
 		ob_start();
237 237
 		?>
238 238
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
239 239
 			<span class="note-content-wrap">
240
-				<?php echo stripslashes( $new_note ); ?>
240
+				<?php echo stripslashes($new_note); ?>
241 241
 			</span>
242 242
 		</div>
243 243
 		<?php
244 244
 		$output = ob_get_contents();
245 245
 		ob_end_clean();
246 246
 
247
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
247
+		if (defined('DOING_AJAX') && DOING_AJAX) {
248 248
 			echo $output;
249 249
 			exit;
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
260
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
261 261
 
262 262
 /**
263 263
  * Delete a customer
@@ -268,37 +268,37 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return int Whether it was a successful deletion
270 270
  */
271
-function give_customer_delete( $args ) {
271
+function give_customer_delete($args) {
272 272
 
273
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
273
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
274 274
 
275
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
276
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
275
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
276
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
277 277
 	}
278 278
 
279
-	if ( empty( $args ) ) {
279
+	if (empty($args)) {
280 280
 		return;
281 281
 	}
282 282
 
283 283
 	$customer_id = (int) $args['customer_id'];
284
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
285
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
284
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
285
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
286 286
 	$nonce       = $args['_wpnonce'];
287 287
 
288
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
289
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
288
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
289
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
290 290
 	}
291 291
 
292
-	if ( ! $confirm ) {
293
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
292
+	if ( ! $confirm) {
293
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
294 294
 	}
295 295
 
296
-	if ( give_get_errors() ) {
297
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
296
+	if (give_get_errors()) {
297
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
298 298
 		exit;
299 299
 	}
300 300
 
301
-	$customer = new Give_Customer( $customer_id );
301
+	$customer = new Give_Customer($customer_id);
302 302
 
303 303
 	/**
304 304
 	 * Fires before deleting customer.
@@ -309,53 +309,53 @@  discard block
 block discarded – undo
309 309
 	 * @param bool $confirm     Delete confirmation.
310 310
 	 * @param bool $remove_data Records delete confirmation.
311 311
 	 */
312
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
312
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
313 313
 	
314
-	if ( $customer->id > 0 ) {
314
+	if ($customer->id > 0) {
315 315
 
316
-		$payments_array = explode( ',', $customer->payment_ids );
317
-		$success        = Give()->customers->delete( $customer->id );
316
+		$payments_array = explode(',', $customer->payment_ids);
317
+		$success        = Give()->customers->delete($customer->id);
318 318
 
319
-		if ( $success ) {
319
+		if ($success) {
320 320
 
321
-			if ( $remove_data ) {
321
+			if ($remove_data) {
322 322
 
323 323
 				// Remove all donations, logs, etc
324
-				foreach ( $payments_array as $payment_id ) {
325
-					give_delete_purchase( $payment_id );
324
+				foreach ($payments_array as $payment_id) {
325
+					give_delete_purchase($payment_id);
326 326
 				}
327 327
 
328 328
 			} else {
329 329
 
330 330
 				// Just set the donations to customer_id of 0
331
-				foreach ( $payments_array as $payment_id ) {
332
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
331
+				foreach ($payments_array as $payment_id) {
332
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
333 333
 				}
334 334
 
335 335
 			}
336 336
 
337
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
337
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
338 338
 
339 339
 		} else {
340 340
 
341
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
342
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
341
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
342
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
343 343
 
344 344
 		}
345 345
 
346 346
 	} else {
347 347
 
348
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
349
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
348
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
349
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
350 350
 
351 351
 	}
352 352
 
353
-	wp_redirect( $redirect );
353
+	wp_redirect($redirect);
354 354
 	exit;
355 355
 
356 356
 }
357 357
 
358
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
358
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
359 359
 
360 360
 /**
361 361
  * Disconnect a user ID from a donor
@@ -366,27 +366,27 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return bool        If the disconnect was successful
368 368
  */
369
-function give_disconnect_customer_user_id( $args ) {
369
+function give_disconnect_customer_user_id($args) {
370 370
 
371
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
371
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
372 372
 
373
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
374
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
373
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
374
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
375 375
 	}
376 376
 
377
-	if ( empty( $args ) ) {
377
+	if (empty($args)) {
378 378
 		return;
379 379
 	}
380 380
 
381 381
 	$customer_id = (int) $args['customer_id'];
382 382
 	$nonce       = $args['_wpnonce'];
383 383
 
384
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
385
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
384
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
385
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
386 386
 	}
387 387
 
388
-	$customer = new Give_Customer( $customer_id );
389
-	if ( empty( $customer->id ) ) {
388
+	$customer = new Give_Customer($customer_id);
389
+	if (empty($customer->id)) {
390 390
 		return false;
391 391
 	}
392 392
 
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	 * @param int $customer_id The ID of the customer.
401 401
 	 * @param int $user_id     The ID of the user.
402 402
 	 */
403
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
403
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
404 404
 
405 405
 	$output = array();
406
-	$customer_args = array( 'user_id' => 0 );
406
+	$customer_args = array('user_id' => 0);
407 407
 
408
-	if ( $customer->update( $customer_args ) ) {
408
+	if ($customer->update($customer_args)) {
409 409
 		global $wpdb;
410 410
 
411
-		if ( ! empty( $customer->payment_ids ) ) {
412
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
411
+		if ( ! empty($customer->payment_ids)) {
412
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
413 413
 		}
414 414
 
415 415
 		$output['success'] = true;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	} else {
418 418
 
419 419
 		$output['success'] = false;
420
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
420
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
421 421
 	}
422 422
 
423 423
 	/**
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @param int $customer_id The ID of the customer.
429 429
 	 */
430
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
430
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
431 431
 
432
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
433
-		header( 'Content-Type: application/json' );
434
-		echo json_encode( $output );
432
+	if (defined('DOING_AJAX') && DOING_AJAX) {
433
+		header('Content-Type: application/json');
434
+		echo json_encode($output);
435 435
 		wp_die();
436 436
 	}
437 437
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 }
441 441
 
442
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
442
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
443 443
 
444 444
 /**
445 445
  * Add an email address to the donor from within the admin and log a donor note
@@ -448,81 +448,81 @@  discard block
 block discarded – undo
448 448
  * @param  array $args  Array of arguments: nonce, customer id, and email address
449 449
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string)
450 450
  */
451
-function give_add_donor_email( $args ) {
452
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
451
+function give_add_donor_email($args) {
452
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
453 453
 
454
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
455
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'edit' ) );
454
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
455
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'edit'));
456 456
 	}
457 457
 
458 458
 	$output = array();
459
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
459
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
460 460
 		$output['success'] = false;
461
-		if ( empty( $args['email'] ) ) {
462
-			$output['message'] = esc_html__( 'Email address is required.', 'give' );
463
-		} else if ( empty( $args['customer_id'] ) ) {
464
-			$output['message'] = esc_html__( 'Customer ID is required.', 'give' );
461
+		if (empty($args['email'])) {
462
+			$output['message'] = esc_html__('Email address is required.', 'give');
463
+		} else if (empty($args['customer_id'])) {
464
+			$output['message'] = esc_html__('Customer ID is required.', 'give');
465 465
 		} else {
466
-			$output['message'] = esc_html__( 'An error has occurred. Please try again.', 'give' );
466
+			$output['message'] = esc_html__('An error has occurred. Please try again.', 'give');
467 467
 		}
468
-	} else if ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
468
+	} else if ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
469 469
 		$output = array(
470 470
 			'success' => false,
471
-			'message' => esc_html__( 'Nonce verification failed.', 'give' ),
471
+			'message' => esc_html__('Nonce verification failed.', 'give'),
472 472
 		);
473
-	} else if ( ! is_email( $args['email'] ) ) {
473
+	} else if ( ! is_email($args['email'])) {
474 474
 		$output = array(
475 475
 			'success' => false,
476
-			'message' => esc_html__( 'Invalid email.', 'give' ),
476
+			'message' => esc_html__('Invalid email.', 'give'),
477 477
 		);
478 478
 	} else {
479
-		$email       = sanitize_email($args['email'] );
479
+		$email       = sanitize_email($args['email']);
480 480
 		$customer_id = (int) $args['customer_id'];
481 481
 		$primary     = 'true' === $args['primary'] ? true : false;
482
-		$customer    = new Give_Customer( $customer_id );
483
-		if ( false === $customer->add_email( $email, $primary ) ) {
484
-			if ( in_array( $email, $customer->emails ) ) {
482
+		$customer    = new Give_Customer($customer_id);
483
+		if (false === $customer->add_email($email, $primary)) {
484
+			if (in_array($email, $customer->emails)) {
485 485
 				$output = array(
486 486
 					'success'  => false,
487
-					'message'  => esc_html__( 'Email already associated with this donor.', 'give' ),
487
+					'message'  => esc_html__('Email already associated with this donor.', 'give'),
488 488
 				);
489 489
 			} else {
490 490
 				$output = array(
491 491
 					'success' => false,
492
-					'message' => esc_html__( 'Email address is already associated with another donor.', 'give' ),
492
+					'message' => esc_html__('Email address is already associated with another donor.', 'give'),
493 493
 				);
494 494
 			}
495 495
 		} else {
496
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' );
496
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added');
497 497
 			$output = array(
498 498
 				'success'  => true,
499
-				'message'  => esc_html__( 'Email successfully added to donor.', 'give' ),
499
+				'message'  => esc_html__('Email successfully added to donor.', 'give'),
500 500
 				'redirect' => $redirect,
501 501
 			);
502 502
 
503 503
 			$user          = wp_get_current_user();
504
-			$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
505
-			$customer_note = sprintf( __( 'Email address %s added by %s', 'give' ), $email, $user_login );
506
-			$customer->add_note( $customer_note );
504
+			$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
505
+			$customer_note = sprintf(__('Email address %s added by %s', 'give'), $email, $user_login);
506
+			$customer->add_note($customer_note);
507 507
 
508
-			if ( $primary ) {
509
-				$customer_note = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $email, $user_login );
510
-				$customer->add_note( $customer_note );
508
+			if ($primary) {
509
+				$customer_note = sprintf(__('Email address %s set as primary by %s', 'give'), $email, $user_login);
510
+				$customer->add_note($customer_note);
511 511
 			}
512 512
 		}
513 513
 	}
514 514
 
515
-	do_action( 'give_post_add_customer_email', $customer_id, $args );
515
+	do_action('give_post_add_customer_email', $customer_id, $args);
516 516
 
517
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
518
-		header( 'Content-Type: application/json' );
519
-		echo json_encode( $output );
517
+	if (defined('DOING_AJAX') && DOING_AJAX) {
518
+		header('Content-Type: application/json');
519
+		echo json_encode($output);
520 520
 		wp_die();
521 521
 	}
522 522
 
523 523
 	return $output;
524 524
 }
525
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
525
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
526 526
 
527 527
 
528 528
 /**
@@ -533,36 +533,36 @@  discard block
 block discarded – undo
533 533
  * @return void|bool
534 534
  */
535 535
 function give_remove_donor_email() {
536
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
536
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
537 537
 		return false;
538 538
 	}
539
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
539
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
540 540
 		return false;
541 541
 	}
542
-	if ( empty( $_GET['_wpnonce'] ) ) {
542
+	if (empty($_GET['_wpnonce'])) {
543 543
 		return false;
544 544
 	}
545 545
 
546 546
 	$nonce = $_GET['_wpnonce'];
547
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
548
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
547
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
548
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
549 549
 	}
550 550
 
551
-	$customer = new Give_Customer( $_GET['id'] );
552
-	if ( $customer->remove_email( $_GET['email'] ) ) {
553
-		$url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
551
+	$customer = new Give_Customer($_GET['id']);
552
+	if ($customer->remove_email($_GET['email'])) {
553
+		$url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
554 554
 		$user          = wp_get_current_user();
555
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
556
-		$customer_note = sprintf( __( 'Email address %s removed by %s', 'give' ), $_GET['email'], $user_login );
557
-		$customer->add_note( $customer_note );
555
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
556
+		$customer_note = sprintf(__('Email address %s removed by %s', 'give'), $_GET['email'], $user_login);
557
+		$customer->add_note($customer_note);
558 558
 	} else {
559
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
559
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
560 560
 	}
561 561
 
562
-	wp_safe_redirect( $url );
562
+	wp_safe_redirect($url);
563 563
 	exit;
564 564
 }
565
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
565
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
566 566
 
567 567
 
568 568
 /**
@@ -573,38 +573,38 @@  discard block
 block discarded – undo
573 573
  * @return void|bool
574 574
  */
575 575
 function give_set_donor_primary_email() {
576
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
576
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
577 577
 		return false;
578 578
 	}
579 579
 
580
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
580
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
581 581
 		return false;
582 582
 	}
583 583
 
584
-	if ( empty( $_GET['_wpnonce'] ) ) {
584
+	if (empty($_GET['_wpnonce'])) {
585 585
 		return false;
586 586
 	}
587 587
 
588 588
 	$nonce = $_GET['_wpnonce'];
589 589
 
590
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
591
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
590
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
591
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
592 592
 	}
593 593
 
594
-	$donor = new Give_Customer( $_GET['id'] );
594
+	$donor = new Give_Customer($_GET['id']);
595 595
 
596
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
597
-		$url = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
596
+	if ($donor->set_primary_email($_GET['email'])) {
597
+		$url = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
598 598
 		$user          = wp_get_current_user();
599
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
600
-		$donor_note    = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $_GET['email'], $user_login );
599
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
600
+		$donor_note    = sprintf(__('Email address %s set as primary by %s', 'give'), $_GET['email'], $user_login);
601 601
 
602
-		$donor->add_note( $donor_note );
602
+		$donor->add_note($donor_note);
603 603
 	} else {
604
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
604
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
605 605
 	}
606 606
 
607
-	wp_safe_redirect( $url );
607
+	wp_safe_redirect($url);
608 608
 	exit;
609 609
 }
610
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
610
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
Please login to merge, or discard this patch.
admin/reporting/tools/class-give-tools-recount-single-customer-stats.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,39 +54,39 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		$customer = new Give_Customer( $this->customer_id );
58
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $customer->id, array() );
57
+		$customer = new Give_Customer($this->customer_id);
58
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$customer->id, array());
59 59
 
60
-		$offset     = ( $this->step - 1 ) * $this->per_step;
61
-		$step_items = array_slice( $payments, $offset, $this->per_step );
60
+		$offset     = ($this->step - 1) * $this->per_step;
61
+		$step_items = array_slice($payments, $offset, $this->per_step);
62 62
 
63
-		if ( count( $step_items ) > 0 ) {
64
-			$pending_total = (float) $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
63
+		if (count($step_items) > 0) {
64
+			$pending_total = (float) $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
65 65
 			$step_total    = 0;
66 66
 
67
-			$found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $customer->id, array() );
67
+			$found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$customer->id, array());
68 68
 
69
-			foreach ( $step_items as $payment ) {
70
-				$payment = get_post( $payment->ID );
69
+			foreach ($step_items as $payment) {
70
+				$payment = get_post($payment->ID);
71 71
 
72
-				if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) {
72
+				if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) {
73 73
 
74
-					$missing_payments   = $this->get_stored_data( 'give_stats_missing_payments' . $customer->id, array() );
74
+					$missing_payments   = $this->get_stored_data('give_stats_missing_payments'.$customer->id, array());
75 75
 					$missing_payments[] = $payment->ID;
76
-					$this->store_data( 'give_stats_missing_payments' . $customer->id, $missing_payments );
76
+					$this->store_data('give_stats_missing_payments'.$customer->id, $missing_payments);
77 77
 
78 78
 					continue;
79 79
 				}
80 80
 
81 81
 				$should_process_payment = 'publish' == $payment->post_status ? true : false;
82
-				$should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment );
82
+				$should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment);
83 83
 
84
-				if ( true === $should_process_payment ) {
84
+				if (true === $should_process_payment) {
85 85
 
86 86
 					$found_payment_ids[] = $payment->ID;
87 87
 
88
-					if ( apply_filters( 'give_customer_recount_sholud_increase_value', true, $payment ) ) {
89
-						$payment_amount = give_get_payment_amount( $payment->ID );
88
+					if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) {
89
+						$payment_amount = give_get_payment_amount($payment->ID);
90 90
 						$step_total += $payment_amount;
91 91
 					}
92 92
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 			}
96 96
 
97 97
 			$updated_total = $pending_total + $step_total;
98
-			$this->store_data( 'give_stats_customer_pending_total' . $customer->id, $updated_total );
99
-			$this->store_data( 'give_stats_found_payments_' . $customer->id, $found_payment_ids );
98
+			$this->store_data('give_stats_customer_pending_total'.$customer->id, $updated_total);
99
+			$this->store_data('give_stats_found_payments_'.$customer->id, $found_payment_ids);
100 100
 
101 101
 			return true;
102 102
 		}
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function get_percentage_complete() {
115 115
 
116
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $this->customer_id );
117
-		$total    = count( $payments );
116
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$this->customer_id);
117
+		$total    = count($payments);
118 118
 
119 119
 		$percentage = 100;
120 120
 
121
-		if ( $total > 0 ) {
122
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
121
+		if ($total > 0) {
122
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
123 123
 		}
124 124
 
125
-		if ( $percentage > 100 ) {
125
+		if ($percentage > 100) {
126 126
 			$percentage = 100;
127 127
 		}
128 128
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param array $request The Form Data passed into the batch processing
138 138
 	 */
139
-	public function set_properties( $request ) {
140
-		$this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false;
139
+	public function set_properties($request) {
140
+		$this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false;
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,62 +148,62 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function process_step() {
150 150
 
151
-		if ( ! $this->can_export() ) {
152
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
151
+		if ( ! $this->can_export()) {
152
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
153 153
 		}
154 154
 
155 155
 		$had_data = $this->get_data();
156 156
 
157
-		if ( $had_data ) {
157
+		if ($had_data) {
158 158
 			$this->done = false;
159 159
 
160 160
 			return true;
161 161
 		} else {
162
-			$customer    = new Give_Customer( $this->customer_id );
163
-			$payment_ids = get_option( 'give_stats_found_payments_' . $customer->id, array() );
164
-			$this->delete_data( 'give_stats_found_payments_' . $customer->id );
162
+			$customer    = new Give_Customer($this->customer_id);
163
+			$payment_ids = get_option('give_stats_found_payments_'.$customer->id, array());
164
+			$this->delete_data('give_stats_found_payments_'.$customer->id);
165 165
 
166
-			$removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $customer->id, array() ) );
166
+			$removed_payments = array_unique(get_option('give_stats_missing_payments'.$customer->id, array()));
167 167
 
168 168
 			// Find non-existing payments (deleted) and total up the donation count
169 169
 			$purchase_count = 0;
170
-			foreach ( $payment_ids as $key => $payment_id ) {
171
-				if ( in_array( $payment_id, $removed_payments ) ) {
172
-					unset( $payment_ids[ $key ] );
170
+			foreach ($payment_ids as $key => $payment_id) {
171
+				if (in_array($payment_id, $removed_payments)) {
172
+					unset($payment_ids[$key]);
173 173
 					continue;
174 174
 				}
175 175
 
176
-				$payment = get_post( $payment_id );
177
-				if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
178
-					$purchase_count ++;
176
+				$payment = get_post($payment_id);
177
+				if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
178
+					$purchase_count++;
179 179
 				}
180 180
 			}
181 181
 
182
-			$this->delete_data( 'give_stats_missing_payments' . $customer->id );
182
+			$this->delete_data('give_stats_missing_payments'.$customer->id);
183 183
 
184
-			$pending_total = $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
185
-			$this->delete_data( 'give_stats_customer_pending_total' . $customer->id );
186
-			$this->delete_data( 'give_recount_customer_stats_' . $customer->id );
187
-			$this->delete_data( 'give_recount_customer_payments_' . $this->customer_id );
184
+			$pending_total = $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
185
+			$this->delete_data('give_stats_customer_pending_total'.$customer->id);
186
+			$this->delete_data('give_recount_customer_stats_'.$customer->id);
187
+			$this->delete_data('give_recount_customer_payments_'.$this->customer_id);
188 188
 
189
-			$payment_ids = implode( ',', $payment_ids );
190
-			$customer->update( array( 'payment_ids'    => $payment_ids,
189
+			$payment_ids = implode(',', $payment_ids);
190
+			$customer->update(array('payment_ids'    => $payment_ids,
191 191
 			                          'purchase_count' => $purchase_count,
192 192
 			                          'purchase_value' => $pending_total
193
-			) );
193
+			));
194 194
 
195 195
 			$this->done    = true;
196
-			$this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' );
196
+			$this->message = esc_html__('Donor stats have been successfully recounted.', 'give');
197 197
 
198 198
 			return false;
199 199
 		}
200 200
 	}
201 201
 
202 202
 	public function headers() {
203
-		ignore_user_abort( true );
203
+		ignore_user_abort(true);
204 204
 
205
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
206
-			set_time_limit( 0 );
205
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
206
+			set_time_limit(0);
207 207
 		}
208 208
 	}
209 209
 
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
 	 * @return void
231 231
 	 */
232 232
 	public function pre_fetch() {
233
-		if ( $this->step === 1 ) {
234
-			$allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() );
233
+		if ($this->step === 1) {
234
+			$allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys());
235 235
 
236 236
 			// Before we start, let's zero out the customer's data
237
-			$customer = new Give_Customer( $this->customer_id );
238
-			$customer->update( array( 'purchase_value' => give_format_amount( 0 ), 'purchase_count' => 0 ) );
237
+			$customer = new Give_Customer($this->customer_id);
238
+			$customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0));
239 239
 
240
-			$attached_payment_ids = explode( ',', $customer->payment_ids );
240
+			$attached_payment_ids = explode(',', $customer->payment_ids);
241 241
 
242 242
 			$attached_args = array(
243 243
 				'post__in' => $attached_payment_ids,
244
-				'number'   => - 1,
244
+				'number'   => -1,
245 245
 				'status'   => $allowed_payment_status,
246 246
 			);
247 247
 
248
-			$attached_payments = give_get_payments( $attached_args );
248
+			$attached_payments = give_get_payments($attached_args);
249 249
 
250 250
 			$unattached_args = array(
251 251
 				'post__not_in' => $attached_payment_ids,
252
-				'number'       => - 1,
252
+				'number'       => -1,
253 253
 				'status'       => $allowed_payment_status,
254 254
 				'meta_query'   => array(
255 255
 					array(
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				),
260 260
 			);
261 261
 
262
-			$unattached_payments = give_get_payments( $unattached_args );
262
+			$unattached_payments = give_get_payments($unattached_args);
263 263
 
264
-			$payments = array_merge( $attached_payments, $unattached_payments );
264
+			$payments = array_merge($attached_payments, $unattached_payments);
265 265
 
266
-			$this->store_data( 'give_recount_customer_payments_' . $customer->id, $payments );
266
+			$this->store_data('give_recount_customer_payments_'.$customer->id, $payments);
267 267
 		}
268 268
 	}
269 269
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return mixed       Returns the data from the database
278 278
 	 */
279
-	private function get_stored_data( $key ) {
279
+	private function get_stored_data($key) {
280 280
 		global $wpdb;
281
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
281
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
282 282
 
283
-		return empty( $value ) ? false : maybe_unserialize( $value );
283
+		return empty($value) ? false : maybe_unserialize($value);
284 284
 	}
285 285
 
286 286
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return void
295 295
 	 */
296
-	private function store_data( $key, $value ) {
296
+	private function store_data($key, $value) {
297 297
 		global $wpdb;
298 298
 
299
-		$value = maybe_serialize( $value );
299
+		$value = maybe_serialize($value);
300 300
 
301 301
 		$data = array(
302 302
 			'option_name'  => $key,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			'%s',
311 311
 		);
312 312
 
313
-		$wpdb->replace( $wpdb->options, $data, $formats );
313
+		$wpdb->replace($wpdb->options, $data, $formats);
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return void
324 324
 	 */
325
-	private function delete_data( $key ) {
325
+	private function delete_data($key) {
326 326
 		global $wpdb;
327
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
327
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
328 328
 	}
329 329
 
330 330
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 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,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
28
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 			/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title:', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
89
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'   => esc_attr__('Display Content:', 'give'),
89
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options' => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99
-				'label'   => esc_attr__( 'Donation Fields:', 'give' ),
100
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
99
+				'label'   => esc_attr__('Donation Fields:', 'give'),
100
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
101 101
 				'options' => array(
102
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
103
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
104
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
102
+					'onpage' => esc_html__('Show on Page', 'give'),
103
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
104
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
105 105
 				),
106 106
 			),
107 107
 			array(
108 108
 				'type'    => 'listbox',
109 109
 				'name'    => 'float_labels',
110
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
111
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form.', 'give' ),
110
+				'label'   => esc_attr__('Floating Labels:', 'give'),
111
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form.', 'give'),
112 112
 				'options' => array(
113
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
114
-					'disabled' => esc_html__( 'Disabled', 'give' ),
113
+					'enabled'  => esc_html__('Enabled', 'give'),
114
+					'disabled' => esc_html__('Disabled', 'give'),
115 115
 				),
116 116
 			),
117 117
 		);
Please login to merge, or discard this patch.