Completed
Pull Request — master (#1055)
by Rami
19:01
created
includes/forms/template.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1189,10 +1189,10 @@
 block discarded – undo
1189 1189
 
1190 1190
 function give_show_goal_progress( $form_id, $args ) {
1191 1191
 
1192
-    ob_start();
1193
-    give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) );
1192
+	ob_start();
1193
+	give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) );
1194 1194
 
1195
-    echo apply_filters( 'give_goal_output', ob_get_clean() );
1195
+	echo apply_filters( 'give_goal_output', ob_get_clean() );
1196 1196
 
1197 1197
 	return true;
1198 1198
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array  $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @param  int  $form_id The form ID.
1361 1361
  *
1362
- * @return void|bool
1362
+ * @return false|null
1363 1363
  */
1364 1364
 function give_terms_agreement( $form_id ) {
1365 1365
 	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
  * @param  int   $form_id The form ID.
1553 1553
  * @param  array $args    An array of form arguments.
1554 1554
  *
1555
- * @return mixed
1555
+ * @return boolean
1556 1556
  */
1557 1557
 function give_show_goal_progress( $form_id, $args ) {
1558 1558
 
Please login to merge, or discard this patch.
Spacing   +373 added lines, -373 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,47 +23,47 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = 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 62
 	//Get the form wrap CSS classes.
63
-	$form_wrap_classes       = $form->get_form_wrap_classes($args);
63
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
64 64
 
65 65
 	//Get the <form> tag wrap CSS classes.
66
-	$form_classes       = $form->get_form_classes($args);
66
+	$form_classes = $form->get_form_classes($args);
67 67
 
68 68
 	ob_start();
69 69
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 	 * @param int   $form_id The form ID.
76 76
 	 * @param array $args    An array of form arguments.
77 77
 	 */
78
-	do_action( 'give_pre_form_output', $form->ID, $args );
78
+	do_action('give_pre_form_output', $form->ID, $args);
79 79
 
80 80
 	?>
81 81
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
82 82
 
83
-		<?php if ( $form->is_close_donation_form() ) {
83
+		<?php if ($form->is_close_donation_form()) {
84 84
 
85 85
 			//Get Goal thank you message.
86
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
87
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
86
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
87
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
88 88
 
89 89
 			//Print thank you message.
90
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
90
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
91 91
 
92 92
 		} else {
93 93
 
94
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
94
+			if (isset($args['show_title']) && $args['show_title'] == true) {
95 95
 
96
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
96
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
97 97
 
98 98
 			}
99 99
 
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 			 * @param int   $form_id The form ID.
106 106
 			 * @param array $args    An array of form arguments.
107 107
 			 */
108
-			do_action( 'give_pre_form', $form->ID, $args );
108
+			do_action('give_pre_form', $form->ID, $args);
109 109
 			?>
110 110
 
111 111
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
112 112
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
113
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
114
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
115
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
116
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
113
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
114
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
115
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
116
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
117 117
 
118 118
 				<!-- The following field is for robots only, invisible to humans: -->
119 119
 				<span class="give-hidden" style="display: none !important;">
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 				<?php
125 125
 
126 126
 				//Price ID hidden field for variable (mult-level) donation forms
127
-				if ( give_has_variable_prices( $form_id ) ) {
127
+				if (give_has_variable_prices($form_id)) {
128 128
 					//get default selected price ID
129
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
129
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
130 130
 					$price_id = 0;
131 131
 					//loop through prices
132
-					foreach ( $prices as $price ) {
133
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
132
+					foreach ($prices as $price) {
133
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
134 134
 							$price_id = $price['_give_id']['level_id'];
135 135
 						};
136 136
 					}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 				 * @param int   $form_id The form ID.
147 147
 				 * @param array $args    An array of form arguments.
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 151
 				/**
152 152
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				 * @param int   $form_id The form ID.
157 157
 				 * @param array $args    An array of form arguments.
158 158
 				 */
159
-				do_action( 'give_donation_mode_select', $form->ID, $args );
159
+				do_action('give_donation_mode_select', $form->ID, $args);
160 160
 
161 161
 				/**
162 162
 				 * Fires while outputing donation form, after all other fields.
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				 * @param int   $form_id The form ID.
167 167
 				 * @param array $args    An array of form arguments.
168 168
 				 */
169
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
169
+				do_action('give_checkout_form_bottom', $form->ID, $args);
170 170
 
171 171
 				?>
172 172
 			</form>
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 			 * @param int   $form_id The form ID.
181 181
 			 * @param array $args    An array of form arguments.
182 182
 			 */
183
-			do_action( 'give_post_form', $form->ID, $args );
183
+			do_action('give_post_form', $form->ID, $args);
184 184
 
185 185
 		}
186 186
 		?>
187 187
 
188
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
188
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
189 189
 	<?php
190 190
 
191 191
 	/**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 * @param int   $form_id The form ID.
197 197
 	 * @param array $args    An array of form arguments.
198 198
 	 */
199
-	do_action( 'give_post_form_output', $form->ID, $args );
199
+	do_action('give_post_form_output', $form->ID, $args);
200 200
 
201 201
 	$final_output = ob_get_clean();
202 202
 
203
-	echo apply_filters( 'give_donate_form', $final_output, $args );
203
+	echo apply_filters('give_donate_form', $final_output, $args);
204 204
 }
205 205
 
206 206
 /**
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return string
219 219
  */
220
-function give_show_purchase_form( $form_id ) {
220
+function give_show_purchase_form($form_id) {
221 221
 
222
-	$payment_mode = give_get_chosen_gateway( $form_id );
222
+	$payment_mode = give_get_chosen_gateway($form_id);
223 223
 
224
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
224
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
225 225
 		$form_id = $_POST['give_form_id'];
226 226
 	}
227 227
 
@@ -230,33 +230,33 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @since 1.7
232 232
 	 */
233
-	do_action( 'give_donation_form_top', $form_id );
233
+	do_action('give_donation_form_top', $form_id);
234 234
 
235
-	if ( give_can_checkout() && isset( $form_id ) ) {
235
+	if (give_can_checkout() && isset($form_id)) {
236 236
 
237 237
 		/**
238 238
 		 * Fires while displaying donation form, before registration login.
239 239
 		 *
240 240
 		 * @since 1.7
241 241
 		 */
242
-		do_action( 'give_donation_form_before_register_login', $form_id );
242
+		do_action('give_donation_form_before_register_login', $form_id);
243 243
 
244 244
 		/**
245 245
 		 * Fire when register/login form fields render.
246 246
 		 *
247 247
 		 * @since 1.7
248 248
 		 */
249
-		do_action( 'give_donation_form_register_login_fields', $form_id );
249
+		do_action('give_donation_form_register_login_fields', $form_id);
250 250
 
251 251
 		/**
252 252
 		 * Fire when credit card form fields render.
253 253
 		 *
254 254
 		 * @since 1.7
255 255
 		 */
256
-		do_action( 'give_donation_form_before_cc_form', $form_id );
256
+		do_action('give_donation_form_before_cc_form', $form_id);
257 257
 
258 258
 		// Load the credit card form and allow gateways to load their own if they wish
259
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
259
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
260 260
 			/**
261 261
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
262 262
 			 *
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			 *
265 265
 			 * @param int $form_id The form ID.
266 266
 			 */
267
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
267
+			do_action("give_{$payment_mode}_cc_form", $form_id);
268 268
 		} else {
269 269
 			/**
270 270
 			 * Fires while displaying donation form, credit card form fields.
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			 *
274 274
 			 * @param int $form_id The form ID.
275 275
 			 */
276
-			do_action( 'give_cc_form', $form_id );
276
+			do_action('give_cc_form', $form_id);
277 277
 		}
278 278
 
279 279
 		/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		 *
282 282
 		 * @since 1.7
283 283
 		 */
284
-		do_action( 'give_donation_form_after_cc_form', $form_id );
284
+		do_action('give_donation_form_after_cc_form', $form_id);
285 285
 
286 286
 	} else {
287 287
 		/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		 *
290 290
 		 * @since 1.7
291 291
 		 */
292
-		do_action( 'give_donation_form_no_access', $form_id );
292
+		do_action('give_donation_form_no_access', $form_id);
293 293
 
294 294
 	}
295 295
 
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.7
300 300
 	 */
301
-	do_action( 'give_donation_form_bottom', $form_id );
301
+	do_action('give_donation_form_bottom', $form_id);
302 302
 }
303 303
 
304
-add_action( 'give_donation_form', 'give_show_purchase_form' );
304
+add_action('give_donation_form', 'give_show_purchase_form');
305 305
 
306 306
 /**
307 307
  * Give Show Login/Register Form Fields.
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @return void
314 314
  */
315
-function give_show_register_login_fields( $form_id ) {
315
+function give_show_register_login_fields($form_id) {
316 316
 
317
-	$show_register_form = give_show_login_register_option( $form_id );
317
+	$show_register_form = give_show_login_register_option($form_id);
318 318
 
319
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
319
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
320 320
 		?>
321 321
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
322 322
 			<?php
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 			 *
326 326
 			 * @since 1.7
327 327
 			 */
328
-			do_action( 'give_donation_form_register_fields', $form_id );
328
+			do_action('give_donation_form_register_fields', $form_id);
329 329
 			?>
330 330
 		</div>
331 331
 		<?php
332
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
333 333
 		?>
334 334
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
335 335
 			<?php
@@ -338,23 +338,23 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_login_fields', $form_id );
341
+			do_action('give_donation_form_login_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345 345
 	endif;
346 346
 
347
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
347
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
348 348
 		/**
349 349
 		 * Fire when user info render.
350 350
 		 *
351 351
 		 * @since 1.7
352 352
 		 */
353
-		do_action( 'give_donation_form_after_user_info', $form_id );
353
+		do_action('give_donation_form_after_user_info', $form_id);
354 354
 	}
355 355
 }
356 356
 
357
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
357
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
358 358
 
359 359
 /**
360 360
  * Donation Amount Field.
@@ -368,16 +368,16 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return void
370 370
  */
371
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
371
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
372 372
 
373 373
 	$give_options        = give_get_settings();
374
-	$variable_pricing    = give_has_variable_prices( $form_id );
375
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
376
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
377
-	$symbol              = give_currency_symbol( give_get_currency() );
378
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
379
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
380
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
374
+	$variable_pricing    = give_has_variable_prices($form_id);
375
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
376
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
377
+	$symbol              = give_currency_symbol(give_get_currency());
378
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
379
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
380
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
381 381
 
382 382
 	/**
383 383
 	 * Fires while displaying donation form, before donation level fields.
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
 	 * @param int   $form_id The form ID.
388 388
 	 * @param array $args    An array of form arguments.
389 389
 	 */
390
-	do_action( 'give_before_donation_levels', $form_id, $args );
390
+	do_action('give_before_donation_levels', $form_id, $args);
391 391
 
392 392
 	//Set Price, No Custom Amount Allowed means hidden price field
393
-	if ( $allow_custom_amount == 'no' ) {
393
+	if ($allow_custom_amount == 'no') {
394 394
 		?>
395
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
395
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
396 396
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required>
397 397
 		<div class="set-price give-donation-amount form-row-wide">
398
-			<?php if ( $currency_position == 'before' ) {
398
+			<?php if ($currency_position == 'before') {
399 399
 				echo $currency_output;
400 400
 			} ?>
401 401
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
402
-			<?php if ( $currency_position == 'after' ) {
402
+			<?php if ($currency_position == 'after') {
403 403
 				echo $currency_output;
404 404
 			} ?>
405 405
 		</div>
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 		?>
410 410
 		<div class="give-total-wrap">
411 411
 			<div class="give-donation-amount form-row-wide">
412
-				<?php if ( $currency_position == 'before' ) {
412
+				<?php if ($currency_position == 'before') {
413 413
 					echo $currency_output;
414 414
 				} ?>
415
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
415
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
416 416
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
417
-				<?php if ( $currency_position == 'after' ) {
417
+				<?php if ($currency_position == 'after') {
418 418
 					echo $currency_output;
419 419
 				} ?>
420 420
 			</div>
@@ -429,16 +429,16 @@  discard block
 block discarded – undo
429 429
 	 * @param int   $form_id The form ID.
430 430
 	 * @param array $args    An array of form arguments.
431 431
 	 */
432
-	do_action( 'give_after_donation_amount', $form_id, $args );
432
+	do_action('give_after_donation_amount', $form_id, $args);
433 433
 
434 434
 	//Custom Amount Text
435
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
435
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
436 436
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
437 437
 	<?php }
438 438
 
439 439
 	//Output Variable Pricing Levels
440
-	if ( $variable_pricing ) {
441
-		give_output_levels( $form_id );
440
+	if ($variable_pricing) {
441
+		give_output_levels($form_id);
442 442
 	}
443 443
 
444 444
 	/**
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 * @param int   $form_id The form ID.
450 450
 	 * @param array $args    An array of form arguments.
451 451
 	 */
452
-	do_action( 'give_after_donation_levels', $form_id, $args );
452
+	do_action('give_after_donation_levels', $form_id, $args);
453 453
 }
454 454
 
455
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
455
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
456 456
 
457 457
 /**
458 458
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -463,32 +463,32 @@  discard block
 block discarded – undo
463 463
  *
464 464
  * @return string Donation levels.
465 465
  */
466
-function give_output_levels( $form_id ) {
466
+function give_output_levels($form_id) {
467 467
 
468 468
 	//Get variable pricing
469
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
470
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
471
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
472
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
473
-	if ( empty( $custom_amount_text ) ) {
474
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
469
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
470
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
471
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
472
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
473
+	if (empty($custom_amount_text)) {
474
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
475 475
 	}
476 476
 
477 477
 	$output  = '';
478 478
 	$counter = 0;
479 479
 
480
-	switch ( $display_style ) {
480
+	switch ($display_style) {
481 481
 		case 'buttons':
482 482
 
483 483
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
484 484
 
485
-			foreach ( $prices as $price ) {
486
-				$counter ++;
487
-				$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 );
488
-				$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 );
485
+			foreach ($prices as $price) {
486
+				$counter++;
487
+				$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);
488
+				$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);
489 489
 
490 490
 				$output .= '<li>';
491
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
491
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
492 492
 				$output .= $level_text;
493 493
 				$output .= '</button>';
494 494
 				$output .= '</li>';
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 			}
497 497
 
498 498
 			//Custom Amount
499
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
499
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
500 500
 				$output .= '<li>';
501 501
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
502 502
 				$output .= $custom_amount_text;
@@ -512,23 +512,23 @@  discard block
 block discarded – undo
512 512
 
513 513
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
514 514
 
515
-			foreach ( $prices as $price ) {
516
-				$counter ++;
517
-				$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 );
518
-				$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 );
515
+			foreach ($prices as $price) {
516
+				$counter++;
517
+				$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);
518
+				$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);
519 519
 
520 520
 				$output .= '<li>';
521
-				$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'] ) . '">';
522
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
521
+				$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']).'">';
522
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
523 523
 				$output .= '</li>';
524 524
 
525 525
 			}
526 526
 
527 527
 			//Custom Amount
528
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
528
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
529 529
 				$output .= '<li>';
530 530
 				$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">';
531
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
531
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
532 532
 				$output .= '</li>';
533 533
 			}
534 534
 
@@ -538,23 +538,23 @@  discard block
 block discarded – undo
538 538
 
539 539
 		case 'dropdown':
540 540
 
541
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
542
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
541
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
542
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
543 543
 
544 544
 			//first loop through prices
545
-			foreach ( $prices as $price ) {
546
-				$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 );
547
-				$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 );
545
+			foreach ($prices as $price) {
546
+				$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);
547
+				$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);
548 548
 
549
-				$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'] ) . '">';
549
+				$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']).'">';
550 550
 				$output .= $level_text;
551 551
 				$output .= '</option>';
552 552
 
553 553
 			}
554 554
 
555 555
 			//Custom Amount
556
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
557
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
556
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
557
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
558 558
 			}
559 559
 
560 560
 			$output .= '</select>';
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			break;
563 563
 	}
564 564
 
565
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
565
+	echo apply_filters('give_form_level_output', $output, $form_id);
566 566
 }
567 567
 
568 568
 /**
@@ -577,26 +577,26 @@  discard block
 block discarded – undo
577 577
  *
578 578
  * @return string Checkout button.
579 579
  */
580
-function give_display_checkout_button( $form_id, $args ) {
580
+function give_display_checkout_button($form_id, $args) {
581 581
 
582
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
582
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
583 583
 		? $args['display_style']
584
-		: get_post_meta( $form_id, '_give_payment_display', true );
584
+		: get_post_meta($form_id, '_give_payment_display', true);
585 585
 
586 586
 	//no btn for onpage
587
-	if ( $display_option === 'onpage' ) {
587
+	if ($display_option === 'onpage') {
588 588
 		return;
589 589
 	}
590 590
 
591
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
592
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
591
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
592
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
593 593
 
594
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
594
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
595 595
 
596
-	echo apply_filters( 'give_display_checkout_button', $output );
596
+	echo apply_filters('give_display_checkout_button', $output);
597 597
 }
598 598
 
599
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
599
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
600 600
 
601 601
 /**
602 602
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return void
609 609
  */
610
-function give_user_info_fields( $form_id ) {
610
+function give_user_info_fields($form_id) {
611 611
 
612
-	if ( is_user_logged_in() ) :
613
-		$user_data = get_userdata( get_current_user_id() );
612
+	if (is_user_logged_in()) :
613
+		$user_data = get_userdata(get_current_user_id());
614 614
 	endif;
615 615
 
616 616
 	/**
@@ -618,35 +618,35 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.7
620 620
 	 */
621
-	do_action( 'give_donation_form_before_personal_info', $form_id );
621
+	do_action('give_donation_form_before_personal_info', $form_id);
622 622
 	?>
623 623
 	<fieldset id="give_checkout_user_info">
624
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
624
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
625 625
 		<p id="give-first-name-wrap" class="form-row form-row-first">
626 626
 			<label class="give-label" for="give-first">
627
-				<?php esc_html_e( 'First Name', 'give' ); ?>
628
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
627
+				<?php esc_html_e('First Name', 'give'); ?>
628
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
629 629
 					<span class="give-required-indicator">*</span>
630 630
 				<?php } ?>
631
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
631
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
632 632
 			</label>
633
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_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 ) ) {
633
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_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)) {
634 634
 				echo ' required ';
635 635
 			} ?>/>
636 636
 		</p>
637 637
 
638 638
 		<p id="give-last-name-wrap" class="form-row form-row-last">
639 639
 			<label class="give-label" for="give-last">
640
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
641
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
640
+				<?php esc_html_e('Last Name', 'give'); ?>
641
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
642 642
 					<span class="give-required-indicator">*</span>
643 643
 				<?php } ?>
644
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
644
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
645 645
 			</label>
646 646
 
647
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
647
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
648 648
 				echo ' required';
649
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_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 ) ) {
649
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_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)) {
650 650
 				echo ' required ';
651 651
 			} ?> />
652 652
 		</p>
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 		 *
658 658
 		 * @since 1.7
659 659
 		 */
660
-		do_action( 'give_donation_form_before_email', $form_id );
660
+		do_action('give_donation_form_before_email', $form_id);
661 661
 		?>
662 662
 		<p id="give-email-wrap" class="form-row form-row-wide">
663 663
 			<label class="give-label" for="give-email">
664
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
665
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
664
+				<?php esc_html_e('Email Address', 'give'); ?>
665
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
666 666
 					<span class="give-required-indicator">*</span>
667 667
 				<?php } ?>
