Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/forms/template.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1221,9 +1221,9 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 	//Sanity check - ensure form has goal set to output
1223 1223
 	if ( empty( $form->ID )
1224
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1225
-	     || $goal_option !== 'yes'
1226
-	     || $goal == 0
1224
+		 || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1225
+		 || $goal_option !== 'yes'
1226
+		 || $goal == 0
1227 1227
 	) {
1228 1228
 		//not this form, bail
1229 1229
 		return false;
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		if ( $goal_format !== 'percentage' ) {
1246 1246
 
1247 1247
 			 // Get formatted amount.
1248
-            $income = give_human_format_large_amount( give_format_amount( $income ) );
1249
-            $goal = give_human_format_large_amount( give_format_amount( $goal ) );
1248
+			$income = give_human_format_large_amount( give_format_amount( $income ) );
1249
+			$goal = give_human_format_large_amount( give_format_amount( $goal ) );
1250 1250
 
1251 1251
 			$output .= sprintf(
1252 1252
 				/* translators: 1: amount of income raised 2: goal target ammount */
Please login to merge, or discard this patch.
Spacing   +407 added lines, -407 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,64 +23,64 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_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 = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(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
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? ' float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
80
+		'give-form-'.$form->ID,
81 81
 		$float_labels_option
82
-	), $form->ID, $args );
83
-	$form_classes       = implode( ' ', $form_classes_array );
82
+	), $form->ID, $args);
83
+	$form_classes = implode(' ', $form_classes_array);
84 84
 
85 85
 
86 86
 	ob_start();
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 * @param int $form ->ID The current form ID
94 94
 	 * @param array $args An array of form args
95 95
 	 */
96
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
96
+	do_action('give_pre_form_output', $form->ID, $args); ?>
97 97
 
98 98
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
99 99
 
100
-		<?php if ( $form->is_close_donation_form() ) {
100
+		<?php if ($form->is_close_donation_form()) {
101 101
 
102 102
 			//Get Goal thank you message.
103
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
104
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
103
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
104
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our fundraising goal.', 'give');
105 105
 
106 106
 			//Print thank you message.
107
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
107
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
108 108
 
109 109
 		} else {
110 110
 
111
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
111
+			if (isset($args['show_title']) && $args['show_title'] == true) {
112 112
 
113
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
113
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
114 114
 
115 115
 			}
116 116
 
117
-			do_action( 'give_pre_form', $form->ID, $args ); ?>
117
+			do_action('give_pre_form', $form->ID, $args); ?>
118 118
 
119 119
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
120 120
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
121
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
122
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
123
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
124
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
121
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
122
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
123
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
124
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
125 125
 
126 126
 				<!-- The following field is for robots only, invisible to humans: -->
127 127
 				<span class="give-hidden" style="display: none !important;">
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 				<?php
133 133
 
134 134
 				//Price ID hidden field for variable (mult-level) donation forms
135
-				if ( give_has_variable_prices( $form_id ) ) {
135
+				if (give_has_variable_prices($form_id)) {
136 136
 					//get default selected price ID
137
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
137
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
138 138
 					$price_id = 0;
139 139
 					//loop through prices
140
-					foreach ( $prices as $price ) {
141
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
140
+					foreach ($prices as $price) {
141
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
142 142
 							$price_id = $price['_give_id']['level_id'];
143 143
 						};
144 144
 					}
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
147 147
 				<?php }
148 148
 
149
-				do_action( 'give_checkout_form_top', $form->ID, $args );
149
+				do_action('give_checkout_form_top', $form->ID, $args);
150 150
 
151
-				do_action( 'give_payment_mode_select', $form->ID, $args );
151
+				do_action('give_payment_mode_select', $form->ID, $args);
152 152
 
153
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
153
+				do_action('give_checkout_form_bottom', $form->ID, $args);
154 154
 
155 155
 				?>
156 156
 			</form>
157 157
 
158
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
158
+			<?php do_action('give_post_form', $form->ID, $args); ?>
159 159
 
160 160
 		<?php } ?>
161 161
 
162
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
162
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
163 163
 	<?php
164 164
 
165 165
 	/**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 * @param int $form ->ID The current form ID
171 171
 	 * @param array $args An array of form args
172 172
 	 */
173
-	do_action( 'give_post_form_output', $form->ID, $args );
173
+	do_action('give_post_form_output', $form->ID, $args);
174 174
 
175 175
 	$final_output = ob_get_clean();
176 176
 
177
-	echo apply_filters( 'give_donate_form', $final_output, $args );
177
+	echo apply_filters('give_donate_form', $final_output, $args);
178 178
 }
179 179
 
180 180
 
@@ -193,43 +193,43 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string
195 195
  */
196
-function give_show_purchase_form( $form_id ) {
196
+function give_show_purchase_form($form_id) {
197 197
 
198
-	$payment_mode = give_get_chosen_gateway( $form_id );
198
+	$payment_mode = give_get_chosen_gateway($form_id);
199 199
 
200
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
200
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
201 201
 		$form_id = $_POST['give_form_id'];
202 202
 	}
203 203
 
204
-	do_action( 'give_purchase_form_top', $form_id );
204
+	do_action('give_purchase_form_top', $form_id);
205 205
 
206
-	if ( give_can_checkout() && isset( $form_id ) ) {
206
+	if (give_can_checkout() && isset($form_id)) {
207 207
 
208
-		do_action( 'give_purchase_form_before_register_login', $form_id );
208
+		do_action('give_purchase_form_before_register_login', $form_id);
209 209
 
210
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
210
+		do_action('give_purchase_form_register_login_fields', $form_id);
211 211
 
212
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
212
+		do_action('give_purchase_form_before_cc_form', $form_id);
213 213
 
214 214
 		// Load the credit card form and allow gateways to load their own if they wish
215
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
216
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
215
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
216
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
217 217
 		} else {
218
-			do_action( 'give_cc_form', $form_id );
218
+			do_action('give_cc_form', $form_id);
219 219
 		}
220 220
 
221
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
221
+		do_action('give_purchase_form_after_cc_form', $form_id);
222 222
 
223 223
 	} else {
224 224
 		// Can't checkout
225
-		do_action( 'give_purchase_form_no_access', $form_id );
225
+		do_action('give_purchase_form_no_access', $form_id);
226 226
 
227 227
 	}
228 228
 
229
-	do_action( 'give_purchase_form_bottom', $form_id );
229
+	do_action('give_purchase_form_bottom', $form_id);
230 230
 }
231 231
 
232
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
232
+add_action('give_purchase_form', 'give_show_purchase_form');
233 233
 
234 234
 /**
235 235
  *
@@ -241,26 +241,26 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return void
243 243
  */
244
-function give_show_register_login_fields( $form_id ) {
244
+function give_show_register_login_fields($form_id) {
245 245
 
246
-	$show_register_form = give_show_login_register_option( $form_id );
246
+	$show_register_form = give_show_login_register_option($form_id);
247 247
 
248
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
248
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
249 249
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
250
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
250
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
251 251
 		</div>
252
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
252
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
253 253
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
254
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
254
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
255 255
 		</div>
256 256
 	<?php endif; ?>
257 257
 
258
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
259
-		do_action( 'give_purchase_form_after_user_info', $form_id );
258
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
259
+		do_action('give_purchase_form_after_user_info', $form_id);
260 260
 	}
261 261
 }
262 262
 
263
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
263
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
264 264
 
265 265
 /**
266 266
  * Donation Amount Field
@@ -274,33 +274,33 @@  discard block
 block discarded – undo
274 274
  *
275 275
  * @return void
276 276
  */
277
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
277
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
278 278
 
279 279
 	global $give_options;
280 280
 
281
-	$variable_pricing    = give_has_variable_prices( $form_id );
282
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
283
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
284
-	$symbol              = give_currency_symbol( give_get_currency() );
285
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
286
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
287
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
281
+	$variable_pricing    = give_has_variable_prices($form_id);
282
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
283
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
284
+	$symbol              = give_currency_symbol(give_get_currency());
285
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
286
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
287
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
288 288
 
289
-	do_action( 'give_before_donation_levels', $form_id, $args );
289
+	do_action('give_before_donation_levels', $form_id, $args);
290 290
 
291 291
 	//Set Price, No Custom Amount Allowed means hidden price field
292
-	if ( $allow_custom_amount == 'no' ) {
292
+	if ($allow_custom_amount == 'no') {
293 293
 		?>
294 294
 
295
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
295
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
296 296
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
297 297
 		       value="<?php echo $default_amount; ?>" required>
298 298
 		<div class="set-price give-donation-amount form-row-wide">
299
-			<?php if ( $currency_position == 'before' ) {
299
+			<?php if ($currency_position == 'before') {
300 300
 				echo $currency_output;
301 301
 			} ?>
302 302
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
303
-			<?php if ( $currency_position == 'after' ) {
303
+			<?php if ($currency_position == 'after') {
304 304
 				echo $currency_output;
305 305
 			} ?>
306 306
 		</div>
@@ -310,34 +310,34 @@  discard block
 block discarded – undo
310 310
 		?>
311 311
 		<div class="give-total-wrap">
312 312
 			<div class="give-donation-amount form-row-wide">
313
-				<?php if ( $currency_position == 'before' ) {
313
+				<?php if ($currency_position == 'before') {
314 314
 					echo $currency_output;
315 315
 				} ?>
316
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
316
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
317 317
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
318
-				<?php if ( $currency_position == 'after' ) {
318
+				<?php if ($currency_position == 'after') {
319 319
 					echo $currency_output;
320 320
 				} ?>
321 321
 			</div>
322 322
 		</div>
323 323
 	<?php }
324 324
 
325
-	do_action( 'give_after_donation_amount', $form_id, $args );
325
+	do_action('give_after_donation_amount', $form_id, $args);
326 326
 
327 327
 	//Custom Amount Text
328
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
328
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
329 329
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
330 330
 	<?php }
331 331
 
332 332
 	//Output Variable Pricing Levels
333
-	if ( $variable_pricing ) {
334
-		give_output_levels( $form_id );
333
+	if ($variable_pricing) {
334
+		give_output_levels($form_id);
335 335
 	}
336 336
 
337
-	do_action( 'give_after_donation_levels', $form_id, $args );
337
+	do_action('give_after_donation_levels', $form_id, $args);
338 338
 }
339 339
 
340
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
340
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
341 341
 
342 342
 
343 343
 /**
@@ -349,32 +349,32 @@  discard block
 block discarded – undo
349 349
  *
350 350
  * @return string
351 351
  */
352
-function give_output_levels( $form_id ) {
352
+function give_output_levels($form_id) {
353 353
 
354 354
 	//Get variable pricing
355
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
356
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
357
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
358
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
359
-	if ( empty( $custom_amount_text ) ) {
360
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
355
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
356
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
357
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
358
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
359
+	if (empty($custom_amount_text)) {
360
+		$custom_amount_text = __('Give a Custom Amount', 'give');
361 361
 	}
362 362
 
363 363
 	$output  = '';
364 364
 	$counter = 0;
365 365
 
366
-	switch ( $display_style ) {
366
+	switch ($display_style) {
367 367
 		case 'buttons':
368 368
 
369 369
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
370 370
 
371
-			foreach ( $prices as $price ) {
372
-				$counter ++;
373
-				$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 );
374
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
371
+			foreach ($prices as $price) {
372
+				$counter++;
373
+				$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);
374
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
375 375
 
376 376
 				$output .= '<li>';
377
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
377
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
378 378
 				$output .= $level_text;
379 379
 				$output .= '</button>';
380 380
 				$output .= '</li>';
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 			}
383 383
 
384 384
 			//Custom Amount
385
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
385
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
386 386
 				$output .= '<li>';
387 387
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
388 388
 				$output .= $custom_amount_text;
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
 
399 399
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
400 400
 
401
-			foreach ( $prices as $price ) {
402
-				$counter ++;
403
-				$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 );
404
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
401
+			foreach ($prices as $price) {
402
+				$counter++;
403
+				$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);
404
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
405 405
 
406 406
 				$output .= '<li>';
407
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
408
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
407
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
408
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
409 409
 				$output .= '</li>';
410 410
 
411 411
 			}
412 412
 
413 413
 			//Custom Amount
414
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
414
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
415 415
 				$output .= '<li>';
416 416
 				$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">';
417
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
417
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
418 418
 				$output .= '</li>';
419 419
 			}
420 420
 
@@ -424,23 +424,23 @@  discard block
 block discarded – undo
424 424
 
425 425
 		case 'dropdown':
426 426
 
427
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
428
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
427
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
428
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
429 429
 
430 430
 			//first loop through prices
431
-			foreach ( $prices as $price ) {
432
-				$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 );
433
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
431
+			foreach ($prices as $price) {
432
+				$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);
433
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
434 434
 
435
-				$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'] ) . '">';
435
+				$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']).'">';
436 436
 				$output .= $level_text;
437 437
 				$output .= '</option>';
438 438
 
439 439
 			}
440 440
 
441 441
 			//Custom Amount
442
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
443
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
442
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
443
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
444 444
 			}
445 445
 
446 446
 			$output .= '</select>';
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 			break;
449 449
 	}
450 450
 
451
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
451
+	echo apply_filters('give_form_level_output', $output, $form_id);
452 452
 }
453 453
 
454 454
 /**
@@ -460,26 +460,26 @@  discard block
 block discarded – undo
460 460
  * @param array $args
461 461
  *
462 462
  */
463
-function give_display_checkout_button( $form_id, $args ) {
463
+function give_display_checkout_button($form_id, $args) {
464 464
 
465
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
465
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
466 466
 		? $args['display_style']
467
-		: get_post_meta( $form_id, '_give_payment_display', true );
467
+		: get_post_meta($form_id, '_give_payment_display', true);
468 468
 
469 469
 	//no btn for onpage
470
-	if ( $display_option === 'onpage' ) {
470
+	if ($display_option === 'onpage') {
471 471
 		return;
472 472
 	}
473 473
 
474
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
475
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
474
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
475
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
476 476
 
477
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
477
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
478 478
 
479
-	echo apply_filters( 'give_display_checkout_button', $output );
479
+	echo apply_filters('give_display_checkout_button', $output);
480 480
 }
481 481
 
482
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
482
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
483 483
 
484 484
 /**
485 485
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -490,71 +490,71 @@  discard block
 block discarded – undo
490 490
  *
491 491
  * @return void
492 492
  */
493
-function give_user_info_fields( $form_id ) {
493
+function give_user_info_fields($form_id) {
494 494
 
495
-	if ( is_user_logged_in() ) :
496
-		$user_data = get_userdata( get_current_user_id() );
495
+	if (is_user_logged_in()) :
496
+		$user_data = get_userdata(get_current_user_id());
497 497
 	endif;
498 498
 
499
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
499
+	do_action('give_purchase_form_before_personal_info', $form_id);
500 500
 	?>
501 501
 	<fieldset id="give_checkout_user_info">
502
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
502
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
503 503
 		<p id="give-first-name-wrap" class="form-row form-row-first">
504 504
 			<label class="give-label" for="give-first">
505
-				<?php _e( 'First Name', 'give' ); ?>
506
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
505
+				<?php _e('First Name', 'give'); ?>
506
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
507 507
 					<span class="give-required-indicator">*</span>
508 508
 				<?php } ?>
509
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
509
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
510 510
 			</label>
511
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
511
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
512 512
 				echo ' required ';
513 513
 			} ?>/>
514 514
 		</p>
515 515
 
516 516
 		<p id="give-last-name-wrap" class="form-row form-row-last">
517 517
 			<label class="give-label" for="give-last">
518
-				<?php _e( 'Last Name', 'give' ); ?>
519
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
518
+				<?php _e('Last Name', 'give'); ?>
519
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
520 520
 					<span class="give-required-indicator">*</span>
521 521
 				<?php } ?>
522
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
522
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
523 523
 			</label>
524 524
 
525
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
525
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
526 526
 				echo ' required';
527
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
527
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
528 528
 				echo ' required ';
529 529
 			} ?> />
530 530
 		</p>
531 531
 
532
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
532
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
533 533
 		<p id="give-email-wrap" class="form-row form-row-wide">
534 534
 			<label class="give-label" for="give-email">
535
-				<?php _e( 'Email Address', 'give' ); ?>
536
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
535
+				<?php _e('Email Address', 'give'); ?>
536
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
537 537
 					<span class="give-required-indicator">*</span>
538 538
 				<?php } ?>
539
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
539
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
540 540
 			</label>
541 541
 
542
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
542
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
543 543
 				echo ' required ';
544 544
 			} ?>/>
545 545
 
546 546
 		</p>
547
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
547
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
548 548
 
549
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
549
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
550 550
 	</fieldset>
551 551
 	<?php
552
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
552
+	do_action('give_purchase_form_after_personal_info', $form_id);
553 553
 
554 554
 }
