Test Failed
Pull Request — master (#3170)
by Devin
06:19
created
includes/admin/payments/view-payment-details.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -323,10 +323,10 @@
 block discarded – undo
323 323
 										</div>
324 324
 
325 325
 										<?php
326
-                                        // Display the transaction ID present.
327
-                                        // The transaction ID is the charge ID from the gateway.
328
-                                        // For instance, stripe "ch_BzvwYCchqOy5Nt".
329
-                                        if ( $transaction_id != $payment_id ) : ?>
326
+										// Display the transaction ID present.
327
+										// The transaction ID is the charge ID from the gateway.
328
+										// For instance, stripe "ch_BzvwYCchqOy5Nt".
329
+										if ( $transaction_id != $payment_id ) : ?>
330 330
 											<div class="give-order-tx-id give-admin-box-inside">
331 331
 												<p>
332 332
 													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
Please login to merge, or discard this patch.
Spacing   +149 added lines, -149 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
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number       = $payment->number;
46 46
 $payment_meta = $payment->get_meta();
47 47
 
48
-$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
-$transaction_id = esc_attr( $payment->transaction_id );
48
+$company_name   = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : '';
49
+$transaction_id = esc_attr($payment->transaction_id);
50 50
 $user_id        = $payment->user_id;
51 51
 $donor_id       = $payment->customer_id;
52
-$payment_date   = strtotime( $payment->date );
53
-$user_info      = give_get_payment_meta_user_info( $payment_id );
52
+$payment_date   = strtotime($payment->date);
53
+$user_info      = give_get_payment_meta_user_info($payment_id);
54 54
 $address        = $payment->address;
55 55
 $currency_code  = $payment->currency;
56 56
 $gateway        = $payment->gateway;
57 57
 $currency_code  = $payment->currency;
58 58
 $payment_mode   = $payment->mode;
59
-$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
59
+$base_url       = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
60 60
 
61 61
 ?>
62 62
 <div class="wrap give-wrap">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	<?php
66 66
 		printf(
67 67
 			/* translators: %s: donation number */
68
-			esc_html__( 'Donation %s', 'give' ),
68
+			esc_html__('Donation %s', 'give'),
69 69
 			$number
70 70
 		);
71
-		if ( $payment_mode == 'test' ) {
71
+		if ($payment_mode == 'test') {
72 72
 			echo Give()->tooltips->render_span(array(
73
-				'label' => __( 'This donation was made in test mode.', 'give' ),
74
-				'tag_content' => __( 'Test Donation', 'give' ),
73
+				'label' => __('This donation was made in test mode.', 'give'),
74
+				'tag_content' => __('Test Donation', 'give'),
75 75
 				'position'=> 'right',
76 76
 				'attributes' => array(
77 77
 					'id' => 'test-payment-label',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $payment_id Payment id.
92 92
 	 */
93
-	do_action( 'give_view_donation_details_before', $payment_id );
93
+	do_action('give_view_donation_details_before', $payment_id);
94 94
 	?>
95 95
 
96 96
 	<hr class="wp-header-end">
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *
105 105
 		 * @param int $payment_id Payment id.
106 106
 		 */
107
-		do_action( 'give_view_donation_details_form_top', $payment_id );
107
+		do_action('give_view_donation_details_form_top', $payment_id);
108 108
 		?>
109 109
 		<div id="poststuff">
110 110
 			<div id="give-dashboard-widgets-wrap">
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 							 *
121 121
 							 * @param int $payment_id Payment id.
122 122
 							 */
123
-							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
123
+							do_action('give_view_donation_details_sidebar_before', $payment_id);
124 124
 							?>
125 125
 
126 126
 							<div id="give-order-update" class="postbox give-order-data">
127 127
 
128 128
 								<div class="give-order-top">
129
-									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
129
+									<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
130 130
 
131 131
 									<?php
132
-									if ( current_user_can( 'view_give_payments' ) ) {
132
+									if (current_user_can('view_give_payments')) {
133 133
 										echo sprintf(
134 134
 											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135 135
 											$payment_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 													), $base_url
142 142
 												), 'give_donation_nonce'
143 143
 											),
144
-											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
144
+											sprintf(__('Delete Donation %s', 'give'), $payment_id)
145 145
 										);
146 146
 									}
147 147
 									?>
@@ -158,33 +158,33 @@  discard block
 block discarded – undo
158 158
 										 *
159 159
 										 * @param int $payment_id Payment id.
160 160
 										 */
161
-										do_action( 'give_view_donation_details_totals_before', $payment_id );
161
+										do_action('give_view_donation_details_totals_before', $payment_id);
162 162
 										?>
163 163
 
164 164
 										<div class="give-admin-box-inside">
165 165
 											<p>
166
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
166
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
167 167
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
168
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
169
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
170 170
 													<?php endforeach; ?>
171 171
 												</select>
172
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
172
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
173 173
 											</p>
174 174
 										</div>
175 175
 
176 176
 										<div class="give-admin-box-inside">
177 177
 											<p>
178
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
179
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
178
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
179
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
180 180
 											</p>
181 181
 										</div>
182 182
 
183 183
 										<div class="give-admin-box-inside">
184 184
 											<p>
185
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
186
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
185
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
186
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
188 188
 											</p>
189 189
 										</div>
190 190
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 										 *
199 199
 										 * @param int $payment_id Payment id.
200 200
 										 */
201
-										do_action( 'give_view_donation_details_update_inner', $payment_id );
201
+										do_action('give_view_donation_details_update_inner', $payment_id);
202 202
 										?>
203 203
 
204 204
 										<div class="give-order-payment give-admin-box-inside">
205 205
 											<p>
206
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
207
-												<?php echo give_currency_symbol( $payment->currency ); ?>
208
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
206
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
207
+												<?php echo give_currency_symbol($payment->currency); ?>
208
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
209 209
 											</p>
210 210
 										</div>
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 										 *
218 218
 										 * @param int $payment_id Payment id.
219 219
 										 */
220
-										do_action( 'give_view_donation_details_totals_after', $payment_id );
220
+										do_action('give_view_donation_details_totals_after', $payment_id);
221 221
 										?>
222 222
 
223 223
 									</div>
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 									 *
236 236
 									 * @param int $payment_id Payment id.
237 237
 									 */
238
-									do_action( 'give_view_donation_details_update_before', $payment_id );
238
+									do_action('give_view_donation_details_update_before', $payment_id);
239 239
 									?>
240 240
 
241 241
 									<div id="major-publishing-actions">
242 242
 										<div id="publishing-action">
243 243
 
244 244
 											<input type="submit" class="button button-primary right"
245
-											       value="<?php _e( 'Save Donation', 'give' ); ?>"/>
245
+											       value="<?php _e('Save Donation', 'give'); ?>"/>
246 246
 
247 247
 											<?php
248
-											if ( give_is_payment_complete( $payment_id ) ) {
248
+											if (give_is_payment_complete($payment_id)) {
249 249
 												echo sprintf(
250 250
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
251 251
 													esc_url(
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 															)
257 257
 														)
258 258
 													),
259
-													__( 'Resend Receipt', 'give' )
259
+													__('Resend Receipt', 'give')
260 260
 												);
261 261
 											}
262 262
 											?>
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 									 *
272 272
 									 * @param int $payment_id Payment id.
273 273
 									 */
274
-									do_action( 'give_view_donation_details_update_after', $payment_id );
274
+									do_action('give_view_donation_details_update_after', $payment_id);
275 275
 									?>
276 276
 
277 277
 								</div>
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
 							<div id="give-order-details" class="postbox give-order-data">
284 284
 
285
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
285
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
286 286
 
287 287
 								<div class="inside">
288 288
 									<div class="give-admin-box">
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 										 *
296 296
 										 * @param int $payment_id Payment id.
297 297
 										 */
298
-										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
298
+										do_action('give_view_donation_details_payment_meta_before', $payment_id);
299 299
 
300
-										$gateway = give_get_payment_gateway( $payment_id );
301
-										if ( $gateway ) :
300
+										$gateway = give_get_payment_gateway($payment_id);
301
+										if ($gateway) :
302 302
 										?>
303 303
 											<div class="give-order-gateway give-admin-box-inside">
304 304
 												<p>
305
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
306
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
305
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
306
+													<?php echo give_get_gateway_admin_label($gateway); ?>
307 307
 												</p>
308 308
 											</div>
309 309
 										<?php endif; ?>
310 310
 
311 311
 										<div class="give-order-payment-key give-admin-box-inside">
312 312
 											<p>
313
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
314
-												<?php echo give_get_payment_key( $payment_id ); ?>
313
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
314
+												<?php echo give_get_payment_key($payment_id); ?>
315 315
 											</p>
316 316
 										</div>
317 317
 
318 318
 										<div class="give-order-ip give-admin-box-inside">
319 319
 											<p>
320
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
321
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
320
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
321
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
322 322
 											</p>
323 323
 										</div>
324 324
 
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
                                         // Display the transaction ID present.
327 327
                                         // The transaction ID is the charge ID from the gateway.
328 328
                                         // For instance, stripe "ch_BzvwYCchqOy5Nt".
329
-                                        if ( $transaction_id != $payment_id ) : ?>
329
+                                        if ($transaction_id != $payment_id) : ?>
330 330
 											<div class="give-order-tx-id give-admin-box-inside">
331 331
 												<p>
332
-													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
333
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
332
+													<strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong>&nbsp;
333
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
334 334
 												</p>
335 335
 											</div>
336 336
 										<?php endif; ?>
337 337
 
338 338
 										<div class="give-admin-box-inside">
339
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
340
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
339
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
340
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
341 341
 											</p>
342 342
 										</div>
343 343
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 										 *
350 350
 										 * @param int $payment_id Payment id.
351 351
 										 */
352
-										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
352
+										do_action('give_view_donation_details_payment_meta_after', $payment_id);
353 353
 										?>
354 354
 
355 355
 									</div>
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 							 *
370 370
 							 * @param int $payment_id Payment id.
371 371
 							 */
372
-							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
372
+							do_action('give_view_donation_details_sidebar_after', $payment_id);
373 373
 							?>
374 374
 
375 375
 						</div>
@@ -389,31 +389,31 @@  discard block
 block discarded – undo
389 389
 							 *
390 390
 							 * @param int $payment_id Payment id.
391 391
 							 */
392
-							do_action( 'give_view_donation_details_main_before', $payment_id );
392
+							do_action('give_view_donation_details_main_before', $payment_id);
393 393
 							?>
394 394
 
395 395
 							<?php $column_count = 'columns-3'; ?>
396 396
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
397
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
397
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
398 398
 
399 399
 								<div class="inside">
400 400
 
401 401
 									<div class="column-container">
402 402
 										<div class="column">
403 403
 											<p>
404
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
404
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
405 405
 												<?php
406
-												if ( $payment_meta['form_id'] ) :
406
+												if ($payment_meta['form_id']) :
407 407
 													printf(
408 408
 														'<a href="%1$s">%2$s</a>',
409
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
409
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
410 410
 														$payment_meta['form_id']
411 411
 													);
412 412
 												endif;
413 413
 												?>
414 414
 											</p>
415 415
 											<p>
416
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
416
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
417 417
 												<?php
418 418
 												echo Give()->html->forms_dropdown(
419 419
 													array(
@@ -429,21 +429,21 @@  discard block
 block discarded – undo
429 429
 										</div>
430 430
 										<div class="column">
431 431
 											<p>
432
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
433
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
432
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
433
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
434 434
 											</p>
435 435
 											<p>
436
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
436
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
437 437
 												<span class="give-donation-level">
438 438
 													<?php
439
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
440
-													if ( empty( $var_prices ) ) {
441
-														_e( 'n/a', 'give' );
439
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
440
+													if (empty($var_prices)) {
441
+														_e('n/a', 'give');
442 442
 													} else {
443 443
 														$prices_atts = array();
444
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
445
-															foreach ( $variable_prices as $variable_price ) {
446
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
444
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
445
+															foreach ($variable_prices as $variable_price) {
446
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
447 447
 															}
448 448
 														}
449 449
 														// Variable price dropdown options.
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 															'name'             => 'give-variable-price',
453 453
 															'chosen'           => true,
454 454
 															'show_option_all'  => '',
455
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
456
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
455
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
456
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
457 457
 															'selected'         => $payment_meta['price_id'],
458 458
 														);
459 459
 														// Render variable prices select tag html.
460
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
460
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
461 461
 													}
462 462
 													?>
463 463
 												</span>
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 										</div>
466 466
 										<div class="column">
467 467
 											<p>
468
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
469
-												<?php echo give_donation_amount( $payment, true ); ?>
468
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
469
+												<?php echo give_donation_amount($payment, true); ?>
470 470
 											</p>
471 471
 
472 472
 											<p>
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 												 *
481 481
 												 * @param int $payment_id Payment id.
482 482
 												 */
483
-												do_action( 'give_donation_details_thead_before', $payment_id );
483
+												do_action('give_donation_details_thead_before', $payment_id);
484 484
 
485 485
 
486 486
 												/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 												 *
493 493
 												 * @param int $payment_id Payment id.
494 494
 												 */
495
-												do_action( 'give_donation_details_thead_after', $payment_id );
495
+												do_action('give_donation_details_thead_after', $payment_id);
496 496
 
497 497
 												/**
498 498
 												 * Fires in donation details page, in the donation-information metabox, before the body elements.
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 												 *
504 504
 												 * @param int $payment_id Payment id.
505 505
 												 */
506
-												do_action( 'give_donation_details_tbody_before', $payment_id );
506
+												do_action('give_donation_details_tbody_before', $payment_id);
507 507
 
508 508
 												/**
509 509
 												 * Fires in donation details page, in the donation-information metabox, after the body elements.
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 												 *
515 515
 												 * @param int $payment_id Payment id.
516 516
 												 */
517
-												do_action( 'give_donation_details_tbody_after', $payment_id );
517
+												do_action('give_donation_details_tbody_after', $payment_id);
518 518
 												?>
519 519
 											</p>
520 520
 										</div>
@@ -534,59 +534,59 @@  discard block
 block discarded – undo
534 534
 							 *
535 535
 							 * @param int $payment_id Payment id.
536 536
 							 */
537
-							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
537
+							do_action('give_view_donation_details_donor_detail_before', $payment_id);
538 538
 							?>
539 539
 
540 540
 							<div id="give-donor-details" class="postbox">
541
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
541
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
542 542
 
543 543
 								<div class="inside">
544 544
 
545
-									<?php $donor = new Give_Donor( $donor_id ); ?>
545
+									<?php $donor = new Give_Donor($donor_id); ?>
546 546
 
547 547
 									<div class="column-container donor-info">
548 548
 										<div class="column">
549 549
 											<p>
550
-												<strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br>
550
+												<strong><?php _e('Donor ID:', 'give'); ?></strong><br>
551 551
 												<?php
552
-												if ( ! empty( $donor->id ) ) {
552
+												if ( ! empty($donor->id)) {
553 553
 													printf(
554 554
 														'<a href="%1$s">%2$s</a>',
555
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
555
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
556 556
 														$donor->id
557 557
 													);
558 558
 												}
559 559
 												?>
560
-												<span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span>
560
+												<span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span>
561 561
 											</p>
562 562
 											<p>
563
-												<strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br>
564
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
563
+												<strong><?php _e('Donor Since:', 'give'); ?></strong><br>
564
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
565 565
 											</p>
566 566
 										</div>
567 567
 										<div class="column">
568 568
 											<p>
569
-												<strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br>
569
+												<strong><?php _e('Donor Name:', 'give'); ?></strong><br>
570 570
 												<?php
571
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
572
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
571
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
572
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
573 573
 
574 574
 												// Check whether the donor name and WP_User name is same or not.
575
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
576
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
575
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
576
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
577 577
 												} else {
578 578
 													echo $donor_name;
579 579
 												}
580 580
 												?>
581 581
 											</p>
582 582
 											<p>
583
-												<strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br>
583
+												<strong><?php _e('Donor Email:', 'give'); ?></strong><br>
584 584
 												<?php echo $donor->email; ?>
585 585
 											</p>
586 586
 										</div>
587 587
 										<div class="column">
588 588
 											<p>
589
-												<strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br>
589
+												<strong><?php _e('Change Donor:', 'give'); ?></strong><br>
590 590
 												<?php
591 591
 												echo Give()->html->donor_dropdown(
592 592
 													array(
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 												?>
598 598
 											</p>
599 599
 											<p>
600
-												<?php if ( ! empty( $company_name ) ) {
600
+												<?php if ( ! empty($company_name)) {
601 601
 													?>
602
-													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
602
+													<strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br>
603 603
 													<?php
604 604
 													echo $company_name;
605 605
 												} ?>
@@ -610,19 +610,19 @@  discard block
 block discarded – undo
610 610
 									<div class="column-container new-donor" style="display: none">
611 611
 										<div class="column">
612 612
 											<p>
613
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
613
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
614 614
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
615 615
 											</p>
616 616
 										</div>
617 617
 										<div class="column">
618 618
 											<p>
619
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
619
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
620 620
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
621 621
 											</p>
622 622
 										</div>
623 623
 										<div class="column">
624 624
 											<p>
625
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
625
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
626 626
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
627 627
 											</p>
628 628
 										</div>
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 											<p>
631 631
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
632 632
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
633
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
633
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
634 634
 												<br>
635
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
635
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
636 636
 											</p>
637 637
 										</div>
638 638
 									</div>
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 									 * @param array $payment_meta Payment meta.
648 648
 									 * @param array $user_info    User information.
649 649
 									 */
650
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
650
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
651 651
 
652 652
 									/**
653 653
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 									 *
657 657
 									 * @param int $payment_id Payment id.
658 658
 									 */
659
-									do_action( 'give_payment_view_details', $payment_id );
659
+									do_action('give_payment_view_details', $payment_id);
660 660
 									?>
661 661
 
662 662
 								</div>
@@ -672,11 +672,11 @@  discard block
 block discarded – undo
672 672
 							 *
673 673
 							 * @param int $payment_id Payment id.
674 674
 							 */
675
-							do_action( 'give_view_donation_details_billing_before', $payment_id );
675
+							do_action('give_view_donation_details_billing_before', $payment_id);
676 676
 							?>
677 677
 
678 678
 							<div id="give-billing-details" class="postbox">
679
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
679
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
680 680
 
681 681
 								<div class="inside">
682 682
 
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 											<div class="data column-container">
687 687
 
688 688
 												<?php
689
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
689
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
690 690
 
691
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
691
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
692 692
 
693 693
 												// Get the country list that does not have any states init.
694 694
 												$no_states_country = give_no_states_country_list();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 												<div class="row">
698 698
 													<div id="give-order-address-country-wrap">
699
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
699
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
700 700
 														<?php
701 701
 														echo Give()->html->select(
702 702
 															array(
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 																'show_option_all'  => false,
707 707
 																'show_option_none' => false,
708 708
 																'chosen'           => true,
709
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
710
-																'data'             => array( 'search-type' => 'no_ajax' ),
709
+																'placeholder'      => esc_attr__('Select a country', 'give'),
710
+																'data'             => array('search-type' => 'no_ajax'),
711 711
 															)
712 712
 														);
713 713
 														?>
@@ -716,35 +716,35 @@  discard block
 block discarded – undo
716 716
 
717 717
 												<div class="row">
718 718
 													<div class="give-wrap-address-line1">
719
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
720
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
719
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
720
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
721 721
 													</div>
722 722
 												</div>
723 723
 
724 724
 												<div class="row">
725 725
 													<div class="give-wrap-address-line2">
726
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
727
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
726
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
727
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
728 728
 													</div>
729 729
 												</div>
730 730
 
731 731
 												<div class="row">
732 732
 													<div class="give-wrap-address-city">
733
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
734
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
733
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
734
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
735 735
 													</div>
736 736
 												</div>
737 737
 
738 738
 												<?php
739
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
739
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
740 740
 												?>
741 741
 												<div class="row">
742
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
743
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
744
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
742
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
743
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
744
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
745 745
 															<?php
746
-															$states = give_get_states( $address['country'] );
747
-															if ( ! empty( $states ) ) {
746
+															$states = give_get_states($address['country']);
747
+															if ( ! empty($states)) {
748 748
 																echo Give()->html->select(
749 749
 																	array(
750 750
 																		'options'          => $states,
@@ -753,23 +753,23 @@  discard block
 block discarded – undo
753 753
 																		'show_option_all'  => false,
754 754
 																		'show_option_none' => false,
755 755
 																		'chosen'           => true,
756
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
757
-																		'data'             => array( 'search-type' => 'no_ajax' ),
756
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
757
+																		'data'             => array('search-type' => 'no_ajax'),
758 758
 																	)
759 759
 																);
760 760
 															} else {
761 761
 																?>
762
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
762
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
763 763
 																<?php
764 764
 															}
765 765
 															?>
766 766
 														</div>
767 767
 													</div>
768 768
 
769
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
769
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
770 770
 														<div class="give-wrap-address-zip">
771
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
772
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
771
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
772
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
773 773
 														</div>
774 774
 													</div>
775 775
 												</div>
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 									 *
789 789
 									 * @param int $payment_id Payment id.
790 790
 									 */
791
-									do_action( 'give_payment_billing_details', $payment_id );
791
+									do_action('give_payment_billing_details', $payment_id);
792 792
 									?>
793 793
 
794 794
 								</div>
@@ -804,34 +804,34 @@  discard block
 block discarded – undo
804 804
 							 *
805 805
 							 * @param int $payment_id Payment id.
806 806
 							 */
807
-							do_action( 'give_view_donation_details_billing_after', $payment_id );
807
+							do_action('give_view_donation_details_billing_after', $payment_id);
808 808
 							?>
809 809
 
810 810
 							<div id="give-payment-notes" class="postbox">
811
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
811
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
812 812
 
813 813
 								<div class="inside">
814 814
 									<div id="give-payment-notes-inner">
815 815
 										<?php
816
-										$notes = give_get_payment_notes( $payment_id );
817
-										if ( ! empty( $notes ) ) {
816
+										$notes = give_get_payment_notes($payment_id);
817
+										if ( ! empty($notes)) {
818 818
 											$no_notes_display = ' style="display:none;"';
819
-											foreach ( $notes as $note ) :
819
+											foreach ($notes as $note) :
820 820
 
821
-												echo give_get_payment_note_html( $note, $payment_id );
821
+												echo give_get_payment_note_html($note, $payment_id);
822 822
 
823 823
 											endforeach;
824 824
 										} else {
825 825
 											$no_notes_display = '';
826 826
 										}
827 827
 
828
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
828
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
829 829
 										?>
830 830
 									</div>
831 831
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
832 832
 
833 833
 									<div class="give-clearfix">
834
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
834
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
835 835
 									</div>
836 836
 
837 837
 								</div>
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 							 *
848 848
 							 * @param int $payment_id Payment id.
849 849
 							 */
850
-							do_action( 'give_view_donation_details_main_after', $payment_id );
850
+							do_action('give_view_donation_details_main_after', $payment_id);
851 851
 							?>
852 852
 
853 853
 						</div>
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 		 *
870 870
 		 * @param int $payment_id Payment id.
871 871
 		 */
872
-		do_action( 'give_view_donation_details_form_bottom', $payment_id );
872
+		do_action('give_view_donation_details_form_bottom', $payment_id);
873 873
 
874
-		wp_nonce_field( 'give_update_payment_details_nonce' );
874
+		wp_nonce_field('give_update_payment_details_nonce');
875 875
 		?>
876
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
876
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
877 877
 		<input type="hidden" name="give_action" value="update_payment_details"/>
878 878
 	</form>
879 879
 	<?php
@@ -884,6 +884,6 @@  discard block
 block discarded – undo
884 884
 	 *
885 885
 	 * @param int $payment_id Payment id.
886 886
 	 */
887
-	do_action( 'give_view_donation_details_after', $payment_id );
887
+	do_action('give_view_donation_details_after', $payment_id);
888 888
 	?>
889 889
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +72 added lines, -72 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,70 +66,70 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) );
83
+					echo give_price($post_id, false);
84
+					printf('<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr($post_id), esc_attr(give_get_form_price($post_id)));
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89 89
 
90
-					echo give_admin_form_goal_stats( $post_id );
90
+					echo give_admin_form_goal_stats($post_id);
91 91
 
92 92
 				} else {
93
-					_e( 'No Goal Set', 'give' );
93
+					_e('No Goal Set', 'give');
94 94
 				}
95 95
 
96 96
 				printf(
97 97
 					'<input type="hidden" class="formgoal-%1$s" value="%2$s" />',
98
-					esc_attr( $post_id ),
99
-					give_get_form_goal( $post_id )
98
+					esc_attr($post_id),
99
+					give_get_form_goal($post_id)
100 100
 				);
101 101
 
102 102
 				break;
103 103
 			case 'donations':
104
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
104
+				if (current_user_can('view_give_form_stats', $post_id)) {
105 105
 					printf(
106 106
 						'<a href="%1$s">%2$s</a>',
107
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ),
108
-						give_get_form_sales_stats( $post_id )
107
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)),
108
+						give_get_form_sales_stats($post_id)
109 109
 					);
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'earnings':
115
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
115
+				if (current_user_can('view_give_form_stats', $post_id)) {
116 116
 					printf(
117 117
 						'<a href="%1$s">%2$s</a>',
118
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ),
119
-						give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) )
118
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)),
119
+						give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)))
120 120
 					);
