Completed
Pull Request — master (#1637)
by Ravinder
16:50
created
includes/forms/template.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
  *
1474 1474
  * @param  int $form_id The form ID.
1475 1475
  *
1476
- * @return bool
1476
+ * @return false|null
1477 1477
  */
1478 1478
 function give_terms_agreement( $form_id ) {
1479 1479
 	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
  * @param  int   $form_id The form ID.
1684 1684
  * @param  array $args    An array of form arguments.
1685 1685
  *
1686
- * @return mixed
1686
+ * @return boolean
1687 1687
  */
1688 1688
 function give_show_goal_progress( $form_id, $args ) {
1689 1689
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
  *
1704 1704
  * @since  1.8
1705 1705
  *
1706
- * @param  $form_id
1706
+ * @param  integer $form_id
1707 1707
  * @param  $args
1708 1708
  *
1709 1709
  * @return mixed|string
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
  * @param  int   $form_id The form ID.
1745 1745
  * @param  array $args    An array of form arguments.
1746 1746
  *
1747
- * @return void|bool
1747
+ * @return false|null
1748 1748
  */
1749 1749
 function give_form_content( $form_id, $args ) {
1750 1750
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1042,9 +1042,12 @@
 block discarded – undo
1042 1042
 					}
1043 1043
 					?>
1044 1044
                 </select>
1045
-			<?php else : ?>
1045
+			<?php else {
1046
+	: ?>
1046 1047
                 <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1047
-                       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1048
+                       placeholder="<?php esc_attr_e( 'State / Province', 'give' );
1049
+}
1050
+?>"/>
1048 1051
 			<?php endif; ?>
1049 1052
         </p>
1050 1053
 		<?php
Please login to merge, or discard this patch.
Spacing   +398 added lines, -398 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args );
81
+	do_action('give_pre_form_output', $form->ID, $args);
82 82
 
83 83
 	?>
84 84
     <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103
-				( isset( $args['show_title'] ) && $args['show_title'] == true )
104
-				&& ! doing_action( 'give_single_form_summary' )
103
+				(isset($args['show_title']) && $args['show_title'] == true)
104
+				&& ! doing_action('give_single_form_summary')
105 105
 			) {
106 106
 				echo $form_title;
107 107
 			}
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
 			 * @param int   $form_id The form ID.
115 115
 			 * @param array $args    An array of form arguments.
116 116
 			 */
117
-			do_action( 'give_pre_form', $form->ID, $args );
117
+			do_action('give_pre_form', $form->ID, $args);
118 118
 			?>
119 119
 
120 120
             <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
121
-                  action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
121
+                  action="<?php echo esc_url_raw($form_action); ?>" method="post">
122 122
                 <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
123
-                <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
123
+                <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
124 124
                 <input type="hidden" name="give-current-url"
125
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
125
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
126 126
                 <input type="hidden" name="give-form-url"
127
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
127
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
128 128
                 <input type="hidden" name="give-form-minimum"
129
-                       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
129
+                       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
130 130
 
131 131
                 <!-- The following field is for robots only, invisible to humans: -->
132 132
                 <span class="give-hidden" style="display: none !important;">
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 				<?php
139 139
 
140 140
 				// Price ID hidden field for variable (mult-level) donation forms.
141
-				if ( give_has_variable_prices( $form_id ) ) {
141
+				if (give_has_variable_prices($form_id)) {
142 142
 					// Get default selected price ID.
143
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
143
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
144 144
 					$price_id = 0;
145 145
 					//loop through prices.
146
-					foreach ( $prices as $price ) {
147
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
146
+					foreach ($prices as $price) {
147
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
148 148
 							$price_id = $price['_give_id']['level_id'];
149 149
 						};
150 150
 					}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				 * @param int   $form_id The form ID.
161 161
 				 * @param array $args    An array of form arguments.
162 162
 				 */
163
-				do_action( 'give_checkout_form_top', $form->ID, $args );
163
+				do_action('give_checkout_form_top', $form->ID, $args);
164 164
 
165 165
 				/**
166 166
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				 * @param int   $form_id The form ID.
171 171
 				 * @param array $args    An array of form arguments.
172 172
 				 */
173
-				do_action( 'give_payment_mode_select', $form->ID, $args );
173
+				do_action('give_payment_mode_select', $form->ID, $args);
174 174
 
175 175
 				/**
176 176
 				 * Fires while outputing donation form, after all other fields.
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 				 * @param int   $form_id The form ID.
181 181
 				 * @param array $args    An array of form arguments.
182 182
 				 */
183
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
183
+				do_action('give_checkout_form_bottom', $form->ID, $args);
184 184
 
185 185
 				?>
186 186
             </form>
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 			 * @param int   $form_id The form ID.
195 195
 			 * @param array $args    An array of form arguments.
196 196
 			 */
197
-			do_action( 'give_post_form', $form->ID, $args );
197
+			do_action('give_post_form', $form->ID, $args);
198 198
 
199 199
 		}
200 200
 		?>
201 201
 
202
-    </div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
202
+    </div><!--end #give-form-<?php echo absint($form->ID); ?>-->
203 203
 	<?php
204 204
 
205 205
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @param int   $form_id The form ID.
211 211
 	 * @param array $args    An array of form arguments.
212 212
 	 */
213
-	do_action( 'give_post_form_output', $form->ID, $args );
213
+	do_action('give_post_form_output', $form->ID, $args);
214 214
 
215 215
 	$final_output = ob_get_clean();
216 216
 
217
-	echo apply_filters( 'give_donate_form', $final_output, $args );
217
+	echo apply_filters('give_donate_form', $final_output, $args);
218 218
 }
219 219
 
220 220
 /**
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return string
233 233
  */
234
-function give_show_purchase_form( $form_id ) {
234
+function give_show_purchase_form($form_id) {
235 235
 
236
-	$payment_mode = give_get_chosen_gateway( $form_id );
236
+	$payment_mode = give_get_chosen_gateway($form_id);
237 237
 
238
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
238
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
239 239
 		$form_id = $_POST['give_form_id'];
240 240
 	}
241 241
 
@@ -244,33 +244,33 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @since 1.7
246 246
 	 */
247
-	do_action( 'give_donation_form_top', $form_id );
247
+	do_action('give_donation_form_top', $form_id);
248 248
 
249
-	if ( give_can_checkout() && isset( $form_id ) ) {
249
+	if (give_can_checkout() && isset($form_id)) {
250 250
 
251 251
 		/**
252 252
 		 * Fires while displaying donation form, before registration login.
253 253
 		 *
254 254
 		 * @since 1.7
255 255
 		 */
256
-		do_action( 'give_donation_form_before_register_login', $form_id );
256
+		do_action('give_donation_form_before_register_login', $form_id);
257 257
 
258 258
 		/**
259 259
 		 * Fire when register/login form fields render.
260 260
 		 *
261 261
 		 * @since 1.7
262 262
 		 */
263
-		do_action( 'give_donation_form_register_login_fields', $form_id );
263
+		do_action('give_donation_form_register_login_fields', $form_id);
264 264
 
265 265
 		/**
266 266
 		 * Fire when credit card form fields render.
267 267
 		 *
268 268
 		 * @since 1.7
269 269
 		 */
270
-		do_action( 'give_donation_form_before_cc_form', $form_id );
270
+		do_action('give_donation_form_before_cc_form', $form_id);
271 271
 
272 272
 		// Load the credit card form and allow gateways to load their own if they wish.
273
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
273
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
274 274
 			/**
275 275
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
276 276
 			 *
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			 *
279 279
 			 * @param int $form_id The form ID.
280 280
 			 */
281
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
281
+			do_action("give_{$payment_mode}_cc_form", $form_id);
282 282
 		} else {
283 283
 			/**
284 284
 			 * Fires while displaying donation form, credit card form fields.
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			 *
288 288
 			 * @param int $form_id The form ID.
289 289
 			 */
290
-			do_action( 'give_cc_form', $form_id );
290
+			do_action('give_cc_form', $form_id);
291 291
 		}
292 292
 
293 293
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 1.7
297 297
 		 */
298
-		do_action( 'give_donation_form_after_cc_form', $form_id );
298
+		do_action('give_donation_form_after_cc_form', $form_id);
299 299
 
300 300
 	} else {
301 301
 		/**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @since 1.7
305 305
 		 */
306
-		do_action( 'give_donation_form_no_access', $form_id );
306
+		do_action('give_donation_form_no_access', $form_id);
307 307
 
308 308
 	}
309 309
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 1.7
314 314
 	 */
315
-	do_action( 'give_donation_form_bottom', $form_id );
315
+	do_action('give_donation_form_bottom', $form_id);
316 316
 }
317 317
 
318
-add_action( 'give_donation_form', 'give_show_purchase_form' );
318
+add_action('give_donation_form', 'give_show_purchase_form');
319 319
 
320 320
 /**
321 321
  * Give Show Login/Register Form Fields.
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @return void
328 328
  */
329
-function give_show_register_login_fields( $form_id ) {
329
+function give_show_register_login_fields($form_id) {
330 330
 
331
-	$show_register_form = give_show_login_register_option( $form_id );
331
+	$show_register_form = give_show_login_register_option($form_id);
332 332
 
333
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
333
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
334 334
 		?>
335 335
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
336 336
 			<?php
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 			 *
340 340
 			 * @since 1.7
341 341
 			 */
342
-			do_action( 'give_donation_form_register_fields', $form_id );
342
+			do_action('give_donation_form_register_fields', $form_id);
343 343
 			?>
344 344
         </div>
345 345
 		<?php
346
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
346
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
347 347
 		?>
348 348
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
349 349
 			<?php
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
 			 *
353 353
 			 * @since 1.7
354 354
 			 */
355
-			do_action( 'give_donation_form_login_fields', $form_id );
355
+			do_action('give_donation_form_login_fields', $form_id);
356 356
 			?>
357 357
         </div>
358 358
 		<?php
359 359
 	endif;
360 360
 
361
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
361
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
362 362
 		/**
363 363
 		 * Fire when user info render.
364 364
 		 *
365 365
 		 * @since 1.7
366 366
 		 */
367
-		do_action( 'give_donation_form_after_user_info', $form_id );
367
+		do_action('give_donation_form_after_user_info', $form_id);
368 368
 	}
369 369
 }
370 370
 
371
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
371
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
372 372
 
373 373
 /**
374 374
  * Donation Amount Field.
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return void
385 385
  */
386
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
386
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
387 387
 
388 388
 	$give_options        = give_get_settings();
389
-	$variable_pricing    = give_has_variable_prices( $form_id );
390
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
391
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
392
-	$symbol              = give_currency_symbol( give_get_currency() );
393
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
394
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
395
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
389
+	$variable_pricing    = give_has_variable_prices($form_id);
390
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
391
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
392
+	$symbol              = give_currency_symbol(give_get_currency());
393
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
394
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
395
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
396 396
 
397 397
 	/**
398 398
 	 * Fires while displaying donation form, before donation level fields.
@@ -402,20 +402,20 @@  discard block
 block discarded – undo
402 402
 	 * @param int   $form_id The form ID.
403 403
 	 * @param array $args    An array of form arguments.
404 404
 	 */
405
-	do_action( 'give_before_donation_levels', $form_id, $args );
405
+	do_action('give_before_donation_levels', $form_id, $args);
406 406
 
407 407
 	//Set Price, No Custom Amount Allowed means hidden price field
408
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
408
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
409 409
 		?>
410
-        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
410
+        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
411 411
         <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
412 412
                value="<?php echo $default_amount; ?>" required aria-required="true"/>
413 413
         <div class="set-price give-donation-amount form-row-wide">
414
-			<?php if ( $currency_position == 'before' ) {
414
+			<?php if ($currency_position == 'before') {
415 415
 				echo $currency_output;
416 416
 			} ?>
417 417
             <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
418
-			<?php if ( $currency_position == 'after' ) {
418
+			<?php if ($currency_position == 'after') {
419 419
 				echo $currency_output;
420 420
 			} ?>
421 421
         </div>
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 		?>
426 426
         <div class="give-total-wrap">
427 427
             <div class="give-donation-amount form-row-wide">
428
-				<?php if ( $currency_position == 'before' ) {
428
+				<?php if ($currency_position == 'before') {
429 429
 					echo $currency_output;
430 430
 				} ?>
431
-                <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
431
+                <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
432 432
                 <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
433 433
                        placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
434
-				<?php if ( $currency_position == 'after' ) {
434
+				<?php if ($currency_position == 'after') {
435 435
 					echo $currency_output;
436 436
 				} ?>
437 437
             </div>
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
 	 * @param int   $form_id The form ID.
447 447
 	 * @param array $args    An array of form arguments.
448 448
 	 */
449
-	do_action( 'give_after_donation_amount', $form_id, $args );
449
+	do_action('give_after_donation_amount', $form_id, $args);
450 450
 
451 451
 	//Custom Amount Text
452
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
452
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
453 453
         <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
454 454
 	<?php }
455 455
 
456 456
 	//Output Variable Pricing Levels.
457
-	if ( $variable_pricing ) {
458
-		give_output_levels( $form_id );
457
+	if ($variable_pricing) {
458
+		give_output_levels($form_id);
459 459
 	}
460 460
 
461 461
 	/**
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	 * @param int   $form_id The form ID.
467 467
 	 * @param array $args    An array of form arguments.
468 468
 	 */
469
-	do_action( 'give_after_donation_levels', $form_id, $args );
469
+	do_action('give_after_donation_levels', $form_id, $args);
470 470
 }
471 471
 
472
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
472
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
473 473
 
474 474
 /**
475 475
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -480,30 +480,30 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @return string Donation levels.
482 482
  */
483
-function give_output_levels( $form_id ) {
483
+function give_output_levels($form_id) {
484 484
 
485 485
 	//Get variable pricing.
486
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
487
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
488
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
489
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
490
-	if ( empty( $custom_amount_text ) ) {
491
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
486
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
487
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
488
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
489
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
490
+	if (empty($custom_amount_text)) {
491
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
492 492
 	}
493 493
 
494
-	$output  = '';
494
+	$output = '';
495 495
 
496
-	switch ( $display_style ) {
496
+	switch ($display_style) {
497 497
 		case 'buttons':
498 498
 
499 499
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
500 500
 
501
-			foreach ( $prices as $price ) {
502
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
503
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
501
+			foreach ($prices as $price) {
502
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
503
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
504 504
 
505 505
 				$output .= '<li>';
506
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
506
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
507 507
 				$output .= $level_text;
508 508
 				$output .= '</button>';
509 509
 				$output .= '</li>';
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			}
512 512
 
513 513
 			//Custom Amount.
514
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
514
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
515 515
 				$output .= '<li>';
516 516
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
517 517
 				$output .= $custom_amount_text;
@@ -527,22 +527,22 @@  discard block
 block discarded – undo
527 527
 
528 528
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
529 529
 
530
-			foreach ( $prices as $price ) {
531
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
532
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
530
+			foreach ($prices as $price) {
531
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
532
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
533 533
 
534 534
 				$output .= '<li>';
535
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
536
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
535
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
536
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
537 537
 				$output .= '</li>';
538 538
 
539 539
 			}
540 540
 
541 541
 			//Custom Amount.
542
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
542
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
543 543
 				$output .= '<li>';
544 544
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
545
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
545
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
546 546
 				$output .= '</li>';
547 547
 			}
548 548
 
@@ -552,23 +552,23 @@  discard block
 block discarded – undo
552 552
 
553 553
 		case 'dropdown':
554 554
 
555
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
556
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
555
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
556
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
557 557
 
558 558
 			//first loop through prices.
559
-			foreach ( $prices as $price ) {
560
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
561
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
559
+			foreach ($prices as $price) {
560
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
561
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
562 562
 
563
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
563
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
564 564
 				$output .= $level_text;
565 565
 				$output .= '</option>';
566 566
 
567 567
 			}
568 568
 
569 569
 			//Custom Amount.
570
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
571
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
570
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
571
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
572 572
 			}
573 573
 
574 574
 			$output .= '</select>';
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			break;
577 577
 	}
578 578
 
579
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
579
+	echo apply_filters('give_form_level_output', $output, $form_id);
580 580
 }
581 581
 
582 582
 /**
@@ -591,27 +591,27 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @return string Checkout button.
593 593
  */
594
-function give_display_checkout_button( $form_id, $args ) {
594
+function give_display_checkout_button($form_id, $args) {
595 595
 
596
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
596
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
597 597
 		? $args['display_style']
598
-		: get_post_meta( $form_id, '_give_payment_display', true );
598
+		: get_post_meta($form_id, '_give_payment_display', true);
599 599
 
600
-	if ( 'button' === $display_option ) {
600
+	if ('button' === $display_option) {
601 601
 		$display_option = 'modal';
602
-	} elseif ( $display_option === 'onpage' ) {
602
+	} elseif ($display_option === 'onpage') {
603 603
 		return '';
604 604
 	}
605 605
 
606
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
607
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
606
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
607
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
608 608
 
609
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
609
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
610 610
 
611
-	echo apply_filters( 'give_display_checkout_button', $output );
611
+	echo apply_filters('give_display_checkout_button', $output);
612 612
 }
613 613
 
614
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
614
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
615 615
 
616 616
 /**
617 617
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -622,57 +622,57 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return void
624 624
  */
625
-function give_user_info_fields( $form_id ) {
625
+function give_user_info_fields($form_id) {
626 626
 	// Get user info.
627
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
627
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
628 628
 
629 629
 	/**
630 630
 	 * Fire before user personal information fields
631 631
 	 *
632 632
 	 * @since 1.7
633 633
 	 */
634
-	do_action( 'give_donation_form_before_personal_info', $form_id );
634
+	do_action('give_donation_form_before_personal_info', $form_id);
635 635
 	?>
636 636
     <fieldset id="give_checkout_user_info">
637
-        <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
637
+        <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
638 638
         <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
639 639
             <label class="give-label" for="give-first">
640
-				<?php esc_html_e( 'First Name', 'give' ); ?>
641
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
640
+				<?php esc_html_e('First Name', 'give'); ?>
641
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
642 642
                     <span class="give-required-indicator">*</span>
643 643
 				<?php endif ?>
644 644
                 <span class="give-tooltip give-icon give-icon-question"
645
-                      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
645
+                      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
646 646
             </label>
647 647
             <input
648 648
                     class="give-input required"
649 649
                     type="text"
650 650
                     name="give_first"
651
-                    placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
651
+                    placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
652 652
                     id="give-first"
653
-                    value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+                    value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
             />
656 656
         </p>
657 657
 
658 658
         <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
659 659
             <label class="give-label" for="give-last">
660
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php esc_html_e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
                     <span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664 664
                 <span class="give-tooltip give-icon give-icon-question"
665
-                      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
665
+                      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
666 666
             </label>
667 667
 
668 668
             <input
669
-                    class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
669
+                    class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
670 670
                     type="text"
671 671
                     name="give_last"
672 672
                     id="give-last"
673
-                    placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
674
-                    value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
675
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
673
+                    placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
674
+                    value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
675
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
676 676
             />
677 677
         </p>
678 678
 
@@ -682,26 +682,26 @@  discard block
 block discarded – undo
682 682
 		 *
683 683
 		 * @since 1.7
684 684
 		 */
685
-		do_action( 'give_donation_form_before_email', $form_id );
685
+		do_action('give_donation_form_before_email', $form_id);
686 686
 		?>
687 687
         <p id="give-email-wrap" class="form-row form-row-wide">
688 688
             <label class="give-label" for="give-email">
689
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
690
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
689
+				<?php esc_html_e('Email Address', 'give'); ?>
690
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
691 691
                     <span class="give-required-indicator">*</span>
692 692
 				<?php } ?>
693 693
                 <span class="give-tooltip give-icon give-icon-question"
694
-                      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
694
+                      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
695 695
             </label>
696 696
 
697 697
             <input
698 698
                     class="give-input required"
699 699
                     type="email"
700 700
                     name="give_email"
701
-                    placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
701
+                    placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
702 702
                     id="give-email"
703
-                    value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
704
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
703
+                    value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
704
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
705 705
             />
706 706
 
707 707
         </p>
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 		 *
712 712
 		 * @since 1.7
713 713
 		 */
714
-		do_action( 'give_donation_form_after_email', $form_id );
714
+		do_action('give_donation_form_after_email', $form_id);
715 715
 
716 716
 		/**
717 717
 		 * Fire after personal email field
718 718
 		 *
719 719
 		 * @since 1.7
720 720
 		 */
721
-		do_action( 'give_donation_form_user_info', $form_id );
721
+		do_action('give_donation_form_user_info', $form_id);
722 722
 		?>
723 723
     </fieldset>
724 724
 	<?php
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @since 1.7
729 729
 	 */
730
-	do_action( 'give_donation_form_after_personal_info', $form_id );
730
+	do_action('give_donation_form_after_personal_info', $form_id);
731 731
 }
732 732
 
733
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
734
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
733
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
734
+add_action('give_register_fields_before', 'give_user_info_fields');
735 735
 
736 736
 /**
737 737
  * Renders the credit card info form.
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return void
744 744
  */
745
-function give_get_cc_form( $form_id ) {
745
+function give_get_cc_form($form_id) {
746 746
 
747 747
 	ob_start();
748 748
 
@@ -753,53 +753,53 @@  discard block
 block discarded – undo
753 753
 	 *
754 754
 	 * @param int $form_id The form ID.
755 755
 	 */
756
-	do_action( 'give_before_cc_fields', $form_id );
756
+	do_action('give_before_cc_fields', $form_id);
757 757
 	?>
758 758
     <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
759
-        <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
760
-		<?php if ( is_ssl() ) : ?>
759
+        <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
760
+		<?php if (is_ssl()) : ?>
761 761
             <div id="give_secure_site_wrapper-<?php echo $form_id ?>">
762 762
                 <span class="give-icon padlock"></span>
763
-                <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
763
+                <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
764 764
             </div>
765 765
 		<?php endif; ?>
766 766
         <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
767 767
             <label for="card_number-<?php echo $form_id ?>" class="give-label">
768
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
768
+				<?php esc_html_e('Card Number', 'give'); ?>
769 769
                 <span class="give-required-indicator">*</span>
770 770
                 <span class="give-tooltip give-icon give-icon-question"
771
-                      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
771
+                      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
772 772
                 <span class="card-type"></span>
773 773
             </label>
774 774
 
775 775
             <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
776
-                   class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
776
+                   class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
777 777
                    required aria-required="true"/>
778 778
         </p>
779 779
 
780 780
         <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
781 781
             <label for="card_cvc-<?php echo $form_id ?>" class="give-label">
782
-				<?php esc_html_e( 'CVC', 'give' ); ?>
782
+				<?php esc_html_e('CVC', 'give'); ?>
783 783
                 <span class="give-required-indicator">*</span>
784 784
                 <span class="give-tooltip give-icon give-icon-question"
785
-                      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
785
+                      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
786 786
             </label>
787 787
 
788 788
             <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
789
-                   class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
789
+                   class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
790 790
                    required aria-required="true"/>
791 791
         </p>
792 792
 
793 793
         <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
794 794
             <label for="card_name-<?php echo $form_id ?>" class="give-label">
795
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
795
+				<?php esc_html_e('Name on the Card', 'give'); ?>
796 796
                 <span class="give-required-indicator">*</span>
797 797
                 <span class="give-tooltip give-icon give-icon-question"
798
-                      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
798
+                      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
799 799
             </label>
800 800
 
801 801
             <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
802
-                   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
802
+                   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
803 803
                    required aria-required="true"/>
804 804
         </p>
805 805
 		<?php
@@ -810,14 +810,14 @@  discard block
 block discarded – undo
810 810
 		 *
811 811
 		 * @param int $form_id The form ID.
812 812
 		 */
813
-		do_action( 'give_before_cc_expiration' );
813
+		do_action('give_before_cc_expiration');
814 814
 		?>
815 815
         <p class="card-expiration form-row form-row-one-third form-row-responsive">
816 816
             <label for="card_expiry-<?php echo $form_id ?>" class="give-label">
817
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
817
+				<?php esc_html_e('Expiration', 'give'); ?>
818 818
                 <span class="give-required-indicator">*</span>
819 819
                 <span class="give-tooltip give-icon give-icon-question"
820
-                      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
820
+                      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
821 821
             </label>
822 822
 
823 823
             <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
                    class="card-expiry-year"/>
827 827
 
828 828
             <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
829
-                   class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
829
+                   class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
830 830
                    required aria-required="true"/>
831 831
         </p>
832 832
 		<?php
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		 *
838 838
 		 * @param int $form_id The form ID.
839 839
 		 */
840
-		do_action( 'give_after_cc_expiration', $form_id );
840
+		do_action('give_after_cc_expiration', $form_id);
841 841
 		?>
842 842
     </fieldset>
843 843
 	<?php
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @param int $form_id The form ID.
850 850
 	 */
851
-	do_action( 'give_after_cc_fields', $form_id );
851
+	do_action('give_after_cc_fields', $form_id);
852 852
 
853 853
 	echo ob_get_clean();
854 854
 }
855 855
 
856
-add_action( 'give_cc_form', 'give_get_cc_form' );
856
+add_action('give_cc_form', 'give_get_cc_form');
857 857
 
858 858
 /**
859 859
  * Outputs the default credit card address fields.
@@ -864,24 +864,24 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return void
866 866
  */
867
-function give_default_cc_address_fields( $form_id ) {
867
+function give_default_cc_address_fields($form_id) {
868 868
 	// Get user info.
869
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
869
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
870 870
 
871 871
 	$logged_in = is_user_logged_in();
872 872
 
873
-	if ( $logged_in ) {
874
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
873
+	if ($logged_in) {
874
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
875 875
 	}
876
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
877
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
878
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
879
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
876
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
877
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
878
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
879
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
880 880
 
881 881
 	ob_start();
882 882
 	?>
883 883
     <fieldset id="give_cc_address" class="cc-address">
884
-        <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
884
+        <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
885 885
 		<?php
886 886
 		/**
887 887
 		 * Fires while rendering credit card billing form, before address fields.
@@ -890,79 +890,79 @@  discard block
 block discarded – undo
890 890
 		 *
891 891
 		 * @param int $form_id The form ID.
892 892
 		 */
893
-		do_action( 'give_cc_billing_top' );
893
+		do_action('give_cc_billing_top');
894 894
 		?>
895 895
         <p id="give-card-address-wrap" class="form-row form-row-wide">
896 896
             <label for="card_address" class="give-label">
897
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
897
+				<?php esc_html_e('Address 1', 'give'); ?>
898 898
 				<?php
899
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
899
+				if (give_field_is_required('card_address', $form_id)) : ?>
900 900
                     <span class="give-required-indicator">*</span>
901 901
 				<?php endif; ?>
902 902
                 <span class="give-tooltip give-icon give-icon-question"
903
-                      data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
903
+                      data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
904 904
             </label>
905 905
 
906 906
             <input
907 907
                     type="text"
908 908
                     id="card_address"
909 909
                     name="card_address"
910
-                    class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
911
-                    placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
912
-                    value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
913
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
910
+                    class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
911
+                    placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
912
+                    value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
913
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
914 914
             />
915 915
         </p>
916 916
 
917 917
         <p id="give-card-address-2-wrap" class="form-row form-row-wide">
918 918
             <label for="card_address_2" class="give-label">
919
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
920
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
919
+				<?php esc_html_e('Address 2', 'give'); ?>
920
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
921 921
                     <span class="give-required-indicator">*</span>
922 922
 				<?php endif; ?>
923 923
                 <span class="give-tooltip give-icon give-icon-question"
924
-                      data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
924
+                      data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
925 925
             </label>
926 926
 
927 927
             <input
928 928
                     type="text"
929 929
                     id="card_address_2"
930 930
                     name="card_address_2"
931
-                    class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
932
-                    placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
933
-                    value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
934
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
931
+                    class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
932
+                    placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
933
+                    value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
934
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
935 935
             />
936 936
         </p>
937 937
 
938 938
         <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive">
939 939
             <label for="card_city" class="give-label">
940
-				<?php esc_html_e( 'City', 'give' ); ?>
941
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
940
+				<?php esc_html_e('City', 'give'); ?>
941
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
942 942
                     <span class="give-required-indicator">*</span>
943 943
 				<?php endif; ?>
944 944
                 <span class="give-tooltip give-icon give-icon-question"
945
-                      data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
945
+                      data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
946 946
             </label>
947 947
             <input
948 948
                     type="text"
949 949
                     id="card_city"
950 950
                     name="card_city"
951
-                    class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
952
-                    placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
953
-                    value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
954
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
951
+                    class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
952
+                    placeholder="<?php esc_attr_e('City', 'give'); ?>"
953
+                    value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
954
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
955 955
             />
956 956
         </p>
957 957
 
958 958
         <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
959 959
             <label for="card_zip" class="give-label">
960
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
961
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
960
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
961
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
962 962
                     <span class="give-required-indicator">*</span>
963 963
 				<?php endif; ?>
964 964
                 <span class="give-tooltip give-icon give-icon-question"
965
-                      data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
965
+                      data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
966 966
             </label>
967 967
 
968 968
             <input
@@ -970,40 +970,40 @@  discard block
 block discarded – undo
970 970
                     size="4"
971 971
                     id="card_zip"
972 972
                     name="card_zip"
973
-                    class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
974
-                    placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
975
-                    value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
976
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
973
+                    class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
974
+                    placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
975
+                    value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
976
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
977 977
             />
978 978
         </p>
979 979
 
980 980
         <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive">
981 981
             <label for="billing_country" class="give-label">
982
-				<?php esc_html_e( 'Country', 'give' ); ?>
983
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
982
+				<?php esc_html_e('Country', 'give'); ?>
983
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
984 984
                     <span class="give-required-indicator">*</span>
985 985
 				<?php endif; ?>
986 986
                 <span class="give-tooltip give-icon give-icon-question"
987
-                      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
987
+                      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
988 988
             </label>
989 989
 
990 990
             <select
991 991
                     name="billing_country"
992 992
                     id="billing_country"
993
-                    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
994
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
993
+                    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
994
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
             >
996 996
 				<?php
997 997
 
998 998
 				$selected_country = give_get_country();
999 999
 
1000
-				if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1000
+				if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1001 1001
 					$selected_country = $give_user_info['billing_country'];
1002 1002
 				}
1003 1003
 
1004 1004
 				$countries = give_get_country_list();
1005
-				foreach ( $countries as $country_code => $country ) {
1006
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1005
+				foreach ($countries as $country_code => $country) {
1006
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1007 1007
 				}
1008 1008
 				?>
1009 1009
             </select>
@@ -1011,37 +1011,37 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
         <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive">
1013 1013
             <label for="card_state" class="give-label">
1014
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
1015
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?>
1014
+				<?php esc_html_e('State / Province', 'give'); ?>
1015
+				<?php if (give_field_is_required('card_state', $form_id)) : ?>
1016 1016
                     <span class="give-required-indicator">*</span>
1017 1017
 				<?php endif; ?>
1018 1018
                 <span class="give-tooltip give-icon give-icon-question"
1019
-                      data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
1019
+                      data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
1020 1020
             </label>
1021 1021
 
1022 1022
 			<?php
1023 1023
 			$selected_state = give_get_state();
1024
-			$states         = give_get_states( $selected_country );
1024
+			$states         = give_get_states($selected_country);
1025 1025
 
1026
-			if ( ! empty( $give_user_info['card_state'] ) ) {
1026
+			if ( ! empty($give_user_info['card_state'])) {
1027 1027
 				$selected_state = $give_user_info['card_state'];
1028 1028
 			}
1029 1029
 
1030
-			if ( ! empty( $states ) ) : ?>
1030
+			if ( ! empty($states)) : ?>
1031 1031
                 <select
1032 1032
                         name="card_state"
1033 1033
                         id="card_state"
1034
-                        class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1035
-					<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1034
+                        class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1035
+					<?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1036 1036
 					<?php
1037
-					foreach ( $states as $state_code => $state ) {
1038
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1037
+					foreach ($states as $state_code => $state) {
1038
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1039 1039
 					}
1040 1040
 					?>
1041 1041
                 </select>
1042 1042
 			<?php else : ?>
1043 1043
                 <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1044
-                       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1044
+                       placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
1045 1045
 			<?php endif; ?>
1046 1046
         </p>
1047 1047
 		<?php
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
1052 1052
 		 *
1053 1053
 		 * @param int $form_id The form ID.
1054 1054
 		 */
1055
-		do_action( 'give_cc_billing_bottom' );
1055
+		do_action('give_cc_billing_bottom');
1056 1056
 		?>
1057 1057
     </fieldset>
1058 1058
 	<?php
1059 1059
 	echo ob_get_clean();
1060 1060
 }
1061 1061
 
1062
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1062
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1063 1063
 
1064 1064
 
1065 1065
 /**
@@ -1072,24 +1072,24 @@  discard block
 block discarded – undo
1072 1072
  *
1073 1073
  * @return string
1074 1074
  */
1075
-function give_get_register_fields( $form_id ) {
1075
+function give_get_register_fields($form_id) {
1076 1076
 
1077 1077
 	global $user_ID;
1078 1078
 
1079
-	if ( is_user_logged_in() ) {
1080
-		$user_data = get_userdata( $user_ID );
1079
+	if (is_user_logged_in()) {
1080
+		$user_data = get_userdata($user_ID);
1081 1081
 	}
1082 1082
 
1083
-	$show_register_form = give_show_login_register_option( $form_id );
1083
+	$show_register_form = give_show_login_register_option($form_id);
1084 1084
 
1085 1085
 	ob_start(); ?>
1086 1086
     <fieldset id="give-register-fields-<?php echo $form_id; ?>">
1087 1087
 
1088
-		<?php if ( $show_register_form == 'both' ) { ?>
1088
+		<?php if ($show_register_form == 'both') { ?>
1089 1089
             <div class="give-login-account-wrap">
1090
-                <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1091
-                    <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1092
-                       data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1090
+                <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1091
+                    <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1092
+                       data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1093 1093
                 </p>
1094 1094
                 <p class="give-loading-text">
1095 1095
                     <span class="give-loading-animation"></span>
@@ -1105,15 +1105,15 @@  discard block
 block discarded – undo
1105 1105
 		 *
1106 1106
 		 * @param int $form_id The form ID.
1107 1107
 		 */
1108
-		do_action( 'give_register_fields_before', $form_id );
1108
+		do_action('give_register_fields_before', $form_id);
1109 1109
 		?>
1110 1110
 
1111 1111
         <fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1112 1112
             <legend>
1113 1113
 				<?php
1114
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1115
-				if ( ! give_logged_in_only( $form_id ) ) {
1116
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1114
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1115
+				if ( ! give_logged_in_only($form_id)) {
1116
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1117 1117
 				}
1118 1118
 				?>
1119 1119
             </legend>
@@ -1125,54 +1125,54 @@  discard block
 block discarded – undo
1125 1125
 			 *
1126 1126
 			 * @param int $form_id The form ID.
1127 1127
 			 */
1128
-			do_action( 'give_register_account_fields_before', $form_id );
1128
+			do_action('give_register_account_fields_before', $form_id);
1129 1129
 			?>
1130 1130
             <div id="give-user-login-wrap-<?php echo $form_id; ?>"
1131 1131
                  class="form-row form-row-one-third form-row-first form-row-responsive">
1132 1132
                 <label for="give-user-login-<?php echo $form_id; ?>">
1133
-					<?php esc_html_e( 'Username', 'give' ); ?>
1134
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1133
+					<?php esc_html_e('Username', 'give'); ?>
1134
+					<?php if (give_logged_in_only($form_id)) { ?>
1135 1135
                         <span class="give-required-indicator">*</span>
1136 1136
 					<?php } ?>
1137 1137
                     <span class="give-tooltip give-icon give-icon-question"
1138
-                          data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1138
+                          data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1139 1139
                 </label>
1140 1140
 
1141 1141
                 <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1142 1142
                        type="text"
1143
-                       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1143
+                       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1144 1144
             </div>
1145 1145
 
1146 1146
             <div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1147 1147
                  class="form-row form-row-one-third form-row-responsive">
1148 1148
                 <label for="give-user-pass-<?php echo $form_id; ?>">
1149
-					<?php esc_html_e( 'Password', 'give' ); ?>
1150
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1149
+					<?php esc_html_e('Password', 'give'); ?>
1150
+					<?php if (give_logged_in_only($form_id)) { ?>
1151 1151
                         <span class="give-required-indicator">*</span>
1152 1152
 					<?php } ?>
1153 1153
                     <span class="give-tooltip give-icon give-icon-question"
1154
-                          data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1154
+                          data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1155 1155
                 </label>
1156 1156
 
1157 1157
                 <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1158
-                       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1159
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1158
+                       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1159
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1160 1160
             </div>
1161 1161
 
1162 1162
             <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1163 1163
                  class="give-register-password form-row form-row-one-third form-row-responsive">
1164 1164
                 <label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1165
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1166
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1165
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1166
+					<?php if (give_logged_in_only($form_id)) { ?>
1167 1167
                         <span class="give-required-indicator">*</span>
1168 1168
 					<?php } ?>
1169 1169
                     <span class="give-tooltip give-icon give-icon-question"
1170
-                          data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1170
+                          data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1171 1171
                 </label>
1172 1172
 
1173 1173
                 <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1174
-                       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1175
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1174
+                       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1175
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1176 1176
             </div>
1177 1177
 			<?php
1178 1178
 			/**
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 			 *
1183 1183
 			 * @param int $form_id The form ID.
1184 1184
 			 */
1185
-			do_action( 'give_register_account_fields_after', $form_id );
1185
+			do_action('give_register_account_fields_after', $form_id);
1186 1186
 			?>
1187 1187
         </fieldset>
1188 1188
 
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		 *
1195 1195
 		 * @param int $form_id The form ID.
1196 1196
 		 */
1197
-		do_action( 'give_register_fields_after', $form_id );
1197
+		do_action('give_register_fields_after', $form_id);
1198 1198
 		?>
1199 1199
 
1200 1200
         <input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		 *
1206 1206
 		 * @since 1.7
1207 1207
 		 */
1208
-		do_action( 'give_donation_form_user_info', $form_id );
1208
+		do_action('give_donation_form_user_info', $form_id);
1209 1209
 		?>
1210 1210
 
1211 1211
     </fieldset>
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 	echo ob_get_clean();
1214 1214
 }
1215 1215
 
1216
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1216
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1217 1217
 
1218 1218
 /**
1219 1219
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1226,27 +1226,27 @@  discard block
 block discarded – undo
1226 1226
  *
1227 1227
  * @return string
1228 1228
  */
1229
-function give_get_login_fields( $form_id ) {
1229
+function give_get_login_fields($form_id) {
1230 1230
 
1231
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1232
-	$show_register_form = give_show_login_register_option( $form_id );
1231
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1232
+	$show_register_form = give_show_login_register_option($form_id);
1233 1233
 
1234 1234
 	ob_start();
1235 1235
 	?>
1236 1236
     <fieldset id="give-login-fields-<?php echo $form_id; ?>">
1237
-        <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1238
-			if ( ! give_logged_in_only( $form_id ) ) {
1239
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1237
+        <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1238
+			if ( ! give_logged_in_only($form_id)) {
1239
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1240 1240
 			} ?>
1241 1241
         </legend>
1242
-		<?php if ( $show_register_form == 'both' ) { ?>
1242
+		<?php if ($show_register_form == 'both') { ?>
1243 1243
             <p class="give-new-account-link">
1244
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1245
-                <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1244
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1245
+                <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1246 1246
                    data-action="give_checkout_register">
1247
-					<?php esc_html_e( 'Register', 'give' );
1248
-					if ( ! give_logged_in_only( $form_id ) ) {
1249
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1247
+					<?php esc_html_e('Register', 'give');
1248
+					if ( ! give_logged_in_only($form_id)) {
1249
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1250 1250
 					} ?>
1251 1251
                 </a>
1252 1252
             </p>
@@ -1262,49 +1262,49 @@  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 form-row-responsive">
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; ?>"
1281 1281
              class="give_login_password form-row form-row-last form-row-responsive">
1282 1282
             <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1283
-				<?php esc_html_e( 'Password', 'give' ); ?>
1284
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1283
+				<?php esc_html_e('Password', 'give'); ?>
1284
+				<?php if (give_logged_in_only($form_id)) { ?>
1285 1285
                     <span class="give-required-indicator">*</span>
1286 1286
 				<?php } ?>
1287 1287
             </label>
1288
-            <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1288
+            <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1289 1289
                    type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1290
-                   placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1290
+                   placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1291 1291
             <input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1292 1292
         </div>
1293 1293
 
1294 1294
         <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1295 1295
 			 <span class="give-forgot-password ">
1296 1296
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1297
-                    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1297
+                    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1298 1298
 			 </span>
1299 1299
         </div>
1300 1300
 
1301 1301
         <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1302 1302
             <input type="submit" class="give-submit give-btn button" name="give_login_submit"
1303
-                   value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1304
-			<?php if ( $show_register_form !== 'login' ) { ?>
1303
+                   value="<?php esc_attr_e('Login', 'give'); ?>"/>
1304
+			<?php if ($show_register_form !== 'login') { ?>
1305 1305
                 <input type="button" data-action="give_cancel_login"
1306 1306
                        class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1307
-                       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1307
+                       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1308 1308
 			<?php } ?>
1309 1309
             <span class="give-loading-animation"></span>
1310 1310
         </div>
@@ -1316,14 +1316,14 @@  discard block
 block discarded – undo
1316 1316
 		 *
1317 1317
 		 * @param int $form_id The form ID.
1318 1318
 		 */
1319
-		do_action( 'give_checkout_login_fields_after', $form_id );
1319
+		do_action('give_checkout_login_fields_after', $form_id);
1320 1320
 		?>
1321 1321
     </fieldset><!--end #give-login-fields-->
1322 1322
 	<?php
1323 1323
 	echo ob_get_clean();
1324 1324
 }
1325 1325
 
1326
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1326
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1327 1327
 
1328 1328
 /**
1329 1329
  * Payment Mode Select.
@@ -1339,9 +1339,9 @@  discard block
 block discarded – undo
1339 1339
  *
1340 1340
  * @return void
1341 1341
  */
1342
-function give_payment_mode_select( $form_id ) {
1342
+function give_payment_mode_select($form_id) {
1343 1343
 
1344
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1344
+	$gateways = give_get_enabled_payment_gateways($form_id);
1345 1345
 
1346 1346
 	/**
1347 1347
 	 * Fires while selecting payment gateways, before the fields.
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
 	 *
1351 1351
 	 * @param int $form_id The form ID.
1352 1352
 	 */
1353
-	do_action( 'give_payment_mode_top', $form_id );
1353
+	do_action('give_payment_mode_top', $form_id);
1354 1354
 	?>
1355 1355
 
1356
-    <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1356
+    <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1357 1357
 		echo 'style="display: none;"';
1358 1358
 	} ?>>
1359 1359
 		<?php
@@ -1364,10 +1364,10 @@  discard block
 block discarded – undo
1364 1364
 		 *
1365 1365
 		 * @param int $form_id The form ID.
1366 1366
 		 */
1367
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1367
+		do_action('give_payment_mode_before_gateways_wrap');
1368 1368
 		?>
1369 1369
         <legend
1370
-                class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1370
+                class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1371 1371
             <span class="give-loading-text"><span
1372 1372
                         class="give-loading-animation"></span>
1373 1373
             </span>
@@ -1380,26 +1380,26 @@  discard block
 block discarded – undo
1380 1380
 			 *
1381 1381
 			 * @since 1.7
1382 1382
 			 */
1383
-			do_action( 'give_payment_mode_before_gateways' )
1383
+			do_action('give_payment_mode_before_gateways')
1384 1384
 			?>
1385 1385
             <ul id="give-gateway-radio-list">
1386 1386
 				<?php
1387 1387
 				/**
1388 1388
 				 * Loop through the active payment gateways.
1389 1389
 				 */
1390
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1390
+				$selected_gateway = give_get_chosen_gateway($form_id);
1391 1391
 
1392
-				foreach ( $gateways as $gateway_id => $gateway ) :
1392
+				foreach ($gateways as $gateway_id => $gateway) :
1393 1393
 					//Determine the default gateway.
1394
-					$checked = checked( $gateway_id, $selected_gateway, false );
1394
+					$checked = checked($gateway_id, $selected_gateway, false);
1395 1395
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1396 1396
                     <li<?php echo $checked_class ?>>
1397 1397
                         <input type="radio" name="payment-mode" class="give-gateway"
1398
-                               id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1399
-                               value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1400
-                        <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1398
+                               id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1399
+                               value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1400
+                        <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1401 1401
                                class="give-gateway-option"
1402
-                               id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1402
+                               id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1403 1403
                     </li>
1404 1404
 					<?php
1405 1405
 				endforeach;
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 			 *
1412 1412
 			 * @since 1.7
1413 1413
 			 */
1414
-			do_action( 'give_payment_mode_after_gateways' );
1414
+			do_action('give_payment_mode_after_gateways');
1415 1415
 			?>
1416 1416
         </div>
1417 1417
 		<?php
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 		 *
1423 1423
 		 * @param int $form_id The form ID.
1424 1424
 		 */
1425
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1425
+		do_action('give_payment_mode_after_gateways_wrap');
1426 1426
 		?>
1427 1427
     </fieldset>
1428 1428
 
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 	 *
1435 1435
 	 * @param int $form_id The form ID.
1436 1436
 	 */
1437
-	do_action( 'give_payment_mode_bottom', $form_id );
1437
+	do_action('give_payment_mode_bottom', $form_id);
1438 1438
 	?>
1439 1439
 
1440 1440
     <div id="give_purchase_form_wrap">
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		 *
1446 1446
 		 * @since 1.7
1447 1447
 		 */
1448
-		do_action( 'give_donation_form', $form_id );
1448
+		do_action('give_donation_form', $form_id);
1449 1449
 		?>
1450 1450
 
1451 1451
     </div>
@@ -1456,10 +1456,10 @@  discard block
 block discarded – undo
1456 1456
 	 *
1457 1457
 	 * @since 1.7
1458 1458
 	 */
1459
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1459
+	do_action('give_donation_form_wrap_bottom', $form_id);
1460 1460
 }
1461 1461
 
1462
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1462
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1463 1463
 
1464 1464
 /**
1465 1465
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1472,31 +1472,31 @@  discard block
 block discarded – undo
1472 1472
  *
1473 1473
  * @return bool
1474 1474
  */
1475
-function give_terms_agreement( $form_id ) {
1476
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1475
+function give_terms_agreement($form_id) {
1476
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1477 1477
 
1478 1478
 	// Bailout if per form and global term and conditions is not setup.
1479 1479
 	if (
1480
-		give_is_setting_enabled( $form_option, 'global' )
1481
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1480
+		give_is_setting_enabled($form_option, 'global')
1481
+		&& give_is_setting_enabled(give_get_option('terms'))
1482 1482
 	) {
1483
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1484
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1485
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1483
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1484
+		$terms         = $terms = give_get_option('agreement_text', '');
1485
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1486 1486
 
1487
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1488
-		$label         = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1489
-		$terms         = get_post_meta( $form_id, '_give_agree_text', true );
1490
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1487
+	} elseif (give_is_setting_enabled($form_option)) {
1488
+		$label         = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1489
+		$terms         = get_post_meta($form_id, '_give_agree_text', true);
1490
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1491 1491
 
1492 1492
 	} else {
1493 1493
 		return false;
1494 1494
 	}
1495 1495
 
1496 1496
 	// Bailout: Check if term and conditions text is empty or not.
1497
-	if ( empty( $terms ) ) {
1498
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1499
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1497
+	if (empty($terms)) {
1498
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1499
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1500 1500
 		}
1501 1501
 
1502 1502
 		return false;
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
 
1505 1505
 	?>
1506 1506
     <fieldset id="give_terms_agreement">
1507
-        <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1507
+        <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1508 1508
         <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1509 1509
 			<?php
1510 1510
 			/**
@@ -1512,22 +1512,22 @@  discard block
 block discarded – undo
1512 1512
 			 *
1513 1513
 			 * @since 1.0
1514 1514
 			 */
1515
-			do_action( 'give_before_terms' );
1515
+			do_action('give_before_terms');
1516 1516
 
1517
-			echo wpautop( stripslashes( $terms ) );
1517
+			echo wpautop(stripslashes($terms));
1518 1518
 			/**
1519 1519
 			 * Fires while rendering terms of agreement, after the fields.
1520 1520
 			 *
1521 1521
 			 * @since 1.0
1522 1522
 			 */
1523
-			do_action( 'give_after_terms' );
1523
+			do_action('give_after_terms');
1524 1524
 			?>
1525 1525
         </div>
1526 1526
         <div id="give_show_terms">
1527 1527
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1528
-               aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1528
+               aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1529 1529
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1530
-               aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1530
+               aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1531 1531
         </div>
1532 1532
 
1533 1533
         <input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 	<?php
1539 1539
 }
1540 1540
 
1541
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1541
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1542 1542
 
1543 1543
 /**
1544 1544
  * Checkout Final Total.
@@ -1551,29 +1551,29 @@  discard block
 block discarded – undo
1551 1551
  *
1552 1552
  * @return void
1553 1553
  */
1554
-function give_checkout_final_total( $form_id ) {
1554
+function give_checkout_final_total($form_id) {
1555 1555
 
1556
-	if ( isset( $_POST['give_total'] ) ) {
1557
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1556
+	if (isset($_POST['give_total'])) {
1557
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1558 1558
 	} else {
1559 1559
 		//default total.
1560
-		$total = give_get_default_form_amount( $form_id );
1560
+		$total = give_get_default_form_amount($form_id);
1561 1561
 	}
1562 1562
 	//Only proceed if give_total available.
1563
-	if ( empty( $total ) ) {
1563
+	if (empty($total)) {
1564 1564
 		return;
1565 1565
 	}
1566 1566
 	?>
1567 1567
     <p id="give-final-total-wrap" class="form-wrap ">
1568 1568
 		<span
1569
-                class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1569
+                class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1570 1570
         <span class="give-final-total-amount"
1571
-              data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1571
+              data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1572 1572
     </p>
1573 1573
 	<?php
1574 1574
 }
1575 1575
 
1576
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1576
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1577 1577
 
1578 1578
 /**
1579 1579
  * Renders the Checkout Submit section.
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
  *
1585 1585
  * @return void
1586 1586
  */
1587
-function give_checkout_submit( $form_id ) {
1587
+function give_checkout_submit($form_id) {
1588 1588
 	?>
1589 1589
     <fieldset id="give_purchase_submit">
1590 1590
 		<?php
@@ -1593,24 +1593,24 @@  discard block
 block discarded – undo
1593 1593
 		 *
1594 1594
 		 * @since 1.7
1595 1595
 		 */
1596
-		do_action( 'give_donation_form_before_submit', $form_id );
1596
+		do_action('give_donation_form_before_submit', $form_id);
1597 1597
 
1598
-		give_checkout_hidden_fields( $form_id );
1598
+		give_checkout_hidden_fields($form_id);
1599 1599
 
1600
-		echo give_checkout_button_purchase( $form_id );
1600
+		echo give_checkout_button_purchase($form_id);
1601 1601
 
1602 1602
 		/**
1603 1603
 		 * Fire after donation form submit.
1604 1604
 		 *
1605 1605
 		 * @since 1.7
1606 1606
 		 */
1607
-		do_action( 'give_donation_form_after_submit', $form_id );
1607
+		do_action('give_donation_form_after_submit', $form_id);
1608 1608
 		?>
1609 1609
     </fieldset>
1610 1610
 	<?php
1611 1611
 }
1612 1612
 
1613
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1613
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1614 1614
 
1615 1615
 /**
1616 1616
  * Give Checkout Button.
@@ -1623,10 +1623,10 @@  discard block
 block discarded – undo
1623 1623
  *
1624 1624
  * @return string
1625 1625
  */
1626
-function give_checkout_button_purchase( $form_id ) {
1626
+function give_checkout_button_purchase($form_id) {
1627 1627
 
1628
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1629
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1628
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1629
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1630 1630
 	ob_start(); ?>
1631 1631
     <div class="give-submit-button-wrap give-clearfix">
1632 1632
         <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
         <span class="give-loading-animation"></span>
1635 1635
     </div>
1636 1636
 	<?php
1637
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1637
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1638 1638
 }
1639 1639
 
1640 1640
 /**
@@ -1649,17 +1649,17 @@  discard block
 block discarded – undo
1649 1649
  *
1650 1650
  * @return mixed
1651 1651
  */
1652
-function give_show_goal_progress( $form_id, $args ) {
1652
+function give_show_goal_progress($form_id, $args) {
1653 1653
 
1654 1654
 	ob_start();
1655
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1655
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1656 1656
 
1657
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1657
+	echo apply_filters('give_goal_output', ob_get_clean());
1658 1658
 
1659 1659
 	return true;
1660 1660
 }
1661 1661
 
1662
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1662
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1663 1663
 
1664 1664
 
1665 1665
 /**
@@ -1672,10 +1672,10 @@  discard block
 block discarded – undo
1672 1672
  *
1673 1673
  * @return mixed|string
1674 1674
  */
1675
-function give_get_form_content_placement( $form_id, $args ) {
1675
+function give_get_form_content_placement($form_id, $args) {
1676 1676
 	$show_content = '';
1677 1677
 
1678
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1678
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1679 1679
 		// Content positions.
1680 1680
 		$content_placement = array(
1681 1681
 			'above' => 'give_pre_form',
@@ -1683,18 +1683,18 @@  discard block
 block discarded – undo
1683 1683
 		);
1684 1684
 
1685 1685
 		// Check if content position already decoded.
1686
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1686
+		if (in_array($args['show_content'], $content_placement)) {
1687 1687
 			return $args['show_content'];
1688 1688
 		}
1689 1689
 
1690
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1690
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1691 1691
 
1692
-	} elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) {
1693
-		$show_content = get_post_meta( $form_id, '_give_content_placement', true );
1692
+	} elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) {
1693
+		$show_content = get_post_meta($form_id, '_give_content_placement', true);
1694 1694
 
1695
-	} elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) {
1695
+	} elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) {
1696 1696
 		// Backward compatibility for _give_content_option for v18.
1697
-		$show_content = get_post_meta( $form_id, '_give_content_option', true );
1697
+		$show_content = get_post_meta($form_id, '_give_content_option', true);
1698 1698
 	}
1699 1699
 
1700 1700
 	return $show_content;
@@ -1710,20 +1710,20 @@  discard block
 block discarded – undo
1710 1710
  *
1711 1711
  * @return void|bool
1712 1712
  */
1713
-function give_form_content( $form_id, $args ) {
1713
+function give_form_content($form_id, $args) {
1714 1714
 
1715
-	$show_content = give_get_form_content_placement( $form_id, $args );
1715
+	$show_content = give_get_form_content_placement($form_id, $args);
1716 1716
 
1717 1717
 	// Bailout.
1718
-	if ( empty( $show_content ) ) {
1718
+	if (empty($show_content)) {
1719 1719
 		return false;
1720 1720
 	}
1721 1721
 
1722 1722
 	// Add action according to value.
1723
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1723
+	add_action($show_content, 'give_form_display_content', 10, 2);
1724 1724
 }
1725 1725
 
1726
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1726
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1727 1727
 
1728 1728
 /**
1729 1729
  * Renders Post Form Content.
@@ -1737,22 +1737,22 @@  discard block
 block discarded – undo
1737 1737
  *
1738 1738
  * @return void
1739 1739
  */
1740
-function give_form_display_content( $form_id, $args ) {
1740
+function give_form_display_content($form_id, $args) {
1741 1741
 
1742
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1743
-	$show_content = give_get_form_content_placement( $form_id, $args );
1742
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1743
+	$show_content = give_get_form_content_placement($form_id, $args);
1744 1744
 
1745
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1746
-		$content = apply_filters( 'the_content', $content );
1745
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1746
+		$content = apply_filters('the_content', $content);
1747 1747
 	}
1748 1748
 
1749
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1749
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1750 1750
 
1751
-	echo apply_filters( 'give_form_content_output', $output );
1751
+	echo apply_filters('give_form_content_output', $output);
1752 1752
 
1753 1753
 	//remove action to prevent content output on addition forms on page.
1754 1754
 	//@see: https://github.com/WordImpress/Give/issues/634.
1755
-	remove_action( $show_content, 'give_form_display_content' );
1755
+	remove_action($show_content, 'give_form_display_content');
1756 1756
 }
1757 1757
 
1758 1758
 /**
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
  *
1765 1765
  * @return void
1766 1766
  */
1767
-function give_checkout_hidden_fields( $form_id ) {
1767
+function give_checkout_hidden_fields($form_id) {
1768 1768
 
1769 1769
 	/**
1770 1770
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 	 *
1774 1774
 	 * @param int $form_id The form ID.
1775 1775
 	 */
1776
-	do_action( 'give_hidden_fields_before', $form_id );
1776
+	do_action('give_hidden_fields_before', $form_id);
1777 1777
 
1778
-	if ( is_user_logged_in() ) { ?>
1778
+	if (is_user_logged_in()) { ?>
1779 1779
         <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1780 1780
 	<?php } ?>
1781 1781
     <input type="hidden" name="give_action" value="purchase"/>
1782
-    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1782
+    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1783 1783
 	<?php
1784 1784
 	/**
1785 1785
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
 	 *
1789 1789
 	 * @param int $form_id The form ID.
1790 1790
 	 */
1791
-	do_action( 'give_hidden_fields_after', $form_id );
1791
+	do_action('give_hidden_fields_after', $form_id);
1792 1792
 
1793 1793
 }
1794 1794
 
@@ -1803,20 +1803,20 @@  discard block
 block discarded – undo
1803 1803
  *
1804 1804
  * @return string $content Filtered content.
1805 1805
  */
1806
-function give_filter_success_page_content( $content ) {
1806
+function give_filter_success_page_content($content) {
1807 1807
 
1808 1808
 	$give_options = give_get_settings();
1809 1809
 
1810
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1811
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1812
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1810
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1811
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1812
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1813 1813
 		}
1814 1814
 	}
1815 1815
 
1816 1816
 	return $content;
1817 1817
 }
1818 1818
 
1819
-add_filter( 'the_content', 'give_filter_success_page_content' );
1819
+add_filter('the_content', 'give_filter_success_page_content');
1820 1820
 
1821 1821
 /**
1822 1822
  * Test Mode Frontend Warning.
@@ -1827,12 +1827,12 @@  discard block
 block discarded – undo
1827 1827
  */
1828 1828
 function give_test_mode_frontend_warning() {
1829 1829
 
1830
-	if ( give_is_test_mode() ) {
1831
-		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>';
1830
+	if (give_is_test_mode()) {
1831
+		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>';
1832 1832
 	}
1833 1833
 }
1834 1834
 
1835
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1835
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1836 1836
 
1837 1837
 /**
1838 1838
  * Members-only Form.
@@ -1846,21 +1846,21 @@  discard block
 block discarded – undo
1846 1846
  *
1847 1847
  * @return string
1848 1848
  */
1849
-function give_members_only_form( $final_output, $args ) {
1849
+function give_members_only_form($final_output, $args) {
1850 1850
 
1851
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1851
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1852 1852
 
1853 1853
 	//Sanity Check: Must have form_id & not be logged in.
1854
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1854
+	if (empty($form_id) || is_user_logged_in()) {
1855 1855
 		return $final_output;
1856 1856
 	}
1857 1857
 
1858 1858
 	//Logged in only and Register / Login set to none.
1859
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1859
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1860 1860
 
1861
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1861
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1862 1862
 
1863
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1863
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1864 1864
 
1865 1865
 	}
1866 1866
 
@@ -1868,4 +1868,4 @@  discard block
 block discarded – undo
1868 1868
 
1869 1869
 }
1870 1870
 
1871
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1871
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -725,9 +725,9 @@
 block discarded – undo
725 725
                         <td class="give-docs-link" colspan="2">
726 726
 							<?php
727 727
 							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
728
-							     . '" target="_blank">'
729
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
730
-							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
728
+								 . '" target="_blank">'
729
+								 . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
730
+								 . '<span class="dashicons dashicons-editor-help"></span></a></p>';
731 731
 							?>
732 732
                         </td>
733 733
                         </tr><?php
Please login to merge, or discard this patch.
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		public static function save() {
87 87
 			$current_tab = give_get_current_setting_tab();
88 88
 
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
90
-				echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>';
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90
+				echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>';
91 91
 				die();
92 92
 			}
93 93
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 			 *
101 101
 			 * @since 1.8
102 102
 			 */
103
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
103
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
104 104
 
105
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
105
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
106 106
 
107 107
 			/**
108 108
 			 * Trigger Action.
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			 *
114 114
 			 * @since 1.8
115 115
 			 */
116
-			do_action( self::$setting_filter_prefix . '_saved' );
116
+			do_action(self::$setting_filter_prefix.'_saved');
117 117
 		}
118 118
 
119 119
 		/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return void
128 128
 		 */
129
-		public static function add_message( $code, $message ) {
130
-			self::$messages[ $code ] = $message;
129
+		public static function add_message($code, $message) {
130
+			self::$messages[$code] = $message;
131 131
 		}
132 132
 
133 133
 		/**
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 		 *
141 141
 		 * @return void
142 142
 		 */
143
-		public static function add_error( $code, $message ) {
144
-			self::$errors[ $code ] = $message;
143
+		public static function add_error($code, $message) {
144
+			self::$errors[$code] = $message;
145 145
 		}
146 146
 
147 147
 		/**
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 			$notice_html = '';
155 155
 			$classes     = 'give-notice settings-error notice is-dismissible';
156 156
 
157
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
158
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
157
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
158
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
159 159
 
160
-			if ( 0 < count( self::$errors ) ) {
161
-				foreach ( self::$errors as $code => $message ) {
162
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
160
+			if (0 < count(self::$errors)) {
161
+				foreach (self::$errors as $code => $message) {
162
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
163 163
 				}
164 164
 			}
165 165
 
166
-			if ( 0 < count( self::$messages ) ) {
167
-				foreach ( self::$messages as $code => $message ) {
168
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
166
+			if (0 < count(self::$messages)) {
167
+				foreach (self::$messages as $code => $message) {
168
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
169 169
 				}
170 170
 			}
171 171
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			self::$setting_filter_prefix = give_get_current_setting_page();
186 186
 
187 187
 			// Bailout: Exit if setting page is not defined.
188
-			if ( empty( self::$setting_filter_prefix ) ) {
188
+			if (empty(self::$setting_filter_prefix)) {
189 189
 				return false;
190 190
 			}
191 191
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			 *
199 199
 			 * @since 1.8
200 200
 			 */
201
-			do_action( self::$setting_filter_prefix . '_start' );
201
+			do_action(self::$setting_filter_prefix.'_start');
202 202
 
203 203
 			$current_tab = give_get_current_setting_tab();
204 204
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			self::get_settings_pages();
207 207
 
208 208
 			// Save settings if data has been posted.
209
-			if ( ! empty( $_POST ) ) {
209
+			if ( ! empty($_POST)) {
210 210
 				self::save();
211 211
 			}
212 212
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			 *
220 220
 			 * @since 1.8
221 221
 			 */
222
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
222
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
223 223
 
224 224
 			include 'views/html-admin-settings.php';
225 225
 
@@ -237,25 +237,25 @@  discard block
 block discarded – undo
237 237
 		 *
238 238
 		 * @return string|bool
239 239
 		 */
240
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
240
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
241 241
 			// Bailout.
242
-			if ( empty( $option_name ) && empty( $field_id ) ) {
242
+			if (empty($option_name) && empty($field_id)) {
243 243
 				return false;
244 244
 			}
245 245
 
246
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
246
+			if ( ! empty($field_id) && ! empty($option_name)) {
247 247
 				// Get field value if any.
248
-				$option_value = get_option( $option_name );
248
+				$option_value = get_option($option_name);
249 249
 
250
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
251
-					? $option_value[ $field_id ]
250
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
251
+					? $option_value[$field_id]
252 252
 					: $default;
253 253
 			} else {
254 254
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
255 255
 				$option_name = ! $option_name ? $field_id : $option_name;
256 256
 
257 257
 				// Get option value if any.
258
-				$option_value = get_option( $option_name, $default );
258
+				$option_value = get_option($option_name, $default);
259 259
 			}
260 260
 
261 261
 			return $option_value;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		 *
274 274
 		 * @return void
275 275
 		 */
276
-		public static function output_fields( $options, $option_name = '' ) {
276
+		public static function output_fields($options, $option_name = '') {
277 277
 			$current_tab = give_get_current_setting_tab();
278 278
 
279 279
 			// Field Default values.
@@ -286,52 +286,52 @@  discard block
 block discarded – undo
286 286
 				'table_html' => true,
287 287
 			);
288 288
 
289
-			foreach ( $options as $value ) {
290
-				if ( ! isset( $value['type'] ) ) {
289
+			foreach ($options as $value) {
290
+				if ( ! isset($value['type'])) {
291 291
 					continue;
292 292
 				}
293 293
 
294 294
 				// Set title.
295
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
295
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
296 296
 
297 297
 				// Set default setting.
298
-				$value = wp_parse_args( $value, $defaults );
298
+				$value = wp_parse_args($value, $defaults);
299 299
 
300 300
 				// Colorpicker field.
301
-				$value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] );
302
-				$value['type']  = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] );
301
+				$value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']);
302
+				$value['type']  = ('colorpicker' === $value['type'] ? 'text' : $value['type']);
303 303
 
304 304
 
305 305
 				// Custom attribute handling.
306 306
 				$custom_attributes = array();
307 307
 
308
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
309
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
310
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
308
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
309
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
310
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
311 311
 					}
312 312
 				}
313 313
 
314 314
 				// Description handling.
315
-				$description          = self::get_field_description( $value );
315
+				$description = self::get_field_description($value);
316 316
 
317 317
 				// Switch based on type.
318
-				switch ( $value['type'] ) {
318
+				switch ($value['type']) {
319 319
 
320 320
 					// Section Titles
321 321
 					case 'title':
322
-						if ( ! empty( $value['title'] ) ) {
323
-							echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>';
322
+						if ( ! empty($value['title'])) {
323
+							echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>';
324 324
 						}
325 325
 
326
-						if ( ! empty( $value['desc'] ) ) {
327
-							echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) );
326
+						if ( ! empty($value['desc'])) {
327
+							echo wpautop(wptexturize(wp_kses_post($value['desc'])));
328 328
 						}
329 329
 
330
-						if ( $value['table_html'] ) {
331
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
330
+						if ($value['table_html']) {
331
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
332 332
 						}
333 333
 
334
-						if ( ! empty( $value['id'] ) ) {
334
+						if ( ! empty($value['id'])) {
335 335
 
336 336
 							/**
337 337
 							 * Trigger Action.
@@ -340,14 +340,14 @@  discard block
 block discarded – undo
340 340
 							 *
341 341
 							 * @since 1.8
342 342
 							 */
343
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
343
+							do_action('give_settings_'.sanitize_title($value['id']));
344 344
 						}
345 345
 
346 346
 						break;
347 347
 
348 348
 					// Section Ends.
349 349
 					case 'sectionend':
350
-						if ( ! empty( $value['id'] ) ) {
350
+						if ( ! empty($value['id'])) {
351 351
 
352 352
 							/**
353 353
 							 * Trigger Action.
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 							 *
357 357
 							 * @since 1.8
358 358
 							 */
359
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
359
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
360 360
 						}
361 361
 
362
-						if ( $value['table_html'] ) {
362
+						if ($value['table_html']) {
363 363
 							echo '</table>';
364 364
 						}
365 365
 
366
-						if ( ! empty( $value['id'] ) ) {
366
+						if ( ! empty($value['id'])) {
367 367
 
368 368
 							/**
369 369
 							 * Trigger Action.
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 							 *
373 373
 							 * @since 1.8
374 374
 							 */
375
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
375
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
376 376
 						}
377 377
 
378 378
 						break;
@@ -385,22 +385,22 @@  discard block
 block discarded – undo
385 385
 					case 'password' :
386 386
 
387 387
 						$type = $value['type'];
388
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
388
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
389 389
 
390 390
 						?>
391
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
391
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
392 392
                         <th scope="row" class="titledesc">
393
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
393
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
394 394
                         </th>
395
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
395
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
396 396
                             <input
397
-                                    name="<?php echo esc_attr( $value['id'] ); ?>"
398
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
399
-                                    type="<?php echo esc_attr( $type ); ?>"
400
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
401
-                                    value="<?php echo esc_attr( $option_value ); ?>"
402
-                                    class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
403
-								<?php echo implode( ' ', $custom_attributes ); ?>
397
+                                    name="<?php echo esc_attr($value['id']); ?>"
398
+                                    id="<?php echo esc_attr($value['id']); ?>"
399
+                                    type="<?php echo esc_attr($type); ?>"
400
+                                    style="<?php echo esc_attr($value['css']); ?>"
401
+                                    value="<?php echo esc_attr($option_value); ?>"
402
+                                    class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
403
+								<?php echo implode(' ', $custom_attributes); ?>
404 404
                             /> <?php echo $description; ?>
405 405
                         </td>
406 406
                         </tr><?php
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 					// Textarea.
410 410
 					case 'textarea':
411 411
 
412
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
412
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
413 413
 
414 414
 						?>
415
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
415
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
416 416
                         <th scope="row" class="titledesc">
417
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
417
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
418 418
                         </th>
419
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
419
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
420 420
 								<textarea
421
-                                        name="<?php echo esc_attr( $value['id'] ); ?>"
422
-                                        id="<?php echo esc_attr( $value['id'] ); ?>"
423
-                                        style="<?php echo esc_attr( $value['css'] ); ?>"
424
-                                        class="<?php echo esc_attr( $value['class'] ); ?>"
421
+                                        name="<?php echo esc_attr($value['id']); ?>"
422
+                                        id="<?php echo esc_attr($value['id']); ?>"
423
+                                        style="<?php echo esc_attr($value['css']); ?>"
424
+                                        class="<?php echo esc_attr($value['class']); ?>"
425 425
                                         rows="10"
426 426
                                         cols="60"
427
-									<?php echo implode( ' ', $custom_attributes ); ?>
428
-                                ><?php echo esc_textarea( $option_value ); ?></textarea>
427
+									<?php echo implode(' ', $custom_attributes); ?>
428
+                                ><?php echo esc_textarea($option_value); ?></textarea>
429 429
 							<?php echo $description; ?>
430 430
                         </td>
431 431
                         </tr><?php
@@ -435,35 +435,35 @@  discard block
 block discarded – undo
435 435
 					case 'select' :
436 436
 					case 'multiselect' :
437 437
 
438
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
438
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
439 439
 
440 440
 						?>
441
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
441
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
442 442
                         <th scope="row" class="titledesc">
443
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
443
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
444 444
                         </th>
445
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
445
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
446 446
                             <select
447
-                                    name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
447
+                                    name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
448 448
 										echo '[]';
449 449
 									} ?>"
450
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
451
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
452
-                                    class="<?php echo esc_attr( $value['class'] ); ?>"
453
-								<?php echo implode( ' ', $custom_attributes ); ?>
454
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
450
+                                    id="<?php echo esc_attr($value['id']); ?>"
451
+                                    style="<?php echo esc_attr($value['css']); ?>"
452
+                                    class="<?php echo esc_attr($value['class']); ?>"
453
+								<?php echo implode(' ', $custom_attributes); ?>
454
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
455 455
                             >
456 456
 
457 457
 								<?php
458
-								if ( ! empty( $value['options'] ) ) {
459
-									foreach ( $value['options'] as $key => $val ) {
458
+								if ( ! empty($value['options'])) {
459
+									foreach ($value['options'] as $key => $val) {
460 460
 										?>
461
-                                        <option value="<?php echo esc_attr( $key ); ?>" <?php
461
+                                        <option value="<?php echo esc_attr($key); ?>" <?php
462 462
 
463
-										if ( is_array( $option_value ) ) {
464
-											selected( in_array( $key, $option_value ), true );
463
+										if (is_array($option_value)) {
464
+											selected(in_array($key, $option_value), true);
465 465
 										} else {
466
-											selected( $option_value, $key );
466
+											selected($option_value, $key);
467 467
 										}
468 468
 
469 469
 										?>><?php echo $val ?></option>
@@ -479,28 +479,28 @@  discard block
 block discarded – undo
479 479
 
480 480
 					// Radio inputs.
481 481
 					case 'radio_inline' :
482
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
482
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
483 483
 					case 'radio' :
484
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
484
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
485 485
 						?>
486
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
486
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
487 487
                         <th scope="row" class="titledesc">
488
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
488
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
489 489
                         </th>
490
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
490
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
491 491
                             <fieldset>
492 492
                                 <ul>
493 493
 									<?php
494
-									foreach ( $value['options'] as $key => $val ) {
494
+									foreach ($value['options'] as $key => $val) {
495 495
 										?>
496 496
                                         <li>
497 497
                                             <label><input
498
-                                                        name="<?php echo esc_attr( $value['id'] ); ?>"
498
+                                                        name="<?php echo esc_attr($value['id']); ?>"
499 499
                                                         value="<?php echo $key; ?>"
500 500
                                                         type="radio"
501
-                                                        style="<?php echo esc_attr( $value['css'] ); ?>"
502
-													<?php echo implode( ' ', $custom_attributes ); ?>
503
-													<?php checked( $key, $option_value ); ?>
501
+                                                        style="<?php echo esc_attr($value['css']); ?>"
502
+													<?php echo implode(' ', $custom_attributes); ?>
503
+													<?php checked($key, $option_value); ?>
504 504
                                                 /> <?php echo $val ?></label>
505 505
                                         </li>
506 506
 										<?php
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
 
515 515
 					// Checkbox input.
516 516
 					case 'checkbox' :
517
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
517
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
518 518
 						?>
519
-                        <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
519
+                        <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
520 520
                             <th scope="row" class="titledesc">
521
-                                <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
521
+                                <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
522 522
                             </th>
523 523
                             <td class="give-forminp">
524 524
                                 <input
525
-                                        name="<?php echo esc_attr( $value['id'] ); ?>"
526
-                                        id="<?php echo esc_attr( $value['id'] ); ?>"
525
+                                        name="<?php echo esc_attr($value['id']); ?>"
526
+                                        id="<?php echo esc_attr($value['id']); ?>"
527 527
                                         type="checkbox"
528
-                                        class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
528
+                                        class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
529 529
                                         value="1"
530
-									<?php checked( $option_value, 'on' ); ?>
531
-									<?php echo implode( ' ', $custom_attributes ); ?>
530
+									<?php checked($option_value, 'on'); ?>
531
+									<?php echo implode(' ', $custom_attributes); ?>
532 532
                                 />
533 533
 								<?php echo $description; ?>
534 534
                             </td>
@@ -538,28 +538,28 @@  discard block
 block discarded – undo
538 538
 
539 539
 					// Multi Checkbox input.
540 540
 					case 'multicheck' :
541
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
542
-						$option_value = is_array( $option_value ) ? $option_value : array();
541
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
542
+						$option_value = is_array($option_value) ? $option_value : array();
543 543
 						?>
544
-                        <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
544
+                        <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
545 545
                             <th scope="row" class="titledesc">
546
-                                <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
546
+                                <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
547 547
                             </th>
548
-                            <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
548
+                            <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
549 549
                                 <fieldset>
550 550
                                     <ul>
551 551
 										<?php
552
-										foreach ( $value['options'] as $key => $val ) {
552
+										foreach ($value['options'] as $key => $val) {
553 553
 											?>
554 554
                                             <li>
555 555
                                                 <label>
556 556
                                                     <input
557
-                                                            name="<?php echo esc_attr( $value['id'] ); ?>[]"
557
+                                                            name="<?php echo esc_attr($value['id']); ?>[]"
558 558
                                                             value="<?php echo $key; ?>"
559 559
                                                             type="checkbox"
560
-                                                            style="<?php echo esc_attr( $value['css'] ); ?>"
561
-														<?php echo implode( ' ', $custom_attributes ); ?>
562
-														<?php if ( in_array( $key, $option_value ) ) {
560
+                                                            style="<?php echo esc_attr($value['css']); ?>"
561
+														<?php echo implode(' ', $custom_attributes); ?>
562
+														<?php if (in_array($key, $option_value)) {
563 563
 															echo 'checked="checked"';
564 564
 														} ?>
565 565
                                                     /> <?php echo $val ?>
@@ -577,25 +577,25 @@  discard block
 block discarded – undo
577 577
 
578 578
 					// File input field.
579 579
 					case 'file' :
580
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
580
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
581 581
 						?>
582
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
582
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
583 583
                         <th scope="row" class="titledesc">
584
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
584
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
585 585
                         </th>
586 586
                         <td class="give-forminp">
587 587
                             <div class="give-field-wrap">
588 588
                                 <label for="<?php echo $value['id'] ?>">
589 589
                                     <input
590
-                                            name="<?php echo esc_attr( $value['id'] ); ?>"
591
-                                            id="<?php echo esc_attr( $value['id'] ); ?>"
590
+                                            name="<?php echo esc_attr($value['id']); ?>"
591
+                                            id="<?php echo esc_attr($value['id']); ?>"
592 592
                                             type="text"
593
-                                            class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
593
+                                            class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
594 594
                                             value="<?php echo $option_value; ?>"
595
-                                            style="<?php echo esc_attr( $value['css'] ); ?>"
596
-										<?php echo implode( ' ', $custom_attributes ); ?>
595
+                                            style="<?php echo esc_attr($value['css']); ?>"
596
+										<?php echo implode(' ', $custom_attributes); ?>
597 597
                                     />&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button"
598
-                                                                     value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>">
598
+                                                                     value="<?php echo esc_html__('Add or Upload File', 'give'); ?>">
599 599
 									<?php echo $description ?>
600 600
                                     <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>">
601 601
                                         <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span>
@@ -610,17 +610,17 @@  discard block
 block discarded – undo
610 610
 					// WordPress Editor.
611 611
 					case 'wysiwyg' :
612 612
 						// Get option value.
613
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
613
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
614 614
 
615 615
 						// Get editor settings.
616
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
616
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
617 617
 						?>
618
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
618
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
619 619
                         <th scope="row" class="titledesc">
620
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
620
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
621 621
                         </th>
622 622
                         <td class="give-forminp">
623
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
623
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
624 624
 							<?php echo $description; ?>
625 625
                         </td>
626 626
                         </tr><?php
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 					// Custom: System setting field.
630 630
 					case 'system_info' :
631 631
 						?>
632
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
632
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
633 633
                         <th scope="row" class="titledesc">
634
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
634
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
635 635
                         </th>
636 636
                         <td class="give-forminp">
637 637
 							<?php give_system_info_callback(); ?>
@@ -642,14 +642,14 @@  discard block
 block discarded – undo
642 642
 
643 643
 					// Custom: Default gateways setting field.
644 644
 					case 'default_gateway' :
645
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
645
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
646 646
 						?>
647
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
647
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
648 648
                         <th scope="row" class="titledesc">
649
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
649
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
650 650
                         </th>
651 651
                         <td class="give-forminp">
652
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
652
+							<?php give_default_gateway_callback($value, $option_value); ?>
653 653
 							<?php echo $description; ?>
654 654
                         </td>
655 655
                         </tr><?php
@@ -657,14 +657,14 @@  discard block
 block discarded – undo
657 657
 
658 658
 					// Custom: Enable gateways setting field.
659 659
 					case 'enabled_gateways' :
660
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
660
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
661 661
 						?>
662
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
662
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
663 663
                         <th scope="row" class="titledesc">
664
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
664
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
665 665
                         </th>
666 666
                         <td class="give-forminp">
667
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
667
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
668 668
 							<?php echo $description; ?>
669 669
                         </td>
670 670
                         </tr><?php
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 					// Custom: Email preview buttons field.
674 674
 					case 'email_preview_buttons' :
675 675
 						?>
676
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
676
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
677 677
                         <th scope="row" class="titledesc">
678
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
678
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
679 679
                         </th>
680 680
                         <td class="give-forminp">
681 681
 							<?php give_email_preview_buttons_callback(); ?>
@@ -692,22 +692,22 @@  discard block
 block discarded – undo
692 692
 
693 693
 					// Custom: Gateway API key.
694 694
 					case 'api_key' :
695
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
696
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
695
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
696
+						$type         = ! empty($option_value) ? 'password' : 'text';
697 697
 						?>
698
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
698
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
699 699
                         <th scope="row" class="titledesc">
700
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
700
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
701 701
                         </th>
702
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
702
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
703 703
                             <input
704
-                                    name="<?php echo esc_attr( $value['id'] ); ?>"
705
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
706
-                                    type="<?php echo esc_attr( $type ); ?>"
707
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
708
-                                    value="<?php echo esc_attr( trim( $option_value ) ); ?>"
709
-                                    class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
710
-								<?php echo implode( ' ', $custom_attributes ); ?>
704
+                                    name="<?php echo esc_attr($value['id']); ?>"
705
+                                    id="<?php echo esc_attr($value['id']); ?>"
706
+                                    type="<?php echo esc_attr($type); ?>"
707
+                                    style="<?php echo esc_attr($value['css']); ?>"
708
+                                    value="<?php echo esc_attr(trim($option_value)); ?>"
709
+                                    class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
710
+								<?php echo implode(' ', $custom_attributes); ?>
711 711
                             /> <?php echo $description; ?>
712 712
                         </td>
713 713
                         </tr><?php
@@ -729,12 +729,12 @@  discard block
 block discarded – undo
729 729
 					// Custom: Give Docs Link field type.
730 730
 					case 'give_docs_link' :
731 731
 						?>
732
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
732
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
733 733
                         <td class="give-docs-link" colspan="2">
734 734
 							<?php
735
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
735
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
736 736
 							     . '" target="_blank">'
737
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
737
+							     . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title'])
738 738
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
739 739
 							?>
740 740
                         </td>
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 					// You can add or handle your custom field action.
746 746
 					default:
747 747
 						// Get option value.
748
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
749
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
748
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
749
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
750 750
 						break;
751 751
 				}
752 752
 			}
@@ -762,15 +762,15 @@  discard block
 block discarded – undo
762 762
 		 *
763 763
 		 * @return string The HTML description of the field.
764 764
 		 */
765
-		public static function get_field_description( $value ) {
765
+		public static function get_field_description($value) {
766 766
 			$description = '';
767 767
 
768 768
 			// Support for both 'description' and 'desc' args.
769
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
770
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
769
+			$description_key = isset($value['description']) ? 'description' : 'desc';
770
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
771 771
 
772
-			if ( ! empty( $value ) ) {
773
-				$description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>';
772
+			if ( ! empty($value)) {
773
+				$description = '<p class="give-field-description">'.wp_kses_post($value).'</p>';
774 774
 			}
775 775
 
776 776
 			return $description;
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 		 *
788 788
 		 * @return array The description and tip as a 2 element array
789 789
 		 */
790
-		public static function get_field_title( $value ) {
791
-			$title = esc_html( $value['title'] );
790
+		public static function get_field_title($value) {
791
+			$title = esc_html($value['title']);
792 792
 
793 793
 			// If html tag detected then allow them to print.
794
-			if ( strip_tags( $title ) ) {
794
+			if (strip_tags($title)) {
795 795
 				$title = $value['title'];
796 796
 			}
797 797
 
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 		 *
811 811
 		 * @return bool
812 812
 		 */
813
-		public static function save_fields( $options, $option_name = '' ) {
814
-			if ( empty( $_POST ) ) {
813
+		public static function save_fields($options, $option_name = '') {
814
+			if (empty($_POST)) {
815 815
 				return false;
816 816
 			}
817 817
 
@@ -819,37 +819,37 @@  discard block
 block discarded – undo
819 819
 			$update_options = array();
820 820
 
821 821
 			// Loop options and get values to save.
822
-			foreach ( $options as $option ) {
823
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
822
+			foreach ($options as $option) {
823
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
824 824
 					continue;
825 825
 				}
826 826
 
827 827
 				// Get posted value.
828
-				if ( strstr( $option['id'], '[' ) ) {
829
-					parse_str( $option['id'], $option_name_array );
830
-					$field_option_name = current( array_keys( $option_name_array ) );
831
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
832
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
828
+				if (strstr($option['id'], '[')) {
829
+					parse_str($option['id'], $option_name_array);
830
+					$field_option_name = current(array_keys($option_name_array));
831
+					$setting_name      = key($option_name_array[$field_option_name]);
832
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
833 833
 				} else {
834 834
 					$field_option_name = $option['id'];
835 835
 					$setting_name      = '';
836
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
836
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
837 837
 				}
838 838
 
839 839
 				// Format the value based on option type.
840
-				switch ( $option['type'] ) {
840
+				switch ($option['type']) {
841 841
 					case 'checkbox' :
842
-						$value = is_null( $raw_value ) ? '' : 'on';
842
+						$value = is_null($raw_value) ? '' : 'on';
843 843
 						break;
844 844
 					case 'wysiwyg'  :
845 845
 					case 'textarea' :
846
-						$value = wp_kses_post( trim( $raw_value ) );
846
+						$value = wp_kses_post(trim($raw_value));
847 847
 						break;
848 848
 					case 'multiselect' :
849
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
849
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
850 850
 						break;
851 851
 					default :
852
-						$value = give_clean( $raw_value );
852
+						$value = give_clean($raw_value);
853 853
 						break;
854 854
 				}
855 855
 
@@ -858,37 +858,37 @@  discard block
 block discarded – undo
858 858
 				 *
859 859
 				 * @since 1.8
860 860
 				 */
861
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
861
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
862 862
 
863 863
 				/**
864 864
 				 * Sanitize the value of an option by option name.
865 865
 				 *
866 866
 				 * @since 1.8
867 867
 				 */
868
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
868
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
869 869
 
870
-				if ( is_null( $value ) ) {
870
+				if (is_null($value)) {
871 871
 					continue;
872 872
 				}
873 873
 
874 874
 				// Check if option is an array and handle that differently to single values.
875
-				if ( $field_option_name && $setting_name ) {
876
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
877
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
875
+				if ($field_option_name && $setting_name) {
876
+					if ( ! isset($update_options[$field_option_name])) {
877
+						$update_options[$field_option_name] = get_option($field_option_name, array());
878 878
 					}
879
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
880
-						$update_options[ $field_option_name ] = array();
879
+					if ( ! is_array($update_options[$field_option_name])) {
880
+						$update_options[$field_option_name] = array();
881 881
 					}
882
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
882
+					$update_options[$field_option_name][$setting_name] = $value;
883 883
 				} else {
884
-					$update_options[ $field_option_name ] = $value;
884
+					$update_options[$field_option_name] = $value;
885 885
 				}
886 886
 			}
887 887
 
888 888
 			// Save all options in our array or there own option name i.e. option id.
889
-			if ( empty( $option_name ) ) {
890
-				foreach ( $update_options as $name => $value ) {
891
-					update_option( $name, $value );
889
+			if (empty($option_name)) {
890
+				foreach ($update_options as $name => $value) {
891
+					update_option($name, $value);
892 892
 
893 893
 					/**
894 894
 					 * Trigger action.
@@ -897,13 +897,13 @@  discard block
 block discarded – undo
897 897
 					 *
898 898
 					 * @since 1.8
899 899
 					 */
900
-					do_action( "give_save_option_{$name}", $value, $name );
900
+					do_action("give_save_option_{$name}", $value, $name);
901 901
 				}
902 902
 			} else {
903
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
904
-				$update_options = array_merge( $old_options, $update_options );
903
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
904
+				$update_options = array_merge($old_options, $update_options);
905 905
 
906
-				update_option( $option_name, $update_options );
906
+				update_option($option_name, $update_options);
907 907
 
908 908
 				/**
909 909
 				 * Trigger action.
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 				 *
913 913
 				 * @since 1.8
914 914
 				 */
915
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
915
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
916 916
 			}
917 917
 
918 918
 			return true;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 								'disabled' => __( 'Disabled', 'give' ),
87 87
 							)
88 88
 						),
89
-                        array(
90
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
92
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
-                            'type'  => 'give_docs_link',
95
-                        ),
89
+						array(
90
+							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
92
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
+							'type'  => 'give_docs_link',
95
+						),
96 96
 						array(
97 97
 							'type' => 'sectionend',
98 98
 							'id'   => 'give_title_gateway_settings_2',
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 								'textarea_rows' => 6,
146 146
 							)
147 147
 						),
148
-                        array(
149
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
-                            'id'    => 'offline_gateway_settings_docs_link',
151
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
153
-                            'type'  => 'give_docs_link',
154
-                        ),
148
+						array(
149
+							'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
+							'id'    => 'offline_gateway_settings_docs_link',
151
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
+							'title' => __( 'Offline Gateway Settings', 'give' ),
153
+							'type'  => 'give_docs_link',
154
+						),
155 155
 						array(
156 156
 							'type' => 'sectionend',
157 157
 							'id'   => 'give_title_gateway_settings_3',
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 							'id'   => 'default_gateway',
190 190
 							'type' => 'default_gateway'
191 191
 						),
192
-                        array(
193
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
194
-                            'id'    => 'gateway_settings_docs_link',
195
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
-                            'title' => __( 'Gateway Settings', 'give' ),
197
-                            'type'  => 'give_docs_link',
198
-                        ),
192
+						array(
193
+							'name'  => __( 'Gateways Docs Link', 'give' ),
194
+							'id'    => 'gateway_settings_docs_link',
195
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
+							'title' => __( 'Gateway Settings', 'give' ),
197
+							'type'  => 'give_docs_link',
198
+						),
199 199
 						array(
200 200
 							'id'   => 'give_title_gateway_settings_1',
201 201
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: PayPal Standard.
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => __( 'PayPal Email', 'give' ),
57
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => __('PayPal Email', 'give'),
57
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => __( 'PayPal Page Style', 'give' ),
63
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => __('PayPal Page Style', 'give'),
63
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
68
+							'name'    => __('PayPal Transaction Type', 'give'),
69
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => __( 'Donation', 'give' ),
74
-								'standard' => __( 'Standard Transaction', 'give' )
73
+								'donation' => __('Donation', 'give'),
74
+								'standard' => __('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Billing Details', 'give' ),
80
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
79
+							'name'    => __('Billing Details', 'give'),
80
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
81 81
 							'id'      => 'paypal_standard_billing_details',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'disabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
 						array(
90
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
91
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
90
+							'name'    => __('PayPal IPN Verification', 'give'),
91
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
92 92
 							'id'      => 'paypal_verification',
93 93
 							'type'    => 'radio_inline',
94 94
 							'default' => 'enabled',
95 95
 							'options' => array(
96
-								'enabled'  => __( 'Enabled', 'give' ),
97
-								'disabled' => __( 'Disabled', 'give' ),
96
+								'enabled'  => __('Enabled', 'give'),
97
+								'disabled' => __('Disabled', 'give'),
98 98
 							)
99 99
 						),
100 100
                         array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
101
+                            'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
102 102
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
103
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
104
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
105 105
                             'type'  => 'give_docs_link',
106 106
                         ),
107 107
 						array(
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 							'id'   => 'give_title_gateway_settings_3',
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Collect Billing Details', 'give' ),
123
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
122
+							'name'    => __('Collect Billing Details', 'give'),
123
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
124 124
 							'id'      => 'give_offline_donation_enable_billing_fields',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'disabled',
127 127
 							'options' => array(
128
-								'enabled'  => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' )
128
+								'enabled'  => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give')
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
134
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
133
+							'name'    => __('Offline Donation Instructions', 'give'),
134
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
135 135
 							'id'      => 'global_offline_donation_content',
136 136
 							'default' => give_get_default_offline_donation_content(),
137 137
 							'type'    => 'wysiwyg',
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						),
142 142
 						array(
143
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
144
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
143
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
144
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
145 145
 							'id'      => 'offline_donation_subject',
146
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
146
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
147 147
 							'type'    => 'text'
148 148
 						),
149 149
 						array(
150
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
151
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
150
+							'name'    => __('Offline Donation Email Instructions', 'give'),
151
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
152 152
 							'id'      => 'global_offline_donation_email',
153 153
 							'default' => give_get_default_offline_donation_email_content(),
154 154
 							'type'    => 'wysiwyg',
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 							)
158 158
 						),
159 159
                         array(
160
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
160
+                            'name'  => __('Offline Donations Settings Docs Link', 'give'),
161 161
                             'id'    => 'offline_gateway_settings_docs_link',
162
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
163
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
162
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'),
163
+                            'title' => __('Offline Gateway Settings', 'give'),
164 164
                             'type'  => 'give_docs_link',
165 165
                         ),
166 166
 						array(
@@ -178,33 +178,33 @@  discard block
 block discarded – undo
178 178
 							'type' => 'title'
179 179
 						),
180 180
 						array(
181
-							'name'    => __( 'Test Mode', 'give' ),
182
-							'desc'    => __( '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' ),
181
+							'name'    => __('Test Mode', 'give'),
182
+							'desc'    => __('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'),
183 183
 							'id'      => 'test_mode',
184 184
 							'type'    => 'radio_inline',
185 185
 							'default' => 'disabled',
186 186
 							'options' => array(
187
-								'enabled'  => __( 'Enabled', 'give' ),
188
-								'disabled' => __( 'Disabled', 'give' ),
187
+								'enabled'  => __('Enabled', 'give'),
188
+								'disabled' => __('Disabled', 'give'),
189 189
 							)
190 190
 						),
191 191
 						array(
192
-							'name' => __( 'Enabled Gateways', 'give' ),
193
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
192
+							'name' => __('Enabled Gateways', 'give'),
193
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
194 194
 							'id'   => 'gateways',
195 195
 							'type' => 'enabled_gateways'
196 196
 						),
197 197
 						array(
198
-							'name' => __( 'Default Gateway', 'give' ),
199
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
198
+							'name' => __('Default Gateway', 'give'),
199
+							'desc' => __('The gateway that will be selected by default.', 'give'),
200 200
 							'id'   => 'default_gateway',
201 201
 							'type' => 'default_gateway'
202 202
 						),
203 203
                         array(
204
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
204
+                            'name'  => __('Gateways Docs Link', 'give'),
205 205
                             'id'    => 'gateway_settings_docs_link',
206
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
207
-                            'title' => __( 'Gateway Settings', 'give' ),
206
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
207
+                            'title' => __('Gateway Settings', 'give'),
208 208
                             'type'  => 'give_docs_link',
209 209
                         ),
210 210
 						array(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			 * Filter the payment gateways settings.
220 220
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
221 221
 			 */
222
-			$settings = apply_filters( 'give_settings_gateways', $settings );
222
+			$settings = apply_filters('give_settings_gateways', $settings);
223 223
 
224 224
 			/**
225 225
 			 * Filter the settings.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 *
229 229
 			 * @param  array $settings
230 230
 			 */
231
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
231
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
232 232
 
233 233
 			// Output.
234 234
 			return $settings;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 		 */
243 243
 		public function get_sections() {
244 244
 			$sections = array(
245
-				'gateways-settings' => __( 'Gateways', 'give' ),
246
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
247
-				'offline-donations' => __( 'Offline Donations', 'give' )
245
+				'gateways-settings' => __('Gateways', 'give'),
246
+				'paypal-standard'   => __('PayPal Standard', 'give'),
247
+				'offline-donations' => __('Offline Donations', 'give')
248 248
 			);
249 249
 
250
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
250
+			return apply_filters('give_get_sections_'.$this->id, $sections);
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) );
71
+				return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id']));
72 72
 			case 'gateway' :
73
-				return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway'];
73
+				return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway'];
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Donation ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			'paged'    => $paged
181 181
 		);
182 182
 
183
-		$logs = $give_logs->get_connected_logs( $log_query );
183
+		$logs = $give_logs->get_connected_logs($log_query);
184 184
 
185
-		if ( $logs ) {
186
-			foreach ( $logs as $log ) {
185
+		if ($logs) {
186
+			foreach ($logs as $log) {
187 187
 
188 188
 				$logs_data[] = array(
189 189
 					'ID'         => $log->ID,
190
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
190
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
191 191
 					'payment_id' => $log->post_parent,
192 192
 					'error'      => 'error',
193
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
193
+					'gateway'    => give_get_payment_gateway($log->post_parent),
194 194
 					'date'       => $log->post_date
195 195
 				);
196 196
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $which
214 214
 	 */
215
-	protected function display_tablenav( $which ) {
216
-		if ( 'top' === $which ) {
217
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
215
+	protected function display_tablenav($which) {
216
+		if ('top' === $which) {
217
+			wp_nonce_field('bulk-'.$this->_args['plural']);
218 218
 		}
219 219
 		?>
220
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
220
+		<div class="tablenav <?php echo esc_attr($which); ?>">
221 221
 
222 222
 			<div class="alignleft actions bulkactions">
223
-				<?php $this->bulk_actions( $which ); ?>
223
+				<?php $this->bulk_actions($which); ?>
224 224
 			</div>
225 225
 			<?php
226
-			$this->extra_tablenav( $which );
227
-			$this->pagination( $which );
226
+			$this->extra_tablenav($which);
227
+			$this->pagination($which);
228 228
 			?>
229 229
 
230 230
 			<br class="clear"/>
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 		$columns               = $this->get_columns();
252 252
 		$hidden                = array(); // No hidden columns
253 253
 		$sortable              = $this->get_sortable_columns();
254
-		$this->_column_headers = array( $columns, $hidden, $sortable );
254
+		$this->_column_headers = array($columns, $hidden, $sortable);
255 255
 		$this->items           = $this->get_logs();
256
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
256
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
257 257
 
258
-		$this->set_pagination_args( array(
258
+		$this->set_pagination_args(array(
259 259
 				'total_items' => $total_items,
260 260
 				'per_page'    => $this->per_page,
261
-				'total_pages' => ceil( $total_items / $this->per_page )
261
+				'total_pages' => ceil($total_items / $this->per_page)
262 262
 			)
263 263
 		);
264 264
 	}
Please login to merge, or discard this patch.
includes/class-give-email-access.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @access public
234 234
 	 *
235
-	 * @return bool
235
+	 * @return null|boolean
236 236
 	 */
237 237
 	public function check_for_token() {
238 238
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public function __construct() {
97 97
 
98 98
 		// get it started
99
-		add_action( 'init', array( $this, 'init' ) );
99
+		add_action('init', array($this, 'init'));
100 100
 	}
101 101
 
102 102
 	/**
@@ -120,29 +120,29 @@  discard block
 block discarded – undo
120 120
 		 */
121 121
 		if (
122 122
 			is_user_logged_in()
123
-			|| ! give_is_setting_enabled( give_get_option( 'email_access' ) )
123
+			|| ! give_is_setting_enabled(give_get_option('email_access'))
124 124
 			|| is_admin()
125 125
 		) {
126 126
 			return;
127 127
 		}
128 128
 
129 129
 		// Are db columns setup?
130
-		$is_setup = give_get_option( 'email_access_installed' );
131
-		if ( empty( $is_setup ) ) {
130
+		$is_setup = give_get_option('email_access_installed');
131
+		if (empty($is_setup)) {
132 132
 			$this->create_columns();
133 133
 		}
134 134
 
135 135
 		// Timeouts.
136
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
137
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
136
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
137
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
138 138
 
139 139
 		// Setup login.
140 140
 		$this->check_for_token();
141 141
 
142
-		if ( $this->token_exists ) {
143
-			add_filter( 'give_can_view_receipt', '__return_true' );
144
-			add_filter( 'give_user_pending_verification', '__return_false' );
145
-			add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
142
+		if ($this->token_exists) {
143
+			add_filter('give_can_view_receipt', '__return_true');
144
+			add_filter('give_user_pending_verification', '__return_false');
145
+			add_filter('give_get_users_donations_args', array($this, 'users_donations_args'));
146 146
 		}
147 147
 
148 148
 	}
@@ -157,25 +157,25 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return bool
159 159
 	 */
160
-	public function can_send_email( $customer_id ) {
160
+	public function can_send_email($customer_id) {
161 161
 		/* @var WPDB $wpdb */
162 162
 		global $wpdb;
163 163
 
164 164
 		// Prevent multiple emails within X minutes
165
-		$throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle );
165
+		$throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle);
166 166
 
167 167
 		// Does a user row exist?
168 168
 		$exists = (int) $wpdb->get_var(
169
-			$wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id )
169
+			$wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id)
170 170
 		);
171 171
 
172
-		if ( 0 < $exists ) {
172
+		if (0 < $exists) {
173 173
 			$row_id = (int) $wpdb->get_var(
174
-				$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle )
174
+				$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle)
175 175
 			);
176 176
 
177
-			if ( $row_id < 1 ) {
178
-				give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) );
177
+			if ($row_id < 1) {
178
+				give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give'));
179 179
 
180 180
 				return false;
181 181
 			}
@@ -195,34 +195,34 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return void
197 197
 	 */
198
-	public function send_email( $customer_id, $email ) {
198
+	public function send_email($customer_id, $email) {
199 199
 
200
-		$verify_key = wp_generate_password( 20, false );
200
+		$verify_key = wp_generate_password(20, false);
201 201
 
202 202
 		// Generate a new verify key
203
-		$this->set_verify_key( $customer_id, $email, $verify_key );
203
+		$this->set_verify_key($customer_id, $email, $verify_key);
204 204
 
205 205
 		// Get the donation history page
206
-		$page_id = give_get_option( 'history_page' );
206
+		$page_id = give_get_option('history_page');
207 207
 
208
-		$access_url = add_query_arg( array(
208
+		$access_url = add_query_arg(array(
209 209
 			'give_nl' => $verify_key,
210
-		), get_permalink( $page_id ) );
210
+		), get_permalink($page_id));
211 211
 
212 212
 		// Nice subject and message.
213
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );
213
+		$subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name')));
214 214
 
215
-		$message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
216
-		$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access Donation Details &raquo;', 'give' ) . '</a>' . "\n\n";
215
+		$message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n";
216
+		$message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access Donation Details &raquo;', 'give').'</a>'."\n\n";
217 217
 		$message .= "\n\n";
218
-		$message .= __( 'Sincerely,', 'give' ) . "\n";
219
-		$message .= get_bloginfo( 'name' ) . "\n";
218
+		$message .= __('Sincerely,', 'give')."\n";
219
+		$message .= get_bloginfo('name')."\n";
220 220
 
221
-		$message = apply_filters( 'give_email_access_token_message', $message );
221
+		$message = apply_filters('give_email_access_token_message', $message);
222 222
 
223 223
 		// Send the email.
224
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) );
225
-		Give()->emails->send( $email, $subject, $message );
224
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give')));
225
+		Give()->emails->send($email, $subject, $message);
226 226
 
227 227
 	}
228 228
 
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function check_for_token() {
238 238
 
239
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
239
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
240 240
 
241 241
 		// Check for cookie.
242
-		if ( empty( $token ) ) {
243
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
242
+		if (empty($token)) {
243
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
244 244
 		}
245 245
 
246 246
 		// Must have a token.
247
-		if ( ! empty( $token ) ) {
247
+		if ( ! empty($token)) {
248 248
 
249
-			if ( ! $this->is_valid_token( $token ) ) {
250
-				if ( ! $this->is_valid_verify_key( $token ) ) {
249
+			if ( ! $this->is_valid_token($token)) {
250
+				if ( ! $this->is_valid_verify_key($token)) {
251 251
 					return;
252 252
 				}
253 253
 			}
254 254
 
255 255
 			$this->token_exists = true;
256 256
 			// Set cookie.
257
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
258
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
257
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
258
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
259 259
 
260 260
 			return true;
261 261
 		}
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @return bool
273 273
 	 */
274
-	public function is_valid_token( $token ) {
274
+	public function is_valid_token($token) {
275 275
 
276 276
 		global $wpdb;
277 277
 
278 278
 		// Make sure token isn't expired.
279
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
279
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
280 280
 
281 281
 		$email = $wpdb->get_var(
282
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
282
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
283 283
 		);
284 284
 
285
-		if ( ! empty( $email ) ) {
285
+		if ( ! empty($email)) {
286 286
 			$this->token_email = $email;
287 287
 			$this->token       = $token;
288 288
 			return true;
289 289
 		}
290 290
 
291 291
 		// Set error only if email access form isn't being submitted
292
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
293
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) );
292
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
293
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give')));
294 294
 		}
295 295
 
296 296
 		return false;
@@ -309,25 +309,25 @@  discard block
 block discarded – undo
309 309
 	 *
310 310
 	 * @return void
311 311
 	 */
312
-	public function set_verify_key( $customer_id, $email, $verify_key ) {
312
+	public function set_verify_key($customer_id, $email, $verify_key) {
313 313
 		global $wpdb;
314 314
 
315
-		$now = date( 'Y-m-d H:i:s' );
315
+		$now = date('Y-m-d H:i:s');
316 316
 
317 317
 		// Insert or update?
318 318
 		$row_id = (int) $wpdb->get_var(
319
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
319
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
320 320
 		);
321 321
 
322 322
 		// Update.
323
-		if ( ! empty( $row_id ) ) {
323
+		if ( ! empty($row_id)) {
324 324
 			$wpdb->query(
325
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
325
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
326 326
 			);
327 327
 		} // Insert.
328 328
 		else {
329 329
 			$wpdb->query(
330
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
330
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
331 331
 			);
332 332
 		}
333 333
 	}
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @return bool
344 344
 	 */
345
-	public function is_valid_verify_key( $token ) {
345
+	public function is_valid_verify_key($token) {
346 346
 		/* @var WPDB $wpdb */
347 347
 		global $wpdb;
348 348
 
349 349
 		// See if the verify_key exists.
350 350
 		$row = $wpdb->get_row(
351
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
351
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
352 352
 		);
353 353
 
354
-		$now = date( 'Y-m-d H:i:s' );
354
+		$now = date('Y-m-d H:i:s');
355 355
 
356 356
 		// Set token and remove verify key.
357
-		if ( ! empty( $row ) ) {
357
+		if ( ! empty($row)) {
358 358
 			$wpdb->query(
359
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
359
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
360 360
 			);
361 361
 
362 362
 			$this->token_email = $row->email;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @return mixed
382 382
 	 */
383
-	public function users_donations_args( $args ) {
383
+	public function users_donations_args($args) {
384 384
 		$args['user'] = $this->token_email;
385 385
 
386 386
 		return $args;
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		global $wpdb;
402 402
 
403 403
 		// Create columns in customers table
404
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
404
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
405 405
 
406 406
 		// Columns added properly
407
-		if ( $query ) {
408
-			give_update_option( 'email_access_installed', 1 );
407
+		if ($query) {
408
+			give_update_option('email_access_installed', 1);
409 409
 		}
410 410
 
411 411
 	}
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	 * @uses api_request()
78 78
 	 *
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80
-	 * @return array Modified update array with custom plugin data.
80
+	 * @return stdClass Modified update array with custom plugin data.
81 81
 	 */
82 82
 	public function check_update( $_transient_data ) {
83 83
 
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined('ABSPATH')) exit;
5 5
 
6 6
 /**
7 7
  * Allows plugins to use their own update API.
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	 * @param string  $_plugin_file Path to the plugin file.
30 30
 	 * @param array   $_api_data    Optional data to send with API calls.
31 31
 	 */
32
-	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
32
+	public function __construct($_api_url, $_plugin_file, $_api_data = null) {
33 33
 
34 34
 		global $edd_plugin_data;
35 35
 
36
-		$this->api_url     = trailingslashit( $_api_url );
36
+		$this->api_url     = trailingslashit($_api_url);
37 37
 		$this->api_data    = $_api_data;
38
-		$this->name        = plugin_basename( $_plugin_file );
39
-		$this->slug        = basename( $_plugin_file, '.php' );
38
+		$this->name        = plugin_basename($_plugin_file);
39
+		$this->slug        = basename($_plugin_file, '.php');
40 40
 		$this->version     = $_api_data['version'];
41
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
42
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
43
-		$this->cache_key   = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
41
+		$this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false;
42
+		$this->beta        = ! empty($this->api_data['beta']) ? true : false;
43
+		$this->cache_key   = md5(serialize($this->slug.$this->api_data['license'].$this->beta));
44 44
 
45
-		$edd_plugin_data[ $this->slug ] = $this->api_data;
45
+		$edd_plugin_data[$this->slug] = $this->api_data;
46 46
 
47 47
 		// Set up hooks.
48 48
 		$this->init();
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function init() {
60 60
 
61
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
62
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
63
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
64
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
65
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
61
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
62
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
63
+		remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10);
64
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
65
+		add_action('admin_init', array($this, 'show_changelog'));
66 66
 
67 67
 	}
68 68
 
@@ -79,41 +79,41 @@  discard block
 block discarded – undo
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80 80
 	 * @return array Modified update array with custom plugin data.
81 81
 	 */
82
-	public function check_update( $_transient_data ) {
82
+	public function check_update($_transient_data) {
83 83
 
84 84
 		global $pagenow;
85 85
 
86
-		if ( ! is_object( $_transient_data ) ) {
86
+		if ( ! is_object($_transient_data)) {
87 87
 			$_transient_data = new stdClass;
88 88
 		}
89 89
 
90
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
90
+		if ('plugins.php' == $pagenow && is_multisite()) {
91 91
 			return $_transient_data;
92 92
 		}
93 93
 
94
-		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
94
+		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
95 95
 			return $_transient_data;
96 96
 		}
97 97
 
98 98
 		$version_info = $this->get_cached_version_info();
99 99
 
100
-		if ( false === $version_info ) {
101
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
100
+		if (false === $version_info) {
101
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
102 102
 
103
-			$this->set_version_info_cache( $version_info );
103
+			$this->set_version_info_cache($version_info);
104 104
 
105 105
 		}
106 106
 
107
-		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
107
+		if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
108 108
 
109
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
109
+			if (version_compare($this->version, $version_info->new_version, '<')) {
110 110
 
111
-				$_transient_data->response[ $this->name ] = $version_info;
111
+				$_transient_data->response[$this->name] = $version_info;
112 112
 
113 113
 			}
114 114
 
115
-			$_transient_data->last_checked           = current_time( 'timestamp' );
116
-			$_transient_data->checked[ $this->name ] = $this->version;
115
+			$_transient_data->last_checked           = current_time('timestamp');
116
+			$_transient_data->checked[$this->name] = $this->version;
117 117
 
118 118
 		}
119 119
 
@@ -126,97 +126,97 @@  discard block
 block discarded – undo
126 126
 	 * @param string  $file
127 127
 	 * @param array   $plugin
128 128
 	 */
129
-	public function show_update_notification( $file, $plugin ) {
129
+	public function show_update_notification($file, $plugin) {
130 130
 
131
-		if ( is_network_admin() ) {
131
+		if (is_network_admin()) {
132 132
 			return;
133 133
 		}
134 134
 
135
-		if( ! current_user_can( 'update_plugins' ) ) {
135
+		if ( ! current_user_can('update_plugins')) {
136 136
 			return;
137 137
 		}
138 138
 
139
-		if( ! is_multisite() ) {
139
+		if ( ! is_multisite()) {
140 140
 			return;
141 141
 		}
142 142
 
143
-		if ( $this->name != $file ) {
143
+		if ($this->name != $file) {
144 144
 			return;
145 145
 		}
146 146
 
147 147
 		// Remove our filter on the site transient
148
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
148
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
149 149
 
150
-		$update_cache = get_site_transient( 'update_plugins' );
150
+		$update_cache = get_site_transient('update_plugins');
151 151
 
152
-		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
152
+		$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
153 153
 
154
-		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
154
+		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
155 155
 
156 156
 			$version_info = $this->get_cached_version_info();
157 157
 
158
-			if ( false === $version_info ) {
159
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
158
+			if (false === $version_info) {
159
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
160 160
 
161
-				$this->set_version_info_cache( $version_info );
161
+				$this->set_version_info_cache($version_info);
162 162
 			}
163 163
 
164
-			if ( ! is_object( $version_info ) ) {
164
+			if ( ! is_object($version_info)) {
165 165
 				return;
166 166
 			}
167 167
 
168
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
168
+			if (version_compare($this->version, $version_info->new_version, '<')) {
169 169
 
170
-				$update_cache->response[ $this->name ] = $version_info;
170
+				$update_cache->response[$this->name] = $version_info;
171 171
 
172 172
 			}
173 173
 
174
-			$update_cache->last_checked = current_time( 'timestamp' );
175
-			$update_cache->checked[ $this->name ] = $this->version;
174
+			$update_cache->last_checked = current_time('timestamp');
175
+			$update_cache->checked[$this->name] = $this->version;
176 176
 
177
-			set_site_transient( 'update_plugins', $update_cache );
177
+			set_site_transient('update_plugins', $update_cache);
178 178
 
179 179
 		} else {
180 180
 
181
-			$version_info = $update_cache->response[ $this->name ];
181
+			$version_info = $update_cache->response[$this->name];
182 182
 
183 183
 		}
184 184
 
185 185
 		// Restore our filter
186
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
186
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
187 187
 
188
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
188
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
189 189
 
190 190
 			// build a plugin list row, with update notification
191
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
191
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
192 192
 			# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
193
-			echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
193
+			echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">';
194 194
 			echo '<td colspan="3" class="plugin-update colspanchange">';
195 195
 			echo '<div class="update-message notice inline notice-warning notice-alt">';
196 196
 
197
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
197
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
198 198
 
199
-			if ( empty( $version_info->download_link ) ) {
199
+			if (empty($version_info->download_link)) {
200 200
 				printf(
201
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
202
-					esc_html( $version_info->name ),
203
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
204
-					esc_html( $version_info->new_version ),
201
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads'),
202
+					esc_html($version_info->name),
203
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
204
+					esc_html($version_info->new_version),
205 205
 					'</a>'
206 206
 				);
207 207
 			} else {
208 208
 				printf(
209
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
210
-					esc_html( $version_info->name ),
211
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
212
-					esc_html( $version_info->new_version ),
209
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads'),
210
+					esc_html($version_info->name),
211
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
212
+					esc_html($version_info->new_version),
213 213
 					'</a>',
214
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
214
+					'<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">',
215 215
 					'</a>'
216 216
 				);
217 217
 			}
218 218
 
219
-			do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
219
+			do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
220 220
 
221 221
 			echo '</div></td></tr>';
222 222
 		}
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
 	 * @param object  $_args
233 233
 	 * @return object $_data
234 234
 	 */
235
-	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
235
+	public function plugins_api_filter($_data, $_action = '', $_args = null) {
236 236
 
237
-		if ( $_action != 'plugin_information' ) {
237
+		if ($_action != 'plugin_information') {
238 238
 
239 239
 			return $_data;
240 240
 
241 241
 		}
242 242
 
243
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
243
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
244 244
 
245 245
 			return $_data;
246 246
 
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
 			)
256 256
 		);
257 257
 
258
-		$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
258
+		$cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta));
259 259
 
260 260
 		// Get the transient where we store the api request for this plugin for 24 hours
261
-		$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
261
+		$edd_api_request_transient = $this->get_cached_version_info($cache_key);
262 262
 
263 263
 		//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
264
-		if ( empty( $edd_api_request_transient ) ) {
264
+		if (empty($edd_api_request_transient)) {
265 265
 
266
-			$api_response = $this->api_request( 'plugin_information', $to_send );
266
+			$api_response = $this->api_request('plugin_information', $to_send);
267 267
 
268 268
 			// Expires in 3 hours
269
-			$this->set_version_info_cache( $api_response, $cache_key );
269
+			$this->set_version_info_cache($api_response, $cache_key);
270 270
 
271
-			if ( false !== $api_response ) {
271
+			if (false !== $api_response) {
272 272
 				$_data = $api_response;
273 273
 			}
274 274
 
@@ -277,20 +277,20 @@  discard block
 block discarded – undo
277 277
 		}
278 278
 
279 279
 		// Convert sections into an associative array, since we're getting an object, but Core expects an array.
280
-		if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
280
+		if (isset($_data->sections) && ! is_array($_data->sections)) {
281 281
 			$new_sections = array();
282
-			foreach ( $_data->sections as $key => $key ) {
283
-				$new_sections[ $key ] = $key;
282
+			foreach ($_data->sections as $key => $key) {
283
+				$new_sections[$key] = $key;
284 284
 			}
285 285
 
286 286
 			$_data->sections = $new_sections;
287 287
 		}
288 288
 
289 289
 		// Convert banners into an associative array, since we're getting an object, but Core expects an array.
290
-		if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
290
+		if (isset($_data->banners) && ! is_array($_data->banners)) {
291 291
 			$new_banners = array();
292
-			foreach ( $_data->banners as $key => $key ) {
293
-				$new_banners[ $key ] = $key;
292
+			foreach ($_data->banners as $key => $key) {
293
+				$new_banners[$key] = $key;
294 294
 			}
295 295
 
296 296
 			$_data->banners = $new_banners;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	 * @param string  $url
307 307
 	 * @return object $array
308 308
 	 */
309
-	public function http_request_args( $args, $url ) {
309
+	public function http_request_args($args, $url) {
310 310
 		// If it is an https request and we are performing a package download, disable ssl verification
311
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
311
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
312 312
 			$args['sslverify'] = false;
313 313
 		}
314 314
 		return $args;
@@ -325,50 +325,50 @@  discard block
 block discarded – undo
325 325
 	 * @param array   $_data   Parameters for the API action.
326 326
 	 * @return false|object
327 327
 	 */
328
-	private function api_request( $_action, $_data ) {
328
+	private function api_request($_action, $_data) {
329 329
 
330 330
 		global $wp_version;
331 331
 
332
-		$data = array_merge( $this->api_data, $_data );
332
+		$data = array_merge($this->api_data, $_data);
333 333
 
334
-		if ( $data['slug'] != $this->slug ) {
334
+		if ($data['slug'] != $this->slug) {
335 335
 			return;
336 336
 		}
337 337
 
338
-		if( $this->api_url == trailingslashit (home_url() ) ) {
338
+		if ($this->api_url == trailingslashit(home_url())) {
339 339
 			return false; // Don't allow a plugin to ping itself
340 340
 		}
341 341
 
342 342
 		$api_params = array(
343 343
 			'edd_action' => 'get_version',
344
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
345
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
346
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
347
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
344
+			'license'    => ! empty($data['license']) ? $data['license'] : '',
345
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
346
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
347
+			'version'    => isset($data['version']) ? $data['version'] : false,
348 348
 			'slug'       => $data['slug'],
349 349
 			'author'     => $data['author'],
350 350
 			'url'        => home_url(),
351
-			'beta'       => ! empty( $data['beta'] ),
351
+			'beta'       => ! empty($data['beta']),
352 352
 		);
353 353
 
354
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
354
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
355 355
 
356
-		if ( ! is_wp_error( $request ) ) {
357
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
356
+		if ( ! is_wp_error($request)) {
357
+			$request = json_decode(wp_remote_retrieve_body($request));
358 358
 		}
359 359
 
360
-		if ( $request && isset( $request->sections ) ) {
361
-			$request->sections = maybe_unserialize( $request->sections );
360
+		if ($request && isset($request->sections)) {
361
+			$request->sections = maybe_unserialize($request->sections);
362 362
 		} else {
363 363
 			$request = false;
364 364
 		}
365 365
 
366
-		if ( $request && isset( $request->banners ) ) {
367
-			$request->banners = maybe_unserialize( $request->banners );
366
+		if ($request && isset($request->banners)) {
367
+			$request->banners = maybe_unserialize($request->banners);
368 368
 		}
369 369
 
370
-		if( ! empty( $request->sections ) ) {
371
-			foreach( $request->sections as $key => $section ) {
370
+		if ( ! empty($request->sections)) {
371
+			foreach ($request->sections as $key => $section) {
372 372
 				$request->$key = (array) $section;
373 373
 			}
374 374
 		}
@@ -380,97 +380,97 @@  discard block
 block discarded – undo
380 380
 
381 381
 		global $edd_plugin_data;
382 382
 
383
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
383
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
384 384
 			return;
385 385
 		}
386 386
 
387
-		if( empty( $_REQUEST['plugin'] ) ) {
387
+		if (empty($_REQUEST['plugin'])) {
388 388
 			return;
389 389
 		}
390 390
 
391
-		if( empty( $_REQUEST['slug'] ) ) {
391
+		if (empty($_REQUEST['slug'])) {
392 392
 			return;
393 393
 		}
394 394
 
395
-		if( ! current_user_can( 'update_plugins' ) ) {
396
-			wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
395
+		if ( ! current_user_can('update_plugins')) {
396
+			wp_die(__('You do not have permission to install plugin updates', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
397 397
 		}
398 398
 
399
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
400
-		$beta         = ! empty( $data['beta'] ) ? true : false;
401
-		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
402
-		$version_info = $this->get_cached_version_info( $cache_key );
399
+		$data         = $edd_plugin_data[$_REQUEST['slug']];
400
+		$beta         = ! empty($data['beta']) ? true : false;
401
+		$cache_key    = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info');
402
+		$version_info = $this->get_cached_version_info($cache_key);
403 403
 
404
-		if( false === $version_info ) {
404
+		if (false === $version_info) {
405 405
 
406 406
 			$api_params = array(
407 407
 				'edd_action' => 'get_version',
408
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
409
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
408
+				'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
409
+				'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
410 410
 				'slug'       => $_REQUEST['slug'],
411 411
 				'author'     => $data['author'],
412 412
 				'url'        => home_url(),
413
-				'beta'       => ! empty( $data['beta'] )
413
+				'beta'       => ! empty($data['beta'])
414 414
 			);
415 415
 
416
-			$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
416
+			$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
417 417
 
418
-			if ( ! is_wp_error( $request ) ) {
419
-				$version_info = json_decode( wp_remote_retrieve_body( $request ) );
418
+			if ( ! is_wp_error($request)) {
419
+				$version_info = json_decode(wp_remote_retrieve_body($request));
420 420
 			}
421 421
 
422 422
 
423
-			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
424
-				$version_info->sections = maybe_unserialize( $version_info->sections );
423
+			if ( ! empty($version_info) && isset($version_info->sections)) {
424
+				$version_info->sections = maybe_unserialize($version_info->sections);
425 425
 			} else {
426 426
 				$version_info = false;
427 427
 			}
428 428
 
429
-			if( ! empty( $version_info ) ) {
430
-				foreach( $version_info->sections as $key => $section ) {
429
+			if ( ! empty($version_info)) {
430
+				foreach ($version_info->sections as $key => $section) {
431 431
 					$version_info->$key = (array) $section;
432 432
 				}
433 433
 			}
434 434
 
435
-			$this->set_version_info_cache( $version_info, $cache_key );
435
+			$this->set_version_info_cache($version_info, $cache_key);
436 436
 
437 437
 		}
438 438
 
439
-		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
440
-			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
439
+		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) {
440
+			echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>';
441 441
 		}
442 442
 
443 443
 		exit;
444 444
 	}
445 445
 
446
-	public function get_cached_version_info( $cache_key = '' ) {
446
+	public function get_cached_version_info($cache_key = '') {
447 447
 
448
-		if( empty( $cache_key ) ) {
448
+		if (empty($cache_key)) {
449 449
 			$cache_key = $this->cache_key;
450 450
 		}
451 451
 
452
-		$cache = get_option( $cache_key );
452
+		$cache = get_option($cache_key);
453 453
 
454
-		if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
454
+		if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) {
455 455
 			return false; // Cache is expired
456 456
 		}
457 457
 
458
-		return json_decode( $cache['value'] );
458
+		return json_decode($cache['value']);
459 459
 
460 460
 	}
461 461
 
462
-	public function set_version_info_cache( $value = '', $cache_key = '' ) {
462
+	public function set_version_info_cache($value = '', $cache_key = '') {
463 463
 
464
-		if( empty( $cache_key ) ) {
464
+		if (empty($cache_key)) {
465 465
 			$cache_key = $this->cache_key;
466 466
 		}
467 467
 
468 468
 		$data = array(
469
-			'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
470
-			'value'   => json_encode( $value )
469
+			'timeout' => strtotime('+3 hours', current_time('timestamp')),
470
+			'value'   => json_encode($value)
471 471
 		);
472 472
 
473
-		update_option( $cache_key, $data );
473
+		update_option($cache_key, $data);
474 474
 
475 475
 	}
476 476
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined( 'ABSPATH' ) ) {
5
+	exit;
6
+}
5 7
 
6 8
 /**
7 9
  * Allows plugins to use their own update API.
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-license.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_License' ) ) :
16
+if ( ! class_exists('Give_Settings_License')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_License.
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'licenses';
46
-			$this->label = esc_html__( 'Licenses', 'give' );
46
+			$this->label = esc_html__('Licenses', 'give');
47 47
 
48
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-settings_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( "give-settings_save_{$this->id}", array( $this, 'save' ) );
48
+			add_filter('give-settings_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-settings_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action("give-settings_save_{$this->id}", array($this, 'save'));
51 51
 		}
52 52
 
53 53
 		/**
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 		 * @param  array $pages Lst of pages.
58 58
 		 * @return array
59 59
 		 */
60
-		public function add_settings_page( $pages ) {
60
+		public function add_settings_page($pages) {
61 61
 			$setting = $this->get_settings();
62 62
 			// Bailout: Do not add licenses setting tab if it does not contain any setting fields.
63
-			if( ! empty( $setting ) ) {
64
-				$pages[ $this->id ] = $this->label;
63
+			if ( ! empty($setting)) {
64
+				$pages[$this->id] = $this->label;
65 65
 			}
66 66
 
67 67
 			return $pages;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			 * Filter the licenses settings.
81 81
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
82 82
 			 */
83
-			$settings = apply_filters( 'give_settings_licenses', $settings );
83
+			$settings = apply_filters('give_settings_licenses', $settings);
84 84
 
85 85
 			/**
86 86
 			 * Filter the settings.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			 * @since  1.8
89 89
 			 * @param  array $settings
90 90
 			 */
91
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
91
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
92 92
 
93 93
 			// Output.
94 94
 			return $settings;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		public function output() {
104 104
 			$settings = $this->get_settings();
105 105
 
106
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
106
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
107 107
 		}
108 108
 
109 109
 		/**
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 			$settings        = $this->get_settings();
117 117
 			$current_section = give_get_current_setting_section();
118 118
 
119
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
119
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
120 120
 
121 121
 			/**
122 122
 			 * Trigger Action
123 123
 			 *
124 124
 			 * @since 1.8
125 125
 			 */
126
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
126
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
127 127
 		}
128 128
 	}
129 129
 
Please login to merge, or discard this patch.
includes/process-donation.php 1 patch
Spacing   +239 added lines, -239 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_purchase_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array      $_POST      Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_purchase_form_user( $valid_data );
58
+	$user = give_get_purchase_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
103
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
103
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
104 104
 
105 105
 	// Setup donation information
106 106
 	$purchase_data = array(
107 107
 		'price'        => $price,
108 108
 		'purchase_key' => $purchase_key,
109 109
 		'user_email'   => $user['user_email'],
110
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
111
-		'user_info'    => stripslashes_deep( $user_info ),
110
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
111
+		'user_info'    => stripslashes_deep($user_info),
112 112
 		'post_data'    => $_POST,
113 113
 		'gateway'      => $valid_data['gateway'],
114 114
 		'card_info'    => $valid_data['cc_info'],
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param array      $user_info  Array containing basic user information.
129 129
 	 * @param bool|array $valid_data Validate fields.
130 130
 	 */
131
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
131
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
132 132
 
133 133
 	// Sanity check for price
134
-	if ( ! $purchase_data['price'] ) {
134
+	if ( ! $purchase_data['price']) {
135 135
 		// Revert to manual
136 136
 		$purchase_data['gateway'] = 'manual';
137 137
 		$_POST['give-gateway']    = 'manual';
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @since 1.7
144 144
 	 */
145
-	$purchase_data = apply_filters( 'give_donation_data_before_gateway', $purchase_data, $valid_data );
145
+	$purchase_data = apply_filters('give_donation_data_before_gateway', $purchase_data, $valid_data);
146 146
 
147 147
 	// Setup the data we're storing in the donation session
148 148
 	$session_data = $purchase_data;
149 149
 
150 150
 	// Make sure credit card numbers are never stored in sessions
151
-	unset( $session_data['card_info']['card_number'] );
152
-	unset( $session_data['post_data']['card_number'] );
151
+	unset($session_data['card_info']['card_number']);
152
+	unset($session_data['post_data']['card_number']);
153 153
 
154 154
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
155
-	give_set_purchase_session( $session_data );
155
+	give_set_purchase_session($session_data);
156 156
 
157 157
 	// Send info to the gateway for payment processing
158
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
158
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
159 159
 	give_die();
160 160
 
161 161
 }
162 162
 
163
-add_action( 'give_purchase', 'give_process_donation_form' );
164
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
165
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
163
+add_action('give_purchase', 'give_process_donation_form');
164
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
165
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
166 166
 
167 167
 
168 168
 /**
@@ -175,26 +175,26 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_checkout_check_existing_email( $valid_data, $post ) {
178
+function give_checkout_check_existing_email($valid_data, $post) {
179 179
 
180 180
 	// Verify that the email address belongs to this customer.
181
-	if ( is_user_logged_in() ) {
181
+	if (is_user_logged_in()) {
182 182
 
183 183
 		$email    = $valid_data['logged_in_user']['user_email'];
184
-		$customer = new Give_Customer( get_current_user_id(), true );
184
+		$customer = new Give_Customer(get_current_user_id(), true);
185 185
 
186 186
 		// If this email address is not registered with this customer, see if it belongs to any other customer
187
-		if ( $email !== $customer->email && ( is_array( $customer->emails ) && ! in_array( $email, $customer->emails ) ) ) {
188
-			$found_customer = new Give_Customer( $email );
187
+		if ($email !== $customer->email && (is_array($customer->emails) && ! in_array($email, $customer->emails))) {
188
+			$found_customer = new Give_Customer($email);
189 189
 
190
-			if ( $found_customer->id > 0 ) {
191
-				give_set_error( 'give-customer-email-exists', sprintf( esc_html__( 'The email address %s is already in use.', 'give' ), $email ) );
190
+			if ($found_customer->id > 0) {
191
+				give_set_error('give-customer-email-exists', sprintf(esc_html__('The email address %s is already in use.', 'give'), $email));
192 192
 			}
193 193
 		}
194 194
 	}
195 195
 }
196 196
 
197
-add_action( 'give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2 );
197
+add_action('give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2);
198 198
 
199 199
 /**
200 200
  * Process the checkout login form
@@ -205,37 +205,37 @@  discard block
 block discarded – undo
205 205
  */
206 206
 function give_process_form_login() {
207 207
 
208
-	$is_ajax = isset( $_POST['give_ajax'] );
208
+	$is_ajax = isset($_POST['give_ajax']);
209 209
 
210 210
 	$user_data = give_purchase_form_validate_user_login();
211 211
 
212
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
213
-		if ( $is_ajax ) {
212
+	if (give_get_errors() || $user_data['user_id'] < 1) {
213
+		if ($is_ajax) {
214 214
 			/**
215 215
 			 * Fires when AJAX sends back errors from the donation form.
216 216
 			 *
217 217
 			 * @since 1.0
218 218
 			 */
219
-			do_action( 'give_ajax_donation_errors' );
219
+			do_action('give_ajax_donation_errors');
220 220
 			give_die();
221 221
 		} else {
222
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
222
+			wp_redirect($_SERVER['HTTP_REFERER']);
223 223
 			exit;
224 224
 		}
225 225
 	}
226 226
 
227
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
227
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
228 228
 
229
-	if ( $is_ajax ) {
229
+	if ($is_ajax) {
230 230
 		echo 'success';
231 231
 		give_die();
232 232
 	} else {
233
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
233
+		wp_redirect($_SERVER['HTTP_REFERER']);
234 234
 	}
235 235
 }
236 236
 
237
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
238
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
237
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
238
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
239 239
 
240 240
 /**
241 241
  * Donation Form Validate Fields
@@ -247,55 +247,55 @@  discard block
 block discarded – undo
247 247
 function give_purchase_form_validate_fields() {
248 248
 
249 249
 	// Check if there is $_POST
250
-	if ( empty( $_POST ) ) {
250
+	if (empty($_POST)) {
251 251
 		return false;
252 252
 	}
253 253
 
254
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
254
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
255 255
 
256 256
 	// Start an array to collect valid data
257 257
 	$valid_data = array(
258 258
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
259
-		'need_new_user'    => false,     // New user flag
260
-		'need_user_login'  => false,     // Login user flag
261
-		'logged_user_data' => array(),   // Logged user collected data
262
-		'new_user_data'    => array(),   // New user collected data
263
-		'login_user_data'  => array(),   // Login user collected data
264
-		'guest_user_data'  => array(),   // Guest user collected data
265
-		'cc_info'          => give_purchase_form_validate_cc(),// Credit card info
259
+		'need_new_user'    => false, // New user flag
260
+		'need_user_login'  => false, // Login user flag
261
+		'logged_user_data' => array(), // Logged user collected data
262
+		'new_user_data'    => array(), // New user collected data
263
+		'login_user_data'  => array(), // Login user collected data
264
+		'guest_user_data'  => array(), // Guest user collected data
265
+		'cc_info'          => give_purchase_form_validate_cc(), // Credit card info
266 266
 	);
267 267
 
268 268
 	// Validate Honeypot First
269
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
270
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
269
+	if ( ! empty($_POST['give-honeypot'])) {
270
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
271 271
 	}
272 272
 
273 273
 	// Validate agree to terms
274
-	if ( give_is_terms_enabled( $form_id ) ) {
274
+	if (give_is_terms_enabled($form_id)) {
275 275
 		give_purchase_form_validate_agree_to_terms();
276 276
 	}
277 277
 
278 278
 	// Stop processing donor registration, if donor registration is optional and donor can do guest checkout.
279 279
 	// If registration form username field is empty that means donor do not want to registration instead want guest checkout.
280 280
 	if (
281
-		! give_logged_in_only( $form_id )
282
-		&& isset( $_POST['give-purchase-var'] )
281
+		! give_logged_in_only($form_id)
282
+		&& isset($_POST['give-purchase-var'])
283 283
 		&& $_POST['give-purchase-var'] == 'needs-to-register'
284
-		&& empty( $_POST['give_user_login'] )
284
+		&& empty($_POST['give_user_login'])
285 285
 	) {
286
-		unset( $_POST['give-purchase-var'] );
286
+		unset($_POST['give-purchase-var']);
287 287
 	}
288 288
 
289
-	if ( is_user_logged_in() ) {
289
+	if (is_user_logged_in()) {
290 290
 		// Collect logged in user data
291 291
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
292
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
292
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
293 293
 		// Set new user registration as required
294 294
 		$valid_data['need_new_user'] = true;
295 295
 		// Validate new user data
296 296
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
297 297
 		// Check if login validation is needed
298
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
298
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
299 299
 		// Set user login as required
300 300
 		$valid_data['need_user_login'] = true;
301 301
 		// Validate users login info
@@ -320,41 +320,41 @@  discard block
 block discarded – undo
320 320
  */
321 321
 function give_purchase_form_validate_gateway() {
322 322
 
323
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
324
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
325
-	$gateway = give_get_default_gateway( $form_id );
323
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
324
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
325
+	$gateway = give_get_default_gateway($form_id);
326 326
 
327 327
 	// Check if a gateway value is present
328
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
328
+	if ( ! empty($_REQUEST['give-gateway'])) {
329 329
 
330
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
330
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
331 331
 
332 332
 		// Is amount being donated in LIVE mode 0.00? If so, error:
333
-		if ( $amount == 0 && ! give_is_test_mode() ) {
333
+		if ($amount == 0 && ! give_is_test_mode()) {
334 334
 
335
-			give_set_error( 'invalid_donation_amount', esc_html__( 'Please insert a valid donation amount.', 'give' ) );
335
+			give_set_error('invalid_donation_amount', esc_html__('Please insert a valid donation amount.', 'give'));
336 336
 
337 337
 		} //Check for a minimum custom amount
338
-		elseif ( ! give_verify_minimum_price() ) {
338
+		elseif ( ! give_verify_minimum_price()) {
339 339
 			// translators: %s: minimum donation amount.
340 340
 			give_set_error(
341 341
 				'invalid_donation_minimum',
342 342
 				sprintf(
343 343
 					/* translators: %s: minimum donation amount */
344
-					esc_html__( 'This form has a minimum donation amount of %s.', 'give' ),
345
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
344
+					esc_html__('This form has a minimum donation amount of %s.', 'give'),
345
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
346 346
 				)
347 347
 			);
348 348
 
349 349
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
350
-		elseif ( $amount == 0 && give_is_test_mode() ) {
350
+		elseif ($amount == 0 && give_is_test_mode()) {
351 351
 
352 352
 			$gateway = 'manual';
353 353
 
354 354
 		} //Check if this gateway is active.
355
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
355
+		elseif ( ! give_is_gateway_active($gateway)) {
356 356
 
357
-			give_set_error( 'invalid_gateway', esc_html__( 'The selected payment gateway is not enabled.', 'give' ) );
357
+			give_set_error('invalid_gateway', esc_html__('The selected payment gateway is not enabled.', 'give'));
358 358
 
359 359
 		}
360 360
 	}
@@ -372,23 +372,23 @@  discard block
 block discarded – undo
372 372
  */
373 373
 function give_verify_minimum_price() {
374 374
 
375
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
376
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
377
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
378
-	$variable_prices = give_has_variable_prices( $form_id );
375
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
376
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
377
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
378
+	$variable_prices = give_has_variable_prices($form_id);
379 379
 
380
-	if ( $variable_prices && ! empty( $price_id ) ) {
380
+	if ($variable_prices && ! empty($price_id)) {
381 381
 
382
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
382
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
383 383
 
384
-		if ( $price_level_amount == $amount ) {
384
+		if ($price_level_amount == $amount) {
385 385
 			return true;
386 386
 		}
387 387
 	}
388 388
 
389
-	$minimum = give_get_form_minimum_price( $form_id );
389
+	$minimum = give_get_form_minimum_price($form_id);
390 390
 
391
-	if ( $minimum > $amount ) {
391
+	if ($minimum > $amount) {
392 392
 		return false;
393 393
 	}
394 394
 
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
  */
405 405
 function give_purchase_form_validate_agree_to_terms() {
406 406
 	// Validate agree to terms.
407
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
407
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
408 408
 		// User did not agree.
409
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', esc_html__( 'You must agree to the terms and conditions.', 'give' ) ) );
409
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', esc_html__('You must agree to the terms and conditions.', 'give')));
410 410
 	}
411 411
 }
412 412
 
@@ -420,43 +420,43 @@  discard block
 block discarded – undo
420 420
  *
421 421
  * @return      array
422 422
  */
423
-function give_get_required_fields( $form_id ) {
423
+function give_get_required_fields($form_id) {
424 424
 
425
-	$payment_mode = give_get_chosen_gateway( $form_id );
425
+	$payment_mode = give_get_chosen_gateway($form_id);
426 426
 
427 427
 	$required_fields = array(
428 428
 		'give_email' => array(
429 429
 			'error_id'      => 'invalid_email',
430
-			'error_message' => esc_html__( 'Please enter a valid email address.', 'give' ),
430
+			'error_message' => esc_html__('Please enter a valid email address.', 'give'),
431 431
 		),
432 432
 		'give_first' => array(
433 433
 			'error_id'      => 'invalid_first_name',
434
-			'error_message' => esc_html__( 'Please enter your first name.', 'give' ),
434
+			'error_message' => esc_html__('Please enter your first name.', 'give'),
435 435
 		),
436 436
 	);
437 437
 
438
-	$require_address = give_require_billing_address( $payment_mode );
438
+	$require_address = give_require_billing_address($payment_mode);
439 439
 
440
-	if ( $require_address ) {
441
-		$required_fields['card_address']    = array(
440
+	if ($require_address) {
441
+		$required_fields['card_address'] = array(
442 442
 			'error_id'      => 'invalid_card_address',
443
-			'error_message' => esc_html__( 'Please enter your primary billing address.', 'give' ),
443
+			'error_message' => esc_html__('Please enter your primary billing address.', 'give'),
444 444
 		);
445
-		$required_fields['card_zip']        = array(
445
+		$required_fields['card_zip'] = array(
446 446
 			'error_id'      => 'invalid_zip_code',
447
-			'error_message' => esc_html__( 'Please enter your zip / postal code.', 'give' ),
447
+			'error_message' => esc_html__('Please enter your zip / postal code.', 'give'),
448 448
 		);
449
-		$required_fields['card_city']       = array(
449
+		$required_fields['card_city'] = array(
450 450
 			'error_id'      => 'invalid_city',
451
-			'error_message' => esc_html__( 'Please enter your billing city.', 'give' ),
451
+			'error_message' => esc_html__('Please enter your billing city.', 'give'),
452 452
 		);
453 453
 		$required_fields['billing_country'] = array(
454 454
 			'error_id'      => 'invalid_country',
455
-			'error_message' => esc_html__( 'Please select your billing country.', 'give' ),
455
+			'error_message' => esc_html__('Please select your billing country.', 'give'),
456 456
 		);
457
-		$required_fields['card_state']      = array(
457
+		$required_fields['card_state'] = array(
458 458
 			'error_id'      => 'invalid_state',
459
-			'error_message' => esc_html__( 'Please enter billing state / province.', 'give' ),
459
+			'error_message' => esc_html__('Please enter billing state / province.', 'give'),
460 460
 		);
461 461
 	}
462 462
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 *
466 466
 	 * @since 1.7
467 467
 	 */
468
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
468
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
469 469
 
470 470
 	return $required_fields;
471 471
 
@@ -480,16 +480,16 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @return mixed|void
482 482
  */
483
-function give_require_billing_address( $payment_mode ) {
483
+function give_require_billing_address($payment_mode) {
484 484
 
485 485
 	$return = false;
486 486
 
487
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
487
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
488 488
 		$return = true;
489 489
 	}
490 490
 
491 491
 	// Let payment gateways and other extensions determine if address fields should be required.
492
-	return apply_filters( 'give_require_billing_address', $return );
492
+	return apply_filters('give_require_billing_address', $return);
493 493
 
494 494
 }
495 495
 
@@ -503,42 +503,42 @@  discard block
 block discarded – undo
503 503
 function give_purchase_form_validate_logged_in_user() {
504 504
 	global $user_ID;
505 505
 
506
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
506
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
507 507
 
508 508
 	// Start empty array to collect valid user data.
509 509
 	$valid_user_data = array(
510 510
 		// Assume there will be errors.
511
-		'user_id' => - 1,
511
+		'user_id' => -1,
512 512
 	);
513 513
 
514 514
 	// Verify there is a user_ID.
515
-	if ( $user_ID > 0 ) {
515
+	if ($user_ID > 0) {
516 516
 		// Get the logged in user data.
517
-		$user_data = get_userdata( $user_ID );
517
+		$user_data = get_userdata($user_ID);
518 518
 
519 519
 		// Loop through required fields and show error messages.
520
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
521
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
522
-				give_set_error( $value['error_id'], $value['error_message'] );
520
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
521
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
522
+				give_set_error($value['error_id'], $value['error_message']);
523 523
 			}
524 524
 		}
525 525
 
526 526
 		// Verify data.
527
-		if ( $user_data ) {
527
+		if ($user_data) {
528 528
 			// Collected logged in user data.
529 529
 			$valid_user_data = array(
530 530
 				'user_id'    => $user_ID,
531
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
532
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
533
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
531
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
532
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
533
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
534 534
 			);
535 535
 
536
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
537
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
536
+			if ( ! is_email($valid_user_data['user_email'])) {
537
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
538 538
 			}
539 539
 		} else {
540 540
 			// Set invalid user error.
541
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
541
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
542 542
 		}
543 543
 	}
544 544
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	// Default user data.
558 558
 	$default_user_data = array(
559 559
 		'give-form-id'           => '',
560
-		'user_id'                => - 1, // Assume there will be errors.
560
+		'user_id'                => -1, // Assume there will be errors.
561 561
 		'user_first'             => '',
562 562
 		'user_last'              => '',
563 563
 		'give_user_login'        => false,
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
 	);
568 568
 
569 569
 	// Get user data.
570
-	$user_data            = wp_parse_args( array_map( 'trim', give_clean( $_POST ) ), $default_user_data );
570
+	$user_data            = wp_parse_args(array_map('trim', give_clean($_POST)), $default_user_data);
571 571
 	$registering_new_user = false;
572
-	$form_id              = absint( $user_data['give-form-id'] );
572
+	$form_id              = absint($user_data['give-form-id']);
573 573
 
574 574
 	// Start an empty array to collect valid user data.
575 575
 	$valid_user_data = array(
576 576
 		// Assume there will be errors.
577
-		'user_id'    => - 1,
577
+		'user_id'    => -1,
578 578
 
579 579
 		// Get first name.
580 580
 		'user_first' => $user_data['give_first'],
@@ -584,25 +584,25 @@  discard block
 block discarded – undo
584 584
 	);
585 585
 
586 586
 	// Loop through required fields and show error messages.
587
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
588
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
589
-			give_set_error( $value['error_id'], $value['error_message'] );
587
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
588
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
589
+			give_set_error($value['error_id'], $value['error_message']);
590 590
 		}
591 591
 	}
592 592
 
593 593
 	// Check if we have an username to register.
594
-	if ( give_validate_username( $user_data['give_user_login'] ) ) {
594
+	if (give_validate_username($user_data['give_user_login'])) {
595 595
 		$registering_new_user          = true;
596 596
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
597 597
 	}
598 598
 
599 599
 	// Check if we have an email to verify.
600
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
600
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
601 601
 		$valid_user_data['user_email'] = $user_data['give_email'];
602 602
 	}
603 603
 
604 604
 	// Check password.
605
-	if ( give_validate_user_password( $user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user ) ) {
605
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
606 606
 		// All is good to go.
607 607
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
608 608
 	}
@@ -622,36 +622,36 @@  discard block
 block discarded – undo
622 622
 	// Start an array to collect valid user data.
623 623
 	$valid_user_data = array(
624 624
 		// Assume there will be errors
625
-		'user_id' => - 1,
625
+		'user_id' => -1,
626 626
 	);
627 627
 
628 628
 	// Username.
629
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
630
-		give_set_error( 'must_log_in', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
629
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
630
+		give_set_error('must_log_in', esc_html__('You must register or login to complete your donation.', 'give'));
631 631
 
632 632
 		return $valid_user_data;
633 633
 	}
634 634
 
635 635
 	// Get the user by login.
636
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
636
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
637 637
 
638 638
 	// Check if user exists.
639
-	if ( $user_data ) {
639
+	if ($user_data) {
640 640
 		// Get password.
641
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
641
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
642 642
 
643 643
 		// Check user_pass.
644
-		if ( $user_pass ) {
644
+		if ($user_pass) {
645 645
 			// Check if password is valid.
646
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
646
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
647 647
 				// Incorrect password.
648 648
 				give_set_error(
649 649
 					'password_incorrect',
650 650
 					sprintf(
651 651
 						'%1$s <a href="%2$s">%3$s</a>',
652
-						esc_html__( 'The password you entered is incorrect.', 'give' ),
653
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
654
-						esc_html__( 'Reset Password', 'give' )
652
+						esc_html__('The password you entered is incorrect.', 'give'),
653
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
654
+						esc_html__('Reset Password', 'give')
655 655
 					)
656 656
 				);
657 657
 				// All is correct.
@@ -668,11 +668,11 @@  discard block
 block discarded – undo
668 668
 			}
669 669
 		} else {
670 670
 			// Empty password.
671
-			give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) );
671
+			give_set_error('password_empty', esc_html__('Enter a password.', 'give'));
672 672
 		}
673 673
 	} else {
674 674
 		// No username.
675
-		give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
675
+		give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
676 676
 	}
677 677
 
678 678
 	return $valid_user_data;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
  */
688 688
 function give_purchase_form_validate_guest_user() {
689 689
 
690
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
690
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
691 691
 
692 692
 	// Start an array to collect valid user data.
693 693
 	$valid_user_data = array(
@@ -696,38 +696,38 @@  discard block
 block discarded – undo
696 696
 	);
697 697
 
698 698
 	// Show error message if user must be logged in.
699
-	if ( give_logged_in_only( $form_id ) ) {
700
-		give_set_error( 'logged_in_only', esc_html__( 'You must be logged in to donate.', 'give' ) );
699
+	if (give_logged_in_only($form_id)) {
700
+		give_set_error('logged_in_only', esc_html__('You must be logged in to donate.', 'give'));
701 701
 	}
702 702
 
703 703
 	// Get the guest email.
704
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
704
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
705 705
 
706 706
 	// Check email.
707
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
707
+	if ($guest_email && strlen($guest_email) > 0) {
708 708
 		// Validate email.
709
-		if ( ! is_email( $guest_email ) ) {
709
+		if ( ! is_email($guest_email)) {
710 710
 			// Invalid email.
711
-			give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
711
+			give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
712 712
 		} else {
713 713
 			// All is good to go.
714 714
 			$valid_user_data['user_email'] = $guest_email;
715 715
 
716 716
 			// Get user_id from donor if exist.
717
-			$donor = new Give_Customer( $guest_email );
718
-			if ( $donor->id && $donor->user_id ) {
717
+			$donor = new Give_Customer($guest_email);
718
+			if ($donor->id && $donor->user_id) {
719 719
 				$valid_user_data['user_id'] = $donor->user_id;
720 720
 			}
721 721
 		}
722 722
 	} else {
723 723
 		// No email.
724
-		give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) );
724
+		give_set_error('email_empty', esc_html__('Enter an email.', 'give'));
725 725
 	}
726 726
 
727 727
 	// Loop through required fields and show error messages.
728
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
729
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
730
-			give_set_error( $value['error_id'], $value['error_message'] );
728
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
729
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
730
+			give_set_error($value['error_id'], $value['error_message']);
731 731
 		}
732 732
 	}
733 733
 
@@ -743,36 +743,36 @@  discard block
 block discarded – undo
743 743
  * @since   1.0
744 744
  * @return  integer
745 745
  */
746
-function give_register_and_login_new_user( $user_data = array() ) {
746
+function give_register_and_login_new_user($user_data = array()) {
747 747
 	// Verify the array.
748
-	if ( empty( $user_data ) ) {
749
-		return - 1;
748
+	if (empty($user_data)) {
749
+		return -1;
750 750
 	}
751 751
 
752
-	if ( give_get_errors() ) {
753
-		return - 1;
752
+	if (give_get_errors()) {
753
+		return -1;
754 754
 	}
755 755
 
756
-	$user_args = apply_filters( 'give_insert_user_args', array(
757
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
758
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
759
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
760
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
761
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
762
-		'user_registered' => date( 'Y-m-d H:i:s' ),
763
-		'role'            => get_option( 'default_role' ),
764
-	), $user_data );
756
+	$user_args = apply_filters('give_insert_user_args', array(
757
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
758
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
759
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
760
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
761
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
762
+		'user_registered' => date('Y-m-d H:i:s'),
763
+		'role'            => get_option('default_role'),
764
+	), $user_data);
765 765
 
766 766
 	// Insert new user.
767
-	$user_id = wp_insert_user( $user_args );
767
+	$user_id = wp_insert_user($user_args);
768 768
 
769 769
 	// Validate inserted user.
770
-	if ( is_wp_error( $user_id ) ) {
771
-		return - 1;
770
+	if (is_wp_error($user_id)) {
771
+		return -1;
772 772
 	}
773 773
 
774 774
 	// Allow themes and plugins to filter the user data.
775
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
775
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
776 776
 
777 777
 	/**
778 778
 	 * Fires after inserting user.
@@ -782,10 +782,10 @@  discard block
 block discarded – undo
782 782
 	 * @param int   $user_id   User id.
783 783
 	 * @param array $user_data Array containing user data.
784 784
 	 */
785
-	do_action( 'give_insert_user', $user_id, $user_data );
785
+	do_action('give_insert_user', $user_id, $user_data);
786 786
 
787 787
 	// Login new user.
788
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
788
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
789 789
 
790 790
 	// Return user id.
791 791
 	return $user_id;
@@ -800,27 +800,27 @@  discard block
 block discarded – undo
800 800
  * @since   1.0
801 801
  * @return  array
802 802
  */
803
-function give_get_purchase_form_user( $valid_data = array() ) {
803
+function give_get_purchase_form_user($valid_data = array()) {
804 804
 
805 805
 	// Initialize user.
806 806
 	$user    = false;
807
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
807
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
808 808
 
809
-	if ( $is_ajax ) {
809
+	if ($is_ajax) {
810 810
 		// Do not create or login the user during the ajax submission (check for errors only).
811 811
 		return true;
812
-	} elseif ( is_user_logged_in() ) {
812
+	} elseif (is_user_logged_in()) {
813 813
 		// Set the valid user as the logged in collected data.
814 814
 		$user = $valid_data['logged_in_user'];
815
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
815
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
816 816
 		// New user registration.
817
-		if ( $valid_data['need_new_user'] === true ) {
817
+		if ($valid_data['need_new_user'] === true) {
818 818
 			// Set user.
819 819
 			$user = $valid_data['new_user_data'];
820 820
 			// Register and login new user.
821
-			$user['user_id'] = give_register_and_login_new_user( $user );
821
+			$user['user_id'] = give_register_and_login_new_user($user);
822 822
 			// User login
823
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
823
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
824 824
 
825 825
 			/*
826 826
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -833,48 +833,48 @@  discard block
 block discarded – undo
833 833
 			// Set user.
834 834
 			$user = $valid_data['login_user_data'];
835 835
 			// Login user.
836
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
836
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
837 837
 		}
838 838
 	}
839 839
 
840 840
 	// Check guest checkout.
841
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
841
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
842 842
 		// Set user
843 843
 		$user = $valid_data['guest_user_data'];
844 844
 	}
845 845
 
846 846
 	// Verify we have an user.
847
-	if ( false === $user || empty( $user ) ) {
847
+	if (false === $user || empty($user)) {
848 848
 		// Return false.
849 849
 		return false;
850 850
 	}
851 851
 
852 852
 	// Get user first name.
853
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
854
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
853
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
854
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
855 855
 	}
856 856
 
857 857
 	// Get user last name.
858
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
859
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
858
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
859
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
860 860
 	}
861 861
 
862 862
 	// Get the user's billing address details.
863 863
 	$user['address']            = array();
864
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
865
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
866
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
867
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
868
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
869
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
870
-
871
-	if ( empty( $user['address']['country'] ) ) {
864
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
865
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
866
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
867
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
868
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
869
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
870
+
871
+	if (empty($user['address']['country'])) {
872 872
 		$user['address'] = false;
873 873
 	} // Country will always be set if address fields are present.
874 874
 
875
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
875
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
876 876
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases.
877
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
877
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
878 878
 	}
879 879
 
880 880
 	// Return valid user.
@@ -893,16 +893,16 @@  discard block
 block discarded – undo
893 893
 	$card_data = give_get_purchase_cc_info();
894 894
 
895 895
 	// Validate the card zip.
896
-	if ( ! empty( $card_data['card_zip'] ) ) {
897
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
898
-			give_set_error( 'invalid_cc_zip', esc_html__( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
896
+	if ( ! empty($card_data['card_zip'])) {
897
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
898
+			give_set_error('invalid_cc_zip', esc_html__('The zip / postal code you entered for your billing address is invalid.', 'give'));
899 899
 		}
900 900
 	}
901 901
 
902 902
 	// Ensure no spaces.
903
-	if ( ! empty( $card_data['card_number'] ) ) {
904
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
905
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
903
+	if ( ! empty($card_data['card_number'])) {
904
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
905
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
906 906
 	}
907 907
 
908 908
 	// This should validate card numbers at some point too.
@@ -918,17 +918,17 @@  discard block
 block discarded – undo
918 918
  */
919 919
 function give_get_purchase_cc_info() {
920 920
 	$cc_info                   = array();
921
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
922
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
923
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
924
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
925
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
926
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
927
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
928
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
929
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
930
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
931
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
921
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
922
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
923
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
924
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
925
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
926
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
927
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
928
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
929
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
930
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
931
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
932 932
 
933 933
 	// Return cc info
934 934
 	return $cc_info;
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return bool|mixed|void
946 946
  */
947
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
947
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
948 948
 	$ret = false;
949 949
 
950
-	if ( empty( $zip ) || empty( $country_code ) ) {
950
+	if (empty($zip) || empty($country_code)) {
951 951
 		return $ret;
952 952
 	}
953 953
 
954
-	$country_code = strtoupper( $country_code );
954
+	$country_code = strtoupper($country_code);
955 955
 
956 956
 	$zip_regex = array(
957 957
 		'AD' => 'AD\d{3}',
@@ -1111,11 +1111,11 @@  discard block
 block discarded – undo
1111 1111
 		'ZM' => '\d{5}',
1112 1112
 	);
1113 1113
 
1114
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1114
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1115 1115
 		$ret = true;
1116 1116
 	}
1117 1117
 
1118
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1118
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1119 1119
 }
1120 1120
 
1121 1121
 
@@ -1129,36 +1129,36 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return bool
1131 1131
  */
1132
-function give_validate_multi_donation_form_level( $valid_data, $data ) {
1132
+function give_validate_multi_donation_form_level($valid_data, $data) {
1133 1133
 	/* @var Give_Donate_Form $form */
1134
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1134
+	$form = new Give_Donate_Form($data['give-form-id']);
1135 1135
 
1136 1136
 	$donation_level_matched = false;
1137 1137
 
1138
-	if ( $form->is_multi_type_donation_form() ) {
1138
+	if ($form->is_multi_type_donation_form()) {
1139 1139
 
1140 1140
 		// Bailout.
1141
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1141
+		if ( ! ($variable_prices = $form->get_prices())) {
1142 1142
 			return false;
1143 1143
 		}
1144 1144
 
1145 1145
 		// Sanitize donation amount.
1146
-		$data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1146
+		$data['give-amount'] = give_sanitize_amount($data['give-amount']);
1147 1147
 
1148 1148
 		// Get number of decimals.
1149 1149
 		$default_decimals = give_get_price_decimals();
1150 1150
 
1151
-		if ( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ) {
1151
+		if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) {
1152 1152
 			return true;
1153 1153
 		}
1154 1154
 
1155 1155
 		// Find correct donation level from all donation levels.
1156
-		foreach ( $variable_prices as $variable_price ) {
1156
+		foreach ($variable_prices as $variable_price) {
1157 1157
 			// Sanitize level amount.
1158
-			$variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1158
+			$variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals);
1159 1159
 
1160 1160
 			// Set first match donation level ID.
1161
-			if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1161
+			if ($data['give-amount'] === $variable_price['_give_amount']) {
1162 1162
 				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1163 1163
 				$donation_level_matched = true;
1164 1164
 				break;
@@ -1169,19 +1169,19 @@  discard block
 block discarded – undo
1169 1169
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1170 1170
 		if (
1171 1171
 			! $donation_level_matched
1172
-			&& ( give_is_setting_enabled( get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) ) )
1172
+			&& (give_is_setting_enabled(get_post_meta($data['give-form-id'], '_give_custom_amount', true)))
1173 1173
 		) {
1174 1174
 			// Sanitize custom minimum amount.
1175
-			$custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1175
+			$custom_minimum_amount = give_sanitize_amount(get_post_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals);
1176 1176
 
1177
-			if ( $data['give-amount'] >= $custom_minimum_amount ) {
1177
+			if ($data['give-amount'] >= $custom_minimum_amount) {
1178 1178
 				$_POST['give-price-id'] = 'custom';
1179 1179
 				$donation_level_matched = true;
1180 1180
 			}
1181 1181
 		}
1182 1182
 	}
1183 1183
 
1184
-	return ( $donation_level_matched ? true : false );
1184
+	return ($donation_level_matched ? true : false);
1185 1185
 }
1186 1186
 
1187
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1187
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @since 1.0
21 21
  */
22
-class Give_Forms_Widget extends WP_Widget{
22
+class Give_Forms_Widget extends WP_Widget {
23 23
 	/**
24 24
 	 * The widget class name
25 25
 	 *
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * Instantiate the class
32 32
 	 */
33
-	public function __construct(){
34
-		$this->self = get_class( $this );
33
+	public function __construct() {
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			esc_html__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			esc_html__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook ){
55
+	public function admin_widget_scripts($hook) {
56 56
 		// Directories of assets
57
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
58
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
59
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
57
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
58
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
59
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
60 60
 
61 61
 		// Use minified libraries if SCRIPT_DEBUG is turned off
62
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
62
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
63 63
 
64 64
 		// Widget Script
65
-		if ( $hook == 'widgets.php' ) {
65
+		if ($hook == 'widgets.php') {
66 66
 
67
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
67
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
68 68
 
69
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
69
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
70 70
 
71
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
71
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
72 72
 		}
73 73
 	}
74 74
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 *                        before_widget, and after_widget.
80 80
 	 * @param array $instance The settings for the particular instance of the widget.
81 81
 	 */
82
-	public function widget( $args, $instance ){
83
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
84
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
82
+	public function widget($args, $instance) {
83
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
84
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
85 85
 
86 86
 		echo $args['before_widget'];
87 87
 
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 		 *
91 91
 		 * @since 1.0
92 92
 		 */
93
-		do_action( 'give_before_forms_widget' );
93
+		do_action('give_before_forms_widget');
94 94
 
95
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
95
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
96 96
 
97
-		give_get_donation_form( $instance );
97
+		give_get_donation_form($instance);
98 98
 
99 99
 		echo $args['after_widget'];
100 100
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 1.0
105 105
 		 */
106
-		do_action( 'give_after_forms_widget' );
106
+		do_action('give_after_forms_widget');
107 107
 	}
108 108
 
109 109
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string
115 115
 	 */
116
-	public function form( $instance ){
116
+	public function form($instance) {
117 117
 		$defaults = array(
118 118
 			'title'         => '',
119 119
 			'id'            => '',
@@ -123,84 +123,84 @@  discard block
 block discarded – undo
123 123
 			'continue_button_title' => '',
124 124
 		);
125 125
 
126
-		$instance = wp_parse_args( (array) $instance, $defaults );
126
+		$instance = wp_parse_args((array) $instance, $defaults);
127 127
 
128 128
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
129
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
129
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
130 130
 
131 131
 		// Query Give Forms
132 132
 		$args = array(
133 133
 			'post_type'      => 'give_forms',
134
-			'posts_per_page' => - 1,
134
+			'posts_per_page' => -1,
135 135
 			'post_status'    => 'publish',
136 136
 		);
137 137
 
138
-		$give_forms = get_posts( $args );
138
+		$give_forms = get_posts($args);
139 139
 		?>
140 140
 		<div class="give_forms_widget_container">
141 141
 
142 142
 			<?php // Widget: widget Title. ?>
143 143
 			<p>
144
-				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
145
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
146
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
144
+				<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
145
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
146
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
147 147
 			</p>
148 148
 
149 149
 			<?php // Widget: Give Form?>
150 150
 			<p>
151
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
152
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
153
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
154
-					<?php foreach ( $give_forms as $give_form ) { ?>
155
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
156
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option>
151
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
152
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
153
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
154
+					<?php foreach ($give_forms as $give_form) { ?>
155
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
156
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option>
157 157
 					<?php } ?>
158 158
 				</select><br>
159
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
159
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
160 160
 			</p>
161 161
 
162 162
 			<?php // Widget: Display Style ?>
163 163
 			<p class="give_forms_display_style_setting_row">
164
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
165
-				<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
166
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
167
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
168
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
164
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
165
+				<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
166
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
167
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
168
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
169 169
 				<small class="give-field-description">
170
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
170
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
171 171
 				</small>
172 172
 			</p>
173 173
 
174 174
 			<?php // Widget: Continue Button Title. ?>
175 175
 			<p class="give_forms_continue_button_title_setting_row">
176
-				<label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
177
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br>
178
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
176
+				<label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
177
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br>
178
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
179 179
 			</p>
180 180
 
181 181
 			<?php // Widget: Floating Labels ?>
182 182
 			<p>
183
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
184
-				<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
185
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
186
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
183
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
184
+				<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
185
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
186
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
187 187
 				<small class="give-field-description">
188 188
 					<?php
189 189
 					printf(
190 190
 					/* translators: %s: http://docs.givewp.com/form-floating-labels */
191
-						__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
192
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
191
+						__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
192
+						esc_url('http://docs.givewp.com/form-floating-labels')
193 193
 					);
194 194
 					?></small>
195 195
 			</p>
196 196
 
197 197
 			<?php // Widget: Display Content ?>
198 198
 			<p>
199
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
200
-				<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
201
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
202
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
203
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
199
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
200
+				<label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
201
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
202
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
203
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
204 204
 		</div>
205 205
 		<?php
206 206
 	}
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return void
212 212
 	 */
213
-	function widget_init(){
214
-		register_widget( $this->self );
213
+	function widget_init() {
214
+		register_widget($this->self);
215 215
 	}
216 216
 
217 217
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return array
224 224
 	 */
225
-	public function update( $new_instance, $old_instance ){
225
+	public function update($new_instance, $old_instance) {
226 226
 		$this->flush_widget_cache();
227 227
 
228 228
 		return $new_instance;
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return void
235 235
 	 */
236
-	public function flush_widget_cache(){
237
-		wp_cache_delete( $this->self, 'widget' );
236
+	public function flush_widget_cache() {
237
+		wp_cache_delete($this->self, 'widget');
238 238
 	}
239 239
 }
240 240
 
Please login to merge, or discard this patch.