555 555
 
556
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
557
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
556
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
557
+add_action('give_register_fields_before', 'give_user_info_fields');
558 558
 
559 559
 /**
560 560
  * Renders the credit card info form.
@@ -565,73 +565,73 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @return void
567 567
  */
568
-function give_get_cc_form( $form_id ) {
568
+function give_get_cc_form($form_id) {
569 569
 
570 570
 	ob_start();
571 571
 
572
-	do_action( 'give_before_cc_fields', $form_id ); ?>
572
+	do_action('give_before_cc_fields', $form_id); ?>
573 573
 
574 574
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
575
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
576
-		<?php if ( is_ssl() ) : ?>
575
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
576
+		<?php if (is_ssl()) : ?>
577 577
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
578 578
 				<span class="give-icon padlock"></span>
579
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
579
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
580 580
 			</div>
581 581
 		<?php endif; ?>
582 582
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
583 583
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
584
-				<?php _e( 'Card Number', 'give' ); ?>
584
+				<?php _e('Card Number', 'give'); ?>
585 585
 				<span class="give-required-indicator">*</span>
586
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
586
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
587 587
 				<span class="card-type"></span>
588 588
 			</label>
589 589
 
590
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
590
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
591 591
 		</p>
592 592
 
593 593
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
594 594
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
595
-				<?php _e( 'CVC', 'give' ); ?>
595
+				<?php _e('CVC', 'give'); ?>
596 596
 				<span class="give-required-indicator">*</span>
597
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
597
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
598 598
 			</label>
599 599
 
600
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/>
600
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/>
601 601
 		</p>
602 602
 
603 603
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
604 604
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
605
-				<?php _e( 'Name on the Card', 'give' ); ?>
605
+				<?php _e('Name on the Card', 'give'); ?>
606 606
 				<span class="give-required-indicator">*</span>
607
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
607
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
608 608
 			</label>
609 609
 
610
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/>
610
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/>
611 611
 		</p>
612
-		<?php do_action( 'give_before_cc_expiration' ); ?>
612
+		<?php do_action('give_before_cc_expiration'); ?>
613 613
 		<p class="card-expiration form-row form-row-one-third">
614 614
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
615
-				<?php _e( 'Expiration', 'give' ); ?>
615
+				<?php _e('Expiration', 'give'); ?>
616 616
 				<span class="give-required-indicator">*</span>
617
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
617
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
618 618
 			</label>
619 619
 
620 620
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
621 621
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
622 622
 
623
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/>
623
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/>
624 624
 		</p>
625
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
625
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
626 626
 
627 627
 	</fieldset>
628 628
 	<?php
629
-	do_action( 'give_after_cc_fields', $form_id );
629
+	do_action('give_after_cc_fields', $form_id);
630 630
 
631 631
 	echo ob_get_clean();
632 632
 }
633 633
 
634
-add_action( 'give_cc_form', 'give_get_cc_form' );
634
+add_action('give_cc_form', 'give_get_cc_form');
635 635
 
636 636
 /**
637 637
  * Outputs the default credit card address fields
@@ -642,110 +642,110 @@  discard block
 block discarded – undo
642 642
  *
643 643
  * @return void
644 644
  */
645
-function give_default_cc_address_fields( $form_id ) {
645
+function give_default_cc_address_fields($form_id) {
646 646
 
647 647
 	$logged_in = is_user_logged_in();
648 648
 
649
-	if ( $logged_in ) {
650
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
649
+	if ($logged_in) {
650
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
651 651
 	}
652
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
653
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
654
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
655
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
652
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
653
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
654
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
655
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
656 656
 	ob_start(); ?>
657 657
 	<fieldset id="give_cc_address" class="cc-address">
658
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
659
-		<?php do_action( 'give_cc_billing_top' ); ?>
658
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
659
+		<?php do_action('give_cc_billing_top'); ?>
660 660
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
661 661
 			<label for="card_address" class="give-label">
662
-				<?php _e( 'Address', 'give' ); ?>
662
+				<?php _e('Address', 'give'); ?>
663 663
 				<?php
664
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
664
+				if (give_field_is_required('card_address', $form_id)) { ?>
665 665
 					<span class="give-required-indicator">*</span>
666 666
 				<?php } ?>
667
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
667
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
668 668
 			</label>
669 669
 
670
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
670
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
671 671
 				echo ' required';
672
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
672
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
673 673
 				echo '  required ';
674 674
 			} ?>/>
675 675
 		</p>
676 676
 
677 677
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
678 678
 			<label for="card_address_2" class="give-label">
679
-				<?php _e( 'Address Line 2', 'give' ); ?>
680
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
679
+				<?php _e('Address Line 2', 'give'); ?>
680
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
681 681
 					<span class="give-required-indicator">*</span>
682 682
 				<?php } ?>
683
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
683
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
684 684
 			</label>
685 685
 
686
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
686
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
687 687
 				echo ' required';
688
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
688
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
689 689
 				echo ' required ';
690 690
 			} ?>/>
691 691
 		</p>
692 692
 
693 693
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
694 694
 			<label for="card_city" class="give-label">
695
-				<?php _e( 'City', 'give' ); ?>
696
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
695
+				<?php _e('City', 'give'); ?>
696
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
697 697
 					<span class="give-required-indicator">*</span>
698 698
 				<?php } ?>
699
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
699
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
700 700
 			</label>
701
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
701
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
702 702
 				echo ' required';
703
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
703
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
704 704
 				echo ' required ';
705 705
 			} ?>/>
706 706
 		</p>
707 707
 
708 708
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
709 709
 			<label for="card_zip" class="give-label">
710
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
711
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
710
+				<?php _e('Zip / Postal Code', 'give'); ?>
711
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
712 712
 					<span class="give-required-indicator">*</span>
713 713
 				<?php } ?>
714
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
714
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
715 715
 			</label>
716 716
 
717
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
717
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
718 718
 				echo ' required';
719
-			} ?>" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
719
+			} ?>" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
720 720
 				echo ' required ';
721 721
 			} ?>/>
722 722
 		</p>
723 723
 
724 724
 		<p id="give-card-country-wrap" class="form-row form-row-first">
725 725
 			<label for="billing_country" class="give-label">
726
-				<?php _e( 'Country', 'give' ); ?>
727
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
726
+				<?php _e('Country', 'give'); ?>
727
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
728 728
 					<span class="give-required-indicator">*</span>
729 729
 				<?php } ?>
730
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
730
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
731 731
 			</label>
732 732
 
733
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
733
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
734 734
 				echo ' required';
735
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
735
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
736 736
 				echo ' required ';
737 737
 			} ?>>
738 738
 				<?php
739 739
 
740 740
 				$selected_country = give_get_country();
741 741
 
742
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
742
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
743 743
 					$selected_country = $user_address['country'];
744 744
 				}
745 745
 
746 746
 				$countries = give_get_country_list();
747
-				foreach ( $countries as $country_code => $country ) {
748
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
747
+				foreach ($countries as $country_code => $country) {
748
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
749 749
 				}
750 750
 				?>
751 751
 			</select>
@@ -753,44 +753,44 @@  discard block
 block discarded – undo
753 753
 
754 754
 		<p id="give-card-state-wrap" class="form-row form-row-last">
755 755
 			<label for="card_state" class="give-label">
756
-				<?php _e( 'State / Province', 'give' ); ?>
757
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
756
+				<?php _e('State / Province', 'give'); ?>
757
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
758 758
 					<span class="give-required-indicator">*</span>
759 759
 				<?php } ?>
760
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
760
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
761 761
 			</label>
762 762
 
763 763
 			<?php
764 764
 			$selected_state = give_get_state();
765
-			$states         = give_get_states( $selected_country );
765
+			$states         = give_get_states($selected_country);
766 766
 
767
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
767
+			if ($logged_in && ! empty($user_address['state'])) {
768 768
 				$selected_state = $user_address['state'];
769 769
 			}
770 770
 
771
-			if ( ! empty( $states ) ) : ?>
772
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
771
+			if ( ! empty($states)) : ?>
772
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
773 773
 					echo ' required';
774
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
774
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
775 775
 					echo ' required ';
776 776
 				} ?>>
777 777
 					<?php
778
-					foreach ( $states as $state_code => $state ) {
779
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
778
+					foreach ($states as $state_code => $state) {
779
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
780 780
 					}
781 781
 					?>
782 782
 				</select>
783 783
 			<?php else : ?>
784
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
784
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
785 785
 			<?php endif; ?>
786 786
 		</p>
787
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
787
+		<?php do_action('give_cc_billing_bottom'); ?>
788 788
 	</fieldset>
789 789
 	<?php
790 790
 	echo ob_get_clean();
791 791
 }
792 792
 
793
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
793
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
794 794
 
795 795
 
796 796
 /**
@@ -802,93 +802,93 @@  discard block
 block discarded – undo
802 802
  *
803 803
  * @return string
804 804
  */