668
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
668
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_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 ) ) {
671
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_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)) {
672 672
 				echo ' required ';
673 673
 			} ?>/>
674 674
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 		 *
680 680
 		 * @since 1.7
681 681
 		 */
682
-		do_action( 'give_donation_form_after_email', $form_id );
682
+		do_action('give_donation_form_after_email', $form_id);
683 683
 
684 684
 		/**
685 685
 		 * Fire after personal email field
686 686
 		 *
687 687
 		 * @since 1.7
688 688
 		 */
689
-		do_action( 'give_donation_form_user_info', $form_id );
689
+		do_action('give_donation_form_user_info', $form_id);
690 690
 		?>
691 691
 	</fieldset>
692 692
 	<?php
@@ -695,11 +695,11 @@  discard block
 block discarded – undo
695 695
 	 *
696 696
 	 * @since 1.7
697 697
 	 */
698
-	do_action( 'give_donation_form_after_personal_info', $form_id );
698
+	do_action('give_donation_form_after_personal_info', $form_id);
699 699
 }
700 700
 
701
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
702
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
701
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
702
+add_action('give_register_fields_before', 'give_user_info_fields');
703 703
 
704 704
 /**
705 705
  * Renders the credit card info form.
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
  *
711 711
  * @return void
712 712
  */
713
-function give_get_cc_form( $form_id ) {
713
+function give_get_cc_form($form_id) {
714 714
 
715 715
 	ob_start();
716 716
 
@@ -721,45 +721,45 @@  discard block
 block discarded – undo
721 721
 	 *
722 722
 	 * @param int $form_id The form ID.
723 723
 	 */
724
-	do_action( 'give_before_cc_fields', $form_id );
724
+	do_action('give_before_cc_fields', $form_id);
725 725
 	?>
726 726
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
727
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
728
-		<?php if ( is_ssl() ) : ?>
727
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
728
+		<?php if (is_ssl()) : ?>
729 729
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
730 730
 				<span class="give-icon padlock"></span>
731
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
731
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
732 732
 			</div>
733 733
 		<?php endif; ?>
734 734
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
735 735
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
736
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
736
+				<?php esc_html_e('Card Number', 'give'); ?>
737 737
 				<span class="give-required-indicator">*</span>
738
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
738
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
739 739
 				<span class="card-type"></span>
740 740
 			</label>
741 741
 
742
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/>
742
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/>
743 743
 		</p>
744 744
 
745 745
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
746 746
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
747
-				<?php esc_html_e( 'CVC', 'give' ); ?>
747
+				<?php esc_html_e('CVC', 'give'); ?>
748 748
 				<span class="give-required-indicator">*</span>
749
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
749
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
750 750
 			</label>
751 751
 
752
-			<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 esc_attr_e( 'Security code', 'give' ); ?>" required/>
752
+			<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 esc_attr_e('Security code', 'give'); ?>" required/>
753 753
 		</p>
754 754
 
755 755
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
756 756
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
757
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
757
+				<?php esc_html_e('Name on the Card', 'give'); ?>
758 758
 				<span class="give-required-indicator">*</span>
759
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
759
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
760 760
 			</label>
761 761
 
762
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/>
762
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/>
763 763
 		</p>
764 764
 		<?php
765 765
 		/**
@@ -769,19 +769,19 @@  discard block
 block discarded – undo
769 769
 		 *
770 770
 		 * @param int $form_id The form ID.
771 771
 		 */
772
-		do_action( 'give_before_cc_expiration' );
772
+		do_action('give_before_cc_expiration');
773 773
 		?>
774 774
 		<p class="card-expiration form-row form-row-one-third">
775 775
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
776
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
776
+				<?php esc_html_e('Expiration', 'give'); ?>
777 777
 				<span class="give-required-indicator">*</span>
778
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
778
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
779 779
 			</label>
780 780
 
781 781
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
782 782
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
783 783
 
784
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/>
784
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/>
785 785
 		</p>
786 786
 		<?php
787 787
 		/**
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		 *
792 792
 		 * @param int $form_id The form ID.
793 793
 		 */
794
-		do_action( 'give_after_cc_expiration', $form_id );
794
+		do_action('give_after_cc_expiration', $form_id);
795 795
 		?>
796 796
 	</fieldset>
797 797
 	<?php
@@ -802,12 +802,12 @@  discard block
 block discarded – undo
802 802
 	 *
803 803
 	 * @param int $form_id The form ID.
804 804
 	 */
805
-	do_action( 'give_after_cc_fields', $form_id );
805
+	do_action('give_after_cc_fields', $form_id);
806 806
 
807 807
 	echo ob_get_clean();
808 808
 }
809 809
 
810
-add_action( 'give_cc_form', 'give_get_cc_form' );
810
+add_action('give_cc_form', 'give_get_cc_form');
811 811
 
812 812
 /**
813 813
  * Outputs the default credit card address fields.
@@ -818,22 +818,22 @@  discard block
 block discarded – undo
818 818
  *
819 819
  * @return void
820 820
  */
821
-function give_default_cc_address_fields( $form_id ) {
821
+function give_default_cc_address_fields($form_id) {
822 822
 
823 823
 	$logged_in = is_user_logged_in();
824 824
 
825
-	if ( $logged_in ) {
826
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
825
+	if ($logged_in) {
826
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
827 827
 	}
828
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
829
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
830
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
831
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
828
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
829
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
830
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
831
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
832 832
 
833 833
 	ob_start();
834 834
 	?>
835 835
 	<fieldset id="give_cc_address" class="cc-address">
836
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
836
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
837 837
 		<?php
838 838
 		/**
839 839
 		 * Fires while rendering credit card billing form, before address fields.
@@ -842,97 +842,97 @@  discard block
 block discarded – undo
842 842
 		 *
843 843
 		 * @param int $form_id The form ID.
844 844
 		 */
845
-		do_action( 'give_cc_billing_top' );
845
+		do_action('give_cc_billing_top');
846 846
 		?>
847 847
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
848 848
 			<label for="card_address" class="give-label">
849
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
849
+				<?php esc_html_e('Address 1', 'give'); ?>
850 850
 				<?php
851
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
851
+				if (give_field_is_required('card_address', $form_id)) { ?>
852 852
 					<span class="give-required-indicator">*</span>
853 853
 				<?php } ?>
854
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
854
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
855 855
 			</label>
856 856
 
857
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
857
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
858 858
 				echo ' required';
859
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
859
+			} ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
860 860
 				echo '  required ';
861 861
 			} ?>/>
862 862
 		</p>
863 863
 
864 864
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
865 865
 			<label for="card_address_2" class="give-label">
866
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
867
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
866
+				<?php esc_html_e('Address 2', 'give'); ?>
867
+				<?php if (give_field_is_required('card_address_2', $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 esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
870
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
871 871
 			</label>
872 872
 
873
-			<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 ) ) {
873
+			<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)) {
874 874
 				echo ' required';
875
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
875
+			} ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
876 876
 				echo ' required ';
877 877
 			} ?>/>
878 878
 		</p>
879 879
 
880 880
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
881 881
 			<label for="card_city" class="give-label">
882
-				<?php esc_html_e( 'City', 'give' ); ?>
883
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
882
+				<?php esc_html_e('City', 'give'); ?>
883
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
884 884
 					<span class="give-required-indicator">*</span>
885 885
 				<?php } ?>
886
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
886
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
887 887
 			</label>
888
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
888
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
889 889
 				echo ' required';
890
-			} ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
890
+			} ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
891 891
 				echo ' required ';
892 892
 			} ?>/>
893 893
 		</p>
894 894
 
895 895
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
896 896
 			<label for="card_zip" class="give-label">
897
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
898
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
897
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
898
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
899 899
 					<span class="give-required-indicator">*</span>
900 900
 				<?php } ?>
901
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
901
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
902 902
 			</label>
903 903
 
904
-			<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 ) ) {
904
+			<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)) {
905 905
 				echo ' required';
906
-			} ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
906
+			} ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
907 907
 				echo ' required ';
908 908
 			} ?>/>
909 909
 		</p>
910 910
 
911 911
 		<p id="give-card-country-wrap" class="form-row form-row-first">
912 912
 			<label for="billing_country" class="give-label">
913
-				<?php esc_html_e( 'Country', 'give' ); ?>
914
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
913
+				<?php esc_html_e('Country', 'give'); ?>
914
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
915 915
 					<span class="give-required-indicator">*</span>
916 916
 				<?php } ?>
917
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
917
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
918 918
 			</label>
919 919
 
920
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
920
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
921 921
 				echo ' required';
922
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
922
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
923 923
 				echo ' required ';
924 924
 			} ?>>
925 925
 				<?php
926 926
 
927 927
 				$selected_country = give_get_country();
928 928
 
929
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
929
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
930 930
 					$selected_country = $user_address['country'];
931 931
 				}
932 932
 
933 933
 				$countries = give_get_country_list();
934
-				foreach ( $countries as $country_code => $country ) {
935
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
934
+				foreach ($countries as $country_code => $country) {
935
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
936 936
 				}
937 937
 				?>
938 938
 			</select>
@@ -940,38 +940,38 @@  discard block
 block discarded – undo
940 940
 
941 941
 		<p id="give-card-state-wrap" class="form-row form-row-last">
942 942
 			<label for="card_state" class="give-label">
943
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
944
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
943
+				<?php esc_html_e('State / Province', 'give'); ?>
944
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
945 945
 					<span class="give-required-indicator">*</span>
946 946
 				<?php } ?>
947
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
947
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
948 948
 			</label>
949 949
 
950 950
 			<?php
951 951
 			$selected_state = give_get_state();
952
-			$states         = give_get_states( $selected_country );
952
+			$states         = give_get_states($selected_country);
953 953
 
954
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
954
+			if ($logged_in && ! empty($user_address['state'])) {
955 955
 				$selected_state = $user_address['state'];
956 956
 			}
957 957
 
958
-			if ( ! empty( $states ) ) {
958
+			if ( ! empty($states)) {
959 959
 				?>
960
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
960
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
961 961
 					echo ' required';
962
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
962
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
963 963
 					echo ' required ';
964 964
 				} ?>>
965 965
 					<?php
966
-					foreach ( $states as $state_code => $state ) {
967
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
966
+					foreach ($states as $state_code => $state) {
967
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
968 968
 					}
969 969
 					?>
970 970
 				</select>
971 971
 				<?php
972 972
 			} else {
973 973
 				?>
974
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
974
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
975 975
 				<?php
976 976
 			}
977 977
 			?>
@@ -984,14 +984,14 @@  discard block
 block discarded – undo
984 984
 		 *
985 985
 		 * @param int $form_id The form ID.
986 986
 		 */
987
-		do_action( 'give_cc_billing_bottom' );
987
+		do_action('give_cc_billing_bottom');
988 988
 		?>
989 989
 	</fieldset>
990 990
 	<?php
991 991
 	echo ob_get_clean();
992 992
 }
993 993
 
994
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
994
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
995 995
 
996 996
 
997 997
 /**
@@ -1003,26 +1003,26 @@  discard block
 block discarded – undo
1003 1003
  *
1004 1004
  * @return string
1005 1005
  */