121 121
 				} else {
122 122
 					echo '-';
123 123
 				}
124 124
 				break;
125 125
 			case 'shortcode':
126
-				printf( '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint( $post_id ) );
126
+				printf('<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint($post_id));
127 127
 				break;
128 128
 		}// End switch().
129 129
 	}// End if().
130 130
 }
131 131
 
132
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
132
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
133 133
 
134 134
 /**
135 135
  * Registers the sortable columns in the list table
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return array $columns Array of sortable columns
142 142
  */
143
-function give_sortable_form_columns( $columns ) {
143
+function give_sortable_form_columns($columns) {
144 144
 	$columns['price']     = 'amount';
145 145
 	$columns['sales']     = 'sales';
146 146
 	$columns['earnings']  = 'earnings';
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	return $columns;
151 151
 }
152 152
 
153
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
153
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
154 154
 
155 155
 /**
156 156
  * Sorts Columns in the Forms List Table
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @return array $vars Array of all the sort variables.
163 163
  */
164
-function give_sort_forms( $vars ) {
164
+function give_sort_forms($vars) {
165 165
 	// Check if we're viewing the "give_forms" post type.
166
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
166
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
167 167
 		return $vars;
168 168
 	}
169 169
 
170
-	switch ( $vars['orderby'] ) {
170
+	switch ($vars['orderby']) {
171 171
 		// Check if 'orderby' is set to "sales".
172 172
 		case 'sales':
173 173
 			$vars = array_merge(
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 		// Check if "orderby" is set to "price/amount".
194 194
 		case 'amount':
195
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
195
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
196 196
 
197 197
 			$vars['orderby']    = 'meta_value_num';
198 198
 			$vars['meta_query'] = array(
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return array       Array of all sort variables.
246 246
  */
247
-function give_filter_forms( $vars ) {
248
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
247
+function give_filter_forms($vars) {
248
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
249 249
 
250 250
 		// If an author ID was passed, use it
251
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
251
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
252 252
 
253 253
 			$author_id = $_REQUEST['author'];
254
-			if ( (int) $author_id !== get_current_user_id() ) {
255
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
254
+			if ((int) $author_id !== get_current_user_id()) {
255
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
256 256
 					'response' => 403,
257
-				) );
257
+				));
258 258
 			}
259 259
 			$vars = array_merge(
260 260
 				$vars,
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
  * @return void
279 279
  */
280 280
 function give_forms_load() {
281
-	add_filter( 'request', 'give_sort_forms' );
282
-	add_filter( 'request', 'give_filter_forms' );
281
+	add_filter('request', 'give_sort_forms');
282
+	add_filter('request', 'give_filter_forms');
283 283
 }
284 284
 
285
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
285
+add_action('load-edit.php', 'give_forms_load', 9999);
286 286
 
287 287
 /**
288 288
  * Remove Forms Month Filter
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
  * @global      $typenow The post type we are viewing.
297 297
  * @return array Empty array disables the dropdown.
298 298
  */
299
-function give_remove_month_filter( $dates ) {
299
+function give_remove_month_filter($dates) {
300 300
 	global $typenow;
301 301
 
302
-	if ( $typenow == 'give_forms' ) {
302
+	if ($typenow == 'give_forms') {
303 303
 		$dates = array();
304 304
 	}
305 305
 
306 306
 	return $dates;
307 307
 }
308 308
 
309
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
309
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
310 310
 
311 311
 /**
312 312
  * Updates price when saving post
@@ -317,23 +317,23 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return int|null
319 319
  */
320
-function give_price_save_quick_edit( $post_id ) {
321
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
320
+function give_price_save_quick_edit($post_id) {
321
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
322 322
 		return;
323 323
 	}
324
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
324
+	if ( ! current_user_can('edit_post', $post_id)) {
325 325
 		return $post_id;
326 326
 	}
327
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
327
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
328 328
 		return $post_id;
329 329
 	}
330 330
 
331
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
332
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
331
+	if (isset($_REQUEST['_give_regprice'])) {
332
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
333 333
 	}
334 334
 }
335 335
 
336
-add_action( 'save_post', 'give_price_save_quick_edit' );
336
+add_action('save_post', 'give_price_save_quick_edit');
337 337
 
338 338
 /**
339 339
  * Process bulk edit actions via AJAX
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
  */
344 344
 function give_save_bulk_edit() {
345 345
 
346
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
346
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
347 347
 
348
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
349
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
350
-		foreach ( $post_ids as $post_id ) {
348
+	if ( ! empty($post_ids) && is_array($post_ids)) {
349
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
350
+		foreach ($post_ids as $post_id) {
351 351
 
352
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
352
+			if ( ! current_user_can('edit_post', $post_id)) {
353 353
 				continue;
354 354
 			}
355 355
 
356
-			if ( ! empty( $price ) ) {
357
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
356
+			if ( ! empty($price)) {
357
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
358 358
 			}
359 359
 		}
360 360
 	}
@@ -362,4 +362,4 @@  discard block
 block discarded – undo
362 362
 	die();
363 363
 }
364 364
 
365
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
365
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +60 added lines, -60 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
 
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return  mixed
29 29
  */
30
-function __give_sanitize_number_decimals_setting_field( $value ) {
30
+function __give_sanitize_number_decimals_setting_field($value) {
31 31
 	$value_changed = false;
32 32
 	$old_value     = $value;
33 33
 
34
-	if ( isset( $_POST['decimal_separator'] ) ) {
35
-		$value         = ! empty( $_POST['decimal_separator'] ) ? $value : 0;
34
+	if (isset($_POST['decimal_separator'])) {
35
+		$value         = ! empty($_POST['decimal_separator']) ? $value : 0;
36 36
 		$value_changed = true;
37 37
 	}
38 38
 
39
-	if ( $value_changed && ( $old_value !== $value ) ) {
40
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) );
39
+	if ($value_changed && ($old_value !== $value)) {
40
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give'));
41 41
 	}
42 42
 
43
-	$value = absint( $value );
43
+	$value = absint($value);
44 44
 
45
-	if ( 6 <= $value ) {
45
+	if (6 <= $value) {
46 46
 		$value = 5;
47
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) );
47
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give'));
48 48
 	}
49 49
 
50
-	return absint( $value );
50
+	return absint($value);
51 51
 }
52 52
 
53
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 );
53
+add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10);
54 54
 
55 55
 
56 56
 /**
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return  mixed
68 68
  */
69
-function __give_validate_decimal_separator_setting_field( $value ) {
70
-	$thousand_separator = isset( $_POST['thousands_separator'] ) ? give_clean( $_POST['thousands_separator'] ) : '';
71
-	$decimal_separator  = isset( $_POST['decimal_separator'] ) ? give_clean( $_POST['decimal_separator'] ) : '';
69
+function __give_validate_decimal_separator_setting_field($value) {
70
+	$thousand_separator = isset($_POST['thousands_separator']) ? give_clean($_POST['thousands_separator']) : '';
71
+	$decimal_separator  = isset($_POST['decimal_separator']) ? give_clean($_POST['decimal_separator']) : '';
72 72
 
73
-	if ( $decimal_separator === $thousand_separator ) {
73
+	if ($decimal_separator === $thousand_separator) {
74 74
 		$value                    = '';
75 75
 		$_POST['number_decimals'] = 0;
76
-		Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) );
76
+		Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give'));
77 77
 	}
78 78
 
79 79
 	return $value;
80 80
 }
81 81
 
82
-add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 );
82
+add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10);
83 83
 
84 84
 /**
85 85
  * Change $delimiter text to symbol.
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return string $delimiter.
92 92
  */
93
-function __give_import_delimiter_set_callback( $delimiter ) {
93
+function __give_import_delimiter_set_callback($delimiter) {
94 94
 	$delimite_type = array(
95 95
 		'csv'                  => ',',
96 96
 		'tab-separated-values' => "\t",
97 97
 	);
98 98
 
99
-	return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : ',' );
99
+	return (array_key_exists($delimiter, $delimite_type) ? $delimite_type[$delimiter] : ',');
100 100
 }
101 101
 
102
-add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 );
102
+add_filter('give_import_delimiter_set', '__give_import_delimiter_set_callback', 10);
103 103
 
104 104
 /**
105 105
  * Give unset the page id from the core setting data from the json files.
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array $json_to_array
113 113
  */
114
-function give_import_core_settings_merge_pages( $json_to_array, $type ) {
115
-	if ( 'merge' === $type ) {
116
-		unset( $json_to_array['success_page'] );
117
-		unset( $json_to_array['failure_page'] );
118
-		unset( $json_to_array['history_page'] );
114
+function give_import_core_settings_merge_pages($json_to_array, $type) {
115
+	if ('merge' === $type) {
116
+		unset($json_to_array['success_page']);
117
+		unset($json_to_array['failure_page']);
118
+		unset($json_to_array['history_page']);
119 119
 	}
120 120
 
121 121
 	return $json_to_array;
122 122
 }
123 123
 
124
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2 );
124
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2);
125 125
 
126 126
 /**
127 127
  * Give check the image size from the core setting data from the json files.
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return array $json_to_array
135 135
  */
136
-function give_import_core_settings_merge_image_size( $json_to_array, $type ) {
137
-	if ( 'merge' === $type ) {
136
+function give_import_core_settings_merge_image_size($json_to_array, $type) {
137
+	if ('merge' === $type) {
138 138
 		// Featured image sizes import under Display Options > Post Types > Featured Image Size.
139 139
 		if (
140
-			! empty( $json_to_array['form_featured_img'] )
141
-			&& ! empty( $json_to_array['featured_image_size'] )
142
-			&& give_is_setting_enabled( $json_to_array['form_featured_img'] )
140
+			! empty($json_to_array['form_featured_img'])
141
+			&& ! empty($json_to_array['featured_image_size'])
142
+			&& give_is_setting_enabled($json_to_array['form_featured_img'])
143 143
 		) {
144 144
 			$images_sizes = get_intermediate_image_sizes();
145 145
 
146
-			if ( ! in_array( $json_to_array['featured_image_size'], $images_sizes, true ) ) {
147
-				unset( $json_to_array['featured_image_size'] );
146
+			if ( ! in_array($json_to_array['featured_image_size'], $images_sizes, true)) {
147
+				unset($json_to_array['featured_image_size']);
148 148
 			}
149 149
 		}
150 150
 	}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	return $json_to_array;
153 153
 }
154 154
 
155
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2 );
155
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2);
156 156
 
157 157
 /**
158 158
  * Give upload the image logo from the core setting data from the json files.
@@ -164,24 +164,24 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return array $json_to_array
166 166
  */
167
-function give_import_core_settings_merge_upload_image( $json_to_array, $type ) {
168
-	if ( 'merge' === $type ) {
167
+function give_import_core_settings_merge_upload_image($json_to_array, $type) {
168
+	if ('merge' === $type) {
169 169
 		// Emails > Email Settings > Logo.
170
-		if ( ! empty( $json_to_array['email_logo'] ) ) {
170
+		if ( ! empty($json_to_array['email_logo'])) {
171 171
 
172 172
 			// Need to require these files.
173
-			if ( ! function_exists( 'media_handle_upload' ) ) {
174
-				require_once( ABSPATH . 'wp-admin/includes/image.php' );
175
-				require_once( ABSPATH . 'wp-admin/includes/file.php' );
176
-				require_once( ABSPATH . 'wp-admin/includes/media.php' );
173
+			if ( ! function_exists('media_handle_upload')) {
174
+				require_once(ABSPATH.'wp-admin/includes/image.php');
175
+				require_once(ABSPATH.'wp-admin/includes/file.php');
176
+				require_once(ABSPATH.'wp-admin/includes/media.php');
177 177
 			}
178 178
 
179 179
 			$url     = $json_to_array['email_logo'];
180
-			$new_url = media_sideload_image( $url, 0, null, 'src' );
181
-			if ( ! is_wp_error( $new_url ) ) {
180
+			$new_url = media_sideload_image($url, 0, null, 'src');
181
+			if ( ! is_wp_error($new_url)) {
182 182
 				$json_to_array['email_logo'] = $new_url;
183 183
 			} else {
184
-				unset( $json_to_array['email_logo'] );
184
+				unset($json_to_array['email_logo']);
185 185
 			}
186 186
 		}
187 187
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	return $json_to_array;
190 190
 }
191 191
 
192
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2 );
192
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2);
193 193
 
194 194
 /**
195 195
  * Give unset the license key from the core setting data from the json files.
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
  *
202 202
  * @return array $json_to_array
203 203
  */
204
-function give_import_core_settings_merge_license_key( $json_to_array, $type ) {
205
-	if ( 'merge' === $type ) {
206
-		foreach ( $json_to_array as $key => $value ) {
207
-			$is_license_key = strpos( '_license_key', $key );
208
-			if ( ! empty( $is_license_key ) ) {
209
-				unset( $json_to_array[ $key ] );
204
+function give_import_core_settings_merge_license_key($json_to_array, $type) {
205
+	if ('merge' === $type) {
206
+		foreach ($json_to_array as $key => $value) {
207
+			$is_license_key = strpos('_license_key', $key);
208
+			if ( ! empty($is_license_key)) {
209
+				unset($json_to_array[$key]);
210 210
 			}
211 211
 		}
212 212
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	return $json_to_array;
215 215
 }
216 216
 
217
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2 );
217
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2);
218 218
 
219 219
 /**
220 220
  * Give merge the json data and setting data.
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return array $json_to_array
229 229
  */
230
-function give_import_core_settings_merge_data( $json_to_array, $type, $host_give_options ) {
231
-	if ( 'merge' === $type ) {
232
-		$json_to_array_merge = array_merge( $host_give_options, $json_to_array );
230
+function give_import_core_settings_merge_data($json_to_array, $type, $host_give_options) {
231
+	if ('merge' === $type) {
232
+		$json_to_array_merge = array_merge($host_give_options, $json_to_array);
233 233
 		$json_to_array       = $json_to_array_merge;
234 234
 	}
235 235
 
236 236
 	return $json_to_array;
237 237
 }
238 238
 
239
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3 );
239
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3);
240 240
 
241 241
 /**
242 242
  * Backward Compatibility - Cleanup User Roles.
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return mixed
249 249
  */
250
-function give_bc_1817_cleanup_user_roles( $caps ) {
250
+function give_bc_1817_cleanup_user_roles($caps) {
251 251
 
252 252
 	if (
253
-		! give_has_upgrade_completed( 'v1817_cleanup_user_roles' ) &&
254
-		! isset( $caps['view_give_payments'] )
253
+		! give_has_upgrade_completed('v1817_cleanup_user_roles') &&
254
+		! isset($caps['view_give_payments'])
255 255
 	) {
256 256
 		give_v1817_process_cleanup_user_roles();
257 257
 	}
@@ -259,4 +259,4 @@  discard block
 block discarded – undo
259 259
 	return $caps;
260 260
 }
261 261
 
262
-add_filter( 'user_has_cap', 'give_bc_1817_cleanup_user_roles' );
262
+add_filter('user_has_cap', 'give_bc_1817_cleanup_user_roles');
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 1 patch
Spacing   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
14 14
 // Add give command.
15
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
15
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
16 16
 
17 17
 
18 18
 /**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @subcommand    logo
78 78
 	 */
79
-	public function ascii( $args, $assoc_args ) {
80
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/dist/images/give-ascii-logo.txt' ) );
79
+	public function ascii($args, $assoc_args) {
80
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/dist/images/give-ascii-logo.txt'));
81 81
 	}
82 82
 
83 83
 
@@ -102,54 +102,54 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @subcommand    details
104 104
 	 */
105
-	public function details( $args, $assoc_args ) {
105
+	public function details($args, $assoc_args) {
106 106
 
107 107
 		/**
108 108
 		 * Plugin Information
109 109
 		 */
110
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
110
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
111 111
 
112 112
 		/**
113 113
 		 * General Information.
114 114
 		 */
115
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
115
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
116 116
 
117
-		$success_page = give_get_option( 'success_page' );
118
-		$failure_page = give_get_option( 'failure_page' );
119
-		$history_page = give_get_option( 'history_page' );
117
+		$success_page = give_get_option('success_page');
118
+		$failure_page = give_get_option('failure_page');
119
+		$history_page = give_get_option('history_page');
120 120
 
121
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
122
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
123
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
124
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
121
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
122
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
123
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
124
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
125 125
 
126 126
 		/**
127 127
 		 * Currency Information.
128 128
 		 */
129
-		$default_gateway = give_get_option( 'default_gateway' );
129
+		$default_gateway = give_get_option('default_gateway');
130 130
 
131
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
131
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
132 132
 
133
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
134
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
135
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
136
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
137
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
138
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
139
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
133
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
134
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
135
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
136
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
137
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
138
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
139
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
140 140
 
141 141
 		// Payment gateways Information.
142
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
143
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
142
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
143
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
144 144
 
145
-		if ( ! empty( $gateways ) ) {
145
+		if ( ! empty($gateways)) {
146 146
 			self::$counter = 1;
147
-			foreach ( $gateways as $gateway ) {
148
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
149
-				self::$counter ++;
147
+			foreach ($gateways as $gateway) {
148
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
149
+				self::$counter++;
150 150
 			}
151 151
 		} else {
152
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
152
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
153 153
 		}
154 154
 	}
155 155
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @subcommand    forms
183 183
 	 */
184
-	public function forms( $args, $assoc_args ) {
184
+	public function forms($args, $assoc_args) {
185 185
 		global $wp_query;
186
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
187
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
186
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
187
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
188 188
 		$start   = time();
189 189
 
190 190
 		// Cache previous number query var.
191 191
 		$is_set_number = $cache_per_page = false;
192
-		if ( isset( $wp_query->query_vars['number'] ) ) {
192
+		if (isset($wp_query->query_vars['number'])) {
193 193
 			$cache_per_page = $wp_query->query_vars['number'];
194 194
 			$is_set_number  = true;
195 195
 		}
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 		$wp_query->query_vars['number'] = $number;
199 199
 
200 200
 		// Get forms.
201
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
201
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
202 202
 
203 203
 		// Reset number query var.
204
-		if ( $is_set_number ) {
204
+		if ($is_set_number) {
205 205
 			$wp_query->query_vars['number'] = $cache_per_page;
206 206
 		}
207 207
 
208 208
 		// Bailout.
209
-		if ( array_key_exists( 'error', $forms ) ) {
209
+		if (array_key_exists('error', $forms)) {
210 210
 
211
-			WP_CLI::warning( $forms['error'] );
211
+			WP_CLI::warning($forms['error']);
212 212
 
213 213
 			return;
214
-		} elseif ( empty( $forms['forms'] ) ) {
214
+		} elseif (empty($forms['forms'])) {
215 215
 
216
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
216
+			WP_CLI::error(__('No forms found.', 'give'));
217 217
 
218 218
 			return;
219 219
 		}
@@ -221,25 +221,25 @@  discard block
 block discarded – undo
221 221
 		// Param to check if form typeis already showed or not.
222 222
 		$is_show_form_type = false;
223 223
 
224
-		if ( 1 === count( $forms ) && $form_id ) {
224
+		if (1 === count($forms) && $form_id) {
225 225
 			// Show single form.
226
-			foreach ( $forms['forms'][0] as $key => $info ) {
227
-				switch ( $key ) {
226
+			foreach ($forms['forms'][0] as $key => $info) {
227
+				switch ($key) {
228 228
 					case 'stats':
229
-						$this->color_main_heading( ucfirst( $key ) );
229
+						$this->color_main_heading(ucfirst($key));
230 230
 
231
-						foreach ( $info as $heading => $data ) {
232
-							$this->color_sub_heading( ucfirst( $heading ) );
233
-							switch ( $heading ) {
231
+						foreach ($info as $heading => $data) {
232
+							$this->color_sub_heading(ucfirst($heading));
233
+							switch ($heading) {
234 234
 								default:
235
-									foreach ( $data as $subheading => $subdata ) {
235
+									foreach ($data as $subheading => $subdata) {
236 236
 
237
-										switch ( $subheading ) {
237
+										switch ($subheading) {
238 238
 											case 'earnings':
239
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
239
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
240 240
 												break;
241 241
 											default:
242
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
242
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
243 243
 										}
244 244
 									}
245 245
 							}
@@ -249,26 +249,26 @@  discard block
 block discarded – undo
249 249
 					case 'pricing':
250 250
 					case 'info':
251 251
 					default:
252
-						$this->color_main_heading( ucfirst( $key ) );
252
+						$this->color_main_heading(ucfirst($key));
253 253
 
254 254
 						// Show form type.
255
-						if ( ! $is_show_form_type ) {
256
-							$form              = new Give_Donate_Form( $form_id );
255
+						if ( ! $is_show_form_type) {
256
+							$form              = new Give_Donate_Form($form_id);
257 257
 							$is_show_form_type = true;
258 258
 
259
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
259
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
260 260
 						}
261 261
 
262
-						foreach ( $info as $heading => $data ) {
262
+						foreach ($info as $heading => $data) {
263 263
 
264
-							switch ( $heading ) {
264
+							switch ($heading) {
265 265
 								case 'id':
266
-									WP_CLI::log( $this->color_message( $heading, $data ) );
266
+									WP_CLI::log($this->color_message($heading, $data));
267 267
 									break;
268 268
 
269 269
 								default:
270
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
271
-									WP_CLI::log( $this->color_message( $heading, $data ) );
270
+									$data = empty($data) ? __('Not set', 'give') : $data;
271
+									WP_CLI::log($this->color_message($heading, $data));
272 272
 							}
273 273
 						}
274 274
 				}// End switch().
@@ -279,37 +279,37 @@  discard block
 block discarded – undo
279 279
 			$is_table_first_row_set = false;
280 280
 			$table_column_count     = 0;
281 281
 
282
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
282
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
283 283
 
284
-			foreach ( $forms['forms'] as $index => $form_data ) {
284
+			foreach ($forms['forms'] as $index => $form_data) {
285 285
 
286 286
 				// Default table data.
287 287
 				$table_first_row = array();
288 288
 				$table_row       = array();
289 289
 
290
-				foreach ( $form_data['info'] as $key => $form ) {
290
+				foreach ($form_data['info'] as $key => $form) {
291 291
 
292 292
 					// Do not show thumbnail, content and link in table.
293
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
293
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
294 294
 						continue;
295 295
 					}
296 296
 
297
-					if ( ! $is_table_first_row_set ) {
297
+					if ( ! $is_table_first_row_set) {
298 298
 						$table_first_row[] = $key;
299 299
 					}
300 300
 
301 301
 					$table_row[] = $form;
302 302
 
303
-					if ( 'status' === $key ) {
303
+					if ('status' === $key) {
304 304
 						// First array item will be an form id in our case.
305
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
305
+						$form = new Give_Donate_Form(absint($table_row[0]));
306 306
 
307 307
 						$table_row[] = $form->get_type();
308 308
 					}
309 309
 				}
310 310
 
311 311
 				// Set table first row.
312
-				if ( ! $is_table_first_row_set ) {
312
+				if ( ! $is_table_first_row_set) {
313 313
 
314 314
 					// Add extra column to table.
315 315
 					$table_first_row[] = 'type';
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				$table_data[] = $table_row;
323 323
 			}// End foreach().
324 324
 
325
-			$this->display_table( $table_data );
325
+			$this->display_table($table_data);
326 326
 		}// End if().
327 327
 	}
328 328
 
@@ -375,59 +375,59 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 * @subcommand    donors
377 377
 	 */
378
-	public function donors( $args, $assoc_args ) {
378
+	public function donors($args, $assoc_args) {
379 379
 		global $wp_query;
380
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
381
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
382
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
383
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
384
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
385
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
386
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
380
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
381
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
382
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
383
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
384
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
385
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
386
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
387 387
 		$start    = time();
388 388
 
389
-		if ( $create ) {
390
-			if ( 80 < $create ) {
391
-				WP_CLI::warning( 'Currently we can only generate maximum 80 donors.', 'give' );
389
+		if ($create) {
390
+			if (80 < $create) {
391
+				WP_CLI::warning('Currently we can only generate maximum 80 donors.', 'give');
392 392
 				$create = 80;
393 393
 			}
394 394
 
395 395
 			$number = 1;
396 396
 
397
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
398
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
397
+			if (isset($assoc_args['email']) && ! is_email($email)) {
398
+				WP_CLI::warning('Wrong email address provided.', 'give');
399 399
 
400 400
 				return;
401 401
 			}
402 402
 
403 403
 			// Create one or more donors.
404
-			if ( ! $email ) {
404
+			if ( ! $email) {
405 405
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
406
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
406
+				$number = is_numeric($create) ? absint($create) : 1;
407 407
 			}
408 408
 
409
-			for ( $i = 0; $i < $number; $i ++ ) {
409
+			for ($i = 0; $i < $number; $i++) {
410 410
 				$name  = $name ? $name : $this->get_random_name();
411
-				$email = $email ? $email : $this->get_random_email( $name );
411
+				$email = $email ? $email : $this->get_random_email($name);
412 412
 
413 413
 				$args = array(
414 414
 					'email' => $email,
415 415
 					'name'  => $name,
416 416
 				);
417 417
 
418
-				$donor_id = Give()->donors->add( $args );
418
+				$donor_id = Give()->donors->add($args);
419 419
 
420
-				if ( $donor_id ) {
421
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
420
+				if ($donor_id) {
421
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
422 422
 				} else {
423
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
423
+					WP_CLI::error(__('Failed to create donor', 'give'));
424 424
 				}
425 425
 
426 426
 				// Reset email and name to false so it is generated on the next loop (if creating donors).
427 427
 				$email = $name = false;
428 428
 			}
429 429
 
430
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
430
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
431 431
 
432 432
 		} else {
433 433
 			// Counter.
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 			 */
442 442
 			// Cache previous number query var.
443 443
 			$is_set_number = $cache_per_page = false;
444
-			if ( isset( $wp_query->query_vars['number'] ) ) {
444
+			if (isset($wp_query->query_vars['number'])) {
445 445
 				$cache_per_page = $wp_query->query_vars['number'];
446 446
 				$is_set_number  = true;
447 447
 			}
@@ -450,24 +450,24 @@  discard block
 block discarded – undo
450 450
 			$wp_query->query_vars['number'] = $number;
451 451
 
452 452
 			// Get donors.
453
-			if ( $form_id ) {
453
+			if ($form_id) {
454 454
 				// @TODO: Allow user to get a list of donors by donation status.
455
-				$donors = $this->get_donors_by_form_id( $form_id );
455
+				$donors = $this->get_donors_by_form_id($form_id);
456 456
 			} else {
457
-				$donors = $this->api->get_donors( $search );
457
+				$donors = $this->api->get_donors($search);
458 458
 			}
459 459
 
460 460
 			// Reset number query var.
461
-			if ( $is_set_number ) {
461
+			if ($is_set_number) {
462 462
 				$wp_query->query_vars['number'] = $cache_per_page;
463 463
 			}
464 464
 
465
-			if ( isset( $donors['error'] ) ) {
466
-				WP_CLI::error( $donors['error'] );
465
+			if (isset($donors['error'])) {
466
+				WP_CLI::error($donors['error']);
467 467
 			}
468 468
 
469
-			if ( empty( $donors ) ) {
470
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
469
+			if (empty($donors)) {
470
+				WP_CLI::error(__('No donors found.', 'give'));
471 471
 
472 472
 				return;
473 473
 			}
@@ -475,24 +475,24 @@  discard block
 block discarded – undo
475 475
 			$table_data             = array();
476 476
 			$is_table_first_row_set = false;
477 477
 
478
-			foreach ( $donors['donors'] as $donor_data ) {
478
+			foreach ($donors['donors'] as $donor_data) {
479 479
 				// Set default table row data.
480
-				$table_first_row = array( __( 's_no', 'give' ) );
481
-				$table_row       = array( self::$counter );
480
+				$table_first_row = array(__('s_no', 'give'));
481
+				$table_row       = array(self::$counter);
482 482
 
483
-				foreach ( $donor_data as $key => $donor ) {
484
-					switch ( $key ) {
483
+				foreach ($donor_data as $key => $donor) {
484
+					switch ($key) {
485 485
 						case 'stats':
486
-							foreach ( $donor as $heading => $data ) {
486
+							foreach ($donor as $heading => $data) {
487 487
 
488 488
 								// Get first row.
489
-								if ( ! $is_table_first_row_set ) {
489
+								if ( ! $is_table_first_row_set) {
490 490
 									$table_first_row[] = $heading;
491 491
 								}
492 492
 
493
-								switch ( $heading ) {
493
+								switch ($heading) {
494 494
 									case 'total_spent':
495
-										$table_row[] = give_currency_filter( $data );
495
+										$table_row[] = give_currency_filter($data);
496 496
 										break;
497 497
 
498 498
 									default:
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 
504 504
 						case 'info':
505 505
 						default:
506
-							foreach ( $donor as $heading => $data ) {
506
+							foreach ($donor as $heading => $data) {
507 507
 
508 508
 								// Get first row.
509
-								if ( ! $is_table_first_row_set ) {
509
+								if ( ! $is_table_first_row_set) {
510 510
 									$table_first_row[] = $heading;
511 511
 								}
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 				}
517 517
 
518 518
 				// Add first row data to table data.
519
-				if ( ! $is_table_first_row_set ) {
519
+				if ( ! $is_table_first_row_set) {
520 520
 					$table_data[]           = $table_first_row;
521 521
 					$is_table_first_row_set = true;
522 522
 				}
@@ -525,44 +525,44 @@  discard block
 block discarded – undo
525 525
 				$table_data[] = $table_row;
526 526
 
527 527
 				// Increase counter.
528
-				self::$counter ++;
528
+				self::$counter++;
529 529
 			}// End foreach().
530 530
 
531
-			switch ( $format ) {
531
+			switch ($format) {
532 532
 				case 'json':
533 533
 					$table_column_name = $table_data[0];
534
-					unset( $table_data[0] );
534
+					unset($table_data[0]);
535 535
 
536 536
 					$new_table_data = array();
537
-					foreach ( $table_data as $index => $data ) {
538
-						foreach ( $data as $key => $value ) {
539
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
537
+					foreach ($table_data as $index => $data) {
538
+						foreach ($data as $key => $value) {
539
+							$new_table_data[$index][$table_column_name[$key]] = $value;
540 540
 						}
541 541
 					}
542 542
 
543
-					WP_CLI::log( json_encode( $new_table_data ) );
543
+					WP_CLI::log(json_encode($new_table_data));
544 544
 					break;
545 545
 
546 546
 				case 'csv':
547
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
548
-					$fp        = fopen( $file_path, 'w' );
547
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
548
+					$fp        = fopen($file_path, 'w');
549 549
 
550
-					if ( is_writable( $file_path ) ) {
551
-						foreach ( $table_data as $fields ) {
552
-							fputcsv( $fp, $fields );
550
+					if (is_writable($file_path)) {
551
+						foreach ($table_data as $fields) {
552
+							fputcsv($fp, $fields);
553 553
 						}
554 554
 
555
-						fclose( $fp );
555
+						fclose($fp);
556 556
 
557
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
557
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
558 558
 					} else {
559
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
559
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
560 560
 					}
561 561
 
562 562
 					break;
563 563
 
564 564
 				default:
565
-					$this->display_table( $table_data );
565
+					$this->display_table($table_data);
566 566
 			}// End switch().
567 567
 		}// End if().
568 568
 	}
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 	 *
593 593
 	 * @subcommand    donations
594 594
 	 */
595
-	public function donations( $args, $assoc_args ) {
595
+	public function donations($args, $assoc_args) {
596 596
 		global $wp_query;
597
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
597
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
598 598
 
599 599
 		// Cache previous number query var.
600 600
 		$is_set_number = $cache_per_page = false;
601
-		if ( isset( $wp_query->query_vars['number'] ) ) {
601
+		if (isset($wp_query->query_vars['number'])) {
602 602
 			$cache_per_page = $wp_query->query_vars['number'];
603 603
 			$is_set_number  = true;
604 604
 		}
@@ -610,46 +610,46 @@  discard block
 block discarded – undo
610 610
 		$donations = $this->api->get_recent_donations();
611 611
 
612 612
 		// Reset number query var.
613
-		if ( $is_set_number ) {
613
+		if ($is_set_number) {
614 614
 			$wp_query->query_vars['number'] = $cache_per_page;
615 615
 		}
616 616
 
617
-		if ( empty( $donations ) ) {
618
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
617
+		if (empty($donations)) {
618
+			WP_CLI::error(__('No donations found.', 'give'));
619 619
 
620 620
 			return;
621 621
 		}
622 622
 
623 623
 		self::$counter = 1;
624 624
 
625
-		foreach ( $donations['donations'] as $key => $donation ) {
626
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
627
-			self::$counter ++;
625
+		foreach ($donations['donations'] as $key => $donation) {
626
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
627
+			self::$counter++;
628 628
 
629
-			foreach ( $donation as $column => $data ) {
629
+			foreach ($donation as $column => $data) {
630 630
 
631
-				if ( is_array( $data ) ) {
632
-					$this->color_sub_heading( $column );
633
-					foreach ( $data as $subcolumn => $subdata ) {
631
+				if (is_array($data)) {
632
+					$this->color_sub_heading($column);
633
+					foreach ($data as $subcolumn => $subdata) {
634 634
 
635 635
 						// Decode html codes.
636
-						switch ( $subcolumn ) {
636
+						switch ($subcolumn) {
637 637
 							case 'name':
638
-								$subdata = html_entity_decode( $subdata );
638
+								$subdata = html_entity_decode($subdata);
639 639
 								break;
640 640
 						}
641 641
 
642 642
 						// @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.
643
-						if ( is_array( $subdata ) ) {
643
+						if (is_array($subdata)) {
644 644
 							continue;
645 645
 						}
646 646
 
647
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
647
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
648 648
 					}
649 649
 					continue;
650 650
 				}
651 651
 
652
-				WP_CLI::log( $this->color_message( $column, $data ) );
652
+				WP_CLI::log($this->color_message($column, $data));
653 653
 			}
654 654
 		}
655 655
 	}
@@ -689,27 +689,27 @@  discard block
 block discarded – undo
689 689
 	 *
690 690
 	 * @return        void
691 691
 	 */
692
-	public function report( $args, $assoc_args ) {
692
+	public function report($args, $assoc_args) {
693 693
 		$stats      = new Give_Payment_Stats();
694
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
695
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
696
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
697
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
694
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
695
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
696
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
697
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
698 698
 
699
-		if ( ! empty( $date ) ) {
699
+		if ( ! empty($date)) {
700 700
 			$start_date = $date;
701 701
 			$end_date   = false;
702
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
702
+		} elseif (empty($date) && empty($start_date)) {
703 703
 			$start_date = 'this_month';
704 704
 			$end_date   = false;
705 705
 		}
706 706
 
707 707
 		// Get stats.
708
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
709
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
708
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
709
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
710 710
 
711
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings, array( 'decode_currency' => true ) ) ) );
712
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
711
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings, array('decode_currency' => true))));
712
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
713 713
 	}
714 714
 
715 715
 
@@ -736,27 +736,27 @@  discard block
 block discarded – undo
736 736
 	 *
737 737
 	 * @subcommand    cache
738 738
 	 */
739
-	public function cache( $args, $assoc_args ) {
740
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
739
+	public function cache($args, $assoc_args) {
740
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
741 741
 
742 742
 		// Bailout.
743
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
744
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
743
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
744
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
745 745
 
746 746
 			return;
747 747
 		}
748 748
 
749
-		switch ( $action ) {
749
+		switch ($action) {
750 750
 			case 'delete':
751 751
 				// Reset counter.
752 752
 				self::$counter = 1;
753 753
 
754
-				if ( $this->delete_stats_transients() ) {
754
+				if ($this->delete_stats_transients()) {
755 755
 					// Report .eading.
756
-					WP_CLI::success( 'Give cache deleted.' );
756
+					WP_CLI::success('Give cache deleted.');
757 757
 				} else {
758 758
 					// Report .eading.
759
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
759
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
760 760
 				}
761 761
 				break;
762 762
 		}
@@ -785,27 +785,27 @@  discard block
 block discarded – undo
785 785
 			ARRAY_A
786 786
 		);
787 787
 
788
-		if ( ! empty( $stat_option_names ) ) {
788
+		if ( ! empty($stat_option_names)) {
789 789
 
790
-			foreach ( $stat_option_names as $option_name ) {
790
+			foreach ($stat_option_names as $option_name) {
791 791
 				$error       = false;
792 792
 				$option_name = $option_name['option_name'];
793 793
 
794
-				switch ( true ) {
795
-					case ( false !== strpos( $option_name, 'transient' ) ):
796
-						$option_name = str_replace( '_transient_', '', $option_name );
797
-						$error       = delete_transient( $option_name );
794
+				switch (true) {
795
+					case (false !== strpos($option_name, 'transient')):
796
+						$option_name = str_replace('_transient_', '', $option_name);
797
+						$error       = delete_transient($option_name);
798 798
 						break;
799 799
 
800 800
 					default:
801
-						$error = delete_option( $option_name );
801
+						$error = delete_option($option_name);
802 802
 				}
803 803
 
804
-				if ( $error ) {
805
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
806
-					self::$counter ++;
804
+				if ($error) {
805
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
806
+					self::$counter++;
807 807
 				} else {
808
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
808
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
809 809
 				}
810 810
 			}
811 811
 
@@ -826,13 +826,13 @@  discard block
 block discarded – undo
826 826
 	 *
827 827
 	 * @return   string
828 828
 	 */
829
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
829
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
830 830
 		// Add colon.
831
-		if ( $colon ) {
832
-			$heading = $heading . ': ';
831
+		if ($colon) {
832
+			$heading = $heading.': ';
833 833
 		}
834 834
 
835
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
835
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
836 836
 	}
837 837
 
838 838
 
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	 *
848 848
 	 * @return    void
849 849
 	 */
850
-	private function color_main_heading( $heading, $color = 'g' ) {
851
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
850
+	private function color_main_heading($heading, $color = 'g') {
851
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
852 852
 	}
853 853
 
854 854
 	/**
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	 *
862 862
 	 * @return    void
863 863
 	 */
864
-	private function color_sub_heading( $subheading ) {
865
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
864
+	private function color_sub_heading($subheading) {
865
+		WP_CLI::log("\n--->".$subheading.'', '', false);
866 866
 	}
867 867
 
868 868
 
@@ -876,17 +876,17 @@  discard block
 block discarded – undo
876 876
 	 *
877 877
 	 * @return    void
878 878
 	 */
879
-	private function display_table( $data ) {
879
+	private function display_table($data) {
880 880
 		$table = new \cli\Table();
881 881
 
882 882
 		// Set table header.
883
-		$table->setHeaders( $data[0] );
883
+		$table->setHeaders($data[0]);
884 884
 
885 885
 		// Remove table header.
886
-		unset( $data[0] );
886
+		unset($data[0]);
887 887
 
888 888
 		// Set table data.
889
-		$table->setRows( $data );
889
+		$table->setRows($data);
890 890
 
891 891
 		// Display table.
892 892
 		$table->display();
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 	 * @return array
904 904
 	 */
905 905
 
906
-	private function get_donors_by_form_id( $form_id ) {
906
+	private function get_donors_by_form_id($form_id) {
907 907
 		$donors = array();
908 908
 
909 909
 		$donations = new Give_Payments_Query(
910 910
 			array(
911
-				'give_forms' => array( $form_id ),
912
-				'number'     => - 1,
913
-				'status'     => array( 'publish' ),
911
+				'give_forms' => array($form_id),
912
+				'number'     => -1,
913
+				'status'     => array('publish'),
914 914
 			)
915 915
 		);
916 916
 
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 		$skip_donors = array();
919 919
 
920 920
 		/* @var Give_Payment|object $donation Payment object. */
921
-		foreach ( $donations as $donation ) {
921
+		foreach ($donations as $donation) {
922 922
 
923
-			if ( in_array( $donation->customer_id, $skip_donors, true ) ) {
923
+			if (in_array($donation->customer_id, $skip_donors, true)) {
924 924
 				continue;
925 925
 			}
926 926
 
927
-			if ( ! empty( $donors ) ) {
928
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
927
+			if ( ! empty($donors)) {
928
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
929 929
 			} else {
930
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
930
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
931 931
 			}
932 932
 
933 933
 			$skip_donors[] = $donation->customer_id;
@@ -972,15 +972,15 @@  discard block
 block discarded – undo
972 972
 		);
973 973
 
974 974
 		// Generate a random forename.
975
-		$random_name = $names[ mt_rand( 0, sizeof( $names ) - 1 ) ];
975
+		$random_name = $names[mt_rand(0, sizeof($names) - 1)];
976 976
 
977 977
 		// Generate a random surname.
978
-		$random_surname = $surnames[ mt_rand( 0, sizeof( $surnames ) - 1 ) ];
978
+		$random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)];
979 979
 
980 980
 		// Generate name.
981 981
 		$name = "{$random_name} {$random_surname}";
982 982
 
983
-		if ( in_array( $name, $this->new_donor_names ) ) {
983
+		if (in_array($name, $this->new_donor_names)) {
984 984
 			$name = $this->get_random_name();
985 985
 		}
986 986
 
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 	 *
1000 1000
 	 * @return string
1001 1001
 	 */
1002
-	private function get_random_email( $name ) {
1003
-		return implode( '.', explode( ' ', strtolower( $name ) ) ) . '@test.com';
1002
+	private function get_random_email($name) {
1003
+		return implode('.', explode(' ', strtolower($name))).'@test.com';
1004 1004
 	}
1005 1005
 
1006 1006
 	/**
@@ -1015,59 +1015,59 @@  discard block
 block discarded – undo
1015 1015
 	 * @when after_wp_load
1016 1016
 	 * @subcommand test-mode
1017 1017
 	 */
1018
-	public function test_mode( $args, $assoc ) {
1018
+	public function test_mode($args, $assoc) {
1019 1019
 
1020 1020
 		// Return if associative arguments are not specified.
1021
-		if ( empty( $assoc ) ) {
1022
-			WP_CLI::error( "--enable or --disable flag is missing." );
1021
+		if (empty($assoc)) {
1022
+			WP_CLI::error("--enable or --disable flag is missing.");
1023 1023
 			return;
1024 1024
 		}
1025 1025
 
1026
-		$enabled_gateways = give_get_option( 'gateways' );
1027
-		$default_gateway  = give_get_option( 'default_gateway' );
1026
+		$enabled_gateways = give_get_option('gateways');
1027
+		$default_gateway  = give_get_option('default_gateway');
1028 1028
 
1029 1029
 
1030 1030
 		// Enable Test Mode.
1031
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'enable' ) ) {
1031
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'enable')) {
1032 1032
 
1033 1033
 			// Set `Test Mode` to `enabled`.
1034
-			give_update_option( 'test_mode', 'enabled' );
1034
+			give_update_option('test_mode', 'enabled');
1035 1035
 
1036 1036
 
1037 1037
 			// Enable `Test Donation` gateway.
1038 1038
 			$enabled_gateways['manual'] = "1";
1039
-			give_update_option( 'gateways', $enabled_gateways );
1039
+			give_update_option('gateways', $enabled_gateways);
1040 1040
 
1041 1041
 
1042 1042
 			// Set `Test Donation` as default gateway.
1043
-			add_option( 'give_test_mode_default_gateway', $default_gateway );
1044
-			give_update_option( 'default_gateway', 'manual' );
1043
+			add_option('give_test_mode_default_gateway', $default_gateway);
1044
+			give_update_option('default_gateway', 'manual');
1045 1045
 
1046 1046
 
1047 1047
 			// Show success message on completion.
1048
-			WP_CLI::success( 'Give Test mode enabled' );
1048
+			WP_CLI::success('Give Test mode enabled');
1049 1049
 		}
1050 1050
 
1051 1051
 		// Disable Test Mode.
1052
-		if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'disable' ) ) {
1052
+		if (true === WP_CLI\Utils\get_flag_value($assoc, 'disable')) {
1053 1053
 
1054 1054
 			// Set `Test Mode` to `disabled`.
1055
-			give_update_option( 'test_mode', 'disabled' );
1055
+			give_update_option('test_mode', 'disabled');
1056 1056
 
1057 1057
 
1058 1058
 			// Disable `Test Donation` gateway.
1059
-			unset( $enabled_gateways['manual'] );
1060
-			give_update_option( 'gateways', $enabled_gateways );
1059
+			unset($enabled_gateways['manual']);
1060
+			give_update_option('gateways', $enabled_gateways);
1061 1061
 
1062 1062
 
1063 1063
 			// Backup `Default Gateway` setting for restore on test mode disable.
1064
-			$default_gateway_backup = get_option( 'give_test_mode_default_gateway' );
1065
-			give_update_option( 'default_gateway', $default_gateway_backup );
1066
-			delete_option( 'give_test_mode_default_gateway' );
1064
+			$default_gateway_backup = get_option('give_test_mode_default_gateway');
1065
+			give_update_option('default_gateway', $default_gateway_backup);
1066
+			delete_option('give_test_mode_default_gateway');
1067 1067
 
1068 1068
 
1069 1069
 			// Show success message on completion.
1070
-			WP_CLI::success( 'Give Test mode disabled' );
1070
+			WP_CLI::success('Give Test mode disabled');
1071 1071
 		}
1072 1072
 	}
1073 1073
 }
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET )
31
-	if ( empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49 49
 
50 50
 /**
51 51
  * Hooks Give actions, when present in the $_POST super global. Every give_action
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function give_post_actions() {
60 60
 
61
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
61
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
62 62
 
63 63
 	// Add backward compatibility to give-action param ( $_POST ).
64
-	if ( empty( $_post_action ) ) {
65
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
64
+	if (empty($_post_action)) {
65
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
66 66
 	}
67 67
 
68
-	if ( isset( $_post_action ) ) {
68
+	if (isset($_post_action)) {
69 69
 		/**
70 70
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
71 71
 		 *
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @param array $_POST Array of HTTP POST variables.
75 75
 		 */
76
-		do_action( "give_{$_post_action}", $_POST );
76
+		do_action("give_{$_post_action}", $_POST);
77 77
 	}
78 78
 
79 79
 }
80 80
 
81
-add_action( 'init', 'give_post_actions' );
81
+add_action('init', 'give_post_actions');
82 82
 
83 83
 /**
84 84
  * Connect WordPress user with Donor.
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return void
92 92
  */
93
-function give_connect_donor_to_wpuser( $user_id, $user_data ) {
93
+function give_connect_donor_to_wpuser($user_id, $user_data) {
94 94
 	/* @var Give_Donor $donor */
95
-	$donor = new Give_Donor( $user_data['user_email'] );
95
+	$donor = new Give_Donor($user_data['user_email']);
96 96
 
97 97
 	// Validate donor id and check if do nor is already connect to wp user or not.
98
-	if ( $donor->id && ! $donor->user_id ) {
98
+	if ($donor->id && ! $donor->user_id) {
99 99
 
100 100
 		// Update donor user_id.
101
-		if ( $donor->update( array( 'user_id' => $user_id ) ) ) {
102
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
103
-			$donor->add_note( $donor_note );
101
+		if ($donor->update(array('user_id' => $user_id))) {
102
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
103
+			$donor->add_note($donor_note);
104 104
 
105 105
 			// Update user_id meta in payments.
106 106
 			// if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
116
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
117 117
 
118 118
 
119 119
 /**
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_validate_license_when_site_migrated() {
129 129
 	// Store current site address if not already stored.
130
-	$home_url_parts              = parse_url( home_url() );
131
-	$home_url                    = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false;
132
-	$home_url                    .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : '';
133
-	$site_address_before_migrate = get_option( 'give_site_address_before_migrate' );
130
+	$home_url_parts              = parse_url(home_url());
131
+	$home_url                    = isset($home_url_parts['host']) ? $home_url_parts['host'] : false;
132
+	$home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : '';
133
+	$site_address_before_migrate = get_option('give_site_address_before_migrate');
134 134
 
135 135
 	// Need $home_url to proceed.
136
-	if ( ! $home_url ) {
136
+	if ( ! $home_url) {
137 137
 		return;
138 138
 	}
139 139
 
140 140
 	// Save site address.
141
-	if ( ! $site_address_before_migrate ) {
141
+	if ( ! $site_address_before_migrate) {
142 142
 		// Update site address.
143
-		update_option( 'give_site_address_before_migrate', $home_url );
143
+		update_option('give_site_address_before_migrate', $home_url);
144 144
 
145 145
 		return;
146 146
 	}
147 147
 
148 148
 	// Backwards compat. for before when we were storing URL scheme.
149
-	if ( strpos( $site_address_before_migrate, 'http' ) ) {
150
-		$site_address_before_migrate = parse_url( $site_address_before_migrate );
151
-		$site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false;
149
+	if (strpos($site_address_before_migrate, 'http')) {
150
+		$site_address_before_migrate = parse_url($site_address_before_migrate);
151
+		$site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false;
152 152
 
153 153
 		// Add path for multisite installs.
154
-		$site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : '';
154
+		$site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : '';
155 155
 	}
156 156
 
157 157
 	// If the two URLs don't match run CRON.
158
-	if ( $home_url !== $site_address_before_migrate ) {
158
+	if ($home_url !== $site_address_before_migrate) {
159 159
 		// Immediately run cron.
160
-		wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' );
160
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
161 161
 
162 162
 		// Update site address.
163
-		update_option( 'give_site_address_before_migrate', $home_url );
163
+		update_option('give_site_address_before_migrate', $home_url);
164 164
 	}
165 165
 
166 166
 }
167 167
 
168
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
168
+add_action('admin_init', 'give_validate_license_when_site_migrated');
169 169
 
170 170
 
171 171
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @param $data
177 177
  */
178
-function give_donor_batch_export_complete( $data ) {
178
+function give_donor_batch_export_complete($data) {
179 179
 	// Remove donor ids cache.
180 180
 	if (
181
-		isset( $data['class'] )
181
+		isset($data['class'])
182 182
 		&& 'Give_Batch_Donors_Export' === $data['class']
183
-		&& ! empty( $data['forms'] )
184
-		&& isset( $data['give_export_option']['query_id'] )
183
+		&& ! empty($data['forms'])
184
+		&& isset($data['give_export_option']['query_id'])
185 185
 	) {
186
-		Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
186
+		Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id']));
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' );
190
+add_action('give_file_export_complete', 'give_donor_batch_export_complete');
191 191
 
192 192
 /**
193 193
  * Print css for wordpress setting pages.
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	/* @var WP_Screen $screen */
199 199
 	$screen = get_current_screen();
200 200
 
201
-	if ( ! ( $screen instanceof WP_Screen ) ) {
201
+	if ( ! ($screen instanceof WP_Screen)) {
202 202
 		return false;
203 203
 	}
204 204
 
205
-	switch ( true ) {
206
-		case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
205
+	switch (true) {
206
+		case ('plugins' === $screen->base || 'plugins-network' === $screen->base):
207 207
 			?>
208 208
 			<style>
209 209
 				tr.active.update + tr.give-addon-notice-tr td {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 }
242 242
 
243
-add_action( 'admin_head', 'give_admin_quick_css' );
243
+add_action('admin_head', 'give_admin_quick_css');
244 244
 
245 245
 
246 246
 /**
@@ -252,31 +252,31 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return void
254 254
  */
255
-function give_set_donation_levels_max_min_amount( $form_id ) {
255
+function give_set_donation_levels_max_min_amount($form_id) {
256 256
 	if (
257
-		( 'set' === $_POST['_give_price_option'] ) ||
258
-		( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) ||
259
-		! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) )
257
+		('set' === $_POST['_give_price_option']) ||
258
+		(in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) ||
259
+		! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount'))
260 260
 	) {
261 261
 		// Delete old meta.
262
-		give_delete_meta( $form_id, '_give_levels_minimum_amount' );
263
-		give_delete_meta( $form_id, '_give_levels_maximum_amount' );
262
+		give_delete_meta($form_id, '_give_levels_minimum_amount');
263
+		give_delete_meta($form_id, '_give_levels_maximum_amount');
264 264
 
265 265
 		return;
266 266
 	}
267 267
 
268 268
 	// Sanitize donation level amounts.
269
-	$donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts );
269
+	$donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts);
270 270
 
271
-	$min_amount = min( $donation_levels_amounts );
272
-	$max_amount = max( $donation_levels_amounts );
271
+	$min_amount = min($donation_levels_amounts);
272
+	$max_amount = max($donation_levels_amounts);
273 273
 
274 274
 	// Set Minimum and Maximum amount for Multi Level Donation Forms.
275
-	give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
276
-	give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 );
275
+	give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0);
276
+	give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0);
277 277
 }
278 278
 
279
-add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
279
+add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30);
280 280
 
281 281
 
282 282
 /**
@@ -286,23 +286,23 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @param int $payment_id
288 288
  */
289
-function _give_save_donor_billing_address( $payment_id ) {
290
-	$donor_id  = absint( give_get_payment_donor_id( $payment_id ));
289
+function _give_save_donor_billing_address($payment_id) {
290
+	$donor_id = absint(give_get_payment_donor_id($payment_id));
291 291
 
292 292
 	// Bailout
293
-	if ( ! $donor_id ) {
293
+	if ( ! $donor_id) {
294 294
 		return;
295 295
 	}
296 296
 
297 297
 
298 298
 	/* @var Give_Donor $donor */
299
-	$donor = new Give_Donor( $donor_id );
299
+	$donor = new Give_Donor($donor_id);
300 300
 
301 301
 	// Save address.
302
-	$donor->add_address( 'billing[]', give_get_donation_address( $payment_id ) );
302
+	$donor->add_address('billing[]', give_get_donation_address($payment_id));
303 303
 }
304 304
 
305
-add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 );
305
+add_action('give_complete_donation', '_give_save_donor_billing_address', 9999);
306 306
 
307 307
 
308 308
 /**
@@ -312,23 +312,23 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @param array $args
314 314
  */
315
-function give_update_log_form_id( $args ) {
316
-	$new_form_id = absint( $args[0] );
317
-	$payment_id  = absint( $args[1] );
318
-	$logs        = Give()->logs->get_logs( $payment_id );
315
+function give_update_log_form_id($args) {
316
+	$new_form_id = absint($args[0]);
317
+	$payment_id  = absint($args[1]);
318
+	$logs        = Give()->logs->get_logs($payment_id);
319 319
 
320 320
 	// Bailout.
321
-	if ( empty( $logs ) ) {
321
+	if (empty($logs)) {
322 322
 		return;
323 323
 	}
324 324
 
325 325
 	/* @var object $log */
326
-	foreach ( $logs as $log ) {
327
-		Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id );
326
+	foreach ($logs as $log) {
327
+		Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id);
328 328
 	}
329 329
 
330 330
 	// Delete cache.
331 331
 	Give()->logs->delete_cache();
332 332
 }
333 333
 
334
-add_action( 'give_update_log_form_id', 'give_update_log_form_id' );
335 334
\ No newline at end of file
335
+add_action('give_update_log_form_id', 'give_update_log_form_id');
336 336
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-translation.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return static
56 56
 	 */
57 57
 	public static function get_instance() {
58
-		if ( null === static::$instance ) {
58
+		if (null === static::$instance) {
59 59
 			self::$instance = new static();
60 60
 		}
61 61
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @access public
80 80
 	 */
81 81
 	public function setup_hooks() {
82
-		add_action( 'init', array( $this, 'load_translated_texts' ), 999 );
82
+		add_action('init', array($this, 'load_translated_texts'), 999);
83 83
 	}
84 84
 
85 85
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return bool|WP_Error false on success otherwise WP_Error object
112 112
 	 */
113
-	public static function add_text( $args = array() ) {
113
+	public static function add_text($args = array()) {
114 114
 		$error = false;
115 115
 
116 116
 		// Set text params.
@@ -126,43 +126,43 @@  discard block
 block discarded – undo
126 126
 
127 127
 		try {
128 128
 			// Check for errors.
129
-			if ( empty( $args['text'] ) ) {
129
+			if (empty($args['text'])) {
130 130
 				/* @var WP_Error $error */
131
-				$error = new WP_Error( 'EMPTY_TEXT', __( 'Empty string is not allowed.', 'give' ), $args );
132
-				throw new Exception( $error->get_error_message( 'EMPTY_TEXT' ) );
131
+				$error = new WP_Error('EMPTY_TEXT', __('Empty string is not allowed.', 'give'), $args);
132
+				throw new Exception($error->get_error_message('EMPTY_TEXT'));
133 133
 
134
-			} elseif ( empty( $args['id'] ) ) {
134
+			} elseif (empty($args['id'])) {
135 135
 				/* @var WP_Error $error */
136
-				$error = new WP_Error( 'EMPTY_ID', __( 'Empty ID is not allowed.', 'give' ), $args );
137
-				throw new Exception( $error->get_error_message( 'EMPTY_ID' ) );
136
+				$error = new WP_Error('EMPTY_ID', __('Empty ID is not allowed.', 'give'), $args);
137
+				throw new Exception($error->get_error_message('EMPTY_ID'));
138 138
 
139 139
 			} elseif (
140
-				empty( $args['group'] ) &&
141
-				array_key_exists( $args['id'], self::$text_configs )
140
+				empty($args['group']) &&
141
+				array_key_exists($args['id'], self::$text_configs)
142 142
 			) {
143 143
 				/* @var WP_Error $error */
144
-				$error = new WP_Error( 'TEXT_ID_ALREADY_EXIST', __( 'Text ID without a group already exists.', 'give' ), $args );
145
-				throw new Exception( $error->get_error_message( 'TEXT_ID_ALREADY_EXIST' ) );
144
+				$error = new WP_Error('TEXT_ID_ALREADY_EXIST', __('Text ID without a group already exists.', 'give'), $args);
145
+				throw new Exception($error->get_error_message('TEXT_ID_ALREADY_EXIST'));
146 146
 
147 147
 			} elseif (
148
-				! empty( $args['group'] ) &&
149
-				! empty( self::$text_configs[ $args['group'] ] ) &&
150
-				array_key_exists( $args['id'], self::$text_configs[ $args['group'] ] )
148
+				! empty($args['group']) &&
149
+				! empty(self::$text_configs[$args['group']]) &&
150
+				array_key_exists($args['id'], self::$text_configs[$args['group']])
151 151
 			) {
152 152
 				/* @var WP_Error $error */
153
-				$error = new WP_Error( 'TEXT_ID_WITHIN_GROUP_ALREADY_EXIST', __( 'Text ID within a group already exists.', 'give' ), $args );
154
-				throw new Exception( $error->get_error_message( 'TEXT_ID_WITHIN_GROUP_ALREADY_EXIST' ) );
153
+				$error = new WP_Error('TEXT_ID_WITHIN_GROUP_ALREADY_EXIST', __('Text ID within a group already exists.', 'give'), $args);
154
+				throw new Exception($error->get_error_message('TEXT_ID_WITHIN_GROUP_ALREADY_EXIST'));
155 155
 
156 156
 			}
157 157
 
158 158
 			// Add text.
159
-			if ( ! empty( $args['group'] ) ) {
160
-				self::$text_configs[ $args['group'] ][ $args['id'] ] = $args;
159
+			if ( ! empty($args['group'])) {
160
+				self::$text_configs[$args['group']][$args['id']] = $args;
161 161
 			} else {
162
-				self::$text_configs[ $args['id'] ] = $args;
162
+				self::$text_configs[$args['id']] = $args;
163 163
 			}
164
-		} catch ( Exception $e ) {
165
-			error_log( $e->getMessage() );
164
+		} catch (Exception $e) {
165
+			error_log($e->getMessage());
166 166
 		}// End try().
167 167
 
168 168
 		/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 *
171 171
 		 * @since 2.0
172 172
 		 */
173
-		self::$text_configs = apply_filters( 'give_texts', self::$text_configs );
173
+		self::$text_configs = apply_filters('give_texts', self::$text_configs);
174 174
 
175 175
 		return $error;
176 176
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	public static function add_label( $args = array() ) {
188
+	public static function add_label($args = array()) {
189 189
 		// Set text params.
190 190
 		$args = wp_parse_args(
191 191
 			$args,
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		$args['type'] = 'label';
200 200
 		$args['id']   = "{$args['id']}_label";
201 201
 
202
-		return self::add_text( $args );
202
+		return self::add_text($args);
203 203
 	}
204 204
 
205 205
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return string
214 214
 	 */
215
-	public static function add_tooltip( $args = array() ) {
215
+	public static function add_tooltip($args = array()) {
216 216
 		// Set text params.
217 217
 		$args = wp_parse_args(
218 218
 			$args,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		$args['type'] = 'tooltip';
227 227
 		$args['id']   = "{$args['id']}_tooltip";
228 228
 
229
-		return self::add_text( $args );
229
+		return self::add_text($args);
230 230
 	}
231 231
 
232 232
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string
241 241
 	 */
242
-	public static function add_translation( $args = array() ) {
242
+	public static function add_translation($args = array()) {
243 243
 		$args = wp_parse_args(
244 244
 			$args,
245 245
 			array(
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		);
251 251
 
252 252
 		// Bailout.
253
-		if ( empty( $args['id'] ) ) {
253
+		if (empty($args['id'])) {
254 254
 			return;
255 255
 		}
256 256
 
257
-		if ( ! empty( $args['group'] ) ) {
258
-			self::$text_translations[ $args['group'] ][ $args['id'] ] = $args['text'];
257
+		if ( ! empty($args['group'])) {
258
+			self::$text_translations[$args['group']][$args['id']] = $args['text'];
259 259
 		} else {
260
-			self::$text_translations[ $args['id'] ] = $args['text'];
260
+			self::$text_translations[$args['id']] = $args['text'];
261 261
 		}
262 262
 	}
263 263
 
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return string
275 275
 	 */
276
-	public static function add_label_translation( $id, $group = '', $text = '' ) {
277
-		return self::get_text( array(
276
+	public static function add_label_translation($id, $group = '', $text = '') {
277
+		return self::get_text(array(
278 278
 			'id' => "{$id}_label",
279 279
 			'group' => $group,
280 280
 			'text' => $text,
281
-		) );
281
+		));
282 282
 	}
283 283
 
284 284
 	/**
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return string
295 295
 	 */
296
-	public static function add_tooltip_translation( $id, $group = '', $text = '' ) {
297
-		return self::get_text( array(
296
+	public static function add_tooltip_translation($id, $group = '', $text = '') {
297
+		return self::get_text(array(
298 298
 			'id' => "{$id}_label",
299 299
 			'group' => $group,
300 300
 			'text' => $text,
301
-		) );
301
+		));
302 302
 	}
303 303
 
304 304
 	/**
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return string
314 314
 	 */
315
-	public static function get_label( $id, $group = '' ) {
316
-		return self::get_text( array(
315
+	public static function get_label($id, $group = '') {
316
+		return self::get_text(array(
317 317
 			'id' => "{$id}_label",
318 318
 			'group' => $group,
319 319
 			'type' => 'label',
320
-		) );
320
+		));
321 321
 	}
322 322
 
323 323
 	/**
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return string
333 333
 	 */
334
-	public static function get_tooltip( $id, $group = '' ) {
335
-		return self::get_text( array(
334
+	public static function get_tooltip($id, $group = '') {
335
+		return self::get_text(array(
336 336
 			'id' => "{$id}_tooltip",
337 337
 			'group' => $group,
338 338
 			'type' => 'tooltip',
339
-		) );
339
+		));
340 340
 	}
341 341
 
342 342
 	/**
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 	 *
350 350
 	 * @return string
351 351
 	 */
352
-	public static function get_text( $args = array() ) {
352
+	public static function get_text($args = array()) {
353 353
 		$text = '';
354 354
 
355 355
 		// Bailout.
356
-		if ( empty( $args ) ) {
356
+		if (empty($args)) {
357 357
 			return $text;
358 358
 		}
359 359
 
@@ -369,40 +369,40 @@  discard block
 block discarded – undo
369 369
 
370 370
 		// Check if text exist.
371 371
 		if (
372
-			empty( $args['id'] ) ||
373
-			( empty( $args['group'] ) && ! array_key_exists( $args['id'], self::$text_configs ) ) ||
374
-			( ! empty( $args['group'] ) && ! empty( self::$text_configs[ $args['group'] ] ) && ! array_key_exists( $args['id'], self::$text_configs[ $args['group'] ] ) )
372
+			empty($args['id']) ||
373
+			(empty($args['group']) && ! array_key_exists($args['id'], self::$text_configs)) ||
374
+			( ! empty($args['group']) && ! empty(self::$text_configs[$args['group']]) && ! array_key_exists($args['id'], self::$text_configs[$args['group']]))
375 375
 		) {
376 376
 			return $text;
377 377
 		}
378 378
 
379 379
 		// Get text value.
380 380
 		if (
381
-			! empty( $args['group'] ) &&
382
-			array_key_exists( $args['group'], self::$text_configs )
381
+			! empty($args['group']) &&
382
+			array_key_exists($args['group'], self::$text_configs)
383 383
 		) {
384
-			$text = self::$text_configs[ $args['group'] ][ $args['id'] ]['text'];
384
+			$text = self::$text_configs[$args['group']][$args['id']]['text'];
385 385
 
386 386
 			// Get translated text if exist.
387 387
 			if (
388
-				! empty( self::$text_translations ) &&
389
-				! empty( self::$text_translations[ $args['group'] ] ) &&
390
-				array_key_exists( $args['id'], self::$text_translations[ $args['group'] ] )
388
+				! empty(self::$text_translations) &&
389
+				! empty(self::$text_translations[$args['group']]) &&
390
+				array_key_exists($args['id'], self::$text_translations[$args['group']])
391 391
 			) {
392
-				$text = self::$text_translations[ $args['group'] ][ $args['id'] ];
392
+				$text = self::$text_translations[$args['group']][$args['id']];
393 393
 			}
394 394
 		} elseif (
395
-			empty( $args['group'] ) &&
396
-			array_key_exists( $args['id'], self::$text_configs )
395
+			empty($args['group']) &&
396
+			array_key_exists($args['id'], self::$text_configs)
397 397
 		) {
398
-			$text = self::$text_configs[ $args['id'] ]['text'];
398
+			$text = self::$text_configs[$args['id']]['text'];
399 399
 
400 400
 			// Get translated text if exist.
401 401
 			if (
402
-				! empty( self::$text_translations ) &&
403
-				array_key_exists( $args['id'], self::$text_translations )
402
+				! empty(self::$text_translations) &&
403
+				array_key_exists($args['id'], self::$text_translations)
404 404
 			) {
405
-				$text = self::$text_translations[ $args['id'] ];
405
+				$text = self::$text_translations[$args['id']];
406 406
 			}
407 407
 		}
408 408
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		 *
412 412
 		 * @since 2.0
413 413
 		 */
414
-		$text = apply_filters( 'give_text', $text, $args, self::$text_configs, self::$text_translations );
414
+		$text = apply_filters('give_text', $text, $args, self::$text_configs, self::$text_translations);
415 415
 
416 416
 		return $text;
417 417
 	}
Please login to merge, or discard this patch.
includes/class-give-db-sequential-ordering.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_sequential_ordering';
38
+		$this->table_name  = $wpdb->prefix.'give_sequential_ordering';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
         PRIMARY KEY  (id)
109 109
         ) {$charset_collate};";
110 110
 
111
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
112
-		dbDelta( $sql );
111
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
112
+		dbDelta($sql);
113 113
 
114
-		if ( ! empty( $payment_ID ) ) {
114
+		if ( ! empty($payment_ID)) {
115 115
 			$auto_increment = $payment_ID + 1;
116
-			$wpdb->query( "ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};" );
117
-			give_update_option( 'sequential-ordering_number', $auto_increment );
116
+			$wpdb->query("ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};");
117
+			give_update_option('sequential-ordering_number', $auto_increment);
118 118
 		} else {
119
-			give_update_option( 'sequential-ordering_number', 1 );
119
+			give_update_option('sequential-ordering_number', 1);
120 120
 		}
121 121
 
122
-		update_option( $this->table_name . '_db_version', $this->version );
122
+		update_option($this->table_name.'_db_version', $this->version);
123 123
 	}
124 124
 
125 125
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -62,51 +62,51 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return bool If the gravatar exists or not
64 64
 	 */
65
-	public function validate_gravatar( $id_or_email ) {
65
+	public function validate_gravatar($id_or_email) {
66 66
 		//id or email code borrowed from wp-includes/pluggable.php
67 67
 		$email = '';
68
-		if ( is_numeric( $id_or_email ) ) {
68
+		if (is_numeric($id_or_email)) {
69 69
 			$id   = (int) $id_or_email;
70
-			$user = get_userdata( $id );
71
-			if ( $user ) {
70
+			$user = get_userdata($id);
71
+			if ($user) {
72 72
 				$email = $user->user_email;
73 73
 			}
74
-		} elseif ( is_object( $id_or_email ) ) {
74
+		} elseif (is_object($id_or_email)) {
75 75
 			// No avatar for pingbacks or trackbacks
76
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
77
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
76
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
77
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
78 78
 				return false;
79 79
 			}
80 80
 
81
-			if ( ! empty( $id_or_email->user_id ) ) {
81
+			if ( ! empty($id_or_email->user_id)) {
82 82
 				$id   = (int) $id_or_email->user_id;
83
-				$user = get_userdata( $id );
84
-				if ( $user ) {
83
+				$user = get_userdata($id);
84
+				if ($user) {
85 85
 					$email = $user->user_email;
86 86
 				}
87
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
87
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
88 88
 				$email = $id_or_email->comment_author_email;
89 89
 			}
90 90
 		} else {
91 91
 			$email = $id_or_email;
92 92
 		}
93 93
 
94
-		$hashkey = md5( strtolower( trim( $email ) ) );
95
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
94
+		$hashkey = md5(strtolower(trim($email)));
95
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
96 96
 
97
-		$data = Give_Cache::get_group( $hashkey );
97
+		$data = Give_Cache::get_group($hashkey);
98 98
 
99
-		if ( is_null( $data ) ) {
100
-			$response = wp_remote_head( $uri );
101
-			if ( is_wp_error( $response ) ) {
99
+		if (is_null($data)) {
100
+			$response = wp_remote_head($uri);
101
+			if (is_wp_error($response)) {
102 102
 				$data = 'not200';
103 103
 			} else {
104 104
 				$data = $response['response']['code'];
105 105
 			}
106
-			Give_Cache::set_group( $hashkey, $data, $group = '', $expire = 60 * 5 );
106
+			Give_Cache::set_group($hashkey, $data, $group = '', $expire = 60 * 5);
107 107
 
108 108
 		}
109
-		if ( $data == '200' ) {
109
+		if ($data == '200') {
110 110
 			return true;
111 111
 		} else {
112 112
 			return false;
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return array        IDs if logs, false otherwise
125 125
 	 */
126
-	public function get_log_ids( $form_id = '' ) {
126
+	public function get_log_ids($form_id = '') {
127 127
 		// get log for this form
128
-		$logs = Give()->logs->get_logs( $form_id );
128
+		$logs = Give()->logs->get_logs($form_id);
129 129
 
130
-		if ( $logs ) {
130
+		if ($logs) {
131 131
 			$log_ids = array();
132 132
 
133 133
 			// make an array with all the donor IDs
134
-			foreach ( $logs as $log ) {
134
+			foreach ($logs as $log) {
135 135
 				$log_ids[] = $log->ID;
136 136
 			}
137 137
 
@@ -152,51 +152,51 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return mixed
154 154
 	 */
155
-	public function get_payment_ids( $form_id = '' ) {
155
+	public function get_payment_ids($form_id = '') {
156 156
 
157 157
 		$give_options = give_get_settings();
158 158
 
159
-		$log_ids = $this->get_log_ids( $form_id );
159
+		$log_ids = $this->get_log_ids($form_id);
160 160
 
161
-		if ( $log_ids ) {
161
+		if ($log_ids) {
162 162
 
163 163
 			$payment_ids = array();
164 164
 
165
-			foreach ( $log_ids as $id ) {
165
+			foreach ($log_ids as $id) {
166 166
 				// get the payment ID for each corresponding log ID
167
-				$payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true );
167
+				$payment_ids[] = give_get_meta($id, '_give_log_payment_id', true);
168 168
 			}
169 169
 
170 170
 			// remove donors who have donated more than once so we can have unique avatars
171 171
 			$unique_emails = array();
172 172
 
173
-			foreach ( $payment_ids as $key => $id ) {
173
+			foreach ($payment_ids as $key => $id) {
174 174
 
175
-				$email = give_get_meta( $id, '_give_payment_donor_email', true );
175
+				$email = give_get_meta($id, '_give_payment_donor_email', true);
176 176
 
177
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
178
-					if ( ! $this->validate_gravatar( $email ) ) {
177
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
178
+					if ( ! $this->validate_gravatar($email)) {
179 179
 						continue;
180 180
 					}
181 181
 				}
182 182
 
183
-				$unique_emails[ $id ] = give_get_meta( $id, '_give_payment_donor_email', true );
183
+				$unique_emails[$id] = give_get_meta($id, '_give_payment_donor_email', true);
184 184
 
185 185
 			}
186 186
 
187 187
 			$unique_ids = array();
188 188
 
189 189
 			// strip duplicate emails
190
-			$unique_emails = array_unique( $unique_emails );
190
+			$unique_emails = array_unique($unique_emails);
191 191
 
192 192
 			// convert the unique IDs back into simple array
193
-			foreach ( $unique_emails as $id => $email ) {
193
+			foreach ($unique_emails as $id => $email) {
194 194
 				$unique_ids[] = $id;
195 195
 			}
196 196
 
197 197
 			// randomize the payment IDs if enabled
198
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
199
-				shuffle( $unique_ids );
198
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
199
+				shuffle($unique_ids);
200 200
 			}
201 201
 
202 202
 			// return our unique IDs
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return string
219 219
 	 */
220
-	public function gravatars( $form_id = false, $title = '' ) {
220
+	public function gravatars($form_id = false, $title = '') {
221 221
 
222 222
 		// unique $payment_ids 
223
-		$payment_ids = $this->get_payment_ids( $form_id );
223
+		$payment_ids = $this->get_payment_ids($form_id);
224 224
 
225 225
 		$give_options = give_get_settings();
226 226
 
227 227
 		// return if no ID
228
-		if ( ! $form_id ) {
228
+		if ( ! $form_id) {
229 229
 			return;
230 230
 		}
231 231
 
232 232
 		// minimum amount of donations before showing gravatars
233 233
 		// if the number of items in array is not greater or equal to the number specified, then exit
234
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
235
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
234
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
235
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
236 236
 				return;
237 237
 			}
238 238
 		}
@@ -243,28 +243,28 @@  discard block
 block discarded – undo
243 243
 		echo '<div id="give-purchase-gravatars">';
244 244
 
245 245
 
246
-		if ( isset ( $title ) ) {
246
+		if (isset ($title)) {
247 247
 
248
-			if ( $title ) {
249
-				echo wp_kses_post( apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ) );
250
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
251
-				echo wp_kses_post( apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ) );
248
+			if ($title) {
249
+				echo wp_kses_post(apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'));
250
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
251
+				echo wp_kses_post(apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'));
252 252
 			}
253 253
 
254 254
 		}
255 255
 		echo '<ul class="give-purchase-gravatars-list">';
256 256
 		$i = 0;
257 257
 
258
-		if ( $payment_ids ) {
259
-			foreach ( $payment_ids as $id ) {
258
+		if ($payment_ids) {
259
+			foreach ($payment_ids as $id) {
260 260
 
261 261
 				// Give saves a blank option even when the control is turned off, hence the extra check
262
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
262
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
263 263
 					continue;
264 264
 				}
265 265
 
266 266
 				// get the payment meta
267
-				$payment_meta = give_get_meta( $id, '_give_payment_meta', true );
267
+				$payment_meta = give_get_meta($id, '_give_payment_meta', true);
268 268
 
269 269
 				$user_info = $payment_meta['user_info'];
270 270
 
@@ -272,30 +272,30 @@  discard block
 block discarded – undo
272 272
 				$name = $user_info['first_name'];
273 273
 
274 274
 				// get donor's email
275
-				$email = give_get_meta( $id, '_give_payment_donor_email', true );
275
+				$email = give_get_meta($id, '_give_payment_donor_email', true);
276 276
 
277 277
 				// set gravatar size and provide filter
278
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
278
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
279 279
 
280 280
 				// default image
281
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
281
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
282 282
 
283 283
 				// assemble output
284 284
 				$output .= '<li>';
285 285
 
286
-				$output .= get_avatar( $email, $size, $default_image, $name );
286
+				$output .= get_avatar($email, $size, $default_image, $name);
287 287
 				$output .= '</li>';
288 288
 
289
-				$i ++;
289
+				$i++;
290 290
 
291 291
 			} // end foreach
292 292
 		}
293 293
 
294
-		echo wp_kses_post( $output );
294
+		echo wp_kses_post($output);
295 295
 		echo '</ul>';
296 296
 		echo '</div>';
297 297
 
298
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
298
+		return apply_filters('give_donors_gravatars', ob_get_clean());
299 299
 	}
300 300
 
301 301
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return void
308 308
 	 */
309 309
 	public function register_widget() {
310
-		register_widget( 'Give_Donors_Gravatars_Widget' );
310
+		register_widget('Give_Donors_Gravatars_Widget');
311 311
 	}
312 312
 
313 313
 	/**
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return string
323 323
 	 */
324
-	public function shortcode( $atts, $content = null ) {
324
+	public function shortcode($atts, $content = null) {
325 325
 
326
-		$atts = shortcode_atts( array(
326
+		$atts = shortcode_atts(array(
327 327
 			'id'    => '',
328 328
 			'title' => ''
329
-		), $atts, 'give_donors_gravatars' );
329
+		), $atts, 'give_donors_gravatars');
330 330
 
331 331
 		// if no ID is passed on single give_forms pages, get the correct ID
332
-		if ( is_singular( 'give_forms' ) ) {
332
+		if (is_singular('give_forms')) {
333 333
 			$id = get_the_ID();
334 334
 		}
335 335
 
336
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
336
+		$content = $this->gravatars($atts['id'], $atts['title']);
337 337
 
338 338
 		return $content;
339 339
 
@@ -349,56 +349,56 @@  discard block
 block discarded – undo
349 349
 	 *
350 350
 	 * @return array           Gravatar settings.
351 351
 	 */
352
-	public function settings( $settings ) {
352
+	public function settings($settings) {
353 353
 
354 354
 		$give_gravatar_settings = array(
355 355
 			array(
356
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
356
+				'name' => esc_html__('Donator Gravatars', 'give'),
357 357
 				'desc' => '<hr>',
358 358
 				'id'   => 'give_title',
359 359
 				'type' => 'give_title'
360 360
 			),
361 361
 			array(
362
-				'name' => esc_html__( 'Heading', 'give' ),
363
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
362
+				'name' => esc_html__('Heading', 'give'),
363
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
364 364
 				'type' => 'text',
365 365
 				'id'   => 'give_donors_gravatars_heading'
366 366
 			),
367 367
 			array(
368
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
369
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
368
+				'name'    => esc_html__('Gravatar Size', 'give'),
369
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
370 370
 				'type'    => 'text_small',
371 371
 				'id'      => 'give_donors_gravatars_gravatar_size',
372 372
 				'default' => '64'
373 373
 			),
374 374
 			array(
375
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
376
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
375
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
376
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
377 377
 				'type' => 'text_small',
378 378
 				'id'   => 'give_donors_gravatars_min_purchases_required',
379 379
 			),
380 380
 			array(
381
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
382
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
381
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
382
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
383 383
 				'type'    => 'text',
384 384
 				'id'      => 'give_donors_gravatars_maximum_number',
385 385
 				'default' => '20',
386 386
 			),
387 387
 			array(
388
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
389
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
388
+				'name' => esc_html__('Gravatar Visibility', 'give'),
389
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
390 390
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
391 391
 				'type' => 'checkbox',
392 392
 			),
393 393
 			array(
394
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
395
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
394
+				'name' => esc_html__('Randomize Gravatars', 'give'),
395
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
396 396
 				'id'   => 'give_donors_gravatars_random_gravatars',
397 397
 				'type' => 'checkbox',
398 398
 			),
399 399
 		);
400 400
 
401
-		return array_merge( $settings, $give_gravatar_settings );
401
+		return array_merge($settings, $give_gravatar_settings);
402 402
 	}
403 403
 
404 404
 }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		// widget settings
425 425
 		$widget_ops = array(
426 426
 			'classname'   => 'give-donors-gravatars',
427
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
427
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
428 428
 		);
429 429
 
430 430
 		// widget control settings
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		// create the widget
438 438
 		parent::__construct(
439 439
 			'give_donors_gravatars_widget',
440
-			esc_html__( 'Give Donors Gravatars', 'give' ),
440
+			esc_html__('Give Donors Gravatars', 'give'),
441 441
 			$widget_ops,
442 442
 			$control_ops
443 443
 		);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return void
459 459
 	 */
460
-	public function widget( $args, $instance ) {
460
+	public function widget($args, $instance) {
461 461
 
462 462
 		$defaults = array(
463 463
 			'before_widget' => '',
@@ -466,14 +466,14 @@  discard block
 block discarded – undo
466 466
 			'after_title' => '',
467 467
 		);
468 468
 
469
-		$args = wp_parse_args( $args, $defaults );
469
+		$args = wp_parse_args($args, $defaults);
470 470
 
471
-		if ( ! is_singular( 'give_forms' ) ) {
471
+		if ( ! is_singular('give_forms')) {
472 472
 			return;
473 473
 		}
474 474
 
475 475
 		// Variables from widget settings
476
-		$title = apply_filters( 'widget_title', $instance['title'] );
476
+		$title = apply_filters('widget_title', $instance['title']);
477 477
 
478 478
 		$output = '';
479 479
 
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
 		$output .= $args['before_widget'];
482 482
 
483 483
 		// Display the widget title
484
-		if ( $title ) {
485
-			$output .= $args['before_title'] . $title . $args['after_title'];
484
+		if ($title) {
485
+			$output .= $args['before_title'].$title.$args['after_title'];
486 486
 		}
487 487
 
488 488
 		$gravatars = new Give_Donors_Gravatars();
489 489
 
490
-		$output .= $gravatars->gravatars( get_the_ID(), null ); // remove title
490
+		$output .= $gravatars->gravatars(get_the_ID(), null); // remove title
491 491
 
492 492
 		// Used by themes. Closes the widget
493 493
 		$output .= $args['after_widget'];
494 494
 
495
-		echo wp_kses_post( $output );
495
+		echo wp_kses_post($output);
496 496
 	}
497 497
 
498 498
 	/**
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return array Updated settings to save.
510 510
 	 */
511
-	public function update( $new_instance, $old_instance ) {
511
+	public function update($new_instance, $old_instance) {
512 512
 
513 513
 		$instance = $old_instance;
514 514
 
515
-		$instance['title'] = wp_strip_all_tags( $new_instance['title'] );
515
+		$instance['title'] = wp_strip_all_tags($new_instance['title']);
516 516
 
517 517
 		return $instance;
518 518
 
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	 *
531 531
 	 * @return void
532 532
 	 */
533
-	public function form( $instance ) {
533
+	public function form($instance) {
534 534
 
535 535
 		// Set up some default widget settings.
536 536
 		$defaults = array(
537 537
 			'title' => '',
538 538
 		);
539 539
 
540
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
540
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
541 541
 
542 542
 		<!-- Title -->
543 543
 		<p>
544
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
545
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
544
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'give') ?></label>
545
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
546 546
 		</p>
547 547
 
548 548
 		<?php
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function donations_dropdown( $args = array() ) {
38
+	public function donations_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'donations',
@@ -45,32 +45,32 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => __( 'Select a donation', 'give' ),
48
+			'placeholder' => __('Select a donation', 'give'),
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number'],
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		// Provide nice human readable options.
62
-		if ( $payments ) {
62
+		if ($payments) {
63 63
 			$options[0] = $args['placeholder'];
64
-			foreach ( $payments as $payment ) {
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = __( 'No donations found.', 'give' );
70
+			$options[0] = __('No donations found.', 'give');
71 71
 		}
72 72
 
73
-		$output = $this->select( array(
73
+		$output = $this->select(array(
74 74
 			'name'             => $args['name'],
75 75
 			'selected'         => $args['selected'],
76 76
 			'id'               => $args['id'],
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			'select_atts'      => $args['select_atts'],
83 83
 			'show_option_all'  => false,
84 84
 			'show_option_none' => false,
85
-		) );
85
+		));
86 86
 
87 87
 		return $output;
88 88
 	}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return string      Give forms dropdown.
101 101
 	 */
102
-	public function forms_dropdown( $args = array() ) {
102
+	public function forms_dropdown($args = array()) {
103 103
 
104 104
 		$defaults = array(
105 105
 			'name'        => 'forms',
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 			'selected'    => 0,
110 110
 			'chosen'      => false,
111 111
 			'number'      => 30,
112
-			'placeholder' => esc_attr__( 'All Forms', 'give' ),
112
+			'placeholder' => esc_attr__('All Forms', 'give'),
113 113
 			'data'        => array(
114 114
 				'search-type' => 'form',
115 115
 			),
116 116
 		);
117 117
 
118
-		$args = wp_parse_args( $args, $defaults );
118
+		$args = wp_parse_args($args, $defaults);
119 119
 
120 120
 		$form_args = array(
121 121
 			'post_type'      => 'give_forms',
@@ -124,34 +124,34 @@  discard block
 block discarded – undo
124 124
 			'posts_per_page' => $args['number'],
125 125
 		);
126 126
 
127
-		$cache_key   = Give_Cache::get_key( 'give_forms', $form_args, false );
127
+		$cache_key = Give_Cache::get_key('give_forms', $form_args, false);
128 128
 
129 129
 		// Get forms from cache.
130
-		$forms = Give_Cache::get_db_query( $cache_key );
130
+		$forms = Give_Cache::get_db_query($cache_key);
131 131
 
132
-		if ( is_null( $forms ) ) {
133
-			$forms = get_posts( $form_args );
134
-			Give_Cache::set_db_query( $cache_key, $forms );
132
+		if (is_null($forms)) {
133
+			$forms = get_posts($form_args);
134
+			Give_Cache::set_db_query($cache_key, $forms);
135 135
 		}
136 136
 
137 137
 		$options = array();
138 138
 
139 139
 		// Ensure the selected.
140
-		if ( false !== $args['selected'] && $args['selected'] !== 0 ) {
141
-			$options[ $args['selected'] ] = get_the_title( $args['selected'] );
140
+		if (false !== $args['selected'] && $args['selected'] !== 0) {
141
+			$options[$args['selected']] = get_the_title($args['selected']);
142 142
 		}
143 143
 
144
-		if ( $forms ) {
144
+		if ($forms) {
145 145
 			$options[0] = $args['placeholder'];
146
-			foreach ( $forms as $form ) {
147
-				$form_title                     = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
148
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
146
+			foreach ($forms as $form) {
147
+				$form_title                     = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
148
+				$options[absint($form->ID)] = esc_html($form_title);
149 149
 			}
150 150
 		} else {
151
-			$options[0] = esc_html__( 'No forms found.', 'give' );
151
+			$options[0] = esc_html__('No forms found.', 'give');
152 152
 		}
153 153
 
154
-		$output = $this->select( array(
154
+		$output = $this->select(array(
155 155
 			'name'             => $args['name'],
156 156
 			'selected'         => $args['selected'],
157 157
 			'id'               => $args['id'],
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			'show_option_all'  => false,
164 164
 			'show_option_none' => false,
165 165
 			'data'             => $args['data'],
166
-		) );
166
+		));
167 167
 
168 168
 		return $output;
169 169
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string      Donors dropdown.
182 182
 	 */
183
-	public function donor_dropdown( $args = array() ) {
183
+	public function donor_dropdown($args = array()) {
184 184
 
185 185
 		$defaults = array(
186 186
 			'name'        => 'donors',
@@ -189,57 +189,57 @@  discard block
 block discarded – undo
189 189
 			'multiple'    => false,
190 190
 			'selected'    => 0,
191 191
 			'chosen'      => true,
192
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
192
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
193 193
 			'number'      => 30,
194 194
 			'data'        => array(
195 195
 				'search-type' => 'donor',
196 196
 			),
197 197
 		);
198 198
 
199
-		$args = wp_parse_args( $args, $defaults );
199
+		$args = wp_parse_args($args, $defaults);
200 200
 
201
-		$donors = Give()->donors->get_donors( array(
201
+		$donors = Give()->donors->get_donors(array(
202 202
 			'number' => $args['number']
203
-		) );
203
+		));
204 204
 
205 205
 		$options = array();
206 206
 
207
-		if ( $donors ) {
208
-			$options[0] = esc_html__( 'No donor attached', 'give' );
209
-			foreach ( $donors as $donor ) {
210
-				$options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
207
+		if ($donors) {
208
+			$options[0] = esc_html__('No donor attached', 'give');
209
+			foreach ($donors as $donor) {
210
+				$options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')');
211 211
 			}
212 212
 		} else {
213
-			$options[0] = esc_html__( 'No donors found.', 'give' );
213
+			$options[0] = esc_html__('No donors found.', 'give');
214 214
 		}
215 215
 
216
-		if ( ! empty( $args['selected'] ) ) {
216
+		if ( ! empty($args['selected'])) {
217 217
 
218 218
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
219
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
219
+			if ( ! array_key_exists($args['selected'], $options)) {
220 220
 
221
-				$donor = new Give_Donor( $args['selected'] );
221
+				$donor = new Give_Donor($args['selected']);
222 222
 
223
-				if ( $donor ) {
223
+				if ($donor) {
224 224
 
225
-					$options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' );
225
+					$options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')');
226 226
 
227 227
 				}
228 228
 			}
229 229
 		}
230 230
 
231
-		$output = $this->select( array(
231
+		$output = $this->select(array(
232 232
 			'name'             => $args['name'],
233 233
 			'selected'         => $args['selected'],
234 234
 			'id'               => $args['id'],
235
-			'class'            => $args['class'] . ' give-customer-select',
235
+			'class'            => $args['class'].' give-customer-select',
236 236
 			'options'          => $options,
237 237
 			'multiple'         => $args['multiple'],
238 238
 			'chosen'           => $args['chosen'],
239 239
 			'show_option_all'  => false,
240 240
 			'show_option_none' => false,
241 241
 			'data'             => $args['data'],
242
-		) );
242
+		));
243 243
 
244 244
 		return $output;
245 245
 	}
@@ -258,22 +258,22 @@  discard block
 block discarded – undo
258 258
 	 *
259 259
 	 * @return string           Categories dropdown.
260 260
 	 */
261
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
262
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
261
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
262
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
263 263
 
264 264
 		$options = array();
265 265
 
266
-		foreach ( $categories as $category ) {
267
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
266
+		foreach ($categories as $category) {
267
+			$options[absint($category->term_id)] = esc_html($category->name);
268 268
 		}
269 269
 
270
-		$output = $this->select( wp_parse_args( $args, array(
270
+		$output = $this->select(wp_parse_args($args, array(
271 271
 			'name'             => $name,
272 272
 			'selected'         => $selected,
273 273
 			'options'          => $options,
274
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
274
+			'show_option_all'  => esc_html__('All Categories', 'give'),
275 275
 			'show_option_none' => false,
276
-		) ) );
276
+		)));
277 277
 
278 278
 		return $output;
279 279
 	}
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @return string           Tags dropdown.
294 294
 	 */
295
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
296
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
295
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
296
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
297 297
 
298 298
 		$options = array();
299 299
 
300
-		foreach ( $tags as $tag ) {
301
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
300
+		foreach ($tags as $tag) {
301
+			$options[absint($tag->term_id)] = esc_html($tag->name);
302 302
 		}
303 303
 
304
-		$output = $this->select( wp_parse_args( $args, array(
304
+		$output = $this->select(wp_parse_args($args, array(
305 305
 			'name'             => $name,
306 306
 			'selected'         => $selected,
307 307
 			'options'          => $options,
308
-			'show_option_all'  => esc_html__( 'All Tags', 'give' ),
308
+			'show_option_all'  => esc_html__('All Tags', 'give'),
309 309
 			'show_option_none' => false,
310
-		) ) );
310
+		)));
311 311
 
312 312
 		return $output;
313 313
 	}
@@ -327,25 +327,25 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return string               Years dropdown.
329 329
 	 */
330
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
331
-		$current    = date( 'Y' );
332
-		$start_year = $current - absint( $years_before );
333
-		$end_year   = $current + absint( $years_after );
334
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
330
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
331
+		$current    = date('Y');
332
+		$start_year = $current - absint($years_before);
333
+		$end_year   = $current + absint($years_after);
334
+		$selected   = empty($selected) ? date('Y') : $selected;
335 335
 		$options    = array();
336 336
 
337
-		while ( $start_year <= $end_year ) {
338
-			$options[ absint( $start_year ) ] = $start_year;
339
-			$start_year ++;
337
+		while ($start_year <= $end_year) {
338
+			$options[absint($start_year)] = $start_year;
339
+			$start_year++;
340 340
 		}
341 341
 
342
-		$output = $this->select( array(
342
+		$output = $this->select(array(
343 343
 			'name'             => $name,
344 344
 			'selected'         => $selected,
345 345
 			'options'          => $options,
346 346
 			'show_option_all'  => false,
347 347
 			'show_option_none' => false,
348
-		) );
348
+		));
349 349
 
350 350
 		return $output;
351 351
 	}
@@ -363,23 +363,23 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @return string           Months dropdown.
365 365
 	 */
366
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
366
+	public function month_dropdown($name = 'month', $selected = 0) {
367 367
 		$month    = 1;
368 368
 		$options  = array();
369
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
369
+		$selected = empty($selected) ? date('n') : $selected;
370 370
 
371
-		while ( $month <= 12 ) {
372
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
373
-			$month ++;
371
+		while ($month <= 12) {
372
+			$options[absint($month)] = give_month_num_to_name($month);
373
+			$month++;
374 374
 		}
375 375
 
376
-		$output = $this->select( array(
376
+		$output = $this->select(array(
377 377
 			'name'             => $name,
378 378
 			'selected'         => $selected,
379 379
 			'options'          => $options,
380 380
 			'show_option_all'  => false,
381 381
 			'show_option_none' => false,
382
-		) );
382
+		));
383 383
 
384 384
 		return $output;
385 385
 	}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string      The dropdown.
398 398
 	 */
399
-	public function select( $args = array() ) {
399
+	public function select($args = array()) {
400 400
 		$defaults = array(
401 401
 			'options'          => array(),
402 402
 			'name'             => null,
@@ -407,74 +407,74 @@  discard block
 block discarded – undo
407 407
 			'placeholder'      => null,
408 408
 			'multiple'         => false,
409 409
 			'select_atts'      => false,
410
-			'show_option_all'  => __( 'All', 'give' ),
411
-			'show_option_none' => __( 'None', 'give' ),
410
+			'show_option_all'  => __('All', 'give'),
411
+			'show_option_none' => __('None', 'give'),
412 412
 			'data'             => array(),
413 413
 			'readonly'         => false,
414 414
 			'disabled'         => false,
415 415
 		);
416 416
 
417
-		$args = wp_parse_args( $args, $defaults );
417
+		$args = wp_parse_args($args, $defaults);
418 418
 
419 419
 		$data_elements = '';
420
-		foreach ( $args['data'] as $key => $value ) {
421
-			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
420
+		foreach ($args['data'] as $key => $value) {
421
+			$data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"';
422 422
 		}
423 423
 
424 424
 		$multiple = '';
425
-		if ( $args['multiple'] ) {
425
+		if ($args['multiple']) {
426 426
 			$multiple = 'MULTIPLE';
427 427
 		}
428 428
 
429
-		if ( $args['chosen'] ) {
429
+		if ($args['chosen']) {
430 430
 			$args['class'] .= ' give-select-chosen';
431 431
 		}
432 432
 
433 433
 		$placeholder = '';
434
-		if ( $args['placeholder'] ) {
434
+		if ($args['placeholder']) {
435 435
 			$placeholder = $args['placeholder'];
436 436
 		}
437 437
 
438 438
 		$output = sprintf(
439 439
 			'<select name="%1$s" id="%2$s" class="give-select %3$s" %4$s %5$s placeholder="%6$s" data-placeholder="%6$s" %7$s>',
440
-			esc_attr( $args['name'] ),
441
-			esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ),
442
-			esc_attr( $args['class'] ),
440
+			esc_attr($args['name']),
441
+			esc_attr(sanitize_key(str_replace('-', '_', $args['id']))),
442
+			esc_attr($args['class']),
443 443
 			$multiple,
444 444
 			$args['select_atts'],
445 445
 			$placeholder,
446 446
 			$data_elements
447 447
 		);
448 448
 
449
-		if ( $args['show_option_all'] ) {
450
-			if ( $args['multiple'] ) {
451
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
449
+		if ($args['show_option_all']) {
450
+			if ($args['multiple']) {
451
+				$selected = selected(true, in_array(0, $args['selected']), false);
452 452
 			} else {
453
-				$selected = selected( $args['selected'], 0, false );
453
+				$selected = selected($args['selected'], 0, false);
454 454
 			}
455
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
455
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
456 456
 		}
457 457
 
458
-		if ( ! empty( $args['options'] ) ) {
458
+		if ( ! empty($args['options'])) {
459 459
 
460
-			if ( $args['show_option_none'] ) {
461
-				if ( $args['multiple'] ) {
462
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
460
+			if ($args['show_option_none']) {
461
+				if ($args['multiple']) {
462
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
463 463
 				} else {
464
-					$selected = selected( $args['selected'], - 1, false );
464
+					$selected = selected($args['selected'], - 1, false);
465 465
 				}
466
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
466
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
467 467
 			}
468 468
 
469
-			foreach ( $args['options'] as $key => $option ) {
469
+			foreach ($args['options'] as $key => $option) {
470 470
 
471
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
472
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
471
+				if ($args['multiple'] && is_array($args['selected'])) {
472
+					$selected = selected(true, in_array($key, $args['selected']), false);
473 473
 				} else {
474
-					$selected = selected( $args['selected'], $key, false );
474
+					$selected = selected($args['selected'], $key, false);
475 475
 				}
476 476
 
477
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
477
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
478 478
 			}
479 479
 		}
480 480
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @return string      The checkbox.
497 497
 	 */
498
-	public function checkbox( $args = array() ) {
498
+	public function checkbox($args = array()) {
499 499
 		$defaults = array(
500 500
 			'name'    => null,
501 501
 			'current' => null,
@@ -506,16 +506,16 @@  discard block
 block discarded – undo
506 506
 			),
507 507
 		);
508 508
 
509
-		$args = wp_parse_args( $args, $defaults );
509
+		$args = wp_parse_args($args, $defaults);
510 510
 
511 511
 		$options = '';
512
-		if ( ! empty( $args['options']['disabled'] ) ) {
512
+		if ( ! empty($args['options']['disabled'])) {
513 513
 			$options .= ' disabled="disabled"';
514
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
514
+		} elseif ( ! empty($args['options']['readonly'])) {
515 515
 			$options .= ' readonly';
516 516
 		}
517 517
 
518
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
518
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
519 519
 
520 520
 		return $output;
521 521
 	}
@@ -532,22 +532,22 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return string      The text field.
534 534
 	 */
535
-	public function text( $args = array() ) {
535
+	public function text($args = array()) {
536 536
 		// Backwards compatibility.
537
-		if ( func_num_args() > 1 ) {
537
+		if (func_num_args() > 1) {
538 538
 			$args = func_get_args();
539 539
 
540 540
 			$name  = $args[0];
541
-			$value = isset( $args[1] ) ? $args[1] : '';
542
-			$label = isset( $args[2] ) ? $args[2] : '';
543
-			$desc  = isset( $args[3] ) ? $args[3] : '';
541
+			$value = isset($args[1]) ? $args[1] : '';
542
+			$label = isset($args[2]) ? $args[2] : '';
543
+			$desc  = isset($args[3]) ? $args[3] : '';
544 544
 		}
545 545
 
546 546
 		$defaults = array(
547
-			'name'         => isset( $name ) ? $name : 'text',
548
-			'value'        => isset( $value ) ? $value : null,
549
-			'label'        => isset( $label ) ? $label : null,
550
-			'desc'         => isset( $desc ) ? $desc : null,
547
+			'name'         => isset($name) ? $name : 'text',
548
+			'value'        => isset($value) ? $value : null,
549
+			'label'        => isset($label) ? $label : null,
550
+			'desc'         => isset($desc) ? $desc : null,
551 551
 			'placeholder'  => '',
552 552
 			'class'        => 'regular-text',
553 553
 			'disabled'     => false,
@@ -555,29 +555,29 @@  discard block
 block discarded – undo
555 555
 			'data'         => false,
556 556
 		);
557 557
 
558
-		$args = wp_parse_args( $args, $defaults );
558
+		$args = wp_parse_args($args, $defaults);
559 559
 
560 560
 		$disabled = '';
561
-		if ( $args['disabled'] ) {
561
+		if ($args['disabled']) {
562 562
 			$disabled = ' disabled="disabled"';
563 563
 		}
564 564
 
565 565
 		$data = '';
566
-		if ( ! empty( $args['data'] ) ) {
567
-			foreach ( $args['data'] as $key => $value ) {
568
-				$data .= 'data-' . $key . '="' . $value . '" ';
566
+		if ( ! empty($args['data'])) {
567
+			foreach ($args['data'] as $key => $value) {
568
+				$data .= 'data-'.$key.'="'.$value.'" ';
569 569
 			}
570 570
 		}
571 571
 
572
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
572
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
573 573
 
574
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
574
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
575 575
 
576
-		if ( ! empty( $args['desc'] ) ) {
577
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
576
+		if ( ! empty($args['desc'])) {
577
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
578 578
 		}
579 579
 
580
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
580
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
581 581
 
582 582
 		$output .= '</span>';
583 583
 
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @return string      The date picker.
598 598
 	 */
599
-	public function date_field( $args = array() ) {
599
+	public function date_field($args = array()) {
600 600
 
601
-		if ( empty( $args['class'] ) ) {
601
+		if (empty($args['class'])) {
602 602
 			$args['class'] = 'give_datepicker';
603
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
603
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
604 604
 			$args['class'] .= ' give_datepicker';
605 605
 		}
606 606
 
607
-		return $this->text( $args );
607
+		return $this->text($args);
608 608
 	}
609 609
 
610 610
 	/**
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 * @return string      The textarea.
621 621
 	 */
622
-	public function textarea( $args = array() ) {
622
+	public function textarea($args = array()) {
623 623
 		$defaults = array(
624 624
 			'name'     => 'textarea',
625 625
 			'value'    => null,
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
 			'disabled' => false,
630 630
 		);
631 631
 
632
-		$args = wp_parse_args( $args, $defaults );
632
+		$args = wp_parse_args($args, $defaults);
633 633
 
634 634
 		$disabled = '';
635
-		if ( $args['disabled'] ) {
635
+		if ($args['disabled']) {
636 636
 			$disabled = ' disabled="disabled"';
637 637
 		}
638 638
 
639
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
639
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
640 640
 
641
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
641
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
642 642
 
643
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
643
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
644 644
 
645
-		if ( ! empty( $args['desc'] ) ) {
646
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
645
+		if ( ! empty($args['desc'])) {
646
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
647 647
 		}
648 648
 
649 649
 		$output .= '</span>';
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 *
664 664
 	 * @return string      The text field with ajax search.
665 665
 	 */
666
-	public function ajax_user_search( $args = array() ) {
666
+	public function ajax_user_search($args = array()) {
667 667
 
668 668
 		$defaults = array(
669 669
 			'name'        => 'users',
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
 			'chosen'      => true,
675 675
 			'number'      => 30,
676 676
 			'select_atts' => '',
677
-			'placeholder' => __( 'Select a user', 'give' ),
677
+			'placeholder' => __('Select a user', 'give'),
678 678
 			'data'        => array(
679 679
 				'search-type' => 'user',
680 680
 			),
681 681
 		);
682 682
 
683
-		$args = wp_parse_args( $args, $defaults );
683
+		$args = wp_parse_args($args, $defaults);
684 684
 
685 685
 		// Set initial args.
686 686
 		$get_users_args = array(
@@ -689,31 +689,31 @@  discard block
 block discarded – undo
689 689
 
690 690
 		// Ensure selected user is not included in initial query.
691 691
 		// This is because sites with many users, it's not a guarantee the selected user will be returned.
692
-		if ( ! empty( $args['selected'] ) ) {
692
+		if ( ! empty($args['selected'])) {
693 693
 			$get_users_args['exclude'] = $args['selected'];
694 694
 		}
695 695
 
696 696
 		// Initial users array.
697
-		$users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args );
697
+		$users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args);
698 698
 
699 699
 		// Now add the selected user to the $users array if the arg is present.
700
-		if ( ! empty( $args['selected'] ) ) {
701
-			$selected_user =  apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );;
702
-			$users         = array_merge( $users, $selected_user );
700
+		if ( ! empty($args['selected'])) {
701
+			$selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ;
702
+			$users         = array_merge($users, $selected_user);
703 703
 		}
704 704
 
705 705
 		$options = array();
706 706
 
707
-		if ( $users ) {
707
+		if ($users) {
708 708
 			$options[0] = $args['placeholder'];
709
-			foreach ( $users as $user ) {
710
-				$options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' );
709
+			foreach ($users as $user) {
710
+				$options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')');
711 711
 			}
712 712
 		} else {
713
-			$options[0] = __( 'No users found.', 'give' );
713
+			$options[0] = __('No users found.', 'give');
714 714
 		}
715 715
 
716
-		$output = $this->select( array(
716
+		$output = $this->select(array(
717 717
 			'name'             => $args['name'],
718 718
 			'selected'         => $args['selected'],
719 719
 			'id'               => $args['id'],
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			'show_option_all'  => false,
727 727
 			'show_option_none' => false,
728 728
 			'data'             => $args['data'],
729
-		) );
729
+		));
730 730
 
731 731
 		return $output;
732 732
 
Please login to merge, or discard this patch.