805
-function give_get_register_fields( $form_id ) {
805
+function give_get_register_fields($form_id) {
806 806
 
807 807
 	global $user_ID;
808 808
 
809
-	if ( is_user_logged_in() ) {
810
-		$user_data = get_userdata( $user_ID );
809
+	if (is_user_logged_in()) {
810
+		$user_data = get_userdata($user_ID);
811 811
 	}
812 812
 
813
-	$show_register_form = give_show_login_register_option( $form_id );
813
+	$show_register_form = give_show_login_register_option($form_id);
814 814
 
815 815
 	ob_start(); ?>
816 816
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
817 817
 
818
-		<?php if ( $show_register_form == 'both' ) { ?>
818
+		<?php if ($show_register_form == 'both') { ?>
819 819
 			<div class="give-login-account-wrap">
820
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
821
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
820
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
821
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
822 822
 				</p>
823 823
 				<p class="give-loading-text">
824
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
824
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
825 825
 			</div>
826 826
 		<?php } ?>
827 827
 
828
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
828
+		<?php do_action('give_register_fields_before', $form_id); ?>
829 829
 
830 830
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
831
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
832
-				if ( ! give_logged_in_only( $form_id ) ) {
833
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
831
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
832
+				if ( ! give_logged_in_only($form_id)) {
833
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
834 834
 				} ?></legend>
835
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
835
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
836 836
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
837 837
 				<label for="give-user-login-<?php echo $form_id; ?>">
838
-					<?php _e( 'Username', 'give' ); ?>
839
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
838
+					<?php _e('Username', 'give'); ?>
839
+					<?php if (give_logged_in_only($form_id)) { ?>
840 840
 						<span class="give-required-indicator">*</span>
841 841
 					<?php } ?>
842
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
842
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
843 843
 				</label>
844 844
 
845
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
845
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
846 846
 					echo 'required ';
847
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
847
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
848 848
 			</div>
849 849
 
850 850
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
851 851
 				<label for="give-user-pass-<?php echo $form_id; ?>">
852
-					<?php _e( 'Password', 'give' ); ?>
853
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
852
+					<?php _e('Password', 'give'); ?>
853
+					<?php if (give_logged_in_only($form_id)) { ?>
854 854
 						<span class="give-required-indicator">*</span>
855 855
 					<?php } ?>
856
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
856
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
857 857
 				</label>
858 858
 
859
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
859
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
860 860
 					echo 'required ';
861
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
861
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
862 862
 			</div>
863 863
 
864 864
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
865 865
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
866
-					<?php _e( 'Confirm PW', 'give' ); ?>
867
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
866
+					<?php _e('Confirm PW', 'give'); ?>
867
+					<?php if (give_logged_in_only($form_id)) { ?>
868 868
 						<span class="give-required-indicator">*</span>
869 869
 					<?php } ?>
870
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
870
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
871 871
 				</label>
872 872
 
873
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
873
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
874 874
 					echo 'required ';
875
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
875
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
876 876
 			</div>
877
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
877
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
878 878
 		</fieldset>
879 879
 
880
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
880
+		<?php do_action('give_register_fields_after', $form_id); ?>
881 881
 
882 882
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
883 883
 
884
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
884
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
885 885
 
886 886
 	</fieldset>
887 887
 	<?php
888 888
 	echo ob_get_clean();
889 889
 }
890 890
 
891
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
891
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
892 892
 
893 893
 /**
894 894
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -901,79 +901,79 @@  discard block
 block discarded – undo
901 901
  *
902 902
  * @return string
903 903
  */
904
-function give_get_login_fields( $form_id ) {
904
+function give_get_login_fields($form_id) {
905 905
 
906
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
907
-	$show_register_form = give_show_login_register_option( $form_id );
906
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
907
+	$show_register_form = give_show_login_register_option($form_id);
908 908
 
909 909
 	ob_start();
910 910
 	?>
911 911
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
912
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
913
-			if ( ! give_logged_in_only( $form_id ) ) {
914
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
912
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
913
+			if ( ! give_logged_in_only($form_id)) {
914
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
915 915
 			} ?>
916 916
 		</legend>
917
-		<?php if ( $show_register_form == 'both' ) { ?>
917
+		<?php if ($show_register_form == 'both') { ?>
918 918
 			<p class="give-new-account-link">
919
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
920
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
921
-					<?php _e( 'Register', 'give' );
922
-					if ( ! give_logged_in_only( $form_id ) ) {
923
-						echo ' ' . __( 'or checkout as a guest', 'give' ) . ' &raquo;';
919
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
920
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
921
+					<?php _e('Register', 'give');
922
+					if ( ! give_logged_in_only($form_id)) {
923
+						echo ' '.__('or checkout as a guest', 'give').' &raquo;';
924 924
 					} ?>
925 925
 				</a>
926 926
 			</p>
927 927
 			<p class="give-loading-text">
928
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
928
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
929 929
 		<?php } ?>
930
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
930
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
931 931
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
932 932
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
933
-				<?php _e( 'Username', 'give' ); ?>
934
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
933
+				<?php _e('Username', 'give'); ?>
934
+				<?php if (give_logged_in_only($form_id)) { ?>
935 935
 					<span class="give-required-indicator">*</span>
936 936
 				<?php } ?>
937 937
 			</label>
938 938
 
939
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
939
+			<input class="<?php if (give_logged_in_only($form_id)) {
940 940
 				echo 'required ';
941
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
941
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
942 942
 		</div>
943 943
 
944 944
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
945 945
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
946
-				<?php _e( 'Password', 'give' ); ?>
947
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
946
+				<?php _e('Password', 'give'); ?>
947
+				<?php if (give_logged_in_only($form_id)) { ?>
948 948
 					<span class="give-required-indicator">*</span>
949 949
 				<?php } ?>
950 950
 			</label>
951
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
951
+			<input class="<?php if (give_logged_in_only($form_id)) {
952 952
 				echo 'required ';
953
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
953
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
954 954
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
955 955
 		</div>
956 956
 
957 957
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
958 958
 			 <span class="give-forgot-password ">
959
-				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php _e( 'Reset password?' ) ?></a>
959
+				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php _e('Reset password?') ?></a>
960 960
 			 </span>
961 961
 		</div>
962 962
 
963 963
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
964
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
965
-			<?php if ( $show_register_form !== 'login' ) { ?>
966
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/>
964
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
965
+			<?php if ($show_register_form !== 'login') { ?>
966
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/>
967 967
 			<?php } ?>
968 968
 			<span class="give-loading-animation"></span>
969 969
 		</div>
970
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
970
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
971 971
 	</fieldset><!--end #give-login-fields-->
972 972
 	<?php
973 973
 	echo ob_get_clean();
974 974
 }
975 975
 
976
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
976
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
977 977
 
978 978
 /**
979 979
  * Payment Mode Select
@@ -989,49 +989,49 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return void
991 991
  */
992
-function give_payment_mode_select( $form_id ) {
992
+function give_payment_mode_select($form_id) {
993 993
 
994 994
 	$gateways = give_get_enabled_payment_gateways();
995 995
 
996
-	do_action( 'give_payment_mode_top', $form_id ); ?>
996
+	do_action('give_payment_mode_top', $form_id); ?>
997 997
 
998 998
 	<fieldset id="give-payment-mode-select">
999
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
999
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
1000 1000
 		<div id="give-payment-mode-wrap">
1001
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
1002
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
1001
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
1002
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
1003 1003
 			</legend>
1004 1004
 			<?php
1005 1005
 
1006
-			do_action( 'give_payment_mode_before_gateways' ) ?>
1006
+			do_action('give_payment_mode_before_gateways') ?>
1007 1007
 
1008 1008
 			<ul id="give-gateway-radio-list">
1009
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1010
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1009
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1010
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1011 1011
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1012
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
1013
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
1012
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
1013
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
1014 1014
 					echo '</label></li>';
1015 1015
 				endforeach; ?>
1016 1016
 			</ul>
1017
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
1017
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1018 1018
 		</div>
1019
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1019
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1020 1020
 	</fieldset>
1021 1021
 
1022
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1022
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1023 1023
 
1024 1024
 	<div id="give_purchase_form_wrap">
1025 1025
 
1026
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1026
+		<?php do_action('give_purchase_form', $form_id); ?>
1027 1027
 
1028 1028
 	</div><!-- the checkout fields are loaded into this-->
1029 1029
 
1030
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1030
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1031 1031
 
1032 1032
 }
1033 1033
 
1034
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1034
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1035 1035
 
1036 1036
 
1037 1037
 /**
@@ -1045,36 +1045,36 @@  discard block
 block discarded – undo
1045 1045
  *
1046 1046
  * @return void
1047 1047
  */
1048
-function give_terms_agreement( $form_id ) {
1048
+function give_terms_agreement($form_id) {
1049 1049
 
1050
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1051
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1052
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1050
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1051
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1052
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1053 1053
 
1054
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1054
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1055 1055
 		<fieldset id="give_terms_agreement">
1056
-			<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1056
+			<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1057 1057
 				<?php
1058
-				do_action( 'give_before_terms' );
1059
-				echo wpautop( stripslashes( $terms ) );
1060
-				do_action( 'give_after_terms' );
1058
+				do_action('give_before_terms');
1059
+				echo wpautop(stripslashes($terms));
1060
+				do_action('give_after_terms');
1061 1061
 				?>
1062 1062
 			</div>
1063 1063
 			<div id="give_show_terms">
1064
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php _e( 'Show Terms', 'give' ); ?></a>
1065
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1064
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php _e('Show Terms', 'give'); ?></a>
1065
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1066 1066
 			</div>
1067 1067
 
1068 1068
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1069 1069
 			<label
1070
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1070
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1071 1071
 
1072 1072
 		</fieldset>
1073 1073
 		<?php
1074 1074
 	}
1075 1075
 }
1076 1076
 
1077
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1077
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1078 1078
 
1079 1079
 /**
1080 1080
  * Checkout Final Total
@@ -1087,27 +1087,27 @@  discard block
 block discarded – undo
1087 1087
  *
1088 1088
  * @return void
1089 1089
  */
1090
-function give_checkout_final_total( $form_id ) {
1090
+function give_checkout_final_total($form_id) {
1091 1091
 
1092
-	if ( isset( $_POST['give_total'] ) ) {
1093
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1092
+	if (isset($_POST['give_total'])) {
1093
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1094 1094
 	} else {
1095 1095
 		//default total
1096
-		$total = give_get_default_form_amount( $form_id );
1096
+		$total = give_get_default_form_amount($form_id);
1097 1097
 	}
1098 1098
 	//Only proceed if give_total available
1099
-	if ( empty( $total ) ) {
1099
+	if (empty($total)) {
1100 1100
 		return;
1101 1101
 	}
1102 1102
 	?>
1103 1103
 	<p id="give-final-total-wrap" class="form-wrap ">
1104
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1105
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1104
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1105
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1106 1106
 	</p>
1107 1107
 	<?php
1108 1108
 }
1109 1109
 
1110
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1110
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1111 1111
 
1112 1112
 
1113 1113
 /**
@@ -1119,22 +1119,22 @@  discard block
 block discarded – undo
1119 1119
  *
1120 1120
  * @return void
1121 1121
  */
1122
-function give_checkout_submit( $form_id ) {
1122
+function give_checkout_submit($form_id) {
1123 1123
 	?>
1124 1124
 	<fieldset id="give_purchase_submit">
1125
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1125
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1126 1126
 
1127
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1127
+		<?php give_checkout_hidden_fields($form_id); ?>
1128 1128
 
1129
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1129
+		<?php echo give_checkout_button_purchase($form_id); ?>
1130 1130
 
1131
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1131
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1132 1132
 
1133 1133
 	</fieldset>
1134 1134
 	<?php
1135 1135
 }
1136 1136
 
1137
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1137
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1138 1138
 
1139 1139
 
1140 1140
 /**
@@ -1147,17 +1147,17 @@  discard block
 block discarded – undo
1147 1147
  *
1148 1148
  * @return string
1149 1149
  */
1150
-function give_checkout_button_purchase( $form_id ) {
1150
+function give_checkout_button_purchase($form_id) {
1151 1151
 
1152
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1153
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1152
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1153
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1154 1154
 	ob_start(); ?>
1155 1155
 	<div class="give-submit-button-wrap give-clearfix">
1156 1156
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1157 1157
 		<span class="give-loading-animation"></span>
1158 1158
 	</div>
1159 1159
 	<?php
1160
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1160
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1170,18 +1170,18 @@  discard block
 block discarded – undo
1170 1170
  *
1171 1171
  * @return void
1172 1172
  */
1173
-function give_agree_to_terms_js( $form_id ) {
1173
+function give_agree_to_terms_js($form_id) {
1174 1174
 
1175
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1175
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1176 1176
 
1177
-	if ( $form_option === 'yes' ) {
1177
+	if ($form_option === 'yes') {
1178 1178
 		?>
1179 1179
 		<script type="text/javascript">
1180 1180
 			jQuery(document).ready(function ($) {
1181
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1181
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1182 1182
 					e.preventDefault();
1183
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1184
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1183
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1184
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1185 1185
 					return false;
1186 1186
 				});
1187 1187
 			});
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 	}
1191 1191
 }
1192 1192
 
1193
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1193
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1194 1194
 
1195 1195
 /**
1196 1196
  * Show Give Goals
@@ -1203,25 +1203,25 @@  discard block
 block discarded – undo
1203 1203
  * @return mixed
1204 1204
  */
1205 1205
 
1206
-function give_show_goal_progress( $form_id, $args ) {
1206
+function give_show_goal_progress($form_id, $args) {
1207 1207
 
1208
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1209
-	$form        = new Give_Donate_Form( $form_id );
1208
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1209
+	$form        = new Give_Donate_Form($form_id);
1210 1210
 	$goal        = $form->goal;
1211
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1211
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1212 1212
 	$income      = $form->get_earnings();
1213
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1214
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1215
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1213
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1214
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1215
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1216 1216
 
1217 1217
 	//Sanity check - respect shortcode args
1218
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1218
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1219 1219
 		return false;
1220 1220
 	}
1221 1221
 
1222 1222
 	//Sanity check - ensure form has goal set to output
1223
-	if ( empty( $form->ID )
1224
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1223
+	if (empty($form->ID)
1224
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1225 1225
 	     || $goal_option !== 'yes'
1226 1226
 	     || $goal == 0
1227 1227
 	) {
@@ -1229,39 +1229,39 @@  discard block
 block discarded – undo
1229 1229
 		return false;
1230 1230
 	}
1231 1231
 
1232
-	$progress = round( ( $income / $goal ) * 100, 2 );
1232
+	$progress = round(($income / $goal) * 100, 2);
1233 1233
 
1234
-	if ( $income >= $goal ) {
1234
+	if ($income >= $goal) {
1235 1235
 		$progress = 100;
1236 1236
 	}
1237 1237
 
1238 1238
 	$output = '<div class="give-goal-progress">';
1239 1239
 
1240 1240
 	//Goal Progress Text
1241
-	if ( ! empty( $show_text ) ) {
1241
+	if ( ! empty($show_text)) {
1242 1242
 
1243 1243
 		$output .= '<div class="raised">';
1244 1244
 
1245
-		if ( $goal_format !== 'percentage' ) {
1245
+		if ($goal_format !== 'percentage') {
1246 1246
 
1247 1247
 			 // Get formatted amount.
1248
-            $income = give_human_format_large_amount( give_format_amount( $income ) );
1249
-            $goal = give_human_format_large_amount( give_format_amount( $goal ) );
1248
+            $income = give_human_format_large_amount(give_format_amount($income));
1249
+            $goal = give_human_format_large_amount(give_format_amount($goal));
1250 1250
 
1251 1251
 			$output .= sprintf(
1252 1252
 				/* translators: 1: amount of income raised 2: goal target ammount */
1253
-				__( '%1$s of %2$s raised', 'give' ),
1254
-				'<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( $income ) ) . '</span>',
1255
-				'<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( $goal ) ) . '</span>'
1253
+				__('%1$s of %2$s raised', 'give'),
1254
+				'<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter($income)).'</span>',
1255
+				'<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter($goal)).'</span>'
1256 1256
 			);
1257 1257
 
1258 1258
 
1259
-		} elseif ( $goal_format == 'percentage' ) {
1259
+		} elseif ($goal_format == 'percentage') {
1260 1260
 
1261 1261
 			$output .= sprintf(
1262 1262
 				/* translators: %s: percentage of the amount raised compared to the goal target */
1263
-				__( '%s%% funded', 'give' ),
1264
-				'<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>'
1263
+				__('%s%% funded', 'give'),
1264
+				'<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>'
1265 1265
 			);
1266 1266
 		}
1267 1267
 
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
 	}
1271 1271
 
1272 1272
 	//Goal Progress Bar
1273
-	if ( ! empty( $show_bar ) ) {
1273
+	if ( ! empty($show_bar)) {
1274 1274
 		$output .= '<div class="give-progress-bar">';
1275
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1276
-		if ( ! empty( $color ) ) {
1277
-			$output .= 'background-color:' . $color;
1275
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1276
+		if ( ! empty($color)) {
1277
+			$output .= 'background-color:'.$color;
1278 1278
 		}
1279 1279
 		$output .= '"></span>';
1280 1280
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1282,13 +1282,13 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 	$output .= '</div><!-- /.goal-progress -->';
1284 1284
 
1285
-	echo apply_filters( 'give_goal_output', $output );
1285
+	echo apply_filters('give_goal_output', $output);
1286 1286
 
1287 1287
 	return false;
1288 1288
 
1289 1289
 }
1290 1290
 
1291
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1291
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1292 1292
 
1293 1293
 /**
1294 1294
  * Adds Actions to Render Form Content
@@ -1300,19 +1300,19 @@  discard block
 block discarded – undo
1300 1300
  *
1301 1301
  * @return void
1302 1302
  */
1303
-function give_form_content( $form_id, $args ) {
1303
+function give_form_content($form_id, $args) {
1304 1304
 
1305
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1305
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1306 1306
 		? $args['show_content']
1307
-		: get_post_meta( $form_id, '_give_content_option', true );
1307
+		: get_post_meta($form_id, '_give_content_option', true);
1308 1308
 
1309
-	if ( $show_content !== 'none' ) {
1309
+	if ($show_content !== 'none') {
1310 1310
 		//add action according to value
1311
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1311
+		add_action($show_content, 'give_form_display_content', 10, 2);
1312 1312
 	}
1313 1313
 }
1314 1314
 
1315
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1315
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1316 1316
 
1317 1317
 /**
1318 1318
  * Renders Post Form Content
@@ -1324,24 +1324,24 @@  discard block
 block discarded – undo
1324 1324
  * @return void
1325 1325
  * @since      1.0
1326 1326
  */
1327
-function give_form_display_content( $form_id, $args ) {
1327
+function give_form_display_content($form_id, $args) {
1328 1328
 
1329
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1330
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1329
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1330
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1331 1331
 		? $args['show_content']
1332
-		: get_post_meta( $form_id, '_give_content_option', true );
1332
+		: get_post_meta($form_id, '_give_content_option', true);
1333 1333
 
1334
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1335
-		$content = apply_filters( 'the_content', $content );
1334
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1335
+		$content = apply_filters('the_content', $content);
1336 1336
 	}
1337 1337
 
1338
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1338
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1339 1339
 
1340
-	echo apply_filters( 'give_form_content_output', $output );
1340
+	echo apply_filters('give_form_content_output', $output);
1341 1341
 
1342 1342
 	//remove action to prevent content output on addition forms on page
1343 1343
 	//@see: https://github.com/WordImpress/Give/issues/634
1344
-	remove_action( $show_content, 'give_form_display_content' );
1344
+	remove_action($show_content, 'give_form_display_content');
1345 1345
 }
1346 1346
 
1347 1347
 
@@ -1354,16 +1354,16 @@  discard block
 block discarded – undo
1354 1354
  *
1355 1355
  * @return void
1356 1356
  */
1357
-function give_checkout_hidden_fields( $form_id ) {
1357
+function give_checkout_hidden_fields($form_id) {
1358 1358
 
1359
-	do_action( 'give_hidden_fields_before', $form_id );
1360
-	if ( is_user_logged_in() ) { ?>
1359
+	do_action('give_hidden_fields_before', $form_id);
1360
+	if (is_user_logged_in()) { ?>
1361 1361
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1362 1362
 	<?php } ?>
1363 1363
 	<input type="hidden" name="give_action" value="purchase"/>
1364
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1364
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1365 1365
 	<?php
1366
-	do_action( 'give_hidden_fields_after', $form_id );
1366
+	do_action('give_hidden_fields_after', $form_id);
1367 1367
 
1368 1368
 }
1369 1369
 
@@ -1378,20 +1378,20 @@  discard block
 block discarded – undo
1378 1378
  *
1379 1379
  * @return string $content Filtered content
1380 1380
  */
1381
-function give_filter_success_page_content( $content ) {
1381
+function give_filter_success_page_content($content) {
1382 1382
 
1383 1383
 	global $give_options;
1384 1384
 
1385
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1386
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1387
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1385
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1386
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1387
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1388 1388
 		}
1389 1389
 	}
1390 1390
 
1391 1391
 	return $content;
1392 1392
 }
1393 1393
 
1394
-add_filter( 'the_content', 'give_filter_success_page_content' );
1394
+add_filter('the_content', 'give_filter_success_page_content');
1395 1395
 
1396 1396
 
1397 1397
 /**
@@ -1403,14 +1403,14 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
 function give_test_mode_frontend_warning() {
1405 1405
 
1406
-	$test_mode = give_get_option( 'test_mode' );
1406
+	$test_mode = give_get_option('test_mode');
1407 1407
 
1408
-	if ( $test_mode == 'on' ) {
1409
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1408
+	if ($test_mode == 'on') {
1409
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1410 1410
 	}
1411 1411
 }
1412 1412
 
1413
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1413
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1414 1414
 
1415 1415
 
1416 1416
 /**
@@ -1426,21 +1426,21 @@  discard block
 block discarded – undo
1426 1426
  * @return string
1427 1427
  */
1428 1428
 
1429
-function give_members_only_form( $final_output, $args ) {
1429
+function give_members_only_form($final_output, $args) {
1430 1430
 
1431
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1431
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1432 1432
 
1433 1433
 	//Sanity Check: Must have form_id & not be logged in
1434
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1434
+	if (empty($form_id) || is_user_logged_in()) {
1435 1435
 		return $final_output;
1436 1436
 	}
1437 1437
 
1438 1438
 	//Logged in only and Register / Login set to none
1439
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1439
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1440 1440
 
1441
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1441
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1442 1442
 
1443
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1443
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1444 1444
 
1445 1445
 	}
1446 1446
 
@@ -1448,4 +1448,4 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
 }
1450 1450
 
1451
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1451
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
17 17
  *
18 18
  * @since 1.0
19 19
  */
20
-class Give_Forms_Widget extends WP_Widget{
20
+class Give_Forms_Widget extends WP_Widget {
21 21
 	/**
22 22
 	 * The widget class name
23 23
 	 *
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * Instantiate the class
30 30
 	 */
31
-	public function __construct(){
32
-		$this->self = get_class( $this );
31
+	public function __construct() {
32
+		$this->self = get_class($this);
33 33
 
34 34
 		parent::__construct(
35
-			strtolower( $this->self ),
36
-			__( 'Give - Donation Form', 'give' ),
35
+			strtolower($this->self),
36
+			__('Give - Donation Form', 'give'),
37 37
 			array(
38
-				'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
38
+				'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
39 39
 			)
40 40
 		);
41 41
 
42
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
43
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
42
+		add_action('widgets_init', array($this, 'widget_init'));
43
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
44 44
 	}
45 45
 
46 46
 	/**
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return void
52 52
 	 */
53
-	public function admin_widget_scripts( $hook ){
53
+	public function admin_widget_scripts($hook) {
54 54
 		// Directories of assets
55
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
56
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
57
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
55
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
56
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
57
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
58 58
 
59 59
 		// Use minified libraries if SCRIPT_DEBUG is turned off
60
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
60
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
61 61
 
62 62
 		// Widget Script
63
-		if ( $hook == 'widgets.php' ) {
63
+		if ($hook == 'widgets.php') {
64 64
 
65
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
65
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
66 66
 
67
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
67
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
68 68
 
69
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
69
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
70 70
 		}
71 71
 	}
72 72
 
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 	 *                        before_widget, and after_widget.
78 78
 	 * @param array $instance The settings for the particular instance of the widget.
79 79
 	 */
80
-	public function widget( $args, $instance ){
81
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
82
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
80
+	public function widget($args, $instance) {
81
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
82
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
83 83
 
84 84
 		echo $args['before_widget'];
85 85
 
86
-		do_action( 'give_before_forms_widget' );
86
+		do_action('give_before_forms_widget');
87 87
 
88
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
88
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
89 89
 
90
-		give_get_donation_form( $instance );
90
+		give_get_donation_form($instance);
91 91
 
92 92
 		echo $args['after_widget'];
93 93
 
94
-		do_action( 'give_after_forms_widget' );
94
+		do_action('give_after_forms_widget');
95 95
 	}
96 96
 
97 97
 	/**
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string
103 103
 	 */
104
-	public function form( $instance ){
104
+	public function form($instance) {
105 105
 		$defaults = array(
106 106
 			'title'        => '',
107 107
 			'id'           => '',
108 108
 			'float_labels' => '',
109 109
 		);
110 110
 
111
-		$instance = wp_parse_args( (array) $instance, $defaults );
111
+		$instance = wp_parse_args((array) $instance, $defaults);
112 112
 
113 113
 		// Query Give Forms
114 114
 		$args = array(
115 115
 			'post_type'      => 'give_forms',
116
-			'posts_per_page' => - 1,
116
+			'posts_per_page' => -1,
117 117
 			'post_status'    => 'publish',
118 118
 		);
119 119
 
120
-		$give_forms = get_posts( $args );
120
+		$give_forms = get_posts($args);
121 121
 
122 122
 		// Widget: Title
123 123
 
124 124
 		?><p>
125
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label>
126
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /><br>
127
-			<small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
125
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label>
126
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" /><br>
127
+			<small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small>
128 128
 		</p><?php
129 129
 
130 130
 		// Widget: Give Form
131 131
 
132 132
 		?><p>
133
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php
133
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php
134 134
 				printf(
135 135
 					/* translators: %s: form singular label */
136
-					__( 'Give %s:', 'give' ),
136
+					__('Give %s:', 'give'),
137 137
 					give_get_forms_label_singular()
138 138
 				);
139 139
 			?></label>
140
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
141
-				<option value="current"><?php _e( '— Select —', 'give' ); ?></option>
142
-				<?php foreach ( $give_forms as $give_form ) { ?>
143
-					<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
140
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
141
+				<option value="current"><?php _e('— Select —', 'give'); ?></option>
142
+				<?php foreach ($give_forms as $give_form) { ?>
143
+					<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
144 144
 				<?php } ?>
145 145
 			</select><br>
146
-			<small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
146
+			<small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small>
147 147
 		</p><?php
148 148
 
149 149
 		// Widget: Floating Labels
150 150
 
151 151
 		?><p>
152
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label>
153
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
154
-				<option value="" <?php selected( esc_attr( $instance['float_labels'] ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option>
155
-				<option value="enabled" <?php selected( esc_attr( $instance['float_labels'] ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option>
156
-				<option value="disabled" <?php selected( esc_attr( $instance['float_labels'] ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option>
152
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label>
153
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
154
+				<option value="" <?php selected(esc_attr($instance['float_labels']), '') ?>>– <?php _e('Select', 'give'); ?> –</option>
155
+				<option value="enabled" <?php selected(esc_attr($instance['float_labels']), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option>
156
+				<option value="disabled" <?php selected(esc_attr($instance['float_labels']), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option>
157 157
 			</select><br>
158 158
 			<small><?php
159 159
 				printf(
160 160
 					/* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */
161
-					__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
162
-					esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' )
161
+					__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
162
+					esc_url('http://bradfrost.com/blog/post/float-label-pattern/')
163 163
 				);
164 164
 			?></small>
165 165
 		</p><?php
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return void
172 172
 	 */
173
-	function widget_init(){
174
-		register_widget( $this->self );
173
+	function widget_init() {
174
+		register_widget($this->self);
175 175
 	}
176 176
 
177 177
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return array
184 184
 	 */
185
-	public function update( $new_instance, $old_instance ){
185
+	public function update($new_instance, $old_instance) {
186 186
 		$this->flush_widget_cache();
187 187
 
188 188
 		return $new_instance;
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return void
195 195
 	 */
196
-	public function flush_widget_cache(){
197
-		wp_cache_delete( $this->self, 'widget' );
196
+	public function flush_widget_cache() {
197
+		wp_cache_delete($this->self, 'widget');
198 198
 	}
199 199
 }
200 200
 
Please login to merge, or discard this patch.
includes/scripts.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -241,23 +241,23 @@  discard block
 block discarded – undo
241 241
 		wp_enqueue_script( 'give-accounting' );
242 242
 	}
243 243
 
244
-    //Settings Scripts
245
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
-        wp_enqueue_script( 'give-admin-settings-scripts' );
248
-    }
244
+	//Settings Scripts
245
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
+		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
+		wp_enqueue_script( 'give-admin-settings-scripts' );
248
+	}
249 249
 
250
-    // Price Separators.
251
-    $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
-    $decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
250
+	// Price Separators.
251
+	$thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
+	$decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
253 253
 
254
-    //Localize strings & variables for JS
254
+	//Localize strings & variables for JS
255 255
 	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
256 256
 		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
257 257
 		'give_version'            => GIVE_VERSION,
258
-        'thousands_separator'     => $thousand_separator,
259
-        'decimal_separator'       => $decimal_separator,
260
-        'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
258
+		'thousands_separator'     => $thousand_separator,
259
+		'decimal_separator'       => $decimal_separator,
260
+		'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
261 261
 		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
262 262
 		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
263 263
 		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 		'batch_export_no_class'   => __( 'You must choose a method.', 'give' ),
286 286
 		'batch_export_no_reqs'    => __( 'Required fields not completed.', 'give' ),
287 287
 		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
288
-        'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
-    ) );
288
+		'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
+	) );
290 290
 
291 291
 	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
292 292
 		//call for new media manager
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 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
 
@@ -28,94 +28,94 @@  discard block
 block discarded – undo
28 28
 
29 29
 	global $give_options;
30 30
 
31
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
32
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
33
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
31
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
32
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
33
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
34 34
 
35 35
 	// Use minified libraries if SCRIPT_DEBUG is turned off
36
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
36
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
37 37
 
38 38
 	//Localize / PHP to AJAX vars
39
-	$localize_give_checkout = apply_filters( 'give_global_script_vars', array(
39
+	$localize_give_checkout = apply_filters('give_global_script_vars', array(
40 40
 		'ajaxurl'             => give_get_ajax_url(),
41
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
42
-		'currency_sign'       => give_currency_filter( '' ),
41
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
42
+		'currency_sign'       => give_currency_filter(''),
43 43
 		'currency_pos'        => give_get_currency_position(),
44
-		'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',',
45
-		'decimal_separator'   => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.',
46
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
47
-		'bad_minimum'         => __( 'The minimum donation amount for this form is', 'give' ),
48
-		'general_loading'     => __( 'Loading...', 'give' ),
49
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
44
+		'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',',
45
+		'decimal_separator'   => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.',
46
+		'no_gateway'          => __('Please select a payment method.', 'give'),
47
+		'bad_minimum'         => __('The minimum donation amount for this form is', 'give'),
48
+		'general_loading'     => __('Loading...', 'give'),
49
+		'purchase_loading'    => __('Please Wait...', 'give'),
50 50
 		'number_decimals'  => give_get_price_decimals(),
51 51
 		'give_version'        => GIVE_VERSION
52
-	) );
53
-	$localize_give_ajax     = apply_filters( 'give_global_ajax_vars', array(
52
+	));
53
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
54 54
 		'ajaxurl'          => give_get_ajax_url(),
55
-		'loading'          => __( 'Loading', 'give' ),
55
+		'loading'          => __('Loading', 'give'),
56 56
 		// General loading message
57
-		'select_option'    => __( 'Please select an option', 'give' ),
57
+		'select_option'    => __('Please select an option', 'give'),
58 58
 		// Variable pricing error with multi-purchase option enabled
59
-		'default_gateway'  => give_get_default_gateway( null ),
60
-		'permalinks'       => get_option( 'permalink_structure' ) ? '1' : '0',
59
+		'default_gateway'  => give_get_default_gateway(null),
60
+		'permalinks'       => get_option('permalink_structure') ? '1' : '0',
61 61
 		'number_decimals'  => give_get_price_decimals()
62
-	) );
62
+	));
63 63
 
64 64
 	//DEBUG is On
65
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
65
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
66 66
 
67
-		if ( give_is_cc_verify_enabled() ) {
68
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
69
-			wp_enqueue_script( 'give-cc-validator' );
67
+		if (give_is_cc_verify_enabled()) {
68
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
69
+			wp_enqueue_script('give-cc-validator');
70 70
 		}
71 71
 
72
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
73
-		wp_enqueue_script( 'give-float-labels' );
72
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
73
+		wp_enqueue_script('give-float-labels');
74 74
 
75
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
76
-		wp_enqueue_script( 'give-blockui' );
75
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
76
+		wp_enqueue_script('give-blockui');
77 77
 
78
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
79
-		wp_enqueue_script( 'give-qtip' );
78
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
79
+		wp_enqueue_script('give-qtip');
80 80
 
81
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
82
-		wp_enqueue_script( 'give-accounting' );
81
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
82
+		wp_enqueue_script('give-accounting');
83 83
 
84
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
85
-		wp_enqueue_script( 'give-magnific' );
84
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
85
+		wp_enqueue_script('give-magnific');
86 86
 
87
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
88
-		wp_enqueue_script( 'give-checkout-global' );
87
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
88
+		wp_enqueue_script('give-checkout-global');
89 89
 
90 90
 		//General scripts
91
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
92
-		wp_enqueue_script( 'give-scripts' );
91
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
92
+		wp_enqueue_script('give-scripts');
93 93
 
94 94
 		// Load AJAX scripts, if enabled
95
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
96
-		wp_enqueue_script( 'give-ajax' );
95
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
96
+		wp_enqueue_script('give-ajax');
97 97
 
98 98
 		//Localize / Pass AJAX vars from PHP
99
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout );
100
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
99
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout);
100
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
101 101
 
102 102
 
103 103
 	} else {
104 104
 
105 105
 		//DEBUG is OFF (one JS file to rule them all!)
106
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
107
-		wp_enqueue_script( 'give' );
106
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
107
+		wp_enqueue_script('give');
108 108
 
109 109
 		//Localize / Pass AJAX vars from PHP
110
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout );
111
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
110
+		wp_localize_script('give', 'give_global_vars', $localize_give_checkout);
111
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
112 112
 
113 113
 	}
114 114
 
115 115
 
116 116
 }
117 117
 
118
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
118
+add_action('wp_enqueue_scripts', 'give_load_scripts');
119 119
 
120 120
 /**
121 121
  * Register Styles
@@ -127,47 +127,47 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_register_styles() {
129 129
 
130
-	if ( give_get_option( 'disable_css', false ) ) {
130
+	if (give_get_option('disable_css', false)) {
131 131
 		return;
132 132
 	}
133 133
 
134 134
 	// Use minified libraries if SCRIPT_DEBUG is turned off
135
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
135
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
136 136
 
137
-	$file          = 'give' . $suffix . '.css';
137
+	$file          = 'give'.$suffix.'.css';
138 138
 	$templates_dir = give_get_theme_template_dir_name();
139 139
 
140
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
141
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css';
142
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
143
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css';
144
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
140
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
141
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css';
142
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
143
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css';
144
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
145 145
 
146 146
 	// Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory
147 147
 	// Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled.
148 148
 	// This allows users to copy just give.css to their theme
149
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
150
-		if ( ! empty( $nonmin ) ) {
151
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css';
149
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
150
+		if ( ! empty($nonmin)) {
151
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css';
152 152
 		} else {
153
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
153
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
154 154
 		}
155
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
156
-		if ( ! empty( $nonmin ) ) {
157
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css';
155
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
156
+		if ( ! empty($nonmin)) {
157
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css';
158 158
 		} else {
159
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
159
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
160 160
 		}
161
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
162
-		$url = trailingslashit( give_get_templates_url() ) . $file;
161
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
162
+		$url = trailingslashit(give_get_templates_url()).$file;
163 163
 	}
164 164
 
165
-	wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' );
166
-	wp_enqueue_style( 'give-styles' );
165
+	wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all');
166
+	wp_enqueue_style('give-styles');
167 167
 
168 168
 }
169 169
 
170
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
170
+add_action('wp_enqueue_scripts', 'give_register_styles');
171 171
 
172 172
 /**
173 173
  * Load Admin Scripts
@@ -183,119 +183,119 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return void
185 185
  */
186
-function give_load_admin_scripts( $hook ) {
186
+function give_load_admin_scripts($hook) {
187 187
 
188 188
 	global $wp_version, $post, $post_type, $give_options;
189 189
 
190 190
 	//Directories of assets
191
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
192
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
193
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
191
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
192
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
193
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
194 194
 
195 195
 	// Use minified libraries if SCRIPT_DEBUG is turned off
196
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
196
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
197 197
 
198 198
 	//Global Admin:
199
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
200
-	wp_enqueue_style( 'give-admin-bar-notification' );
199
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
200
+	wp_enqueue_style('give-admin-bar-notification');
201 201
 
202 202
 	//Give Admin Only:
203
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
203
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
204 204
 		return;
205 205
 	}
206 206
 
207 207
 	//CSS
208
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
209
-	wp_enqueue_style( 'jquery-ui-css' );
210
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION );
211
-	wp_enqueue_style( 'give-admin' );
212
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
213
-	wp_enqueue_style( 'jquery-chosen' );
214
-	wp_enqueue_style( 'thickbox' );
208
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
209
+	wp_enqueue_style('jquery-ui-css');
210
+	wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION);
211
+	wp_enqueue_style('give-admin');
212
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
213
+	wp_enqueue_style('jquery-chosen');
214
+	wp_enqueue_style('thickbox');
215 215
 
216 216
 	//JS
217
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
218
-	wp_enqueue_script( 'jquery-chosen' );
217
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
218
+	wp_enqueue_script('jquery-chosen');
219 219
 
220
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
221
-	wp_enqueue_script( 'give-admin-scripts' );
220
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
221
+	wp_enqueue_script('give-admin-scripts');
222 222
 
223
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
224
-	wp_enqueue_script( 'jquery-flot' );
223
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
224
+	wp_enqueue_script('jquery-flot');
225 225
 
226
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
227
-	wp_enqueue_script( 'give-qtip' );
226
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
227
+	wp_enqueue_script('give-qtip');
228 228
 
229
-	wp_enqueue_script( 'jquery-ui-datepicker' );
230
-	wp_enqueue_script( 'thickbox' );
229
+	wp_enqueue_script('jquery-ui-datepicker');
230
+	wp_enqueue_script('thickbox');
231 231
 
232 232
 	// Forms CPT Script.
233
-	if ( $post_type === 'give_forms' ) {
234
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
235
-		wp_enqueue_script( 'give-admin-forms-scripts' );
233
+	if ($post_type === 'give_forms') {
234
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
235
+		wp_enqueue_script('give-admin-forms-scripts');
236 236
 	}
237 237
 
238 238
 	// Report Scripts.
239
-	if ( isset($_GET['page']) && $_GET['page'] == 'give-reports'  ) {
240
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
241
-		wp_enqueue_script( 'give-accounting' );
239
+	if (isset($_GET['page']) && $_GET['page'] == 'give-reports') {
240
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
241
+		wp_enqueue_script('give-accounting');
242 242
 	}
243 243
 
244 244
     //Settings Scripts
245
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
246
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
247
-        wp_enqueue_script( 'give-admin-settings-scripts' );
245
+    if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
246
+        wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
247
+        wp_enqueue_script('give-admin-settings-scripts');
248 248
     }
249 249
 
250 250
     // Price Separators.
251
-    $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
252
-    $decimal_separator  = isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.';
251
+    $thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',';
252
+    $decimal_separator  = isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.';
253 253
 
254 254
     //Localize strings & variables for JS
255
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
256
-		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
255
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
256
+		'post_id'                 => isset($post->ID) ? $post->ID : null,
257 257
 		'give_version'            => GIVE_VERSION,
258 258
         'thousands_separator'     => $thousand_separator,
259 259
         'decimal_separator'       => $decimal_separator,
260
-        'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
261
-		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
262
-		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
263
-		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
264
-		'regenerate_api_key'      => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
265
-		'resend_receipt'          => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
266
-		'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor.', 'give' ),
260
+        'quick_edit_warning'      => __('Sorry, not available for variable priced forms.', 'give'),
261
+		'delete_payment'          => __('Are you sure you wish to delete this payment?', 'give'),
262
+		'delete_payment_note'     => __('Are you sure you wish to delete this note?', 'give'),
263
+		'revoke_api_key'          => __('Are you sure you wish to revoke this API key?', 'give'),
264
+		'regenerate_api_key'      => __('Are you sure you wish to regenerate this API key?', 'give'),
265
+		'resend_receipt'          => __('Are you sure you wish to resend the donation receipt?', 'give'),
266
+		'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor.', 'give'),
267 267
 		/* translators: %s: form singular label */
268
-		'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ),
269
-		'one_price_min'           => __( 'You must have at least one price.', 'give' ),
270
-		'one_file_min'            => __( 'You must have at least one file.', 'give' ),
271
-		'one_field_min'           => __( 'You must have at least one field.', 'give' ),
268
+		'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()),
269
+		'one_price_min'           => __('You must have at least one price.', 'give'),
270
+		'one_file_min'            => __('You must have at least one file.', 'give'),
271
+		'one_field_min'           => __('You must have at least one field.', 'give'),
272 272
 		/* translators: %s: form singular label */
273
-		'one_option'              => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ),
273
+		'one_option'              => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()),
274 274
 		/* translators: %s: form plural label */
275
-		'one_or_more_option'      => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ),
276
-		'numeric_item_price'      => __( 'Item price must be numeric.', 'give' ),
277
-		'numeric_quantity'        => __( 'Quantity must be numeric.', 'give' ),
278
-		'currency_sign'           => give_currency_filter( '' ),
279
-		'currency_pos'            => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
275
+		'one_or_more_option'      => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()),
276
+		'numeric_item_price'      => __('Item price must be numeric.', 'give'),
277
+		'numeric_quantity'        => __('Quantity must be numeric.', 'give'),
278
+		'currency_sign'           => give_currency_filter(''),
279
+		'currency_pos'            => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
280 280
 		'currency_decimals'       => give_currency_decimal_filter(),
281
-		'new_media_ui'            => apply_filters( 'give_use_35_media_ui', 1 ),
282
-		'remove_text'             => __( 'Remove', 'give' ),
281
+		'new_media_ui'            => apply_filters('give_use_35_media_ui', 1),
282
+		'remove_text'             => __('Remove', 'give'),
283 283
 		/* translators: %s: form plural label */
284
-		'type_to_search'          => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ),
285
-		'batch_export_no_class'   => __( 'You must choose a method.', 'give' ),
286
-		'batch_export_no_reqs'    => __( 'Required fields not completed.', 'give' ),
287
-		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
288
-        'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator )
289
-    ) );
290
-
291
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
284
+		'type_to_search'          => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()),
285
+		'batch_export_no_class'   => __('You must choose a method.', 'give'),
286
+		'batch_export_no_reqs'    => __('Required fields not completed.', 'give'),
287
+		'reset_stats_warn'        => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
288
+        'price_format_guide'      => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator)
289
+    ));
290
+
291
+	if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
292 292
 		//call for new media manager
293 293
 		wp_enqueue_media();
294 294
 	}
295 295
 
296 296
 }
297 297
 
298
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
298
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
299 299
 
300 300
 /**
301 301
  * Admin Give Icon
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
 	?>
313 313
 	<style type="text/css" media="screen">
314 314
 
315
-		<?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?>
315
+		<?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?>
316 316
 		@font-face {
317 317
 			font-family: 'give-icomoon';
318
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
319
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
320
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
321
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
322
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
318
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
319
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
320
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
321
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
322
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
323 323
 			font-weight: normal;
324 324
 			font-style: normal;
325 325
 		}
@@ -338,4 +338,4 @@  discard block
 block discarded – undo
338 338
 	<?php
339 339
 }
340 340
 
341
-add_action( 'admin_head', 'give_admin_icon' );
341
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo __( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		echo __( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
 function give_test_ajax_works() {
26 26
 
27 27
 	// Check if the Airplane Mode plugin is installed
28
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
28
+	if (class_exists('Airplane_Mode_Core')) {
29 29
 
30 30
 		$airplane = Airplane_Mode_Core::getInstance();
31 31
 
32
-		if ( method_exists( $airplane, 'enabled' ) ) {
32
+		if (method_exists($airplane, 'enabled')) {
33 33
 
34
-			if ( $airplane->enabled() ) {
34
+			if ($airplane->enabled()) {
35 35
 				return true;
36 36
 			}
37 37
 
38 38
 		} else {
39 39
 
40
-			if ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( get_transient( '_give_ajax_works' ) ) {
48
+	if (get_transient('_give_ajax_works')) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		)
58 58
 	);
59 59
 
60
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
61 61
 	$works = true;
62 62
 
63
-	if ( is_wp_error( $ajax ) ) {
63
+	if (is_wp_error($ajax)) {
64 64
 
65 65
 		$works = false;
66 66
 
67 67
 	} else {
68 68
 
69
-		if ( empty( $ajax['response'] ) ) {
69
+		if (empty($ajax['response'])) {
70 70
 			$works = false;
71 71
 		}
72 72
 
73
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
73
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
74 74
 			$works = false;
75 75
 		}
76 76
 
77
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
77
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
78 78
 			$works = false;
79 79
 		}
80 80
 
81
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
81
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
82 82
 			$works = false;
83 83
 		}
84 84
 
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
87
+	if ($works) {
88
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  * @return string
100 100
  */
101 101
 function give_get_ajax_url() {
102
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
102
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
103 103
 
104 104
 	$current_url = give_get_current_page_url();
105
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
105
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
106 106
 
107
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
108
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
107
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
108
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_ajax_url', $ajax_url );
111
+	return apply_filters('give_ajax_url', $ajax_url);
112 112
 }
113 113
 
114 114
 /**
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
  * @return void
119 119
  */
120 120
 function give_load_checkout_login_fields() {
121
-	do_action( 'give_purchase_form_login_fields' );
121
+	do_action('give_purchase_form_login_fields');
122 122
 	give_die();
123 123
 }
124 124
 
125
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
125
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
126 126
 
127 127
 /**
128 128
  * Load Checkout Fields
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
  * @return void
132 132
  */
133 133
 function give_load_checkout_fields() {
134
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
134
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
135 135
 
136 136
 	ob_start();
137 137
 
138
-	do_action( 'give_purchase_form_register_login_fields', $form_id );
138
+	do_action('give_purchase_form_register_login_fields', $form_id);
139 139
 
140 140
 	$fields = ob_get_clean();
141 141
 
142
-	wp_send_json( array(
143
-		'fields' => wp_json_encode( $fields ),
144
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
145
-	) );
142
+	wp_send_json(array(
143
+		'fields' => wp_json_encode($fields),
144
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
145
+	));
146 146
 }
147 147
 
148
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
149
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
148
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
149
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
150 150
 
151 151
 /**
152 152
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
  * @return void
156 156
  */
157 157
 function give_ajax_get_form_title() {
158
-	if ( isset( $_POST['form_id'] ) ) {
159
-		$title = get_the_title( $_POST['form_id'] );
160
-		if ( $title ) {
158
+	if (isset($_POST['form_id'])) {
159
+		$title = get_the_title($_POST['form_id']);
160
+		if ($title) {
161 161
 			echo $title;
162 162
 		} else {
163 163
 			echo 'fail';
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	give_die();
167 167
 }
168 168
 
169
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
170
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
169
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
170
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
171 171
 
172 172
 /**
173 173
  * Retrieve a states drop down
@@ -177,23 +177,23 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_ajax_get_states_field() {
179 179
 
180
-	if ( empty( $_POST['country'] ) ) {
180
+	if (empty($_POST['country'])) {
181 181
 		$_POST['country'] = give_get_country();
182 182
 	}
183
-	$states = give_get_states( $_POST['country'] );
183
+	$states = give_get_states($_POST['country']);
184 184
 
185
-	if ( ! empty( $states ) ) {
185
+	if ( ! empty($states)) {
186 186
 
187 187
 		$args = array(
188 188
 			'name'             => $_POST['field_name'],
189 189
 			'id'               => $_POST['field_name'],
190
-			'class'            => $_POST['field_name'] . '  give-select',
191
-			'options'          => give_get_states( $_POST['country'] ),
190
+			'class'            => $_POST['field_name'].'  give-select',
191
+			'options'          => give_get_states($_POST['country']),
192 192
 			'show_option_all'  => false,
193 193
 			'show_option_none' => false
194 194
 		);
195 195
 
196
-		$response = Give()->html->select( $args );
196
+		$response = Give()->html->select($args);
197 197
 
198 198
 	} else {
199 199
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	give_die();
206 206
 }
207 207
 
208
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
209
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
208
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
209
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
210 210
 
211 211
 /**
212 212
  * Retrieve a states drop down
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
 function give_ajax_form_search() {
218 218
 	global $wpdb;
219 219
 
220
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
220
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
221 221
 	$results = array();
222
-	if ( current_user_can( 'edit_give_forms' ) ) {
223
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
222
+	if (current_user_can('edit_give_forms')) {
223
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
224 224
 	} else {
225
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
225
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
226 226
 	}
227 227
 
228
-	if ( $items ) {
228
+	if ($items) {
229 229
 
230
-		foreach ( $items as $item ) {
230
+		foreach ($items as $item) {
231 231
 
232 232
 			$results[] = array(
233 233
 				'id'   => $item->ID,
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$items[] = array(
241 241
 			'id'   => 0,
242
-			'name' => __( 'No results found', 'give' )
242
+			'name' => __('No results found', 'give')
243 243
 		);
244 244
 
245 245
 	}
246 246
 
247
-	echo json_encode( $results );
247
+	echo json_encode($results);
248 248
 
249 249
 	give_die();
250 250
 }
251 251
 
252
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
253
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
252
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
253
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
254 254
 
255 255
 /**
256 256
  * Search the donors database via Ajax
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 function give_ajax_donor_search() {
262 262
 	global $wpdb;
263 263
 
264
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
264
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
265 265
 	$results = array();
266
-	if ( ! current_user_can( 'view_give_reports' ) ) {
266
+	if ( ! current_user_can('view_give_reports')) {
267 267
 		$donors = array();
268 268
 	} else {
269
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
269
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
270 270
 	}
271 271
 
272
-	if ( $donors ) {
272
+	if ($donors) {
273 273
 
274
-		foreach ( $donors as $donor ) {
274
+		foreach ($donors as $donor) {
275 275
 
276 276
 			$results[] = array(
277 277
 				'id'   => $donor->id,
278
-				'name' => $donor->name . '(' . $donor->email . ')'
278
+				'name' => $donor->name.'('.$donor->email.')'
279 279
 			);
280 280
 		}
281 281
 
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$donors[] = array(
285 285
 			'id'   => 0,
286
-			'name' => __( 'No results found', 'give' )
286
+			'name' => __('No results found', 'give')
287 287
 		);
288 288
 
289 289
 	}
290 290
 
291
-	echo json_encode( $results );
291
+	echo json_encode($results);
292 292
 
293 293
 	give_die();
294 294
 }
295 295
 
296
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
296
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
297 297
 
298 298
 
299 299
 /**
@@ -304,42 +304,42 @@  discard block
 block discarded – undo
304 304
  */
305 305
 function give_ajax_search_users() {
306 306
 
307
-	if ( current_user_can( 'manage_give_settings' ) ) {
307
+	if (current_user_can('manage_give_settings')) {
308 308
 
309
-		$search_query = trim( $_POST['user_name'] );
310
-		$exclude      = trim( $_POST['exclude'] );
309
+		$search_query = trim($_POST['user_name']);
310
+		$exclude      = trim($_POST['exclude']);
311 311
 
312 312
 		$get_users_args = array(
313 313
 			'number' => 9999,
314
-			'search' => $search_query . '*'
314
+			'search' => $search_query.'*'
315 315
 		);
316 316
 
317
-		if ( ! empty( $exclude ) ) {
318
-			$exclude_array             = explode( ',', $exclude );
317
+		if ( ! empty($exclude)) {
318
+			$exclude_array             = explode(',', $exclude);
319 319
 			$get_users_args['exclude'] = $exclude_array;
320 320
 		}
321 321
 
322
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
322
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
323 323
 
324
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
324
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
325 325
 
326 326
 		$user_list = '<ul>';
327
-		if ( $found_users ) {
328
-			foreach ( $found_users as $user ) {
329
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
327
+		if ($found_users) {
328
+			foreach ($found_users as $user) {
329
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
330 330
 			}
331 331
 		} else {
332
-			$user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>';
332
+			$user_list .= '<li>'.__('No users found', 'give').'</li>';
333 333
 		}
334 334
 		$user_list .= '</ul>';
335 335
 
336
-		echo json_encode( array( 'results' => $user_list ) );
336
+		echo json_encode(array('results' => $user_list));
337 337
 
338 338
 	}
339 339
 	die();
340 340
 }
341 341
 
342
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
342
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
343 343
 
344 344
 
345 345
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  */
351 351
 function give_check_for_form_price_variations() {
352 352
 
353
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
354
-		die( '-1' );
353
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
354
+		die('-1');
355 355
 	}
356 356
 
357
-	$form_id = intval( $_POST['form_id'] );
358
-	$form    = get_post( $form_id );
357
+	$form_id = intval($_POST['form_id']);
358
+	$form    = get_post($form_id);
359 359
 
360
-	if ( 'give_forms' != $form->post_type ) {
361
-		die( '-2' );
360
+	if ('give_forms' != $form->post_type) {
361
+		die('-2');
362 362
 	}
363 363
 
364
-	if ( give_has_variable_prices( $form_id ) ) {
365
-		$variable_prices = give_get_variable_prices( $form_id );
364
+	if (give_has_variable_prices($form_id)) {
365
+		$variable_prices = give_get_variable_prices($form_id);
366 366
 
367
-		if ( $variable_prices ) {
367
+		if ($variable_prices) {
368 368
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
369 369
 
370
-			if ( isset( $_POST['all_prices'] ) ) {
371
-				$ajax_response .= '<option value="">' . __( 'All Levels', 'give' ) . '</option>';
370
+			if (isset($_POST['all_prices'])) {
371
+				$ajax_response .= '<option value="">'.__('All Levels', 'give').'</option>';
372 372
 			}
373 373
 
374
-			foreach ( $variable_prices as $key => $price ) {
374
+			foreach ($variable_prices as $key => $price) {
375 375
 
376
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
376
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
377 377
 				
378
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
378
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
379 379
 			}
380 380
 			$ajax_response .= '</select>';
381 381
 			echo $ajax_response;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	give_die();
387 387
 }
388 388
 
389
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
389
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
390 390
 
391 391
 
392 392
 /**
@@ -396,30 +396,30 @@  discard block
 block discarded – undo
396 396
  * @return void
397 397
  */
398 398
 function give_check_for_form_price_variations_html() {
399
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
400
-		die( '-1' );
399
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
400
+		die('-1');
401 401
 	}
402 402
 
403
-	$form_id = intval( $_POST['form_id'] );
404
-	$payment_id = intval( $_POST['payment_id'] );
405
-	$form    = get_post( $form_id );
403
+	$form_id = intval($_POST['form_id']);
404
+	$payment_id = intval($_POST['payment_id']);
405
+	$form    = get_post($form_id);
406 406
 
407
-	if ( 'give_forms' != $form->post_type ) {
408
-		die( '-2' );
407
+	if ('give_forms' != $form->post_type) {
408
+		die('-2');
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo __( 'n/a', 'give' );
411
+    if ( ! give_has_variable_prices($form_id)) {
412
+        echo __('n/a', 'give');
413 413
     } else {
414 414
         // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
415
+        $payment = new Give_Payment($payment_id);
416 416
 
417 417
         // Payment meta.
418 418
         $payment_meta = $payment->get_meta();
419 419
 
420 420
 
421 421
         // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
422
+        $variable_price_dropdown_option = array(
423 423
             'id'                => $form_id,
424 424
             'name'              => 'give-variable-price',
425 425
             'chosen'            => true,
@@ -428,10 +428,10 @@  discard block
 block discarded – undo
428 428
         );
429 429
 
430 430
         // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
431
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
432 432
     }
433 433
 
434 434
     give_die();
435 435
 }
436 436
 
437
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
437
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/class-give-customer.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
 
515 515
 	/**
516 516
 	 * Decrease/Increase a customer's lifetime value
517
-     *
518
-     * This function will update donation stat on basis of current amount and new amount donation difference.
519
-     * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
520
-     *
521
-     *
522
-     * @access public
517
+	 *
518
+	 * This function will update donation stat on basis of current amount and new amount donation difference.
519
+	 * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
520
+	 *
521
+	 *
522
+	 * @access public
523 523
 	 * @since  1.0
524 524
 	 *
525 525
 	 * @param  float $curr_amount Current Donation amount
@@ -528,28 +528,28 @@  discard block
 block discarded – undo
528 528
 	 * @return mixed              If successful, the new donation stat value, otherwise false
529 529
 	 */
530 530
 	public function update_donation_value( $curr_amount, $new_amount ) {
531
-        /**
532
-         * Payment total difference value can be:
533
-         *  zero   (in case amount not change)
534
-         *  or -ve (in case amount decrease)
535
-         *  or +ve (in case amount increase)
536
-         */
537
-        $payment_total_diff = $new_amount - $curr_amount;
538
-
539
-        // We do not need to update donation stat if donation did not change.
540
-        if( ! $payment_total_diff ) {
541
-            return false;
542
-        }
543
-
544
-
545
-        if( $payment_total_diff > 0 ) {
546
-            $this->increase_value( $payment_total_diff );
547
-        }else{
548
-            // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549
-            $this->decrease_value( -$payment_total_diff );
550
-        }
551
-
552
-        return $this->purchase_value;
531
+		/**
532
+		 * Payment total difference value can be:
533
+		 *  zero   (in case amount not change)
534
+		 *  or -ve (in case amount decrease)
535
+		 *  or +ve (in case amount increase)
536
+		 */
537
+		$payment_total_diff = $new_amount - $curr_amount;
538
+
539
+		// We do not need to update donation stat if donation did not change.
540
+		if( ! $payment_total_diff ) {
541
+			return false;
542
+		}
543
+
544
+
545
+		if( $payment_total_diff > 0 ) {
546
+			$this->increase_value( $payment_total_diff );
547
+		}else{
548
+			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549
+			$this->decrease_value( -$payment_total_diff );
550
+		}
551
+
552
+		return $this->purchase_value;
553 553
 	}
554 554
 
555 555
 	/**
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 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
 
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 	 * @param bool $_id_or_email
98 98
 	 * @param bool $by_user_id
99 99
 	 */
100
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
100
+	public function __construct($_id_or_email = false, $by_user_id = false) {
101 101
 
102 102
 		$this->db = new Give_DB_Customers;
103 103
 
104
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
104
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
105 105
 			return false;
106 106
 		}
107 107
 
108
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
108
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
109 109
 
110
-		if ( is_numeric( $_id_or_email ) ) {
110
+		if (is_numeric($_id_or_email)) {
111 111
 			$field = $by_user_id ? 'user_id' : 'id';
112 112
 		} else {
113 113
 			$field = 'email';
114 114
 		}
115 115
 
116
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
116
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
117 117
 
118
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
118
+		if (empty($customer) || ! is_object($customer)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$this->setup_customer( $customer );
122
+		$this->setup_customer($customer);
123 123
 
124 124
 	}
125 125
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return bool             If the setup was successful or not
134 134
 	 */
135
-	private function setup_customer( $customer ) {
135
+	private function setup_customer($customer) {
136 136
 
137
-		if ( ! is_object( $customer ) ) {
137
+		if ( ! is_object($customer)) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		foreach ( $customer as $key => $value ) {
141
+		foreach ($customer as $key => $value) {
142 142
 
143
-			switch ( $key ) {
143
+			switch ($key) {
144 144
 
145 145
 				case 'notes':
146 146
 					$this->$key = $this->get_notes();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		// Customer ID and email are the only things that are necessary, make sure they exist
158
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
158
+		if ( ! empty($this->id) && ! empty($this->email)) {
159 159
 			return true;
160 160
 		}
161 161
 
@@ -168,16 +168,16 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @since 1.0
170 170
 	 */
171
-	public function __get( $key ) {
171
+	public function __get($key) {
172 172
 
173
-		if ( method_exists( $this, 'get_' . $key ) ) {
173
+		if (method_exists($this, 'get_'.$key)) {
174 174
 
175
-			return call_user_func( array( $this, 'get_' . $key ) );
175
+			return call_user_func(array($this, 'get_'.$key));
176 176
 
177 177
 		} else {
178 178
 
179 179
 			/* translators: %s: property key */
180
-			return new WP_Error( 'give-customer-invalid-property', sprintf( __( 'Can\'t get property %s.', 'give' ), $key ) );
180
+			return new WP_Error('give-customer-invalid-property', sprintf(__('Can\'t get property %s.', 'give'), $key));
181 181
 
182 182
 		}
183 183
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return mixed        False if not a valid creation, Customer ID if user is found or valid creation
194 194
 	 */
195
-	public function create( $data = array() ) {
195
+	public function create($data = array()) {
196 196
 
197
-		if ( $this->id != 0 || empty( $data ) ) {
197
+		if ($this->id != 0 || empty($data)) {
198 198
 			return false;
199 199
 		}
200 200
 
@@ -202,34 +202,34 @@  discard block
 block discarded – undo
202 202
 			'payment_ids' => ''
203 203
 		);
204 204
 
205
-		$args = wp_parse_args( $data, $defaults );
206
-		$args = $this->sanitize_columns( $args );
205
+		$args = wp_parse_args($data, $defaults);
206
+		$args = $this->sanitize_columns($args);
207 207
 
208
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
208
+		if (empty($args['email']) || ! is_email($args['email'])) {
209 209
 			return false;
210 210
 		}
211 211
 
212
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
213
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
212
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
213
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
214 214
 		}
215 215
 
216
-		do_action( 'give_customer_pre_create', $args );
216
+		do_action('give_customer_pre_create', $args);
217 217
 
218 218
 		$created = false;
219 219
 
220 220
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
221
-		if ( $this->db->add( $data ) ) {
221
+		if ($this->db->add($data)) {
222 222
 
223 223
 			// We've successfully added/updated the customer, reset the class vars with the new data
224
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
224
+			$customer = $this->db->get_customer_by('email', $args['email']);
225 225
 
226 226
 			// Setup the customer data with the values from DB
227
-			$this->setup_customer( $customer );
227
+			$this->setup_customer($customer);
228 228
 
229 229
 			$created = $this->id;
230 230
 		}
231 231
 
232
-		do_action( 'give_customer_post_create', $created, $args );
232
+		do_action('give_customer_post_create', $created, $args);
233 233
 
234 234
 		return $created;
235 235
 
@@ -244,27 +244,27 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return bool         If the update was successful or not
246 246
 	 */
247
-	public function update( $data = array() ) {
247
+	public function update($data = array()) {
248 248
 
249
-		if ( empty( $data ) ) {
249
+		if (empty($data)) {
250 250
 			return false;
251 251
 		}
252 252
 
253
-		$data = $this->sanitize_columns( $data );
253
+		$data = $this->sanitize_columns($data);
254 254
 
255
-		do_action( 'give_customer_pre_update', $this->id, $data );
255
+		do_action('give_customer_pre_update', $this->id, $data);
256 256
 
257 257
 		$updated = false;
258 258
 
259
-		if ( $this->db->update( $this->id, $data ) ) {
259
+		if ($this->db->update($this->id, $data)) {
260 260
 
261
-			$customer = $this->db->get_customer_by( 'id', $this->id );
262
-			$this->setup_customer( $customer );
261
+			$customer = $this->db->get_customer_by('id', $this->id);
262
+			$this->setup_customer($customer);
263 263
 
264 264
 			$updated = true;
265 265
 		}
266 266
 
267
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
267
+		do_action('give_customer_post_update', $updated, $this->id, $data);
268 268
 
269 269
 		return $updated;
270 270
 	}
@@ -280,44 +280,44 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool            If the attachment was successfuly
282 282
 	 */
283
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
283
+	public function attach_payment($payment_id = 0, $update_stats = true) {
284 284
 
285
-		if ( empty( $payment_id ) ) {
285
+		if (empty($payment_id)) {
286 286
 			return false;
287 287
 		}
288 288
 
289
-		if ( empty( $this->payment_ids ) ) {
289
+		if (empty($this->payment_ids)) {
290 290
 
291 291
 			$new_payment_ids = $payment_id;
292 292
 
293 293
 		} else {
294 294
 
295
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
295
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
296 296
 
297
-			if ( in_array( $payment_id, $payment_ids ) ) {
297
+			if (in_array($payment_id, $payment_ids)) {
298 298
 				$update_stats = false;
299 299
 			}
300 300
 
301 301
 			$payment_ids[] = $payment_id;
302 302
 
303
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
303
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
304 304
 
305 305
 		}
306 306
 
307
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
307
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
308 308
 
309
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
309
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
310 310
 
311
-		if ( $payment_added ) {
311
+		if ($payment_added) {
312 312
 
313 313
 			$this->payment_ids = $new_payment_ids;
314 314
 
315 315
 			// We added this payment successfully, increment the stats
316
-			if ( $update_stats ) {
317
-				$payment_amount = give_get_payment_amount( $payment_id );
316
+			if ($update_stats) {
317
+				$payment_amount = give_get_payment_amount($payment_id);
318 318
 
319
-				if ( ! empty( $payment_amount ) ) {
320
-					$this->increase_value( $payment_amount );
319
+				if ( ! empty($payment_amount)) {
320
+					$this->increase_value($payment_amount);
321 321
 				}
322 322
 
323 323
 				$this->increase_purchase_count();
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 		}
327 327
 
328
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
328
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
329 329
 
330 330
 		return $payment_added;
331 331
 	}
@@ -341,50 +341,50 @@  discard block
 block discarded – undo
341 341
 	 *
342 342
 	 * @return boolean             If the removal was successful
343 343
 	 */
344
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
344
+	public function remove_payment($payment_id = 0, $update_stats = true) {
345 345
 
346
-		if ( empty( $payment_id ) ) {
346
+		if (empty($payment_id)) {
347 347
 			return false;
348 348
 		}
349 349
 
350
-		$payment = new Give_Payment( $payment_id );
350
+		$payment = new Give_Payment($payment_id);
351 351
 
352
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
352
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
353 353
 			$update_stats = false;
354 354
 		}
355 355
 
356 356
 		$new_payment_ids = '';
357 357
 
358
-		if ( ! empty( $this->payment_ids ) ) {
358
+		if ( ! empty($this->payment_ids)) {
359 359
 
360
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
360
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
361 361
 
362
-			$pos = array_search( $payment_id, $payment_ids );
363
-			if ( false === $pos ) {
362
+			$pos = array_search($payment_id, $payment_ids);
363
+			if (false === $pos) {
364 364
 				return false;
365 365
 			}
366 366
 
367
-			unset( $payment_ids[ $pos ] );
368
-			$payment_ids = array_filter( $payment_ids );
367
+			unset($payment_ids[$pos]);
368
+			$payment_ids = array_filter($payment_ids);
369 369
 
370
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
370
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
371 371
 
372 372
 		}
373 373
 
374
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
374
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
375 375
 
376
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
376
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
377 377
 
378
-		if ( $payment_removed ) {
378
+		if ($payment_removed) {
379 379
 
380 380
 			$this->payment_ids = $new_payment_ids;
381 381
 
382
-			if ( $update_stats ) {
382
+			if ($update_stats) {
383 383
 				// We removed this payment successfully, decrement the stats
384
-				$payment_amount = give_get_payment_amount( $payment_id );
384
+				$payment_amount = give_get_payment_amount($payment_id);
385 385
 
386
-				if ( ! empty( $payment_amount ) ) {
387
-					$this->decrease_value( $payment_amount );
386
+				if ( ! empty($payment_amount)) {
387
+					$this->decrease_value($payment_amount);
388 388
 				}
389 389
 
390 390
 				$this->decrease_purchase_count();
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 		}
394 394
 
395
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
395
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
396 396
 
397 397
 		return $payment_removed;
398 398
 
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 	 *
408 408
 	 * @return int            The purchase count
409 409
 	 */
410
-	public function increase_purchase_count( $count = 1 ) {
410
+	public function increase_purchase_count($count = 1) {
411 411
 
412 412
 		// Make sure it's numeric and not negative
413
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
413
+		if ( ! is_numeric($count) || $count != absint($count)) {
414 414
 			return false;
415 415
 		}
416 416
 
417 417
 		$new_total = (int) $this->purchase_count + (int) $count;
418 418
 
419
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
419
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
420 420
 
421
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
421
+		if ($this->update(array('purchase_count' => $new_total))) {
422 422
 			$this->purchase_count = $new_total;
423 423
 		}
424 424
 
425
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
425
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
426 426
 
427 427
 		return $this->purchase_count;
428 428
 	}
@@ -436,26 +436,26 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @return mixed          If successful, the new count, otherwise false
438 438
 	 */
439
-	public function decrease_purchase_count( $count = 1 ) {
439
+	public function decrease_purchase_count($count = 1) {
440 440
 
441 441
 		// Make sure it's numeric and not negative
442
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
442
+		if ( ! is_numeric($count) || $count != absint($count)) {
443 443
 			return false;
444 444
 		}
445 445
 
446 446
 		$new_total = (int) $this->purchase_count - (int) $count;
447 447
 
448
-		if ( $new_total < 0 ) {
448
+		if ($new_total < 0) {
449 449
 			$new_total = 0;
450 450
 		}
451 451
 
452
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
452
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
453 453
 
454
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
454
+		if ($this->update(array('purchase_count' => $new_total))) {
455 455
 			$this->purchase_count = $new_total;
456 456
 		}
457 457
 
458
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
458
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
459 459
 
460 460
 		return $this->purchase_count;
461 461
 	}
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return mixed         If successful, the new value, otherwise false
471 471
 	 */
472
-	public function increase_value( $value = 0.00 ) {
472
+	public function increase_value($value = 0.00) {
473 473
 
474
-		$new_value = floatval( $this->purchase_value ) + $value;
474
+		$new_value = floatval($this->purchase_value) + $value;
475 475
 
476
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
476
+		do_action('give_customer_pre_increase_value', $value, $this->id);
477 477
 
478
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
478
+		if ($this->update(array('purchase_value' => $new_value))) {
479 479
 			$this->purchase_value = $new_value;
480 480
 		}
481 481
 
482
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
482
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
483 483
 
484 484
 		return $this->purchase_value;
485 485
 	}
@@ -493,21 +493,21 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return mixed         If successful, the new value, otherwise false
495 495
 	 */
496
-	public function decrease_value( $value = 0.00 ) {
496
+	public function decrease_value($value = 0.00) {
497 497
 
498
-		$new_value = floatval( $this->purchase_value ) - $value;
498
+		$new_value = floatval($this->purchase_value) - $value;
499 499
 
500
-		if ( $new_value < 0 ) {
500
+		if ($new_value < 0) {
501 501
 			$new_value = 0.00;
502 502
 		}
503 503
 
504
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
504
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
505 505
 
506
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
506
+		if ($this->update(array('purchase_value' => $new_value))) {
507 507
 			$this->purchase_value = $new_value;
508 508
 		}
509 509
 
510
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
510
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
511 511
 
512 512
 		return $this->purchase_value;
513 513
 	}
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return mixed              If successful, the new donation stat value, otherwise false
529 529
 	 */
530
-	public function update_donation_value( $curr_amount, $new_amount ) {
530
+	public function update_donation_value($curr_amount, $new_amount) {
531 531
         /**
532 532
          * Payment total difference value can be:
533 533
          *  zero   (in case amount not change)
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
         $payment_total_diff = $new_amount - $curr_amount;
538 538
 
539 539
         // We do not need to update donation stat if donation did not change.
540
-        if( ! $payment_total_diff ) {
540
+        if ( ! $payment_total_diff) {
541 541
             return false;
542 542
         }
543 543
 
544 544
 
545
-        if( $payment_total_diff > 0 ) {
546
-            $this->increase_value( $payment_total_diff );
547
-        }else{
545
+        if ($payment_total_diff > 0) {
546
+            $this->increase_value($payment_total_diff);
547
+        } else {
548 548
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549 549
             $this->decrease_value( -$payment_total_diff );
550 550
         }
@@ -562,15 +562,15 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return array           The notes requsted
564 564
 	 */
565
-	public function get_notes( $length = 20, $paged = 1 ) {
565
+	public function get_notes($length = 20, $paged = 1) {
566 566
 
567
-		$length = is_numeric( $length ) ? $length : 20;
568
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
567
+		$length = is_numeric($length) ? $length : 20;
568
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
569 569
 
570 570
 		$all_notes   = $this->get_raw_notes();
571
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
571
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
572 572
 
573
-		$desired_notes = array_slice( $notes_array, $offset, $length );
573
+		$desired_notes = array_slice($notes_array, $offset, $length);
574 574
 
575 575
 		return $desired_notes;
576 576
 
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 	public function get_notes_count() {
586 586
 
587 587
 		$all_notes   = $this->get_raw_notes();
588
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
588
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
589 589
 
590
-		return count( $notes_array );
590
+		return count($notes_array);
591 591
 
592 592
 	}
593 593
 
@@ -600,32 +600,32 @@  discard block
 block discarded – undo
600 600
 	 *
601 601
 	 * @return string|boolean The new note if added succesfully, false otherwise
602 602
 	 */
603
-	public function add_note( $note = '' ) {
603
+	public function add_note($note = '') {
604 604
 
605
-		$note = trim( $note );
606
-		if ( empty( $note ) ) {
605
+		$note = trim($note);
606
+		if (empty($note)) {
607 607
 			return false;
608 608
 		}
609 609
 
610 610
 		$notes = $this->get_raw_notes();
611 611
 
612
-		if ( empty( $notes ) ) {
612
+		if (empty($notes)) {
613 613
 			$notes = '';
614 614
 		}
615 615
 
616
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
617
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
618
-		$notes .= "\n\n" . $new_note;
616
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
617
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
618
+		$notes .= "\n\n".$new_note;
619 619
 
620
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
620
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
621 621
 
622
-		$updated = $this->update( array( 'notes' => $notes ) );
622
+		$updated = $this->update(array('notes' => $notes));
623 623
 
624
-		if ( $updated ) {
624
+		if ($updated) {
625 625
 			$this->notes = $this->get_notes();
626 626
 		}
627 627
 
628
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
628
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
629 629
 
630 630
 		// Return the formatted note, so we can test, as well as update any displays
631 631
 		return $new_note;
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	private function get_raw_notes() {
642 642
 
643
-		$all_notes = $this->db->get_column( 'notes', $this->id );
643
+		$all_notes = $this->db->get_column('notes', $this->id);
644 644
 
645 645
 		return $all_notes;
646 646
 
@@ -655,51 +655,51 @@  discard block
 block discarded – undo
655 655
 	 *
656 656
 	 * @return array       The sanitized data, based off column defaults
657 657
 	 */
658
-	private function sanitize_columns( $data ) {
658
+	private function sanitize_columns($data) {
659 659
 
660 660
 		$columns        = $this->db->get_columns();
661 661
 		$default_values = $this->db->get_column_defaults();
662 662
 
663
-		foreach ( $columns as $key => $type ) {
663
+		foreach ($columns as $key => $type) {
664 664
 
665 665
 			// Only sanitize data that we were provided
666
-			if ( ! array_key_exists( $key, $data ) ) {
666
+			if ( ! array_key_exists($key, $data)) {
667 667
 				continue;
668 668
 			}
669 669
 
670
-			switch ( $type ) {
670
+			switch ($type) {
671 671
 
672 672
 				case '%s':
673
-					if ( 'email' == $key ) {
674
-						$data[ $key ] = sanitize_email( $data[ $key ] );
675
-					} elseif ( 'notes' == $key ) {
676
-						$data[ $key ] = strip_tags( $data[ $key ] );
673
+					if ('email' == $key) {
674
+						$data[$key] = sanitize_email($data[$key]);
675
+					} elseif ('notes' == $key) {
676
+						$data[$key] = strip_tags($data[$key]);
677 677
 					} else {
678
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
678
+						$data[$key] = sanitize_text_field($data[$key]);
679 679
 					}
680 680
 					break;
681 681
 
682 682
 				case '%d':
683
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
684
-						$data[ $key ] = $default_values[ $key ];
683
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
684
+						$data[$key] = $default_values[$key];
685 685
 					} else {
686
-						$data[ $key ] = absint( $data[ $key ] );
686
+						$data[$key] = absint($data[$key]);
687 687
 					}
688 688
 					break;
689 689
 
690 690
 				case '%f':
691 691
 					// Convert what was given to a float
692
-					$value = floatval( $data[ $key ] );
692
+					$value = floatval($data[$key]);
693 693
 
694
-					if ( ! is_float( $value ) ) {
695
-						$data[ $key ] = $default_values[ $key ];
694
+					if ( ! is_float($value)) {
695
+						$data[$key] = $default_values[$key];
696 696
 					} else {
697
-						$data[ $key ] = $value;
697
+						$data[$key] = $value;
698 698
 					}
699 699
 					break;
700 700
 
701 701
 				default:
702
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
702
+					$data[$key] = sanitize_text_field($data[$key]);
703 703
 					break;
704 704
 
705 705
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -544,7 +544,7 @@
 block discarded – undo
544 544
 
545 545
         if( $payment_total_diff > 0 ) {
546 546
             $this->increase_value( $payment_total_diff );
547
-        }else{
547
+        } else{
548 548
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549 549
             $this->decrease_value( -$payment_total_diff );
550 550
         }
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
  * @uses  load_template()
52 52
  * @uses  get_template_part()
53 53
  */
54
-function give_get_template_part( $slug, $name = null, $load = true ) {
54
+function give_get_template_part($slug, $name = null, $load = true) {
55 55
 
56 56
 	// Execute code for this part
57
-	do_action( 'get_template_part_' . $slug, $slug, $name );
57
+	do_action('get_template_part_'.$slug, $slug, $name);
58 58
 
59 59
 	// Setup possible parts
60 60
 	$templates = array();
61
-	if ( isset( $name ) ) {
62
-		$templates[] = $slug . '-' . $name . '.php';
61
+	if (isset($name)) {
62
+		$templates[] = $slug.'-'.$name.'.php';
63 63
 	}
64
-	$templates[] = $slug . '.php';
64
+	$templates[] = $slug.'.php';
65 65
 
66 66
 	// Allow template parts to be filtered
67
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
67
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
68 68
 
69 69
 	// Return the part that is found
70
-	return give_locate_template( $templates, $load, false );
70
+	return give_locate_template($templates, $load, false);
71 71
 }
72 72
 
73 73
 /**
@@ -88,37 +88,37 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return string The template filename if one is located.
90 90
  */
91
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
91
+function give_locate_template($template_names, $load = false, $require_once = true) {
92 92
 	// No file found yet
93 93
 	$located = false;
94 94
 
95 95
 	// Try to find a template file
96
-	foreach ( (array) $template_names as $template_name ) {
96
+	foreach ((array) $template_names as $template_name) {
97 97
 
98 98
 		// Continue if template is empty
99
-		if ( empty( $template_name ) ) {
99
+		if (empty($template_name)) {
100 100
 			continue;
101 101
 		}
102 102
 
103 103
 		// Trim off any slashes from the template name
104
-		$template_name = ltrim( $template_name, '/' );
104
+		$template_name = ltrim($template_name, '/');
105 105
 
106 106
 		// try locating this template file by looping through the template paths
107
-		foreach ( give_get_theme_template_paths() as $template_path ) {
107
+		foreach (give_get_theme_template_paths() as $template_path) {
108 108
 
109
-			if ( file_exists( $template_path . $template_name ) ) {
110
-				$located = $template_path . $template_name;
109
+			if (file_exists($template_path.$template_name)) {
110
+				$located = $template_path.$template_name;
111 111
 				break;
112 112
 			}
113 113
 		}
114 114
 
115
-		if ( $located ) {
115
+		if ($located) {
116 116
 			break;
117 117
 		}
118 118
 	}
119 119
 
120
-	if ( ( true == $load ) && ! empty( $located ) ) {
121
-		load_template( $located, $require_once );
120
+	if ((true == $load) && ! empty($located)) {
121
+		load_template($located, $require_once);
122 122
 	}
123 123
 
124 124
 	return $located;
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	$template_dir = give_get_theme_template_dir_name();
136 136
 
137 137
 	$file_paths = array(
138
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
139
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
138
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
139
+		10  => trailingslashit(get_template_directory()).$template_dir,
140 140
 		100 => give_get_templates_dir()
141 141
 	);
142 142
 
143
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
143
+	$file_paths = apply_filters('give_template_paths', $file_paths);
144 144
 
145 145
 	// sort the file paths based on priority
146
-	ksort( $file_paths, SORT_NUMERIC );
146
+	ksort($file_paths, SORT_NUMERIC);
147 147
 
148
-	return array_map( 'trailingslashit', $file_paths );
148
+	return array_map('trailingslashit', $file_paths);
149 149
 }
150 150
 
151 151
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  * @return string
158 158
  */
159 159
 function give_get_theme_template_dir_name() {
160
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
160
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
161 161
 }
162 162
 
163 163
 /**
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
  * @return void
168 168
  */
169 169
 function give_version_in_header() {
170
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
170
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
171 171
 }
172 172
 
173
-add_action( 'wp_head', 'give_version_in_header' );
173
+add_action('wp_head', 'give_version_in_header');
174 174
 
175 175
 /**
176 176
  * Determines if we're currently on the Donations History page.
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function give_is_donation_history_page() {
182 182
 
183
-	$ret = is_page( give_get_option( 'history_page' ) );
183
+	$ret = is_page(give_get_option('history_page'));
184 184
 
185
-	return apply_filters( 'give_is_donation_history_page', $ret );
185
+	return apply_filters('give_is_donation_history_page', $ret);
186 186
 }
187 187
 
188 188
 /**
@@ -194,25 +194,25 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return array Modified array of classes
196 196
  */
197
-function give_add_body_classes( $class ) {
197
+function give_add_body_classes($class) {
198 198
 	$classes = (array) $class;
199 199
 
200
-	if ( give_is_success_page() ) {
200
+	if (give_is_success_page()) {
201 201
 		$classes[] = 'give-success';
202 202
 		$classes[] = 'give-page';
203 203
 	}
204 204
 
205
-	if ( give_is_failed_transaction_page() ) {
205
+	if (give_is_failed_transaction_page()) {
206 206
 		$classes[] = 'give-failed-transaction';
207 207
 		$classes[] = 'give-page';
208 208
 	}
209 209
 
210
-	if ( give_is_donation_history_page() ) {
210
+	if (give_is_donation_history_page()) {
211 211
 		$classes[] = 'give-donation-history';
212 212
 		$classes[] = 'give-page';
213 213
 	}
214 214
 
215
-	if ( give_is_test_mode() ) {
215
+	if (give_is_test_mode()) {
216 216
 		$classes[] = 'give-test-mode';
217 217
 		$classes[] = 'give-page';
218 218
 	}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	//Theme-specific Classes used to prevent conflicts via CSS
221 221
 	$current_theme = wp_get_theme();
222 222
 
223
-	switch ( $current_theme->template ) {
223
+	switch ($current_theme->template) {
224 224
 
225 225
 		case 'Divi':
226 226
 			$classes[] = 'give-divi';
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 
235 235
 	}
236 236
 
237
-	return array_unique( $classes );
237
+	return array_unique($classes);
238 238
 }
239 239
 
240
-add_filter( 'body_class', 'give_add_body_classes' );
240
+add_filter('body_class', 'give_add_body_classes');
241 241
 
242 242
 
243 243
 /**
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return array
255 255
  */
256
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
257
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
256
+function give_add_post_class($classes, $class = '', $post_id = '') {
257
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
258 258
 		return $classes;
259 259
 	}
260 260
 
261 261
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
262 262
 
263
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
264
-		unset( $classes[ $key ] );
263
+	if (false !== ($key = array_search('hentry', $classes))) {
264
+		unset($classes[$key]);
265 265
 	}
266 266
 
267 267
 	return $classes;
268 268
 }
269 269
 
270 270
 
271
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
271
+add_filter('post_class', 'give_add_post_class', 20, 3);
272 272
 
273 273
 /**
274 274
  * Get the placeholder image URL for forms etc
@@ -278,84 +278,84 @@  discard block
 block discarded – undo
278 278
  */
279 279
 function give_get_placeholder_img_src() {
280 280
 
281
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
281
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
282 282
 
283
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
283
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
284 284
 }
285 285
 
286 286
 
287 287
 /**
288 288
  * Global
289 289
  */
290
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
290
+if ( ! function_exists('give_output_content_wrapper')) {
291 291
 
292 292
 	/**
293 293
 	 * Output the start of the page wrapper.
294 294
 	 */
295 295
 	function give_output_content_wrapper() {
296
-		give_get_template_part( 'global/wrapper-start' );
296
+		give_get_template_part('global/wrapper-start');
297 297
 	}
298 298
 }
299
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
299
+if ( ! function_exists('give_output_content_wrapper_end')) {
300 300
 
301 301
 	/**
302 302
 	 * Output the end of the page wrapper.
303 303
 	 */
304 304
 	function give_output_content_wrapper_end() {
305
-		give_get_template_part( 'global/wrapper-end' );
305
+		give_get_template_part('global/wrapper-end');
306 306
 	}
307 307
 }
308 308
 
309 309
 /**
310 310
  * Single Give Form
311 311
  */
312
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
312
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
313 313
 	function give_left_sidebar_pre_wrap() {
314
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
314
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
315 315
 	}
316 316
 }
317 317
 
318
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
318
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
319 319
 	function give_left_sidebar_post_wrap() {
320
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
320
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
321 321
 	}
322 322
 }
323 323
 
324
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
324
+if ( ! function_exists('give_get_forms_sidebar')) {
325 325
 	function give_get_forms_sidebar() {
326
-		give_get_template_part( 'single-give-form/sidebar' );
326
+		give_get_template_part('single-give-form/sidebar');
327 327
 	}
328 328
 }
329 329
 
330
-if ( ! function_exists( 'give_show_form_images' ) ) {
330
+if ( ! function_exists('give_show_form_images')) {
331 331
 
332 332
 	/**
333 333
 	 * Output the product image before the single product summary.
334 334
 	 */
335 335
 	function give_show_form_images() {
336
-		$featured_image_option = give_get_option( 'disable_form_featured_img' );
337
-		if ( $featured_image_option !== 'on' ) {
338
-			give_get_template_part( 'single-give-form/featured-image' );
336
+		$featured_image_option = give_get_option('disable_form_featured_img');
337
+		if ($featured_image_option !== 'on') {
338
+			give_get_template_part('single-give-form/featured-image');
339 339
 		}
340 340
 	}
341 341
 }
342 342
 
343
-if ( ! function_exists( 'give_template_single_title' ) ) {
343
+if ( ! function_exists('give_template_single_title')) {
344 344
 
345 345
 	/**
346 346
 	 * Output the product title.
347 347
 	 */
348 348
 	function give_template_single_title() {
349
-		give_get_template_part( 'single-give-form/title' );
349
+		give_get_template_part('single-give-form/title');
350 350
 	}
351 351
 }
352 352
 
353
-if ( ! function_exists( 'give_show_avatars' ) ) {
353
+if ( ! function_exists('give_show_avatars')) {
354 354
 
355 355
 	/**
356 356
 	 * Output the product title.
357 357
 	 */
358 358
 	function give_show_avatars() {
359
-		echo do_shortcode( '[give_donators_gravatars]' );
359
+		echo do_shortcode('[give_donators_gravatars]');
360 360
 	}
361 361
 }
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-db-customers.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @access  public
424 424
 	 * @since   1.0
425
-     *
426
-     * @param array $args
427
-     *
428
-     * @return array|object|null
425
+	 *
426
+	 * @param array $args
427
+	 *
428
+	 * @return array|object|null
429 429
 	 */
430 430
 	public function get_customers( $args = array() ) {
431
-        /* @var WPDB $wpdb */
431
+		/* @var WPDB $wpdb */
432 432
 		global $wpdb;
433 433
 
434 434
 		$defaults = array(
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 *
554 554
 	 * @access  public
555 555
 	 * @since   1.0
556
-     *
557
-     * @param array $args
558
-     *
559
-     * @return int
556
+	 *
557
+	 * @param array $args
558
+	 *
559
+	 * @return int
560 560
 	 */
561 561
 	public function count( $args = array() ) {
562
-        /* @var WPDB $wpdb */
562
+		/* @var WPDB $wpdb */
563 563
 		global $wpdb;
564 564
 
565 565
 		$where = ' WHERE 1=1 ';
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => __( 'Once Weekly', 'give' )
49
+			'display'  => __('Once Weekly', 'give')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
includes/class-give-email-access.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	public $error = '';
24 24
 
25 25
 	private $verify_throttle;
26
-    private $token_expiration;
26
+	private $token_expiration;
27 27
 
28 28
 	/**
29 29
 	 * Give_Email_Access constructor.
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return bool
244 244
 	 */
245 245
 	function is_valid_verify_key( $token ) {
246
-        /* @var WPDB $wpdb */
246
+		/* @var WPDB $wpdb */
247 247
 		global $wpdb;
248 248
 
249 249
 		// See if the verify_key exists
Please login to merge, or discard this patch.