1006
-function give_get_register_fields( $form_id ) {
1006
+function give_get_register_fields($form_id) {
1007 1007
 
1008 1008
 	global $user_ID;
1009 1009
 
1010
-	if ( is_user_logged_in() ) {
1011
-		$user_data = get_userdata( $user_ID );
1010
+	if (is_user_logged_in()) {
1011
+		$user_data = get_userdata($user_ID);
1012 1012
 	}
1013 1013
 
1014
-	$show_register_form = give_show_login_register_option( $form_id );
1014
+	$show_register_form = give_show_login_register_option($form_id);
1015 1015
 
1016 1016
 	ob_start(); ?>
1017 1017
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1018 1018
 
1019
-		<?php if ( $show_register_form == 'both' ) { ?>
1019
+		<?php if ($show_register_form == 'both') { ?>
1020 1020
 			<div class="give-login-account-wrap">
1021
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1022
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1021
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1022
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1023 1023
 				</p>
1024 1024
 				<p class="give-loading-text">
1025
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
1025
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
1026 1026
 			</div>
1027 1027
 		<?php } ?>
1028 1028
 
@@ -1034,15 +1034,15 @@  discard block
 block discarded – undo
1034 1034
 		 *
1035 1035
 		 * @param int $form_id The form ID.
1036 1036
 		 */
1037
-		do_action( 'give_register_fields_before', $form_id );
1037
+		do_action('give_register_fields_before', $form_id);
1038 1038
 		?>
1039 1039
 
1040 1040
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1041 1041
 			<legend>
1042 1042
 				<?php
1043
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1044
-				if ( ! give_logged_in_only( $form_id ) ) {
1045
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1043
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1044
+				if ( ! give_logged_in_only($form_id)) {
1045
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1046 1046
 				}
1047 1047
 				?>
1048 1048
 			</legend>
@@ -1054,42 +1054,42 @@  discard block
 block discarded – undo
1054 1054
 			 *
1055 1055
 			 * @param int $form_id The form ID.
1056 1056
 			 */
1057
-			do_action( 'give_register_account_fields_before', $form_id );
1057
+			do_action('give_register_account_fields_before', $form_id);
1058 1058
 			?>
1059 1059
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
1060 1060
 				<label for="give-user-login-<?php echo $form_id; ?>">
1061
-					<?php esc_html_e( 'Username', 'give' ); ?>
1062
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1061
+					<?php esc_html_e('Username', 'give'); ?>
1062
+					<?php if (give_logged_in_only($form_id)) { ?>
1063 1063
 						<span class="give-required-indicator">*</span>
1064 1064
 					<?php } ?>
1065
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1065
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1066 1066
 				</label>
1067 1067
 
1068
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1068
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1069 1069
 			</div>
1070 1070
 
1071 1071
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
1072 1072
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1073
-					<?php esc_html_e( 'Password', 'give' ); ?>
1074
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1073
+					<?php esc_html_e('Password', 'give'); ?>
1074
+					<?php if (give_logged_in_only($form_id)) { ?>
1075 1075
 						<span class="give-required-indicator">*</span>
1076 1076
 					<?php } ?>
1077
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1077
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1078 1078
 				</label>
1079 1079
 
1080
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1080
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1081 1081
 			</div>
1082 1082
 
1083 1083
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
1084 1084
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1085
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1086
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1085
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1086
+					<?php if (give_logged_in_only($form_id)) { ?>
1087 1087
 						<span class="give-required-indicator">*</span>
1088 1088
 					<?php } ?>
1089
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1089
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1090 1090
 				</label>
1091 1091
 
1092
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1092
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1093 1093
 			</div>
1094 1094
 			<?php
1095 1095
 			/**
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			 *
1100 1100
 			 * @param int $form_id The form ID.
1101 1101
 			 */
1102
-			do_action( 'give_register_account_fields_after', $form_id );
1102
+			do_action('give_register_account_fields_after', $form_id);
1103 1103
 			?>
1104 1104
 		</fieldset>
1105 1105
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 		 *
1112 1112
 		 * @param int $form_id The form ID.
1113 1113
 		 */
1114
-		do_action( 'give_register_fields_after', $form_id );
1114
+		do_action('give_register_fields_after', $form_id);
1115 1115
 		?>
1116 1116
 
1117 1117
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		 *
1123 1123
 		 * @since 1.7
1124 1124
 		 */
1125
-		do_action( 'give_donation_form_user_info', $form_id );
1125
+		do_action('give_donation_form_user_info', $form_id);
1126 1126
 		?>
1127 1127
 
1128 1128
 	</fieldset>
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	echo ob_get_clean();
1131 1131
 }
1132 1132
 
1133
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
1133
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
1134 1134
 
1135 1135
 /**
1136 1136
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1143,31 +1143,31 @@  discard block
 block discarded – undo
1143 1143
  *
1144 1144
  * @return string
1145 1145
  */
1146
-function give_get_login_fields( $form_id ) {
1146
+function give_get_login_fields($form_id) {
1147 1147
 
1148
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1149
-	$show_register_form = give_show_login_register_option( $form_id );
1148
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1149
+	$show_register_form = give_show_login_register_option($form_id);
1150 1150
 
1151 1151
 	ob_start();
1152 1152
 	?>
1153 1153
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1154
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1155
-			if ( ! give_logged_in_only( $form_id ) ) {
1156
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1154
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1155
+			if ( ! give_logged_in_only($form_id)) {
1156
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1157 1157
 			} ?>
1158 1158
 		</legend>
1159
-		<?php if ( $show_register_form == 'both' ) { ?>
1159
+		<?php if ($show_register_form == 'both') { ?>
1160 1160
 			<p class="give-new-account-link">
1161
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1162
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
1163
-					<?php esc_html_e( 'Register', 'give' );
1164
-					if ( ! give_logged_in_only( $form_id ) ) {
1165
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1161
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1162
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
1163
+					<?php esc_html_e('Register', 'give');
1164
+					if ( ! give_logged_in_only($form_id)) {
1165
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1166 1166
 					} ?>
1167 1167
 				</a>
1168 1168
 			</p>
1169 1169
 			<p class="give-loading-text">
1170
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
1170
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
1171 1171
 		<?php } ?>
1172 1172
 		<?php
1173 1173
 		/**
@@ -1177,44 +1177,44 @@  discard block
 block discarded – undo
1177 1177
 		 *
1178 1178
 		 * @param int $form_id The form ID.
1179 1179
 		 */
1180
-		do_action( 'give_checkout_login_fields_before', $form_id );
1180
+		do_action('give_checkout_login_fields_before', $form_id);
1181 1181
 		?>
1182 1182
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
1183 1183
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1184
-				<?php esc_html_e( 'Username', 'give' ); ?>
1185
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1184
+				<?php esc_html_e('Username', 'give'); ?>
1185
+				<?php if (give_logged_in_only($form_id)) { ?>
1186 1186
 					<span class="give-required-indicator">*</span>
1187 1187
 				<?php } ?>
1188 1188
 			</label>
1189 1189
 
1190
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
1190
+			<input class="<?php if (give_logged_in_only($form_id)) {
1191 1191
 				echo 'required ';
1192
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/>
1192
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/>
1193 1193
 		</div>
1194 1194
 
1195 1195
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
1196 1196
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1197
-				<?php esc_html_e( 'Password', 'give' ); ?>
1198
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1197
+				<?php esc_html_e('Password', 'give'); ?>
1198
+				<?php if (give_logged_in_only($form_id)) { ?>
1199 1199
 					<span class="give-required-indicator">*</span>
1200 1200
 				<?php } ?>
1201 1201
 			</label>
1202
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
1202
+			<input class="<?php if (give_logged_in_only($form_id)) {
1203 1203
 				echo 'required ';
1204
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/>
1204
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/>
1205 1205
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1206 1206
 		</div>
1207 1207
 
1208 1208
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1209 1209
 			 <span class="give-forgot-password ">
1210
-				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1210
+				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1211 1211
 			 </span>
1212 1212
 		</div>
1213 1213
 
1214 1214
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1215
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1216
-			<?php if ( $show_register_form !== 'login' ) { ?>
1217
-				<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 esc_attr_e( 'Cancel', 'give' ); ?>"/>
1215
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/>
1216
+			<?php if ($show_register_form !== 'login') { ?>
1217
+				<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 esc_attr_e('Cancel', 'give'); ?>"/>
1218 1218
 			<?php } ?>
1219 1219
 			<span class="give-loading-animation"></span>
1220 1220
 		</div>
@@ -1226,14 +1226,14 @@  discard block
 block discarded – undo
1226 1226
 		 *
1227 1227
 		 * @param int $form_id The form ID.
1228 1228
 		 */
1229
-		do_action( 'give_checkout_login_fields_after', $form_id );
1229
+		do_action('give_checkout_login_fields_after', $form_id);
1230 1230
 		?>
1231 1231
 	</fieldset><!--end #give-login-fields-->
1232 1232
 	<?php
1233 1233
 	echo ob_get_clean();
1234 1234
 }
1235 1235
 
1236
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
1236
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
1237 1237
 
1238 1238
 /**
1239 1239
  * Payment Mode Select.
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
  *
1250 1250
  * @return void
1251 1251
  */
1252
-function give_payment_mode_select( $form_id ) {
1252
+function give_payment_mode_select($form_id) {
1253 1253
 
1254 1254
 	$gateways = give_get_enabled_payment_gateways();
1255 1255
 
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 	 *
1261 1261
 	 * @param int $form_id The form ID.
1262 1262
 	 */
1263
-	do_action( 'give_donation_mode_top', $form_id ); ?>
1263
+	do_action('give_donation_mode_top', $form_id); ?>
1264 1264
 
1265 1265
 	<fieldset id="give-payment-mode-select">
1266 1266
 		<?php
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 		 *
1272 1272
 		 * @param int $form_id The form ID.
1273 1273
 		 */
1274
-		do_action( 'give_donation_mode_before_gateways_wrap' );
1274
+		do_action('give_donation_mode_before_gateways_wrap');
1275 1275
 		?>
1276 1276
 		<div id="give-payment-mode-wrap">
1277
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1278
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1277
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1278
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1279 1279
 			</legend>
1280 1280
 			<?php
1281 1281
 			/**
@@ -1283,14 +1283,14 @@  discard block
 block discarded – undo
1283 1283
 			 *
1284 1284
 			 * @since 1.7
1285 1285
 			 */
1286
-			do_action( 'give_donation_mode_before_gateways' )
1286
+			do_action('give_donation_mode_before_gateways')
1287 1287
 			?>
1288 1288
 			<ul id="give-gateway-radio-list">
1289
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1290
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1289
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1290
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1291 1291
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1292
-					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 ) . '">';
1293
-					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'] );
1292
+					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).'">';
1293
+					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']);
1294 1294
 					echo '</label></li>';
1295 1295
 				endforeach; ?>
1296 1296
 			</ul>
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 			 *
1301 1301
 			 * @since 1.7
1302 1302
 			 */
1303
-			do_action( 'give_donation_mode_after_gateways' );
1303
+			do_action('give_donation_mode_after_gateways');
1304 1304
 			?>
1305 1305
 		</div>
1306 1306
 		<?php
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		 *
1312 1312
 		 * @param int $form_id The form ID.
1313 1313
 		 */
1314
-		do_action( 'give_donation_mode_after_gateways_wrap' );
1314
+		do_action('give_donation_mode_after_gateways_wrap');
1315 1315
 		?>
1316 1316
 	</fieldset>
1317 1317
 
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param int $form_id The form ID.
1325 1325
 	 */
1326
-	do_action( 'give_donation_mode_bottom', $form_id );
1326
+	do_action('give_donation_mode_bottom', $form_id);
1327 1327
 	?>
1328 1328
 
1329 1329
 	<div id="give_purchase_form_wrap">
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		 *
1335 1335
 		 * @since 1.7
1336 1336
 		 */
1337
-		do_action( 'give_donation_form', $form_id );
1337
+		do_action('give_donation_form', $form_id);
1338 1338
 		?>
1339 1339
 
1340 1340
 	</div>
@@ -1345,10 +1345,10 @@  discard block
 block discarded – undo
1345 1345
 	 *
1346 1346
 	 * @since 1.7
1347 1347
 	 */
1348
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1348
+	do_action('give_donation_form_wrap_bottom', $form_id);
1349 1349
 }
1350 1350
 
1351
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1351
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1352 1352
 
1353 1353
 /**
1354 1354
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1361,49 +1361,49 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @return void|bool
1363 1363
  */
1364
-function give_terms_agreement( $form_id ) {
1365
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1364
+function give_terms_agreement($form_id) {
1365
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1366 1366
 
1367 1367
 	// Bailout if per form and global term and conditions is not setup
1368
-	if( 'yes' !== $form_option ) {
1368
+	if ('yes' !== $form_option) {
1369 1369
 		return false;
1370 1370
 	}
1371 1371
 
1372 1372
 	// Set term and conditions label and text on basis of per form and global setting.
1373
-	$label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1374
-	$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1373
+	$label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1374
+	$terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', '');
1375 1375
 
1376 1376
 	// Bailout: Check if term and conditions text is empty or not.
1377
-	if( empty( $terms ) ) {
1378
-		if( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
1379
-			echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) );
1377
+	if (empty($terms)) {
1378
+		if (is_user_logged_in() && current_user_can('manage_options')) {
1379
+			echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit'));
1380 1380
 		}
1381 1381
 		return false;
1382 1382
 	}
1383 1383
 
1384 1384
 	?>
1385 1385
 	<fieldset id="give_terms_agreement">
1386
-		<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1386
+		<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1387 1387
 			<?php
1388 1388
 			/**
1389 1389
 			 * Fires while rendering terms of agreement, before the fields.
1390 1390
 			 *
1391 1391
 			 * @since 1.0
1392 1392
 			 */
1393
-			do_action( 'give_before_terms' );
1393
+			do_action('give_before_terms');
1394 1394
 
1395
-			echo wpautop( stripslashes( $terms ) );
1395
+			echo wpautop(stripslashes($terms));
1396 1396
 			/**
1397 1397
 			 * Fires while rendering terms of agreement, after the fields.
1398 1398
 			 *
1399 1399
 			 * @since 1.0
1400 1400
 			 */
1401
-			do_action( 'give_after_terms' );
1401
+			do_action('give_after_terms');
1402 1402
 			?>
1403 1403
 		</div>
1404 1404
 		<div id="give_show_terms">
1405
-			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1406
-			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1405
+			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a>
1406
+			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1407 1407
 		</div>
1408 1408
 
1409 1409
 		<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 	<?php
1414 1414
 }
1415 1415
 
1416
-add_action( 'give_donation_form_before_submit', 'give_terms_agreement', 10, 1 );
1416
+add_action('give_donation_form_before_submit', 'give_terms_agreement', 10, 1);
1417 1417
 
1418 1418
 /**
1419 1419
  * Checkout Final Total.
@@ -1426,27 +1426,27 @@  discard block
 block discarded – undo
1426 1426
  *
1427 1427
  * @return void
1428 1428
  */
1429
-function give_checkout_final_total( $form_id ) {
1429
+function give_checkout_final_total($form_id) {
1430 1430
 
1431
-	if ( isset( $_POST['give_total'] ) ) {
1432
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1431
+	if (isset($_POST['give_total'])) {
1432
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1433 1433
 	} else {
1434 1434
 		//default total
1435
-		$total = give_get_default_form_amount( $form_id );
1435
+		$total = give_get_default_form_amount($form_id);
1436 1436
 	}
1437 1437
 	//Only proceed if give_total available
1438
-	if ( empty( $total ) ) {
1438
+	if (empty($total)) {
1439 1439
 		return;
1440 1440
 	}
1441 1441
 	?>
1442 1442
 	<p id="give-final-total-wrap" class="form-wrap ">
1443
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1444
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1443
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1444
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1445 1445
 	</p>
1446 1446
 	<?php
1447 1447
 }
1448 1448
 
1449
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1449
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1450 1450
 
1451 1451
 /**
1452 1452
  * Renders the Checkout Submit section.
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return void
1459 1459
  */
1460
-function give_checkout_submit( $form_id ) {
1460
+function give_checkout_submit($form_id) {
1461 1461
 	?>
1462 1462
 	<fieldset id="give_purchase_submit">
1463 1463
 		<?php
@@ -1466,24 +1466,24 @@  discard block
 block discarded – undo
1466 1466
 		 *
1467 1467
 		 * @since 1.7
1468 1468
 		 */
1469
-		do_action( 'give_donation_form_before_submit', $form_id );
1469
+		do_action('give_donation_form_before_submit', $form_id);
1470 1470
 
1471
-		give_checkout_hidden_fields( $form_id );
1471
+		give_checkout_hidden_fields($form_id);
1472 1472
 
1473
-		echo give_checkout_button_purchase( $form_id );
1473
+		echo give_checkout_button_purchase($form_id);
1474 1474
 
1475 1475
 		/**
1476 1476
 		 * Fire after donation form submit.
1477 1477
 		 *
1478 1478
 		 * @since 1.7
1479 1479
 		 */
1480
-		do_action( 'give_donation_form_after_submit', $form_id );
1480
+		do_action('give_donation_form_after_submit', $form_id);
1481 1481
 		?>
1482 1482
 	</fieldset>
1483 1483
 	<?php
1484 1484
 }
1485 1485
 
1486
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1486
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1487 1487
 
1488 1488
 /**
1489 1489
  * Give Checkout Button.
@@ -1496,17 +1496,17 @@  discard block
 block discarded – undo
1496 1496
  *
1497 1497
  * @return string
1498 1498
  */
1499
-function give_checkout_button_purchase( $form_id ) {
1499
+function give_checkout_button_purchase($form_id) {
1500 1500
 
1501
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1502
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1501
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1502
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1503 1503
 	ob_start(); ?>
1504 1504
 	<div class="give-submit-button-wrap give-clearfix">
1505 1505
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1506 1506
 		<span class="give-loading-animation"></span>
1507 1507
 	</div>
1508 1508
 	<?php
1509
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1509
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1510 1510
 }
1511 1511
 
1512 1512
 /**
@@ -1520,18 +1520,18 @@  discard block
 block discarded – undo
1520 1520
  *
1521 1521
  * @return void
1522 1522
  */
1523
-function give_agree_to_terms_js( $form_id ) {
1523
+function give_agree_to_terms_js($form_id) {
1524 1524
 
1525
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1525
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1526 1526
 
1527
-	if ( $form_option === 'yes' ) {
1527
+	if ($form_option === 'yes') {
1528 1528
 		?>
1529 1529
 		<script type="text/javascript">
1530 1530
 			jQuery(document).ready(function ($) {
1531
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1531
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1532 1532
 					e.preventDefault();
1533
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1534
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1533
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1534
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1535 1535
 					return false;
1536 1536
 				});
1537 1537
 			});
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 	}
1541 1541
 }
1542 1542
 
1543
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1543
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1544 1544
 
1545 1545
 /**
1546 1546
  * Show Give Goals.
@@ -1554,17 +1554,17 @@  discard block
 block discarded – undo
1554 1554
  *
1555 1555
  * @return mixed
1556 1556
  */
1557
-function give_show_goal_progress( $form_id, $args ) {
1557
+function give_show_goal_progress($form_id, $args) {
1558 1558
 
1559 1559
     ob_start();
1560
-    give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) );
1560
+    give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1561 1561
 
1562
-    echo apply_filters( 'give_goal_output', ob_get_clean() );
1562
+    echo apply_filters('give_goal_output', ob_get_clean());
1563 1563
 
1564 1564
 	return true;
1565 1565
 }
1566 1566
 
1567
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1567
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1568 1568
 
1569 1569
 /**
1570 1570
  * Adds Actions to Render Form Content.
@@ -1576,19 +1576,19 @@  discard block
 block discarded – undo
1576 1576
  *
1577 1577
  * @return void
1578 1578
  */
1579
-function give_form_content( $form_id, $args ) {
1579
+function give_form_content($form_id, $args) {
1580 1580
 
1581
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1581
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1582 1582
 		? $args['show_content']
1583
-		: get_post_meta( $form_id, '_give_content_option', true );
1583
+		: get_post_meta($form_id, '_give_content_option', true);
1584 1584
 
1585
-	if ( $show_content !== 'none' ) {
1585
+	if ($show_content !== 'none') {
1586 1586
 		//add action according to value
1587
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1587
+		add_action($show_content, 'give_form_display_content', 10, 2);
1588 1588
 	}
1589 1589
 }
1590 1590
 
1591
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1591
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1592 1592
 
1593 1593
 /**
1594 1594
  * Renders Post Form Content.
@@ -1602,24 +1602,24 @@  discard block
 block discarded – undo
1602 1602
  *
1603 1603
  * @return void
1604 1604
  */
1605
-function give_form_display_content( $form_id, $args ) {
1605
+function give_form_display_content($form_id, $args) {
1606 1606
 
1607
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1608
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1607
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1608
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1609 1609
 		? $args['show_content']
1610
-		: get_post_meta( $form_id, '_give_content_option', true );
1610
+		: get_post_meta($form_id, '_give_content_option', true);
1611 1611
 
1612
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1613
-		$content = apply_filters( 'the_content', $content );
1612
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1613
+		$content = apply_filters('the_content', $content);
1614 1614
 	}
1615 1615
 
1616
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1616
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1617 1617
 
1618
-	echo apply_filters( 'give_form_content_output', $output );
1618
+	echo apply_filters('give_form_content_output', $output);
1619 1619
 
1620 1620
 	//remove action to prevent content output on addition forms on page
1621 1621
 	//@see: https://github.com/WordImpress/Give/issues/634
1622
-	remove_action( $show_content, 'give_form_display_content' );
1622
+	remove_action($show_content, 'give_form_display_content');
1623 1623
 }
1624 1624
 
1625 1625
 /**
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
  *
1632 1632
  * @return void
1633 1633
  */
1634
-function give_checkout_hidden_fields( $form_id ) {
1634
+function give_checkout_hidden_fields($form_id) {
1635 1635
 
1636 1636
 	/**
1637 1637
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1640,13 +1640,13 @@  discard block
 block discarded – undo
1640 1640
 	 *
1641 1641
 	 * @param int $form_id The form ID.
1642 1642
 	 */
1643
-	do_action( 'give_hidden_fields_before', $form_id );
1643
+	do_action('give_hidden_fields_before', $form_id);
1644 1644
 
1645
-	if ( is_user_logged_in() ) { ?>
1645
+	if (is_user_logged_in()) { ?>
1646 1646
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1647 1647
 	<?php } ?>
1648 1648
 	<input type="hidden" name="give_action" value="purchase"/>
1649
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1649
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1650 1650
 	<?php
1651 1651
 	/**
1652 1652
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	 *
1656 1656
 	 * @param int $form_id The form ID.
1657 1657
 	 */
1658
-	do_action( 'give_hidden_fields_after', $form_id );
1658
+	do_action('give_hidden_fields_after', $form_id);
1659 1659
 
1660 1660
 }
1661 1661
 
@@ -1670,20 +1670,20 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return string $content Filtered content.
1672 1672
  */
1673
-function give_filter_success_page_content( $content ) {
1673
+function give_filter_success_page_content($content) {
1674 1674
 
1675 1675
 	$give_options = give_get_settings();
1676 1676
 
1677
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1678
-		if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) {
1679
-			$content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content );
1677
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1678
+		if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) {
1679
+			$content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content);
1680 1680
 		}
1681 1681
 	}
1682 1682
 
1683 1683
 	return $content;
1684 1684
 }
1685 1685
 
1686
-add_filter( 'the_content', 'give_filter_success_page_content' );
1686
+add_filter('the_content', 'give_filter_success_page_content');
1687 1687
 
1688 1688
 /**
1689 1689
  * Test Mode Frontend Warning.
@@ -1694,14 +1694,14 @@  discard block
 block discarded – undo
1694 1694
  */
1695 1695
 function give_test_mode_frontend_warning() {
1696 1696
 
1697
-	$test_mode = give_get_option( 'test_mode' );
1697
+	$test_mode = give_get_option('test_mode');
1698 1698
 
1699
-	if ( $test_mode == 'on' ) {
1700
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1699
+	if ($test_mode == 'on') {
1700
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1701 1701
 	}
1702 1702
 }
1703 1703
 
1704
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1704
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1705 1705
 
1706 1706
 /**
1707 1707
  * Members-only Form.
@@ -1715,21 +1715,21 @@  discard block
 block discarded – undo
1715 1715
  *
1716 1716
  * @return string
1717 1717
  */
1718
-function give_members_only_form( $final_output, $args ) {
1718
+function give_members_only_form($final_output, $args) {
1719 1719
 
1720
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1720
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1721 1721
 
1722 1722
 	//Sanity Check: Must have form_id & not be logged in
1723
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1723
+	if (empty($form_id) || is_user_logged_in()) {
1724 1724
 		return $final_output;
1725 1725
 	}
1726 1726
 
1727 1727
 	//Logged in only and Register / Login set to none
1728
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1728
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1729 1729
 
1730
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1730
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1731 1731
 
1732
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1732
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1733 1733
 
1734 1734
 	}
1735 1735
 
@@ -1737,4 +1737,4 @@  discard block
 block discarded – undo
1737 1737
 
1738 1738
 }
1739 1739
 
1740
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1740
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function get_predefined_dates() {
87 87
 		$predefined = array(
88
-			'today'        => esc_html__( 'Today', 'give' ),
89
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
90
-			'this_week'    => esc_html__( 'This Week', 'give' ),
91
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
92
-			'this_month'   => esc_html__( 'This Month', 'give' ),
93
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
94
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
95
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
96
-			'this_year'    => esc_html__( 'This Year', 'give' ),
97
-			'last_year'    => esc_html__( 'Last Year', 'give' )
88
+			'today'        => esc_html__('Today', 'give'),
89
+			'yesterday'    => esc_html__('Yesterday', 'give'),
90
+			'this_week'    => esc_html__('This Week', 'give'),
91
+			'last_week'    => esc_html__('Last Week', 'give'),
92
+			'this_month'   => esc_html__('This Month', 'give'),
93
+			'last_month'   => esc_html__('Last Month', 'give'),
94
+			'this_quarter' => esc_html__('This Quarter', 'give'),
95
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
96
+			'this_year'    => esc_html__('This Year', 'give'),
97
+			'last_year'    => esc_html__('Last Year', 'give')
98 98
 		);
99 99
 
100
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
100
+		return apply_filters('give_stats_predefined_dates', $predefined);
101 101
 	}
102 102
 
103 103
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return void
115 115
 	 */
116
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
116
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
117 117
 
118
-		if ( empty( $_start_date ) ) {
118
+		if (empty($_start_date)) {
119 119
 			$_start_date = 'this_month';
120 120
 		}
121 121
 
122
-		if ( empty( $_end_date ) ) {
122
+		if (empty($_end_date)) {
123 123
 			$_end_date = $_start_date;
124 124
 		}
125 125
 
126
-		$this->start_date = $this->convert_date( $_start_date );
127
-		$this->end_date   = $this->convert_date( $_end_date, true );
126
+		$this->start_date = $this->convert_date($_start_date);
127
+		$this->end_date   = $this->convert_date($_end_date, true);
128 128
 	}
129 129
 
130 130
 	/**
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
142 142
 	 */
143
-	public function convert_date( $date, $end_date = false ) {
143
+	public function convert_date($date, $end_date = false) {
144 144
 
145 145
 		$this->timestamp = false;
146 146
 		$second          = $end_date ? 59 : 0;
147 147
 		$minute          = $end_date ? 59 : 0;
148 148
 		$hour            = $end_date ? 23 : 0;
149 149
 		$day             = 1;
150
-		$month           = date( 'n', current_time( 'timestamp' ) );
151
-		$year            = date( 'Y', current_time( 'timestamp' ) );
150
+		$month           = date('n', current_time('timestamp'));
151
+		$year            = date('Y', current_time('timestamp'));
152 152
 
153
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
153
+		if (array_key_exists($date, $this->get_predefined_dates())) {
154 154
 
155 155
 			// This is a predefined date rate, such as last_week
156
-			switch ( $date ) {
156
+			switch ($date) {
157 157
 
158 158
 				case 'this_month' :
159 159
 
160
-					if ( $end_date ) {
160
+					if ($end_date) {
161 161
 
162
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
162
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
163 163
 						$hour   = 23;
164 164
 						$minute = 59;
165 165
 						$second = 59;
@@ -169,28 +169,28 @@  discard block
 block discarded – undo
169 169
 
170 170
 				case 'last_month' :
171 171
 
172
-					if ( $month == 1 ) {
172
+					if ($month == 1) {
173 173
 
174 174
 						$month = 12;
175
-						$year --;
175
+						$year--;
176 176
 
177 177
 					} else {
178 178
 
179
-						$month --;
179
+						$month--;
180 180
 
181 181
 					}
182 182
 
183
-					if ( $end_date ) {
184
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
183
+					if ($end_date) {
184
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
185 185
 					}
186 186
 
187 187
 					break;
188 188
 
189 189
 				case 'today' :
190 190
 
191
-					$day = date( 'd', current_time( 'timestamp' ) );
191
+					$day = date('d', current_time('timestamp'));
192 192
 
193
-					if ( $end_date ) {
193
+					if ($end_date) {
194 194
 						$hour   = 23;
195 195
 						$minute = 59;
196 196
 						$second = 59;
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 
201 201
 				case 'yesterday' :
202 202
 
203
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
203
+					$day = date('d', current_time('timestamp')) - 1;
204 204
 
205 205
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
206
-					if ( $day < 1 ) {
206
+					if ($day < 1) {
207 207
 
208 208
 						// If current month is 1
209
-						if ( 1 == $month ) {
209
+						if (1 == $month) {
210 210
 
211 211
 							$year -= 1; // Today is January 1, so skip back to last day of December
212 212
 							$month = 12;
213
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
213
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
214 214
 
215 215
 						} else {
216 216
 
217 217
 							// Go back one month and get the last day of the month
218 218
 							$month -= 1;
219
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
219
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
220 220
 
221 221
 						}
222 222
 					}
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
 				case 'this_week' :
227 227
 
228
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
229
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
228
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
229
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
230 230
 
231
-					if ( $today < $days_to_week_start ) {
231
+					if ($today < $days_to_week_start) {
232 232
 
233
-						if ( $month > 1 ) {
233
+						if ($month > 1) {
234 234
 							$month -= 1;
235 235
 						} else {
236 236
 							$month = 12;
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 
239 239
 					}
240 240
 
241
-					if ( ! $end_date ) {
241
+					if ( ! $end_date) {
242 242
 
243 243
 						// Getting the start day
244 244
 
245
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
246
-						$day += get_option( 'start_of_week' );
245
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
246
+						$day += get_option('start_of_week');
247 247
 
248 248
 					} else {
249 249
 
250 250
 						// Getting the end day
251 251
 
252
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
253
-						$day += get_option( 'start_of_week' ) + 6;
252
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
253
+						$day += get_option('start_of_week') + 6;
254 254
 
255 255
 					}
256 256
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 				case 'last_week' :
260 260
 
261
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
262
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
261
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
262
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
263 263
 
264
-					if ( $today < $days_to_week_start ) {
264
+					if ($today < $days_to_week_start) {
265 265
 
266
-						if ( $month > 1 ) {
266
+						if ($month > 1) {
267 267
 							$month -= 1;
268 268
 						} else {
269 269
 							$month = 12;
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 
272 272
 					}
273 273
 
274
-					if ( ! $end_date ) {
274
+					if ( ! $end_date) {
275 275
 
276 276
 						// Getting the start day
277 277
 
278
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
279
-						$day += get_option( 'start_of_week' );
278
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
279
+						$day += get_option('start_of_week');
280 280
 
281 281
 					} else {
282 282
 
283 283
 						// Getting the end day
284 284
 
285
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
286
-						$day += get_option( 'start_of_week' ) + 6;
285
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
286
+						$day += get_option('start_of_week') + 6;
287 287
 
288 288
 					}
289 289
 
@@ -291,39 +291,39 @@  discard block
 block discarded – undo
291 291
 
292 292
 				case 'this_quarter' :
293 293
 
294
-					$month_now = date( 'n', current_time( 'timestamp' ) );
294
+					$month_now = date('n', current_time('timestamp'));
295 295
 
296
-					if ( $month_now <= 3 ) {
296
+					if ($month_now <= 3) {
297 297
 
298
-						if ( ! $end_date ) {
298
+						if ( ! $end_date) {
299 299
 							$month = 1;
300 300
 						} else {
301 301
 							$month  = 3;
302
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
302
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
303 303
 							$hour   = 23;
304 304
 							$minute = 59;
305 305
 							$second = 59;
306 306
 						}
307 307
 
308
-					} else if ( $month_now <= 6 ) {
308
+					} else if ($month_now <= 6) {
309 309
 
310
-						if ( ! $end_date ) {
310
+						if ( ! $end_date) {
311 311
 							$month = 4;
312 312
 						} else {
313 313
 							$month  = 6;
314
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
314
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
315 315
 							$hour   = 23;
316 316
 							$minute = 59;
317 317
 							$second = 59;
318 318
 						}
319 319
 
320
-					} else if ( $month_now <= 9 ) {
320
+					} else if ($month_now <= 9) {
321 321
 
322
-						if ( ! $end_date ) {
322
+						if ( ! $end_date) {
323 323
 							$month = 7;
324 324
 						} else {
325 325
 							$month  = 9;
326
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
326
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
327 327
 							$hour   = 23;
328 328
 							$minute = 59;
329 329
 							$second = 59;
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 
332 332
 					} else {
333 333
 
334
-						if ( ! $end_date ) {
334
+						if ( ! $end_date) {
335 335
 							$month = 10;
336 336
 						} else {
337 337
 							$month  = 12;
338
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
338
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
339 339
 							$hour   = 23;
340 340
 							$minute = 59;
341 341
 							$second = 59;
@@ -347,40 +347,40 @@  discard block
 block discarded – undo
347 347
 
348 348
 				case 'last_quarter' :
349 349
 
350
-					$month_now = date( 'n', current_time( 'timestamp' ) );
350
+					$month_now = date('n', current_time('timestamp'));
351 351
 
352
-					if ( $month_now <= 3 ) {
352
+					if ($month_now <= 3) {
353 353
 
354
-						if ( ! $end_date ) {
354
+						if ( ! $end_date) {
355 355
 							$month = 10;
356 356
 						} else {
357 357
 							$year -= 1;
358 358
 							$month  = 12;
359
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
359
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
360 360
 							$hour   = 23;
361 361
 							$minute = 59;
362 362
 							$second = 59;
363 363
 						}
364 364
 
365
-					} else if ( $month_now <= 6 ) {
365
+					} else if ($month_now <= 6) {
366 366
 
367
-						if ( ! $end_date ) {
367
+						if ( ! $end_date) {
368 368
 							$month = 1;
369 369
 						} else {
370 370
 							$month  = 3;
371
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
371
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
372 372
 							$hour   = 23;
373 373
 							$minute = 59;
374 374
 							$second = 59;
375 375
 						}
376 376
 
377
-					} else if ( $month_now <= 9 ) {
377
+					} else if ($month_now <= 9) {
378 378
 
379
-						if ( ! $end_date ) {
379
+						if ( ! $end_date) {
380 380
 							$month = 4;
381 381
 						} else {
382 382
 							$month  = 6;
383
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
383
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
384 384
 							$hour   = 23;
385 385
 							$minute = 59;
386 386
 							$second = 59;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 
389 389
 					} else {
390 390
 
391
-						if ( ! $end_date ) {
391
+						if ( ! $end_date) {
392 392
 							$month = 7;
393 393
 						} else {
394 394
 							$month  = 9;
395
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
395
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
396 396
 							$hour   = 23;
397 397
 							$minute = 59;
398 398
 							$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 				case 'this_year' :
406 406
 
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 				case 'last_year' :
420 420
 
421 421
 					$year -= 1;
422
-					if ( ! $end_date ) {
422
+					if ( ! $end_date) {
423 423
 						$month = 1;
424 424
 					} else {
425 425
 						$month  = 12;
426
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
426
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
427 427
 						$hour   = 23;
428 428
 						$minute = 59;
429 429
 						$second = 59;
@@ -434,30 +434,30 @@  discard block
 block discarded – undo
434 434
 			}
435 435
 
436 436
 
437
-		} else if ( is_numeric( $date ) ) {
437
+		} else if (is_numeric($date)) {
438 438
 
439 439
 			// return $date unchanged since it is a timestamp
440 440
 			$this->timestamp = true;
441 441
 
442
-		} else if ( false !== strtotime( $date ) ) {
442
+		} else if (false !== strtotime($date)) {
443 443
 
444
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
445
-			$year  = date( 'Y', $date );
446
-			$month = date( 'm', $date );
447
-			$day   = date( 'd', $date );
444
+			$date  = strtotime($date, current_time('timestamp'));
445
+			$year  = date('Y', $date);
446
+			$month = date('m', $date);
447
+			$day   = date('d', $date);
448 448
 
449 449
 		} else {
450 450
 
451
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
451
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
452 452
 
453 453
 		}
454 454
 
455
-		if ( false === $this->timestamp ) {
455
+		if (false === $this->timestamp) {
456 456
 			// Create an exact timestamp
457
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
457
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
458 458
 		}
459 459
 
460
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
460
+		return apply_filters('give_stats_date', $date, $end_date, $this);
461 461
 
462 462
 	}
463 463
 
@@ -473,33 +473,33 @@  discard block
 block discarded – undo
473 473
 	 * 
474 474
 	 * @return string
475 475
 	 */
476
-	public function count_where( $where = '' ) {
476
+	public function count_where($where = '') {
477 477
 		// Only get payments in our date range
478 478
 
479 479
 		$start_where = '';
480 480
 		$end_where   = '';
481 481
 
482
-		if ( $this->start_date ) {
482
+		if ($this->start_date) {
483 483
 
484
-			if ( $this->timestamp ) {
484
+			if ($this->timestamp) {
485 485
 				$format = 'Y-m-d H:i:s';
486 486
 			} else {
487 487
 				$format = 'Y-m-d 00:00:00';
488 488
 			}
489 489
 
490
-			$start_date  = date( $format, $this->start_date );
490
+			$start_date  = date($format, $this->start_date);
491 491
 			$start_where = " AND p.post_date >= '{$start_date}'";
492 492
 		}
493 493
 
494
-		if ( $this->end_date ) {
494
+		if ($this->end_date) {
495 495
 
496
-			if ( $this->timestamp ) {
496
+			if ($this->timestamp) {
497 497
 				$format = 'Y-m-d H:i:s';
498 498
 			} else {
499 499
 				$format = 'Y-m-d 23:59:59';
500 500
 			}
501 501
 
502
-			$end_date = date( $format, $this->end_date );
502
+			$end_date = date($format, $this->end_date);
503 503
 
504 504
 			$end_where = " AND p.post_date <= '{$end_date}'";
505 505
 		}
@@ -521,34 +521,34 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string
523 523
 	 */
524
-	public function payments_where( $where = '' ) {
524
+	public function payments_where($where = '') {
525 525
 
526 526
 		global $wpdb;
527 527
 
528 528
 		$start_where = '';
529 529
 		$end_where   = '';
530 530
 
531
-		if ( ! is_wp_error( $this->start_date ) ) {
531
+		if ( ! is_wp_error($this->start_date)) {
532 532
 
533
-			if ( $this->timestamp ) {
533
+			if ($this->timestamp) {
534 534
 				$format = 'Y-m-d H:i:s';
535 535
 			} else {
536 536
 				$format = 'Y-m-d 00:00:00';
537 537
 			}
538 538
 
539
-			$start_date  = date( $format, $this->start_date );
539
+			$start_date  = date($format, $this->start_date);
540 540
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
541 541
 		}
542 542
 
543
-		if ( ! is_wp_error( $this->end_date ) ) {
543
+		if ( ! is_wp_error($this->end_date)) {
544 544
 
545
-			if ( $this->timestamp ) {
545
+			if ($this->timestamp) {
546 546
 				$format = 'Y-m-d 00:00:00';
547 547
 			} else {
548 548
 				$format = 'Y-m-d 23:59:59';
549 549
 			}
550 550
 
551
-			$end_date = date( $format, $this->end_date );
551
+			$end_date = date($format, $this->end_date);
552 552
 
553 553
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
554 554
 		}
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 		/**
39 39
 		 * Templates
40 40
 		 */
41
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
41
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
42 42
 
43 43
 		/**
44 44
 		 * Content Wrappers
45 45
 		 */
46
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
47
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
46
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
47
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
48 48
 
49 49
 		/**
50 50
 		 * Entry Summary Classes
51 51
 		 */
52
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
52
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
53 53
 
54 54
 		/**
55 55
 		 * Sidebar
56 56
 		 */
57
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
57
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
58 58
 
59 59
 		/**
60 60
 		 * Single Forms Summary Box
61 61
 		 */
62
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
63
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
62
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
63
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
64 64
 
65 65
 	}
66 66
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return string $classes List of space separated class names.
77 77
 	 */
78
-	public function give_set_single_summary_classes( $classes ) {
78
+	public function give_set_single_summary_classes($classes) {
79 79
 
80
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
80
+		$sidebar_option = give_get_option('disable_form_sidebar');
81 81
 
82 82
 		//Add full width class when feature image is disabled AND no widgets are present
83
-		if ( $sidebar_option == 'on' ) {
83
+		if ($sidebar_option == 'on') {
84 84
 			$classes .= ' give-full-width';
85 85
 		}
86 86
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function give_output_sidebar_option() {
102 102
 
103
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
103
+		$sidebar_option = give_get_option('disable_form_sidebar');
104 104
 
105 105
 		//Add full width class when feature image is disabled AND no widgets are present
106
-		if ( $sidebar_option !== 'on' ) {
107
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
108
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
109
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
110
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
106
+		if ($sidebar_option !== 'on') {
107
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
108
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
109
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
110
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
111 111
 		}
112 112
 
113 113
 	}
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string $template
131 131
 	 */
132
-	public static function template_loader( $template ) {
133
-		$find = array( 'give.php' );
132
+	public static function template_loader($template) {
133
+		$find = array('give.php');
134 134
 		$file = '';
135 135
 
136
-		if ( is_single() && get_post_type() == 'give_forms' ) {
136
+		if (is_single() && get_post_type() == 'give_forms') {
137 137
 			$file   = 'single-give-form.php';
138 138
 			$find[] = $file;
139
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
139
+			$find[] = apply_filters('give_template_path', 'give/').$file;
140 140
 		}
141 141
 
142
-		if ( $file ) {
143
-			$template = locate_template( array_unique( $find ) );
144
-			if ( ! $template ) {
145
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
142
+		if ($file) {
143
+			$template = locate_template(array_unique($find));
144
+			if ( ! $template) {
145
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
146 146
 			}
147 147
 		}
148 148
 
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 
771 771
 	}
772 772
 
773
-    /**
774
-     * Get if form type set or not.
775
-     *
776
-     * @since  1.6
773
+	/**
774
+	 * Get if form type set or not.
775
+	 *
776
+	 * @since  1.6
777 777
 	 * @access public
778
-     *
778
+	 *
779 779
 	 * @return bool
780 780
 	 *
781 781
 	public function is_set_type_donation_form() {
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1029
-		       );
1026
+				   'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
+			   && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
+			   && ( $this->get_goal() <= $this->get_earnings()
1029
+			   );
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return void
333 333
 	 */
334
-	public function __construct( $_id = false, $_args = array() ) {
334
+	public function __construct($_id = false, $_args = array()) {
335 335
 
336
-		$donation_form = WP_Post::get_instance( $_id );
336
+		$donation_form = WP_Post::get_instance($_id);
337 337
 
338
-		return $this->setup_donation_form( $donation_form );
338
+		return $this->setup_donation_form($donation_form);
339 339
 	}
340 340
 
341 341
 	/**
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return bool                   If the setup was successful or not.
350 350
 	 */
351
-	private function setup_donation_form( $donation_form ) {
351
+	private function setup_donation_form($donation_form) {
352 352
 
353
-		if ( ! is_object( $donation_form ) ) {
353
+		if ( ! is_object($donation_form)) {
354 354
 			return false;
355 355
 		}
356 356
 
357
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
357
+		if ( ! is_a($donation_form, 'WP_Post')) {
358 358
 			return false;
359 359
 		}
360 360
 
361
-		if ( 'give_forms' !== $donation_form->post_type ) {
361
+		if ('give_forms' !== $donation_form->post_type) {
362 362
 			return false;
363 363
 		}
364 364
 
365
-		foreach ( $donation_form as $key => $value ) {
365
+		foreach ($donation_form as $key => $value) {
366 366
 
367
-			switch ( $key ) {
367
+			switch ($key) {
368 368
 
369 369
 				default:
370 370
 					$this->$key = $value;
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 * @return mixed
390 390
 	 * @throws Exception
391 391
 	 */
392
-	public function __get( $key ) {
392
+	public function __get($key) {
393 393
 
394
-		if ( method_exists( $this, 'get_' . $key ) ) {
394
+		if (method_exists($this, 'get_'.$key)) {
395 395
 
396
-			return call_user_func( array( $this, 'get_' . $key ) );
396
+			return call_user_func(array($this, 'get_'.$key));
397 397
 
398 398
 		} else {
399 399
 
400 400
 			/* translators: %s: property key */
401
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
401
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
402 402
 
403 403
 		}
404 404
 
@@ -414,30 +414,30 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417
-	public function create( $data = array() ) {
417
+	public function create($data = array()) {
418 418
 
419
-		if ( $this->id != 0 ) {
419
+		if ($this->id != 0) {
420 420
 			return false;
421 421
 		}
422 422
 
423 423
 		$defaults = array(
424 424
 			'post_type'   => 'give_forms',
425 425
 			'post_status' => 'draft',
426
-			'post_title'  => esc_html__( 'New Donation Form', 'give' )
426
+			'post_title'  => esc_html__('New Donation Form', 'give')
427 427
 		);
428 428
 
429
-		$args = wp_parse_args( $data, $defaults );
429
+		$args = wp_parse_args($data, $defaults);
430 430
 
431 431
 		/**
432 432
 		 * Fired before a donation form is created
433 433
 		 *
434 434
 		 * @param array $args The post object arguments used for creation.
435 435
 		 */
436
-		do_action( 'give_form_pre_create', $args );
436
+		do_action('give_form_pre_create', $args);
437 437
 
438
-		$id = wp_insert_post( $args, true );
438
+		$id = wp_insert_post($args, true);
439 439
 
440
-		$donation_form = WP_Post::get_instance( $id );
440
+		$donation_form = WP_Post::get_instance($id);
441 441
 
442 442
 		/**
443 443
 		 * Fired after a donation form is created
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 		 * @param int   $id   The post ID of the created item.
446 446
 		 * @param array $args The post object arguments used for creation.
447 447
 		 */
448
-		do_action( 'give_form_post_create', $id, $args );
448
+		do_action('give_form_post_create', $id, $args);
449 449
 
450
-		return $this->setup_donation_form( $donation_form );
450
+		return $this->setup_donation_form($donation_form);
451 451
 
452 452
 	}
453 453
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @return string Donation form name.
473 473
 	 */
474 474
 	public function get_name() {
475
-		return get_the_title( $this->ID );
475
+		return get_the_title($this->ID);
476 476
 	}
477 477
 
478 478
 	/**
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function get_price() {
487 487
 
488
-		if ( ! isset( $this->price ) ) {
488
+		if ( ! isset($this->price)) {
489 489
 
490
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
490
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
491 491
 
492
-			if ( $this->price ) {
492
+			if ($this->price) {
493 493
 
494
-				$this->price = give_sanitize_amount( $this->price );
494
+				$this->price = give_sanitize_amount($this->price);
495 495
 
496 496
 			} else {
497 497
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		 * @param string     $price The donation form price.
510 510
 		 * @param string|int $id    The form ID.
511 511
 		 */
512
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
512
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
513 513
 	}
514 514
 
515 515
 	/**
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function get_minimum_price() {
524 524
 
525
-		if ( ! isset( $this->minimum_price ) ) {
525
+		if ( ! isset($this->minimum_price)) {
526 526
 
527
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
528
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
527
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
528
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
529 529
 
530
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
530
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
531 531
 
532
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
532
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
533 533
 
534 534
 			} else {
535 535
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		}
541 541
 
542
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
542
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
543 543
 	}
544 544
 
545 545
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	public function get_prices() {
554 554
 
555
-		if ( ! isset( $this->prices ) ) {
555
+		if ( ! isset($this->prices)) {
556 556
 
557
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
557
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
558 558
 
559 559
 		}
560 560
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @param array $prices The array of mulit-level prices.
567 567
 		 * @param int|string The ID of the form.
568 568
 		 */
569
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
569
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
570 570
 
571 571
 	}
572 572
 
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	public function get_goal() {
582 582
 
583
-		if ( ! isset( $this->goal ) ) {
583
+		if ( ! isset($this->goal)) {
584 584
 
585
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
585
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
586 586
 
587
-			if ( $this->goal ) {
587
+			if ($this->goal) {
588 588
 
589
-				$this->goal = give_sanitize_amount( $this->goal );
589
+				$this->goal = give_sanitize_amount($this->goal);
590 590
 
591 591
 			} else {
592 592
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		}
598 598
 
599
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
599
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
600 600
 
601 601
 	}
602 602
 
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function is_single_price_mode() {
612 612
 
613
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
613
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
614 614
 		$ret    = 0;
615 615
 
616
-		if ( empty( $option ) || $option === 'set' ) {
616
+		if (empty($option) || $option === 'set') {
617 617
 			$ret = 1;
618 618
 		}
619 619
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		 * @param bool $ret Is donation form in single price mode?
626 626
 		 * @param int|string The ID of the donation form.
627 627
 		 */
628
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
628
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
629 629
 
630 630
 	}
631 631
 
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function is_custom_price_mode() {
641 641
 
642
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
642
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
643 643
 		$ret    = 0;
644 644
 
645
-		if ( $option === 'yes' ) {
645
+		if ($option === 'yes') {
646 646
 			$ret = 1;
647 647
 		}
648 648
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		 * @param bool $ret Is donation form in custom price mode?
655 655
 		 * @param int|string The ID of the donation form.
656 656
 		 */
657
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
657
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
658 658
 
659 659
 	}
660 660
 
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 	 */
671 671
 	public function has_variable_prices() {
672 672
 
673
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
673
+		$option = get_post_meta($this->ID, '_give_price_option', true);
674 674
 		$ret    = 0;
675 675
 
676
-		if ( $option === 'multi' ) {
676
+		if ($option === 'multi') {
677 677
 			$ret = 1;
678 678
 		}
679 679
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 		 * @param bool $ret Does donation form have variable prices?
684 684
 		 * @param int|string The ID of the donation form.
685 685
 		 */
686
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
686
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
687 687
 
688 688
 	}
689 689
 
@@ -697,17 +697,17 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function get_type() {
699 699
 
700
-		if ( ! isset( $this->type ) ) {
700
+		if ( ! isset($this->type)) {
701 701
 
702
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
702
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
703 703
 
704
-			if ( empty( $this->type ) ) {
704
+			if (empty($this->type)) {
705 705
 				$this->type = 'set';
706 706
 			}
707 707
 
708 708
 		}
709 709
 
710
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
710
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
711 711
 
712 712
 	}
713 713
 
@@ -723,23 +723,23 @@  discard block
 block discarded – undo
723 723
 	 *
724 724
 	 * @return string
725 725
 	 */
726
-	public function get_form_classes( $args ) {
726
+	public function get_form_classes($args) {
727 727
 
728
-		$float_labels_option = give_is_float_labels_enabled( $args )
728
+		$float_labels_option = give_is_float_labels_enabled($args)
729 729
 			? 'float-labels-enabled'
730 730
 			: '';
731 731
 
732
-		$form_classes_array = apply_filters( 'give_form_classes', array(
732
+		$form_classes_array = apply_filters('give_form_classes', array(
733 733
 			'give-form',
734
-			'give-form-' . $this->ID,
735
-			'give-form-type-' . $this->get_type(),
734
+			'give-form-'.$this->ID,
735
+			'give-form-type-'.$this->get_type(),
736 736
 			$float_labels_option
737
-		), $this->ID, $args );
737
+		), $this->ID, $args);
738 738
 
739 739
 		// Remove empty class names.
740
-		$form_classes_array = array_filter( $form_classes_array );
740
+		$form_classes_array = array_filter($form_classes_array);
741 741
 
742
-		return implode( ' ', $form_classes_array );
742
+		return implode(' ', $form_classes_array);
743 743
 
744 744
 	}
745 745
 
@@ -754,19 +754,19 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return string
756 756
 	 */
757
-	public function get_form_wrap_classes( $args ) {
757
+	public function get_form_wrap_classes($args) {
758 758
 
759
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
759
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
760 760
 			? $args['display_style']
761
-			: get_post_meta( $this->ID, '_give_payment_display', true );
761
+			: get_post_meta($this->ID, '_give_payment_display', true);
762 762
 
763
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
763
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
764 764
 			'give-form-wrap',
765
-			'give-display-' . $display_option
766
-		), $this->ID, $args );
765
+			'give-display-'.$display_option
766
+		), $this->ID, $args);
767 767
 
768 768
 
769
-		return implode( ' ', $form_wrap_classes_array );
769
+		return implode(' ', $form_wrap_classes_array);
770 770
 
771 771
 	}
772 772
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	public function is_multi_type_donation_form() {
797 797
 		$form_type = $this->get_type();
798 798
 
799
-		return ( 'multi' === $form_type ? true : false );
799
+		return ('multi' === $form_type ? true : false);
800 800
 
801 801
 	}
802 802
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 */
811 811
 	public function get_sales() {
812 812
 
813
-		if ( ! isset( $this->sales ) ) {
813
+		if ( ! isset($this->sales)) {
814 814
 
815
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
816
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
815
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
816
+				add_post_meta($this->ID, '_give_form_sales', 0);
817 817
 			} // End if
818 818
 
819
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
819
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
820 820
 
821
-			if ( $this->sales < 0 ) {
821
+			if ($this->sales < 0) {
822 822
 				// Never let sales be less than zero
823 823
 				$this->sales = 0;
824 824
 			}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @return int|false     New number of total sales.
841 841
 	 */
842
-	public function increase_sales( $quantity = 1 ) {
842
+	public function increase_sales($quantity = 1) {
843 843
 
844
-		$sales       = give_get_form_sales_stats( $this->ID );
845
-		$quantity    = absint( $quantity );
844
+		$sales       = give_get_form_sales_stats($this->ID);
845
+		$quantity    = absint($quantity);
846 846
 		$total_sales = $sales + $quantity;
847 847
 
848
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
848
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
849 849
 
850 850
 			$this->sales = $total_sales;
851 851
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return int|false     New number of total sales.
868 868
 	 */
869
-	public function decrease_sales( $quantity = 1 ) {
869
+	public function decrease_sales($quantity = 1) {
870 870
 
871
-		$sales = give_get_form_sales_stats( $this->ID );
871
+		$sales = give_get_form_sales_stats($this->ID);
872 872
 
873 873
 		// Only decrease if not already zero
874
-		if ( $sales > 0 ) {
874
+		if ($sales > 0) {
875 875
 
876
-			$quantity    = absint( $quantity );
876
+			$quantity    = absint($quantity);
877 877
 			$total_sales = $sales - $quantity;
878 878
 
879
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
879
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
880 880
 
881 881
 				$this->sales = $sales;
882 882
 
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	 */
901 901
 	public function get_earnings() {
902 902
 
903
-		if ( ! isset( $this->earnings ) ) {
903
+		if ( ! isset($this->earnings)) {
904 904
 
905
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
906
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
905
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
906
+				add_post_meta($this->ID, '_give_form_earnings', 0);
907 907
 			}
908 908
 
909
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
909
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
910 910
 
911
-			if ( $this->earnings < 0 ) {
911
+			if ($this->earnings < 0) {
912 912
 				// Never let earnings be less than zero
913 913
 				$this->earnings = 0;
914 914
 			}
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 	 *
930 930
 	 * @return float|false
931 931
 	 */
932
-	public function increase_earnings( $amount = 0 ) {
932
+	public function increase_earnings($amount = 0) {
933 933
 
934
-		$earnings   = give_get_form_earnings_stats( $this->ID );
934
+		$earnings   = give_get_form_earnings_stats($this->ID);
935 935
 		$new_amount = $earnings + (float) $amount;
936 936
 
937
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
937
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
938 938
 
939 939
 			$this->earnings = $new_amount;
940 940
 
@@ -956,16 +956,16 @@  discard block
 block discarded – undo
956 956
 	 * 
957 957
 	 * @return float|false
958 958
 	 */
959
-	public function decrease_earnings( $amount ) {
959
+	public function decrease_earnings($amount) {
960 960
 
961
-		$earnings = give_get_form_earnings_stats( $this->ID );
961
+		$earnings = give_get_form_earnings_stats($this->ID);
962 962
 
963
-		if ( $earnings > 0 ) {
963
+		if ($earnings > 0) {
964 964
 			// Only decrease if greater than zero
965 965
 			$new_amount = $earnings - (float) $amount;
966 966
 
967 967
 
968
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
968
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
969 969
 
970 970
 				$this->earnings = $new_amount;
971 971
 
@@ -989,22 +989,22 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @return bool
991 991
 	 */
992
-	public function is_free( $price_id = false ) {
992
+	public function is_free($price_id = false) {
993 993
 
994 994
 		$is_free          = false;
995
-		$variable_pricing = give_has_variable_prices( $this->ID );
995
+		$variable_pricing = give_has_variable_prices($this->ID);
996 996
 
997
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
998
-			$price = give_get_price_option_amount( $this->ID, $price_id );
999
-		} elseif ( ! $variable_pricing ) {
1000
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
997
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
998
+			$price = give_get_price_option_amount($this->ID, $price_id);
999
+		} elseif ( ! $variable_pricing) {
1000
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1001 1001
 		}
1002 1002
 
1003
-		if ( isset( $price ) && (float) $price == 0 ) {
1003
+		if (isset($price) && (float) $price == 0) {
1004 1004
 			$is_free = true;
1005 1005
 		}
1006 1006
 
1007
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1007
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1008 1008
 
1009 1009
 	}
1010 1010
 
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1026
+			       'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
1027
+		       && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1028
+		       && ($this->get_goal() <= $this->get_earnings()
1029 1029
 		       );
1030 1030
 	}
1031 1031
 
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool                            The result of the update query.
1042 1042
 	 */
1043
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1043
+	private function update_meta($meta_key = '', $meta_value = '') {
1044 1044
 
1045 1045
 		/* @var WPDB $wpdb */
1046 1046
 		global $wpdb;
1047 1047
 
1048
-		if ( empty( $meta_key ) ) {
1048
+		if (empty($meta_key)) {
1049 1049
 			return false;
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make sure if it needs to be serialized, we do
1053
-		$meta_value = maybe_serialize( $meta_value );
1053
+		$meta_value = maybe_serialize($meta_value);
1054 1054
 
1055
-		if ( is_numeric( $meta_value ) ) {
1056
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1055
+		if (is_numeric($meta_value)) {
1056
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1057 1057
 		} else {
1058 1058
 			$value_type = "'%s'";
1059 1059
 		}
1060 1060
 
1061
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1061
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1062 1062
 
1063
-		if ( $wpdb->query( $sql ) ) {
1063
+		if ($wpdb->query($sql)) {
1064 1064
 
1065
-			clean_post_cache( $this->ID );
1065
+			clean_post_cache($this->ID);
1066 1066
 
1067 1067
 			return true;
1068 1068
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -409,7 +409,7 @@
 block discarded – undo
409 409
 	 *
410 410
 	 * @param  array $data Array of attributes for a donation form.
411 411
 	 *
412
-	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
412
+	 * @return boolean       False if data isn't passed and class not instantiated for creation, or New Form ID.
413 413
 	 */
414 414
 	public function create( $data = array() ) {
415 415
 
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 * @since  1.0
112 112
 	 * @access public
113 113
 	 *
114
-     * @param  int $column Column ID.
115
-     * @param  int $row_id Row ID.
116
-     *
117
-     * @return object
114
+	 * @param  int $column Column ID.
115
+	 * @param  int $row_id Row ID.
116
+	 *
117
+	 * @return object
118 118
 	 */
119 119
 	public function get_by( $column, $row_id ) {
120
-        /* @var WPDB $wpdb */
121
-        global $wpdb;
120
+		/* @var WPDB $wpdb */
121
+		global $wpdb;
122 122
 
123 123
 		$column = esc_sql( $column );
124 124
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since  1.0
131 131
 	 * @access public
132
-     *
133
-     * @param  int $column Column ID.
134
-     * @param  int $row_id Row ID.
135
-     *
132
+	 *
133
+	 * @param  int $column Column ID.
134
+	 * @param  int $row_id Row ID.
135
+	 *
136 136
 	 * @return string      Column value.
137 137
 	 */
138 138
 	public function get_column( $column, $row_id ) {
139
-        /* @var WPDB $wpdb */
140
-        global $wpdb;
139
+		/* @var WPDB $wpdb */
140
+		global $wpdb;
141 141
 
142 142
 		$column = esc_sql( $column );
143 143
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @since  1.0
150 150
 	 * @access public
151
-     *
152
-     * @param  int    $column       Column ID.
153
-     * @param  string $column_where Column name.
154
-     * @param  string $column_value Column value.
155
-     *
151
+	 *
152
+	 * @param  int    $column       Column ID.
153
+	 * @param  string $column_where Column name.
154
+	 * @param  string $column_value Column value.
155
+	 *
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function get_column_by( $column, $column_where, $column_value ) {
159
-        /* @var WPDB $wpdb */
160
-        global $wpdb;
159
+		/* @var WPDB $wpdb */
160
+		global $wpdb;
161 161
 
162 162
 		$column_where = esc_sql( $column_where );
163 163
 		$column       = esc_sql( $column );
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @since  1.0
171 171
 	 * @access public
172
-     *
173
-     * @param  array  $data
174
-     * @param  string $type
175
-     *
172
+	 *
173
+	 * @param  array  $data
174
+	 * @param  string $type
175
+	 *
176 176
 	 * @return int
177 177
 	 */
178 178
 	public function insert( $data, $type = '' ) {
179
-        /* @var WPDB $wpdb */
180
-        global $wpdb;
179
+		/* @var WPDB $wpdb */
180
+		global $wpdb;
181 181
 
182 182
 		// Set default values
183 183
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @since  1.0
211 211
 	 * @access public
212
-     *
213
-     * @param  int    $row_id Column ID
214
-     * @param  array  $data
215
-     * @param  string $where  Column value
216
-     *
212
+	 *
213
+	 * @param  int    $row_id Column ID
214
+	 * @param  array  $data
215
+	 * @param  string $where  Column value
216
+	 *
217 217
 	 * @return bool
218 218
 	 */
219 219
 	public function update( $row_id, $data = array(), $where = '' ) {
220
-        /* @var WPDB $wpdb */
221
-        global $wpdb;
220
+		/* @var WPDB $wpdb */
221
+		global $wpdb;
222 222
 
223 223
 		// Row ID must be positive integer
224 224
 		$row_id = absint( $row_id );
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @since  1.0
258 258
 	 * @access public
259
-     *
260
-     * @param  int $row_id Column ID.
261
-     *
259
+	 *
260
+	 * @param  int $row_id Column ID.
261
+	 *
262 262
 	 * @return bool
263 263
 	 */
264 264
 	public function delete( $row_id = 0 ) {
265
-        /* @var WPDB $wpdb */
266
-        global $wpdb;
265
+		/* @var WPDB $wpdb */
266
+		global $wpdb;
267 267
 
268 268
 		// Row ID must be positive integer
269 269
 		$row_id = absint( $row_id );
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @since  1.3.2
286 286
 	 * @access public
287
-     *
287
+	 *
288 288
 	 * @param  string $table The table name.
289
-     *
289
+	 *
290 290
 	 * @return bool          If the table name exists.
291 291
 	 */
292 292
 	public function table_exists( $table ) {
293
-        /* @var WPDB $wpdb */
293
+		/* @var WPDB $wpdb */
294 294
 		global $wpdb;
295 295
 
296 296
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
105
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return object
118 118
 	 */
119
-	public function get_by( $column, $row_id ) {
119
+	public function get_by($column, $row_id) {
120 120
         /* @var WPDB $wpdb */
121 121
         global $wpdb;
122 122
 
123
-		$column = esc_sql( $column );
124
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
123
+		$column = esc_sql($column);
124
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
125 125
 	}
126 126
 
127 127
 	/**
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
      *
136 136
 	 * @return string      Column value.
137 137
 	 */
138
-	public function get_column( $column, $row_id ) {
138
+	public function get_column($column, $row_id) {
139 139
         /* @var WPDB $wpdb */
140 140
         global $wpdb;
141 141
 
142
-		$column = esc_sql( $column );
143
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
142
+		$column = esc_sql($column);
143
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
144 144
 	}
145 145
 
146 146
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
 	 * @return string
157 157
 	 */
158
-	public function get_column_by( $column, $column_where, $column_value ) {
158
+	public function get_column_by($column, $column_where, $column_value) {
159 159
         /* @var WPDB $wpdb */
160 160
         global $wpdb;
161 161
 
162
-		$column_where = esc_sql( $column_where );
163
-		$column       = esc_sql( $column );
164
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
162
+		$column_where = esc_sql($column_where);
163
+		$column       = esc_sql($column);
164
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
165 165
 	}
166 166
 
167 167
 	/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
 	 * @return int
177 177
 	 */
178
-	public function insert( $data, $type = '' ) {
178
+	public function insert($data, $type = '') {
179 179
         /* @var WPDB $wpdb */
180 180
         global $wpdb;
181 181
 
182 182
 		// Set default values.
183
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
183
+		$data = wp_parse_args($data, $this->get_column_defaults());
184 184
 
185 185
 		/**
186 186
 		 * Fires before inserting data to the database.
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 		 *
190 190
 		 * @param array $data
191 191
 		 */
192
-		do_action( "give_pre_insert_{$type}", $data );
192
+		do_action("give_pre_insert_{$type}", $data);
193 193
 
194 194
 		// Initialise column format array
195 195
 		$column_formats = $this->get_columns();
196 196
 
197 197
 		// Force fields to lower case
198
-		$data = array_change_key_case( $data );
198
+		$data = array_change_key_case($data);
199 199
 
200 200
 		// White list columns
201
-		$data = array_intersect_key( $data, $column_formats );
201
+		$data = array_intersect_key($data, $column_formats);
202 202
 
203 203
 		// Reorder $column_formats to match the order of columns given in $data
204
-		$data_keys      = array_keys( $data );
205
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
204
+		$data_keys      = array_keys($data);
205
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
206 206
 
207
-		$wpdb->insert( $this->table_name, $data, $column_formats );
207
+		$wpdb->insert($this->table_name, $data, $column_formats);
208 208
 
209 209
 		/**
210 210
 		 * Fires after inserting data to the database.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		 * @param int   $insert_id
215 215
 		 * @param array $data
216 216
 		 */
217
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
217
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
218 218
 
219 219
 		return $wpdb->insert_id;
220 220
 	}
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
      *
232 232
 	 * @return bool
233 233
 	 */
234
-	public function update( $row_id, $data = array(), $where = '' ) {
234
+	public function update($row_id, $data = array(), $where = '') {
235 235
         /* @var WPDB $wpdb */
236 236
         global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239
-		$row_id = absint( $row_id );
239
+		$row_id = absint($row_id);
240 240
 
241
-		if ( empty( $row_id ) ) {
241
+		if (empty($row_id)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( empty( $where ) ) {
245
+		if (empty($where)) {
246 246
 			$where = $this->primary_key;
247 247
 		}
248 248
 
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 		$column_formats = $this->get_columns();
251 251
 
252 252
 		// Force fields to lower case
253
-		$data = array_change_key_case( $data );
253
+		$data = array_change_key_case($data);
254 254
 
255 255
 		// White list columns
256
-		$data = array_intersect_key( $data, $column_formats );
256
+		$data = array_intersect_key($data, $column_formats);
257 257
 
258 258
 		// Reorder $column_formats to match the order of columns given in $data
259
-		$data_keys      = array_keys( $data );
260
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
259
+		$data_keys      = array_keys($data);
260
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
261 261
 
262
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
262
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
263 263
 			return false;
264 264
 		}
265 265
 
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
      *
277 277
 	 * @return bool
278 278
 	 */
279
-	public function delete( $row_id = 0 ) {
279
+	public function delete($row_id = 0) {
280 280
         /* @var WPDB $wpdb */
281 281
         global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284
-		$row_id = absint( $row_id );
284
+		$row_id = absint($row_id);
285 285
 
286
-		if ( empty( $row_id ) ) {
286
+		if (empty($row_id)) {
287 287
 			return false;
288 288
 		}
289 289
 
290
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
290
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
291 291
 			return false;
292 292
 		}
293 293
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
      *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307
-	public function table_exists( $table ) {
307
+	public function table_exists($table) {
308 308
         /* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311
-		$table = sanitize_text_field( $table );
311
+		$table = sanitize_text_field($table);
312 312
 
313
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
313
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
323 323
 	 */
324 324
 	public function installed() {
325
-		return $this->table_exists( $this->table_name );
325
+		return $this->table_exists($this->table_name);
326 326
 	}
327 327
 
328 328
 }
Please login to merge, or discard this patch.
includes/class-give-logging.php 1 patch
Spacing   +56 added lines, -56 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
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	public function __construct() {
37 37
 
38 38
 		// Create the log post type
39
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
39
+		add_action('init', array($this, 'register_post_type'), 1);
40 40
 
41 41
 		// Create types taxonomy and default types
42
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
42
+		add_action('init', array($this, 'register_taxonomy'), 1);
43 43
 
44 44
 	}
45 45
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	public function register_post_type() {
57 57
 		/* Logs post type */
58 58
 		$log_args = array(
59
-			'labels'              => array( 'name' => esc_html__( 'Logs', 'give' ) ),
59
+			'labels'              => array('name' => esc_html__('Logs', 'give')),
60 60
 			'public'              => false,
61 61
 			'exclude_from_search' => true,
62 62
 			'publicly_queryable'  => false,
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 			'query_var'           => false,
65 65
 			'rewrite'             => false,
66 66
 			'capability_type'     => 'post',
67
-			'supports'            => array( 'title', 'editor' ),
67
+			'supports'            => array('title', 'editor'),
68 68
 			'can_export'          => true
69 69
 		);
70 70
 
71
-		register_post_type( 'give_log', $log_args );
71
+		register_post_type('give_log', $log_args);
72 72
 	}
73 73
 
74 74
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	public function register_taxonomy() {
85
-		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
85
+		register_taxonomy('give_log_type', 'give_log', array('public' => false));
86 86
 	}
87 87
 
88 88
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'api_request'
103 103
 		);
104 104
 
105
-		return apply_filters( 'give_log_types', $terms );
105
+		return apply_filters('give_log_types', $terms);
106 106
 	}
107 107
 
108 108
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return bool         Whether log type is valid.
119 119
 	 */
120
-	public function valid_type( $type ) {
121
-		return in_array( $type, $this->log_types() );
120
+	public function valid_type($type) {
121
+		return in_array($type, $this->log_types());
122 122
 	}
123 123
 
124 124
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return int             Log ID.
139 139
 	 */
140
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
140
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
141 141
 		$log_data = array(
142 142
 			'post_title'   => $title,
143 143
 			'post_content' => $message,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'log_type'     => $type
146 146
 		);
147 147
 
148
-		return $this->insert_log( $log_data );
148
+		return $this->insert_log($log_data);
149 149
 	}
150 150
 
151 151
 	/**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return array             An array of the connected logs.
164 164
 	 */
165
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
166
-		return $this->get_connected_logs( array(
165
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
166
+		return $this->get_connected_logs(array(
167 167
 			'post_parent' => $object_id,
168 168
 			'paged'       => $paged,
169 169
 			'log_type'    => $type
170
-		) );
170
+		));
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return int             The ID of the newly created log item.
183 183
 	 */
184
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
184
+	public function insert_log($log_data = array(), $log_meta = array()) {
185 185
 		$defaults = array(
186 186
 			'post_type'    => 'give_log',
187 187
 			'post_status'  => 'publish',
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 			'log_type'     => false
191 191
 		);
192 192
 
193
-		$args = wp_parse_args( $log_data, $defaults );
193
+		$args = wp_parse_args($log_data, $defaults);
194 194
 
195
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
195
+		do_action('give_pre_insert_log', $log_data, $log_meta);
196 196
 
197 197
 		// Store the log entry
198
-		$log_id = wp_insert_post( $args );
198
+		$log_id = wp_insert_post($args);
199 199
 
200 200
 		// Set the log type, if any
201
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
202
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
201
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
202
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
203 203
 		}
204 204
 
205 205
 		// Set log meta, if any
206
-		if ( $log_id && ! empty( $log_meta ) ) {
207
-			foreach ( (array) $log_meta as $key => $meta ) {
208
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
206
+		if ($log_id && ! empty($log_meta)) {
207
+			foreach ((array) $log_meta as $key => $meta) {
208
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
209 209
 			}
210 210
 		}
211 211
 
212
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
212
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
213 213
 
214 214
 		return $log_id;
215 215
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return bool            True if successful, false otherwise.
227 227
 	 */
228
-	public function update_log( $log_data = array(), $log_meta = array() ) {
228
+	public function update_log($log_data = array(), $log_meta = array()) {
229 229
 
230
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
230
+		do_action('give_pre_update_log', $log_data, $log_meta);
231 231
 
232 232
 		$defaults = array(
233 233
 			'post_type'   => 'give_log',
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
 			'post_parent' => 0
236 236
 		);
237 237
 
238
-		$args = wp_parse_args( $log_data, $defaults );
238
+		$args = wp_parse_args($log_data, $defaults);
239 239
 
240 240
 		// Store the log entry
241
-		$log_id = wp_update_post( $args );
241
+		$log_id = wp_update_post($args);
242 242
 
243
-		if ( $log_id && ! empty( $log_meta ) ) {
244
-			foreach ( (array) $log_meta as $key => $meta ) {
245
-				if ( ! empty( $meta ) ) {
246
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
243
+		if ($log_id && ! empty($log_meta)) {
244
+			foreach ((array) $log_meta as $key => $meta) {
245
+				if ( ! empty($meta)) {
246
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
247 247
 				}
248 248
 			}
249 249
 		}
250 250
 
251
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
251
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
252 252
 	}
253 253
 
254 254
 	/**
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return array|false Array if logs were found, false otherwise.
265 265
 	 */
266
-	public function get_connected_logs( $args = array() ) {
266
+	public function get_connected_logs($args = array()) {
267 267
 
268 268
 		$defaults = array(
269 269
 			'post_type'      => 'give_log',
270 270
 			'posts_per_page' => 20,
271 271
 			'post_status'    => 'publish',
272
-			'paged'          => get_query_var( 'paged' ),
272
+			'paged'          => get_query_var('paged'),
273 273
 			'log_type'       => false
274 274
 		);
275 275
 
276
-		$query_args = wp_parse_args( $args, $defaults );
276
+		$query_args = wp_parse_args($args, $defaults);
277 277
 
278
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
278
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
279 279
 			$query_args['tax_query'] = array(
280 280
 				array(
281 281
 					'taxonomy' => 'give_log_type',
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			);
286 286
 		}
287 287
 		
288
-		$logs = get_posts( $query_args );
288
+		$logs = get_posts($query_args);
289 289
 	
290
-		if ( $logs ) {
290
+		if ($logs) {
291 291
 			return $logs;
292 292
 		}
293 293
 
@@ -310,17 +310,17 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @return int                Log count.
312 312
 	 */
313
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
313
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
314 314
 
315 315
 		$query_args = array(
316 316
 			'post_parent'    => $object_id,
317 317
 			'post_type'      => 'give_log',
318
-			'posts_per_page' => - 1,
318
+			'posts_per_page' => -1,
319 319
 			'post_status'    => 'publish',
320 320
 			'fields'         => 'ids',
321 321
 		);
322 322
 
323
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
323
+		if ( ! empty($type) && $this->valid_type($type)) {
324 324
 			$query_args['tax_query'] = array(
325 325
 				array(
326 326
 					'taxonomy' => 'give_log_type',
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 			);
331 331
 		}
332 332
 
333
-		if ( ! empty( $meta_query ) ) {
333
+		if ( ! empty($meta_query)) {
334 334
 			$query_args['meta_query'] = $meta_query;
335 335
 		}
336 336
 
337
-		if ( ! empty( $date_query ) ) {
337
+		if ( ! empty($date_query)) {
338 338
 			$query_args['date_query'] = $date_query;
339 339
 		}
340 340
 
341
-		$logs = new WP_Query( $query_args );
341
+		$logs = new WP_Query($query_args);
342 342
 
343 343
 		return (int) $logs->post_count;
344 344
 	}
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 	 *
358 358
 	 * @return void
359 359
 	 */
360
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) {
360
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
361 361
 		$query_args = array(
362 362
 			'post_parent'    => $object_id,
363 363
 			'post_type'      => 'give_log',
364
-			'posts_per_page' => - 1,
364
+			'posts_per_page' => -1,
365 365
 			'post_status'    => 'publish',
366 366
 			'fields'         => 'ids'
367 367
 		);
368 368
 
369
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
369
+		if ( ! empty($type) && $this->valid_type($type)) {
370 370
 			$query_args['tax_query'] = array(
371 371
 				array(
372 372
 					'taxonomy' => 'give_log_type',
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 			);
377 377
 		}
378 378
 
379
-		if ( ! empty( $meta_query ) ) {
379
+		if ( ! empty($meta_query)) {
380 380
 			$query_args['meta_query'] = $meta_query;
381 381
 		}
382 382
 
383
-		$logs = get_posts( $query_args );
383
+		$logs = get_posts($query_args);
384 384
 
385
-		if ( $logs ) {
386
-			foreach ( $logs as $log ) {
387
-				wp_delete_post( $log, true );
385
+		if ($logs) {
386
+			foreach ($logs as $log) {
387
+				wp_delete_post($log, true);
388 388
 			}
389 389
 		}
390 390
 	}
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
  *
409 409
  * @return mixed           ID of the new log entry.
410 410
  */
411
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
411
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
412 412
 	/* @var Give_Logging $give_logs */
413 413
 	global $give_logs;
414
-	$log = $give_logs->add( $title, $message, $parent, $type );
414
+	$log = $give_logs->add($title, $message, $parent, $type);
415 415
 
416 416
 	return $log;
417 417
 }
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -398,6 +398,7 @@
 block discarded – undo
398 398
 	 *
399 399
 	 * @since 1.6
400 400
 	 *
401
+	 * @param Give_Payment $payment
401 402
 	 * @return mixed|void
402 403
 	 */
403 404
 	function get_row_actions( $payment ) {
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,37 +118,37 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
123
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
124 124
 			'ajax'     => false                        // Does this table support ajax?
125
-		) );
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	public function advanced_filters() {
133
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
134
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
135
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
133
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
134
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
135
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
136 136
 		?>
137 137
 		<div id="give-payment-filters">
138 138
 			<span id="give-payment-date-filters">
139
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
139
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
140 140
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
141
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
141
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
142 142
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
143
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
143
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
144 144
 			</span>
145
-			<?php if ( ! empty( $status ) ) : ?>
146
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
145
+			<?php if ( ! empty($status)) : ?>
146
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
147 147
 			<?php endif; ?>
148
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
149
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
148
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
149
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
150 150
 			<?php endif; ?>
151
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
151
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
152 152
 		</div>
153 153
 
154 154
 		<?php
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return void
167 167
 	 */
168
-	public function search_box( $text, $input_id ) {
169
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
168
+	public function search_box($text, $input_id) {
169
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
170 170
 			return;
171 171
 		}
172 172
 
173
-		$input_id = $input_id . '-search-input';
173
+		$input_id = $input_id.'-search-input';
174 174
 
175
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
176
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
175
+		if ( ! empty($_REQUEST['orderby'])) {
176
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
177 177
 		}
178
-		if ( ! empty( $_REQUEST['order'] ) ) {
179
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
178
+		if ( ! empty($_REQUEST['order'])) {
179
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
180 180
 		}
181 181
 		?>
182 182
 		<p class="search-box" role="search">
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 *
189 189
 			 * @since 1.7
190 190
 			 */
191
-			do_action( 'give_donation_history_search' );
191
+			do_action('give_donation_history_search');
192 192
 			?>
193 193
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
194 194
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
195
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
195
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
196 196
 		</p>
197 197
 		<?php
198 198
 	}
@@ -206,52 +206,52 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function get_views() {
208 208
 
209
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
210
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
211
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
212
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
213
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
214
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
215
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
216
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
217
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
209
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
210
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
211
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
212
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
213
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
214
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
215
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
216
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
217
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
218 218
 
219 219
 		$views = array(
220
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
220
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
221 221
 				'status',
222 222
 				'paged'
223
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
224
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
223
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
224
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
225 225
 				'status' => 'publish',
226 226
 				'paged'  => false
227
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
228
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
227
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
228
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
229 229
 				'status' => 'pending',
230 230
 				'paged'  => false
231
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
232
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
231
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
232
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
233 233
 				'status' => 'refunded',
234 234
 				'paged'  => false
235
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
236
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
235
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
236
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
237 237
 				'status' => 'revoked',
238 238
 				'paged'  => false
239
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
240
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
239
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
240
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
241 241
 				'status' => 'failed',
242 242
 				'paged'  => false
243
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
244
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
243
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
244
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
245 245
 				'status' => 'cancelled',
246 246
 				'paged'  => false
247
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
248
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
247
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
248
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
249 249
 				'status' => 'abandoned',
250 250
 				'paged'  => false
251
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count )
251
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count)
252 252
 		);
253 253
 
254
-		return apply_filters( 'give_donations_table_views', $views );
254
+		return apply_filters('give_donations_table_views', $views);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 	public function get_columns() {
265 265
 		$columns = array(
266 266
 			'cb'            => '<input type="checkbox" />', //Render a checkbox instead of text
267
-			'donation'      => esc_html__( 'Donation', 'give' ),
268
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
269
-			'status'        => esc_html__( 'Status', 'give' ),
270
-			'date'          => esc_html__( 'Date', 'give' ),
271
-			'amount'        => esc_html__( 'Amount', 'give' ),
272
-			'details'       => esc_html__( 'Details', 'give' ),
267
+			'donation'      => esc_html__('Donation', 'give'),
268
+			'donation_form' => esc_html__('Donation Form', 'give'),
269
+			'status'        => esc_html__('Status', 'give'),
270
+			'date'          => esc_html__('Date', 'give'),
271
+			'amount'        => esc_html__('Amount', 'give'),
272
+			'details'       => esc_html__('Details', 'give'),
273 273
 		);
274 274
 
275
-		return apply_filters( 'give_donations_table_columns', $columns );
275
+		return apply_filters('give_donations_table_columns', $columns);
276 276
 	}
277 277
 
278 278
 	/**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function get_sortable_columns() {
286 286
 		$columns = array(
287
-			'donation'      => array( 'ID', true ),
288
-			'donation_form' => array( 'donation_form', false ),
289
-			'status'        => array( 'status', false ),
290
-			'amount'        => array( 'amount', false ),
291
-			'date'          => array( 'date', false )
287
+			'donation'      => array('ID', true),
288
+			'donation_form' => array('donation_form', false),
289
+			'status'        => array('status', false),
290
+			'amount'        => array('amount', false),
291
+			'date'          => array('date', false)
292 292
 		);
293 293
 
294
-		return apply_filters( 'give_donations_table_sortable_columns', $columns );
294
+		return apply_filters('give_donations_table_sortable_columns', $columns);
295 295
 	}
296 296
 
297 297
 	/**
@@ -317,65 +317,65 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return string Column Name
319 319
 	 */
320
-	public function column_default( $payment, $column_name ) {
320
+	public function column_default($payment, $column_name) {
321 321
 
322
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
323
-		$row_actions         = $this->get_row_actions( $payment );
322
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
323
+		$row_actions         = $this->get_row_actions($payment);
324 324
 
325
-		switch ( $column_name ) {
325
+		switch ($column_name) {
326 326
 			case 'donation' :
327 327
 				$value = sprintf(
328 328
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
329 329
 					$single_donation_url,
330
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
330
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
331 331
 					$payment->ID,
332
-					esc_html__( 'by', 'give' ),
333
-					$this->get_donor( $payment )
332
+					esc_html__('by', 'give'),
333
+					$this->get_donor($payment)
334 334
 				);
335
-				$value .= $this->get_donor_email( $payment );
336
-				$value .= $this->row_actions( $row_actions );
335
+				$value .= $this->get_donor_email($payment);
336
+				$value .= $this->row_actions($row_actions);
337 337
 				break;
338 338
 
339 339
 			case 'amount' :
340
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
341
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
340
+				$amount = ! empty($payment->total) ? $payment->total : 0;
341
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
342 342
 				break;
343 343
 
344 344
 			case 'donation_form' :
345 345
 
346
-				$value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>';
347
-				$level = give_get_payment_form_title( $payment->meta, true );
346
+				$value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>';
347
+				$level = give_get_payment_form_title($payment->meta, true);
348 348
 
349
-				if ( ! empty( $level ) ) {
349
+				if ( ! empty($level)) {
350 350
 					$value .= $level;
351 351
 				}
352 352
 
353 353
 				break;
354 354
 
355 355
 			case 'date' :
356
-				$date  = strtotime( $payment->date );
357
-				$value = date_i18n( give_date_format(), $date );
356
+				$date  = strtotime($payment->date);
357
+				$value = date_i18n(give_date_format(), $date);
358 358
 				break;
359 359
 
360 360
 			case 'status' :
361
-				$value = $this->get_payment_status( $payment );
361
+				$value = $this->get_payment_status($payment);
362 362
 				break;
363 363
 
364 364
 			case 'details' :
365 365
 				$value = sprintf(
366 366
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
367 367
 					$single_donation_url,
368
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
368
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
369 369
 				);
370 370
 				break;
371 371
 
372 372
 			default:
373
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
373
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
374 374
 				break;
375 375
 
376 376
 		}
377 377
 
378
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, $column_name );
378
+		return apply_filters('give_donations_table_column', $value, $payment->ID, $column_name);
379 379
 	}
380 380
 
381 381
 	/**
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 	 *
389 389
 	 * @return string                Data shown in the Email column
390 390
 	 */
391
-	public function get_donor_email( $payment ) {
391
+	public function get_donor_email($payment) {
392 392
 
393
-		$email = give_get_payment_user_email( $payment->ID );
393
+		$email = give_get_payment_user_email($payment->ID);
394 394
 
395
-		if ( empty( $email ) ) {
396
-			$email = esc_html__( '(unknown)', 'give' );
395
+		if (empty($email)) {
396
+			$email = esc_html__('(unknown)', 'give');
397 397
 		}
398 398
 
399
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>';
399
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>';
400 400
 
401
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'email' );
401
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'email');
402 402
 	}
403 403
 
404 404
 	/**
@@ -408,18 +408,18 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return mixed|void
410 410
 	 */
411
-	function get_row_actions( $payment ) {
411
+	function get_row_actions($payment) {
412 412
 
413 413
 		$actions = array();
414
-		$email   = give_get_payment_user_email( $payment->ID );
414
+		$email   = give_get_payment_user_email($payment->ID);
415 415
 
416 416
 		// Add search term string back to base URL
417
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
418
-		if ( ! empty( $search_terms ) ) {
419
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
417
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
418
+		if ( ! empty($search_terms)) {
419
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
420 420
 		}
421 421
 
422
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
422
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
423 423
 
424 424
 			$actions['email_links'] = sprintf(
425 425
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 					),
434 434
 					'give_payment_nonce'
435 435
 				),
436
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
437
-				esc_html__( 'Resend Donation Receipt', 'give' )
436
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
437
+				esc_html__('Resend Donation Receipt', 'give')
438 438
 			);
439 439
 
440 440
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 				),
452 452
 				'give_payment_nonce'
453 453
 			),
454
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
455
-			esc_html__( 'Delete', 'give' )
454
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
455
+			esc_html__('Delete', 'give')
456 456
 		);
457 457
 
458
-		return apply_filters( 'give_donation_row_actions', $actions, $payment );
458
+		return apply_filters('give_donation_row_actions', $actions, $payment);
459 459
 	}
460 460
 
461 461
 
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return string                Data shown in the Email column
471 471
 	 */
472
-	function get_payment_status( $payment ) {
473
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
474
-		if ( $payment->mode == 'test' ) {
475
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
472
+	function get_payment_status($payment) {
473
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
474
+		if ($payment->mode == 'test') {
475
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
476 476
 		}
477 477
 
478 478
 		return $value;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 *
489 489
 	 * @return string Displays a checkbox
490 490
 	 */
491
-	public function column_cb( $payment ) {
491
+	public function column_cb($payment) {
492 492
 		return sprintf(
493 493
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
494 494
 			'payment',
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *
507 507
 	 * @return string Displays a checkbox
508 508
 	 */
509
-	public function get_payment_id( $payment ) {
510
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
509
+	public function get_payment_id($payment) {
510
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
511 511
 	}
512 512
 
513 513
 	/**
@@ -520,19 +520,19 @@  discard block
 block discarded – undo
520 520
 	 *
521 521
 	 * @return string Data shown in the User column
522 522
 	 */
523
-	public function get_donor( $payment ) {
523
+	public function get_donor($payment) {
524 524
 
525
-		$customer_id = give_get_payment_customer_id( $payment->ID );
525
+		$customer_id = give_get_payment_customer_id($payment->ID);
526 526
 
527
-		if ( ! empty( $customer_id ) ) {
528
-			$customer = new Give_Customer( $customer_id );
529
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
527
+		if ( ! empty($customer_id)) {
528
+			$customer = new Give_Customer($customer_id);
529
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
530 530
 		} else {
531
-			$email = give_get_payment_user_email( $payment->ID );
532
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
531
+			$email = give_get_payment_user_email($payment->ID);
532
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
533 533
 		}
534 534
 
535
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'donor' );
535
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'donor');
536 536
 	}
537 537
 
538 538
 	/**
@@ -544,18 +544,18 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public function get_bulk_actions() {
546 546
 		$actions = array(
547
-			'delete'               => esc_html__( 'Delete', 'give' ),
548
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
549
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
550
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
551
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
552
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
553
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
554
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
555
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' )
547
+			'delete'               => esc_html__('Delete', 'give'),
548
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
549
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
550
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
551
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
552
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
553
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
554
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
555
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give')
556 556
 		);
557 557
 
558
-		return apply_filters( 'give_donations_table_bulk_actions', $actions );
558
+		return apply_filters('give_donations_table_bulk_actions', $actions);
559 559
 	}
560 560
 
561 561
 	/**
@@ -566,59 +566,59 @@  discard block
 block discarded – undo
566 566
 	 * @return void
567 567
 	 */
568 568
 	public function process_bulk_action() {
569
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
569
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
570 570
 		$action = $this->current_action();
571 571
 
572
-		if ( ! is_array( $ids ) ) {
573
-			$ids = array( $ids );
572
+		if ( ! is_array($ids)) {
573
+			$ids = array($ids);
574 574
 		}
575 575
 
576
-		if ( empty( $action ) ) {
576
+		if (empty($action)) {
577 577
 			return;
578 578
 		}
579 579
 
580
-		foreach ( $ids as $id ) {
580
+		foreach ($ids as $id) {
581 581
 
582 582
 			// Detect when a bulk action is being triggered...
583
-			switch ( $this->current_action() ) {
583
+			switch ($this->current_action()) {
584 584
 
585 585
 				case'delete':
586
-					give_delete_purchase( $id );
586
+					give_delete_purchase($id);
587 587
 					break;
588 588
 
589 589
 				case 'set-status-publish':
590
-					give_update_payment_status( $id, 'publish' );
590
+					give_update_payment_status($id, 'publish');
591 591
 					break;
592 592
 
593 593
 				case 'set-status-pending':
594
-					give_update_payment_status( $id, 'pending' );
594
+					give_update_payment_status($id, 'pending');
595 595
 					break;
596 596
 
597 597
 				case 'set-status-refunded':
598
-					give_update_payment_status( $id, 'refunded' );
598
+					give_update_payment_status($id, 'refunded');
599 599
 					break;
600 600
 				case 'set-status-revoked':
601
-					give_update_payment_status( $id, 'revoked' );
601
+					give_update_payment_status($id, 'revoked');
602 602
 					break;
603 603
 
604 604
 				case 'set-status-failed':
605
-					give_update_payment_status( $id, 'failed' );
605
+					give_update_payment_status($id, 'failed');
606 606
 					break;
607 607
 
608 608
 				case 'set-status-cancelled':
609
-					give_update_payment_status( $id, 'cancelled' );
609
+					give_update_payment_status($id, 'cancelled');
610 610
 					break;
611 611
 
612 612
 				case 'set-status-abandoned':
613
-					give_update_payment_status( $id, 'abandoned' );
613
+					give_update_payment_status($id, 'abandoned');
614 614
 					break;
615 615
 
616 616
 				case 'set-status-preapproval':
617
-					give_update_payment_status( $id, 'preapproval' );
617
+					give_update_payment_status($id, 'preapproval');
618 618
 					break;
619 619
 
620 620
 				case 'resend-receipt':
621
-					give_email_donation_receipt( $id, false );
621
+					give_email_donation_receipt($id, false);
622 622
 					break;
623 623
 			}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			 * @param int    $id The ID of the payment.
631 631
 			 * @param string $current_action The action that is being triggered.
632 632
 			 */
633
-			do_action( 'give_donations_table_do_bulk_action', $id, $this->current_action() );
633
+			do_action('give_donations_table_do_bulk_action', $id, $this->current_action());
634 634
 		}
635 635
 
636 636
 	}
@@ -646,27 +646,27 @@  discard block
 block discarded – undo
646 646
 
647 647
 		$args = array();
648 648
 
649
-		if ( isset( $_GET['user'] ) ) {
650
-			$args['user'] = urldecode( $_GET['user'] );
651
-		} elseif ( isset( $_GET['s'] ) ) {
652
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
653
-			if ( $is_user ) {
654
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
655
-				unset( $args['s'] );
649
+		if (isset($_GET['user'])) {
650
+			$args['user'] = urldecode($_GET['user']);
651
+		} elseif (isset($_GET['s'])) {
652
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
653
+			if ($is_user) {
654
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
655
+				unset($args['s']);
656 656
 			} else {
657
-				$args['s'] = sanitize_text_field( $_GET['s'] );
657
+				$args['s'] = sanitize_text_field($_GET['s']);
658 658
 			}
659 659
 		}
660 660
 
661
-		if ( ! empty( $_GET['start-date'] ) ) {
662
-			$args['start-date'] = urldecode( $_GET['start-date'] );
661
+		if ( ! empty($_GET['start-date'])) {
662
+			$args['start-date'] = urldecode($_GET['start-date']);
663 663
 		}
664 664
 
665
-		if ( ! empty( $_GET['end-date'] ) ) {
666
-			$args['end-date'] = urldecode( $_GET['end-date'] );
665
+		if ( ! empty($_GET['end-date'])) {
666
+			$args['end-date'] = urldecode($_GET['end-date']);
667 667
 		}
668 668
 
669
-		$payment_count         = give_count_payments( $args );
669
+		$payment_count         = give_count_payments($args);
670 670
 		$this->complete_count  = $payment_count->publish;
671 671
 		$this->pending_count   = $payment_count->pending;
672 672
 		$this->refunded_count  = $payment_count->refunded;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		$this->cancelled_count = $payment_count->cancelled;
676 676
 		$this->abandoned_count = $payment_count->abandoned;
677 677
 
678
-		foreach ( $payment_count as $count ) {
678
+		foreach ($payment_count as $count) {
679 679
 			$this->total_count += $count;
680 680
 		}
681 681
 	}
@@ -690,26 +690,26 @@  discard block
 block discarded – undo
690 690
 	public function payments_data() {
691 691
 
692 692
 		$per_page   = $this->per_page;
693
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
694
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
695
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
696
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
697
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
698
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
699
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
700
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
701
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
702
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
703
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
704
-
705
-		if ( ! empty( $search ) ) {
693
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
694
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
695
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
696
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
697
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
698
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
699
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
700
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
701
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
702
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
703
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
704
+
705
+		if ( ! empty($search)) {
706 706
 			$status = 'any'; // Force all payment statuses when searching
707 707
 		}
708 708
 
709 709
 		$args = array(
710 710
 			'output'     => 'payments',
711 711
 			'number'     => $per_page,
712
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
712
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
713 713
 			'orderby'    => $orderby,
714 714
 			'order'      => $order,
715 715
 			'user'       => $user,
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 			'end_date'   => $end_date,
724 724
 		);
725 725
 
726
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
726
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
727 727
 
728 728
 			$args['search_in_notes'] = true;
729
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
729
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
730 730
 
731 731
 		}
732 732
 
733
-		$p_query = new Give_Payments_Query( $args );
733
+		$p_query = new Give_Payments_Query($args);
734 734
 
735 735
 		return $p_query->get_payments();
736 736
 
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	public function prepare_items() {
752 752
 
753
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
753
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
754 754
 
755 755
 		$columns  = $this->get_columns();
756 756
 		$hidden   = array(); // No hidden columns
757 757
 		$sortable = $this->get_sortable_columns();
758 758
 		$data     = $this->payments_data();
759
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
759
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
760 760
 
761
-		$this->_column_headers = array( $columns, $hidden, $sortable );
761
+		$this->_column_headers = array($columns, $hidden, $sortable);
762 762
 
763
-		switch ( $status ) {
763
+		switch ($status) {
764 764
 			case 'publish':
765 765
 				$total_items = $this->complete_count;
766 766
 				break;
@@ -787,19 +787,19 @@  discard block
 block discarded – undo
787 787
 				break;
788 788
 			default:
789 789
 				// Retrieve the count of the non-default-Give status
790
-				$count       = wp_count_posts( 'give_payment' );
790
+				$count       = wp_count_posts('give_payment');
791 791
 				$total_items = $count->{$status};
792 792
 				break;
793 793
 		}
794 794
 
795 795
 		$this->items = $data;
796 796
 
797
-		$this->set_pagination_args( array(
797
+		$this->set_pagination_args(array(
798 798
 				'total_items' => $total_items,
799 799
 				// WE have to calculate the total number of items
800 800
 				'per_page'    => $this->per_page,
801 801
 				// WE have to determine how many items to show on a page
802
-				'total_pages' => ceil( $total_items / $this->per_page )
802
+				'total_pages' => ceil($total_items / $this->per_page)
803 803
 				// WE have to calculate the total number of pages
804 804
 			)
805 805
 		);
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -713,7 +713,7 @@
 block discarded – undo
713 713
 	 * @param	bool   $colon   Check if add colon between heading and message.
714 714
 	 * @param	string $color   Heading color.
715 715
 	 *
716
-	 * @return	mixed
716
+	 * @return	string
717 717
 	 */
718 718
 	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
719 719
 	    // Add colon.
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @subcommand	donors
327 327
 	 */
328 328
 	public function donors( $args, $assoc_args ) {
329
-	    global $wp_query;
329
+		global $wp_query;
330 330
 		$donor_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )      ? absint( $assoc_args['id'] ) : false;
331 331
 		$email       = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args )   ? $assoc_args['email']        : false;
332 332
 		$name        = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args )    ? $assoc_args['name']         : '';
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @subcommand	donations
493 493
 	 */
494 494
 	public function donations( $args, $assoc_args ) {
495
-	    global $wp_query;
495
+		global $wp_query;
496 496
 		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
497 497
 
498 498
 		// Cache previous number query var.
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	 * @return	mixed
717 717
 	 */
718 718
 	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
719
-	    // Add colon.
720
-	    if ( $colon ) {
721
-	        $heading = $heading . ': ';
719
+		// Add colon.
720
+		if ( $colon ) {
721
+			$heading = $heading . ': ';
722 722
 		}
723 723
 		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
724 724
 	}
Please login to merge, or discard this patch.
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) { exit; }
10
+if ( ! defined('ABSPATH')) { exit; }
11 11
 
12 12
 // Add give command.
13
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
13
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
14 14
 
15 15
 
16 16
 /**
@@ -66,54 +66,54 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @subcommand  details
68 68
 	 */
69
-	public function details( $args, $assoc_args ) {
69
+	public function details($args, $assoc_args) {
70 70
 
71 71
 		/**
72 72
 		 * Plugin Information
73 73
 		 */
74
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
74
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
75 75
 
76 76
 		/**
77 77
 		 * General Information.
78 78
 		 */
79
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
79
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
80 80
 
81
-		$success_page = give_get_option( 'success_page' );
82
-		$failure_page = give_get_option( 'failure_page' );
83
-		$history_page = give_get_option( 'history_page' );
81
+		$success_page = give_get_option('success_page');
82
+		$failure_page = give_get_option('failure_page');
83
+		$history_page = give_get_option('history_page');
84 84
 
85
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
86
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
87
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
88
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
85
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
86
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
87
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
88
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
89 89
 
90 90
 		/**
91 91
 		 * Currency Information.
92 92
 		 */
93
-		$default_gateway = give_get_option( 'default_gateway' );
93
+		$default_gateway = give_get_option('default_gateway');
94 94
 
95
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
95
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
96 96
 
97
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
98
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
99
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
100
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
101
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
102
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' )  ) ) );
103
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' )  ) ) );
97
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
98
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
99
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
100
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
101
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
102
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
103
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
104 104
 
105 105
 		// Payment gateways Information.
106
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
107
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
106
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
107
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
108 108
 
109
-		if ( ! empty( $gateways ) ) {
109
+		if ( ! empty($gateways)) {
110 110
 			self::$counter = 1;
111
-			foreach ( $gateways as $gateway ) {
112
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
111
+			foreach ($gateways as $gateway) {
112
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
113 113
 				self::$counter++;
114 114
 			}
115 115
 		} else {
116
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
116
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
117 117
 		}
118 118
 	}
119 119
 
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @subcommand	forms
147 147
 	 */
148
-	public function forms( $args, $assoc_args ) {
148
+	public function forms($args, $assoc_args) {
149 149
 		global $wp_query;
150
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )     ? absint( $assoc_args['id'] )     : false;
151
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
150
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
151
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
152 152
 		$start   = time();
153 153
 
154 154
 		// Cache previous number query var.
155 155
 		$is_set_number = $cache_per_page = false;
156
-		if ( isset( $wp_query->query_vars['number'] ) ) {
156
+		if (isset($wp_query->query_vars['number'])) {
157 157
 			$cache_per_page = $wp_query->query_vars['number'];
158 158
 			$is_set_number = true;
159 159
 		}
@@ -162,46 +162,46 @@  discard block
 block discarded – undo
162 162
 		$wp_query->query_vars['number'] = $number;
163 163
 
164 164
 		// Get forms.
165
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
165
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
166 166
 
167 167
 		// Reset number query var.
168
-		if ( $is_set_number ) {
168
+		if ($is_set_number) {
169 169
 			$wp_query->query_vars['number'] = $cache_per_page;
170 170
 		}
171 171
 
172 172
 		// Bailout.
173
-		if ( array_key_exists( 'error', $forms ) ) {
173
+		if (array_key_exists('error', $forms)) {
174 174
 
175
-			WP_CLI::warning( $forms['error'] );
175
+			WP_CLI::warning($forms['error']);
176 176
 			return;
177
-		} elseif ( empty( $forms['forms'] ) ) {
177
+		} elseif (empty($forms['forms'])) {
178 178
 
179
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
179
+			WP_CLI::error(__('No forms found.', 'give'));
180 180
 			return;
181 181
 		}
182 182
 
183 183
 		// Param to check if form typeis already showed or not.
184 184
 		$is_show_form_type = false;
185 185
 
186
-		if ( 1 === count( $forms ) && $form_id ) {
186
+		if (1 === count($forms) && $form_id) {
187 187
 			// Show single form.
188
-			foreach ( $forms['forms'][0] as $key => $info ) {
189
-				switch ( $key ) {
188
+			foreach ($forms['forms'][0] as $key => $info) {
189
+				switch ($key) {
190 190
 					case 'stats':
191
-						$this->color_main_heading( ucfirst( $key ) );
191
+						$this->color_main_heading(ucfirst($key));
192 192
 
193
-						foreach ( $info as $heading => $data ) {
194
-							$this->color_sub_heading( ucfirst( $heading ) );
195
-							switch ( $heading ) {
193
+						foreach ($info as $heading => $data) {
194
+							$this->color_sub_heading(ucfirst($heading));
195
+							switch ($heading) {
196 196
 								default:
197
-									foreach ( $data as $subheading => $subdata ) {
197
+									foreach ($data as $subheading => $subdata) {
198 198
 
199
-										switch ( $subheading ) {
199
+										switch ($subheading) {
200 200
 											case 'earnings':
201
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
201
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
202 202
 												break;
203 203
 											default:
204
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
204
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
205 205
 										}
206 206
 									}
207 207
 							}
@@ -211,26 +211,26 @@  discard block
 block discarded – undo
211 211
 					case 'pricing':
212 212
 					case 'info':
213 213
 					default:
214
-						$this->color_main_heading( ucfirst( $key ) );
214
+						$this->color_main_heading(ucfirst($key));
215 215
 
216 216
 						// Show form type.
217
-						if ( ! $is_show_form_type ) {
218
-							$form = new Give_Donate_Form( $form_id );
217
+						if ( ! $is_show_form_type) {
218
+							$form = new Give_Donate_Form($form_id);
219 219
 							$is_show_form_type = true;
220 220
 
221
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
221
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
222 222
 						}
223 223
 
224
-						foreach ( $info as $heading => $data ) {
224
+						foreach ($info as $heading => $data) {
225 225
 
226
-							switch ( $heading ) {
226
+							switch ($heading) {
227 227
 								case 'id':
228
-									WP_CLI::log( $this->color_message( $heading, $data ) );
228
+									WP_CLI::log($this->color_message($heading, $data));
229 229
 									break;
230 230
 
231 231
 								default:
232
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
233
-									WP_CLI::log( $this->color_message( $heading, $data ) );
232
+									$data = empty($data) ? __('Not set', 'give') : $data;
233
+									WP_CLI::log($this->color_message($heading, $data));
234 234
 							}
235 235
 						}
236 236
 				}
@@ -241,37 +241,37 @@  discard block
 block discarded – undo
241 241
 			$is_table_first_row_set = false;
242 242
 			$table_column_count = 0;
243 243
 
244
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
244
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
245 245
 
246
-			foreach ( $forms['forms'] as $index => $form_data ) {
246
+			foreach ($forms['forms'] as $index => $form_data) {
247 247
 
248 248
 				// Default table data.
249 249
 				$table_first_row = array();
250 250
 				$table_row = array();
251 251
 
252
-				foreach ( $form_data['info'] as $key => $form ) {
252
+				foreach ($form_data['info'] as $key => $form) {
253 253
 
254 254
 					// Do not show thumbnail, content and link in table.
255
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
255
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
256 256
 						continue;
257 257
 					}
258 258
 
259
-					if ( ! $is_table_first_row_set ) {
259
+					if ( ! $is_table_first_row_set) {
260 260
 						$table_first_row[] = $key;
261 261
 					}
262 262
 
263 263
 					$table_row[] = $form;
264 264
 
265
-					if ( 'status' === $key ) {
265
+					if ('status' === $key) {
266 266
 						// First array item will be an form id in our case.
267
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
267
+						$form = new Give_Donate_Form(absint($table_row[0]));
268 268
 
269 269
 						$table_row[] = $form->get_type();
270 270
 					}
271 271
 				}
272 272
 
273 273
 				// Set table first row.
274
-				if ( ! $is_table_first_row_set ) {
274
+				if ( ! $is_table_first_row_set) {
275 275
 
276 276
 					// Add extra column to table.
277 277
 					$table_first_row[]      = 'type';
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				$table_data[] = $table_row;
285 285
 			}
286 286
 
287
-			$this->display_table( $table_data );
287
+			$this->display_table($table_data);
288 288
 		}
289 289
 	}
290 290
 
@@ -325,29 +325,29 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @subcommand	donors
327 327
 	 */
328
-	public function donors( $args, $assoc_args ) {
328
+	public function donors($args, $assoc_args) {
329 329
 	    global $wp_query;
330
-		$donor_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )      ? absint( $assoc_args['id'] ) : false;
331
-		$email       = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args )   ? $assoc_args['email']        : false;
332
-		$name        = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args )    ? $assoc_args['name']         : '';
333
-		$create      = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args )  ? $assoc_args['create']       : false;
334
-		$number      = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args )  ? $assoc_args['number']       : 10;
330
+		$donor_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
331
+		$email       = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
332
+		$name        = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
333
+		$create      = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
334
+		$number      = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
335 335
 		$start       = time();
336 336
 
337
-		if ( $create ) {
337
+		if ($create) {
338 338
 			$number = 1;
339 339
 
340 340
 			// Create one or more donors.
341
-			if ( ! $email ) {
341
+			if ( ! $email) {
342 342
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
343
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
343
+				$number = is_numeric($create) ? absint($create) : 1;
344 344
 			}
345 345
 
346
-			for ( $i = 0; $i < $number; $i++ ) {
347
-				if ( ! $email ) {
346
+			for ($i = 0; $i < $number; $i++) {
347
+				if ( ! $email) {
348 348
 
349 349
 					// Generate fake email.
350
-					$email = 'customer-' . uniqid() . '@test.com';
350
+					$email = 'customer-'.uniqid().'@test.com';
351 351
 				}
352 352
 
353 353
 				$args = array(
@@ -355,33 +355,33 @@  discard block
 block discarded – undo
355 355
 					'name'    => $name,
356 356
 				);
357 357
 
358
-				$customer_id = Give()->customers->add( $args );
358
+				$customer_id = Give()->customers->add($args);
359 359
 
360
-				if ( $customer_id ) {
361
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor %d created successfully', 'give' ), $customer_id ) ) );
360
+				if ($customer_id) {
361
+					WP_CLI::line($this->color_message(sprintf(__('Donor %d created successfully', 'give'), $customer_id)));
362 362
 				} else {
363
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
363
+					WP_CLI::error(__('Failed to create donor', 'give'));
364 364
 				}
365 365
 
366 366
 				// Reset email to false so it is generated on the next loop (if creating donors).
367 367
 				$email = false;
368 368
 			}
369 369
 
370
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
370
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
371 371
 
372 372
 		} else {
373 373
 			// Counter.
374 374
 			self::$counter = 1;
375 375
 
376 376
 			// Search for customers.
377
-			$search    = $donor_id ? $donor_id : $email;
377
+			$search = $donor_id ? $donor_id : $email;
378 378
 
379 379
 			/**
380 380
 			 * Get donors.
381 381
 			 */
382 382
 			// Cache previous number query var.
383 383
 			$is_set_number = $cache_per_page = false;
384
-			if ( isset( $wp_query->query_vars['number'] ) ) {
384
+			if (isset($wp_query->query_vars['number'])) {
385 385
 				$cache_per_page = $wp_query->query_vars['number'];
386 386
 				$is_set_number = true;
387 387
 			}
@@ -390,43 +390,43 @@  discard block
 block discarded – undo
390 390
 			$wp_query->query_vars['number'] = $number;
391 391
 
392 392
 			// Get donors.
393
-			$donors = $this->api->get_customers( $search );
393
+			$donors = $this->api->get_customers($search);
394 394
 
395 395
 			// Reset number query var.
396
-			if ( $is_set_number ) {
396
+			if ($is_set_number) {
397 397
 				$wp_query->query_vars['number'] = $cache_per_page;
398 398
 			}
399 399
 
400
-			if ( isset( $donors['error'] ) ) {
401
-				WP_CLI::error( $donors['error'] );
400
+			if (isset($donors['error'])) {
401
+				WP_CLI::error($donors['error']);
402 402
 			}
403 403
 
404
-			if ( empty( $donors ) ) {
405
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
404
+			if (empty($donors)) {
405
+				WP_CLI::error(__('No donors found.', 'give'));
406 406
 				return;
407 407
 			}
408 408
 
409 409
 			$table_data = array();
410 410
 			$is_table_first_row_set = false;
411 411
 
412
-			foreach ( $donors['donors'] as $donor_data ) {
412
+			foreach ($donors['donors'] as $donor_data) {
413 413
 				// Set default table row data.
414
-				$table_first_row = array( __( 'S. No.', 'give' ) );
415
-				$table_row = array( self::$counter );
414
+				$table_first_row = array(__('S. No.', 'give'));
415
+				$table_row = array(self::$counter);
416 416
 
417
-				foreach ( $donor_data as $key => $donor ) {
418
-					switch ( $key ) {
417
+				foreach ($donor_data as $key => $donor) {
418
+					switch ($key) {
419 419
 						case 'stats':
420
-							foreach ( $donor as $heading => $data ) {
420
+							foreach ($donor as $heading => $data) {
421 421
 
422 422
 								// Get first row.
423
-								if ( ! $is_table_first_row_set ) {
423
+								if ( ! $is_table_first_row_set) {
424 424
 									$table_first_row[] = $heading;
425 425
 								}
426 426
 
427
-								switch ( $heading ) {
427
+								switch ($heading) {
428 428
 									case 'total_spent':
429
-										$table_row[] = give_currency_filter( $data );
429
+										$table_row[] = give_currency_filter($data);
430 430
 										break;
431 431
 
432 432
 									default:
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
 
438 438
 						case 'info':
439 439
 						default:
440
-							foreach ( $donor as $heading => $data ) {
440
+							foreach ($donor as $heading => $data) {
441 441
 
442 442
 								// Get first row.
443
-								if ( ! $is_table_first_row_set ) {
443
+								if ( ! $is_table_first_row_set) {
444 444
 									$table_first_row[] = $heading;
445 445
 								}
446 446
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 				}
451 451
 
452 452
 				// Add first row data to table data.
453
-				if ( ! $is_table_first_row_set ) {
453
+				if ( ! $is_table_first_row_set) {
454 454
 					$table_data[] = $table_first_row;
455 455
 					$is_table_first_row_set = true;
456 456
 				}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 				self::$counter++;
463 463
 			}
464 464
 
465
-			$this->display_table( $table_data );
465
+			$this->display_table($table_data);
466 466
 		}
467 467
 	}
468 468
 
@@ -491,13 +491,13 @@  discard block
 block discarded – undo
491 491
 	 *
492 492
 	 * @subcommand	donations
493 493
 	 */
494
-	public function donations( $args, $assoc_args ) {
494
+	public function donations($args, $assoc_args) {
495 495
 	    global $wp_query;
496
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
496
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
497 497
 
498 498
 		// Cache previous number query var.
499 499
 		$is_set_number = $cache_per_page = false;
500
-		if ( isset( $wp_query->query_vars['number'] ) ) {
500
+		if (isset($wp_query->query_vars['number'])) {
501 501
 			$cache_per_page = $wp_query->query_vars['number'];
502 502
 			$is_set_number = true;
503 503
 		}
@@ -509,45 +509,45 @@  discard block
 block discarded – undo
509 509
 		$donations = $this->api->get_recent_donations();
510 510
 
511 511
 		// Reset number query var.
512
-		if ( $is_set_number ) {
512
+		if ($is_set_number) {
513 513
 			$wp_query->query_vars['number'] = $cache_per_page;
514 514
 		}
515 515
 
516
-		if ( empty( $donations ) ) {
517
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
516
+		if (empty($donations)) {
517
+			WP_CLI::error(__('No donations found.', 'give'));
518 518
 			return;
519 519
 		}
520 520
 
521 521
 		self::$counter = 1;
522 522
 
523
-		foreach ( $donations['donations'] as $key => $donation ) {
524
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
523
+		foreach ($donations['donations'] as $key => $donation) {
524
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
525 525
 			self::$counter++;
526 526
 
527
-			foreach ( $donation as $column => $data ) {
527
+			foreach ($donation as $column => $data) {
528 528
 
529
-				if ( is_array( $data ) ) {
530
-					$this->color_sub_heading( $column );
531
-					foreach ( $data as $subcolumn => $subdata ) {
529
+				if (is_array($data)) {
530
+					$this->color_sub_heading($column);
531
+					foreach ($data as $subcolumn => $subdata) {
532 532
 
533 533
 						// Decode html codes.
534
-						switch ( $subcolumn ) {
534
+						switch ($subcolumn) {
535 535
 							case 'name':
536
-								$subdata = html_entity_decode( $subdata );
536
+								$subdata = html_entity_decode($subdata);
537 537
 								break;
538 538
 						}
539 539
 
540 540
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
541
-						if ( is_array( $subdata ) ) {
541
+						if (is_array($subdata)) {
542 542
 							continue;
543 543
 						}
544 544
 
545
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
545
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
546 546
 					}
547 547
 					continue;
548 548
 				}
549 549
 
550
-				WP_CLI::log( $this->color_message( $column, $data ) );
550
+				WP_CLI::log($this->color_message($column, $data));
551 551
 			}
552 552
 		}
553 553
 	}
@@ -586,27 +586,27 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return		void
588 588
 	 */
589
-	public function report( $args, $assoc_args ) {
589
+	public function report($args, $assoc_args) {
590 590
 		$stats      = new Give_Payment_Stats();
591
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args )      ? $assoc_args['date']      : false;
592
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
593
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args )   ? $assoc_args['end-date']   : false;
594
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )        ? $assoc_args['id']        : 0;
591
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
592
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
593
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
594
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
595 595
 
596
-		if ( ! empty( $date ) ) {
596
+		if ( ! empty($date)) {
597 597
 			$start_date = $date;
598 598
 			$end_date   = false;
599
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
599
+		} elseif (empty($date) && empty($start_date)) {
600 600
 			$start_date = 'this_month';
601 601
 			$end_date   = false;
602 602
 		}
603 603
 
604 604
 		// Get stats.
605
-		$earnings   = $stats->get_earnings( $form_id, $start_date, $end_date );
606
-		$sales      = $stats->get_sales( $form_id, $start_date, $end_date );
605
+		$earnings   = $stats->get_earnings($form_id, $start_date, $end_date);
606
+		$sales      = $stats->get_sales($form_id, $start_date, $end_date);
607 607
 
608
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
609
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
608
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
609
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
610 610
 	}
611 611
 
612 612
 
@@ -633,26 +633,26 @@  discard block
 block discarded – undo
633 633
 	 *
634 634
 	 * @subcommand cache
635 635
 	 */
636
-	public function cache( $args, $assoc_args ) {
637
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
636
+	public function cache($args, $assoc_args) {
637
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
638 638
 
639 639
 		// Bailout.
640
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
641
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
640
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
641
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
642 642
 			return;
643 643
 		}
644 644
 
645
-		switch ( $action ) {
645
+		switch ($action) {
646 646
 			case 'delete' :
647 647
 				// Reset counter.
648 648
 				self::$counter = 1;
649 649
 
650
-				if ( $this->delete_stats_transients() ) {
650
+				if ($this->delete_stats_transients()) {
651 651
 					// Report .eading.
652
-					WP_CLI::success( 'All form stat transient cache deleted.' );
652
+					WP_CLI::success('All form stat transient cache deleted.');
653 653
 				} else {
654 654
 					// Report .eading.
655
-					WP_CLI::warning( 'We did not find any transient to delete :)' );
655
+					WP_CLI::warning('We did not find any transient to delete :)');
656 656
 				}
657 657
 				break;
658 658
 		}
@@ -678,23 +678,23 @@  discard block
 block discarded – undo
678 678
 			ARRAY_A
679 679
 		);
680 680
 
681
-		if ( ! empty( $stat_option_names ) ) {
681
+		if ( ! empty($stat_option_names)) {
682 682
 
683 683
 			// Convert transient option name to transient name.
684 684
 			$stat_option_names = array_map(
685
-				function( $option ) {
686
-					return str_replace( '_transient_', '', $option['option_name'] );
685
+				function($option) {
686
+					return str_replace('_transient_', '', $option['option_name']);
687 687
 				},
688 688
 				$stat_option_names
689 689
 			);
690 690
 
691
-			foreach ( $stat_option_names as $option_name ) {
692
-				if ( delete_transient( $option_name ) ) {
691
+			foreach ($stat_option_names as $option_name) {
692
+				if (delete_transient($option_name)) {
693 693
 
694
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
694
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
695 695
 					self::$counter++;
696 696
 				} else {
697
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
697
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
698 698
 				}
699 699
 			}
700 700
 
@@ -715,12 +715,12 @@  discard block
 block discarded – undo
715 715
 	 *
716 716
 	 * @return	mixed
717 717
 	 */
718
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
718
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
719 719
 	    // Add colon.
720
-	    if ( $colon ) {
721
-	        $heading = $heading . ': ';
720
+	    if ($colon) {
721
+	        $heading = $heading.': ';
722 722
 		}
723
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
723
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
724 724
 	}
725 725
 
726 726
 
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
 	 *
736 736
 	 * @return	void
737 737
 	 */
738
-	private function color_main_heading( $heading, $color = 'g' ) {
739
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
738
+	private function color_main_heading($heading, $color = 'g') {
739
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
740 740
 	}
741 741
 
742 742
 	/**
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 	 *
750 750
 	 * @return	void
751 751
 	 */
752
-	private function color_sub_heading( $subheading ) {
753
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
752
+	private function color_sub_heading($subheading) {
753
+		WP_CLI::log("\n--->".$subheading.'', '', false);
754 754
 	}
755 755
 
756 756
 
@@ -764,17 +764,17 @@  discard block
 block discarded – undo
764 764
 	 *
765 765
 	 * @return	void
766 766
 	 */
767
-	private function display_table( $data ) {
767
+	private function display_table($data) {
768 768
 		$table = new \cli\Table();
769 769
 
770 770
 		// Set table header.
771
-		$table->setHeaders( $data[0] );
771
+		$table->setHeaders($data[0]);
772 772
 
773 773
 		// Remove table header.
774
-		unset( $data[0] );
774
+		unset($data[0]);
775 775
 
776 776
 		// Set table data.
777
-		$table->setRows( $data );
777
+		$table->setRows($data);
778 778
 
779 779
 		// Display table.
780 780
 		$table->display();
Please login to merge, or discard this patch.
give.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,9 +358,9 @@
 block discarded – undo
358 358
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359 359
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360 360
 
361
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
362
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
-            }
361
+			if( defined( 'WP_CLI' ) && WP_CLI ) {
362
+				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
+			}
364 364
 
365 365
 			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
366 366
 
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.7' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.7');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,116 +300,116 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
304 304
 			$give_options = give_get_settings();
305 305
 
306
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
311
-
312
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
326
-
327
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
329
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
330
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
342
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
343
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
344
-
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
348
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
349
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
350
-
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
354
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
355
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
356
-
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
360
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
361
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
362
-
363
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
364
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
311
+
312
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
326
+
327
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
329
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
330
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
342
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
343
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
344
+
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
348
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
349
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
350
+
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
354
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
355
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
356
+
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
360
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
361
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
362
+
363
+            if (defined('WP_CLI') && WP_CLI) {
364
+                require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
365 365
             }
366 366
 
367
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
368
-
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
379
-
380
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
382
-
383
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
388
-
389
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
396
-
397
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
404
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
405
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
406
-
407
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
408
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
367
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
368
+
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
379
+
380
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
382
+
383
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
388
+
389
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
396
+
397
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
404
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
405
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
406
+
407
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
408
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
409 409
 
410 410
 			}
411 411
 
412
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
412
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
413 413
 
414 414
 		}
415 415
 
@@ -423,26 +423,26 @@  discard block
 block discarded – undo
423 423
 		 */
424 424
 		public function load_textdomain() {
425 425
 			// Set filter for Give's languages directory
426
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
427
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
426
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
427
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
428 428
 
429 429
 			// Traditional WordPress plugin locale filter
430
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
431
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
430
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
431
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
432 432
 
433 433
 			// Setup paths to current locale file
434
-			$mofile_local  = $give_lang_dir . $mofile;
435
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
434
+			$mofile_local  = $give_lang_dir.$mofile;
435
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
436 436
 
437
-			if ( file_exists( $mofile_global ) ) {
437
+			if (file_exists($mofile_global)) {
438 438
 				// Look in global /wp-content/languages/give folder
439
-				load_textdomain( 'give', $mofile_global );
440
-			} elseif ( file_exists( $mofile_local ) ) {
439
+				load_textdomain('give', $mofile_global);
440
+			} elseif (file_exists($mofile_local)) {
441 441
 				// Look in local location from filter `give_languages_directory`
442
-				load_textdomain( 'give', $mofile_local );
442
+				load_textdomain('give', $mofile_local);
443 443
 			} else {
444 444
 				// Load the default language files packaged up w/ Give
445
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
445
+				load_plugin_textdomain('give', false, $give_lang_dir);
446 446
 			}
447 447
 		}
448 448
 
Please login to merge, or discard this patch.