Test Failed
Pull Request — master (#2029)
by
unknown
04:38
created
includes/user-functions.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,54 +30,54 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|array List of all user donations.
32 32
  */
33
-function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 	$paged = 1;
45 45
 
46
-	if ( $pagination ) {
47
-		if ( get_query_var( 'paged' ) ) {
48
-			$paged = get_query_var( 'paged' );
49
-		} elseif ( get_query_var( 'page' ) ) {
50
-			$paged = get_query_var( 'page' );
46
+	if ($pagination) {
47
+		if (get_query_var('paged')) {
48
+			$paged = get_query_var('paged');
49
+		} elseif (get_query_var('page')) {
50
+			$paged = get_query_var('page');
51 51
 		}
52 52
 	}
53 53
 
54
-	$args = apply_filters( 'give_get_users_donations_args', array(
54
+	$args = apply_filters('give_get_users_donations_args', array(
55 55
 		'user'    => $user,
56 56
 		'number'  => $number,
57 57
 		'status'  => $status,
58 58
 		'orderby' => 'date',
59
-	) );
59
+	));
60 60
 
61
-	if ( $pagination ) {
61
+	if ($pagination) {
62 62
 		$args['page'] = $paged;
63 63
 	} else {
64 64
 		$args['nopaging'] = true;
65 65
 	}
66 66
 
67
-	$by_user_id = is_numeric( $user ) ? true : false;
68
-	$donor   = new Give_Donor( $user, $by_user_id );
67
+	$by_user_id = is_numeric($user) ? true : false;
68
+	$donor = new Give_Donor($user, $by_user_id);
69 69
 
70
-	if ( ! empty( $donor->payment_ids ) ) {
70
+	if ( ! empty($donor->payment_ids)) {
71 71
 
72
-		unset( $args['user'] );
73
-		$args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) );
72
+		unset($args['user']);
73
+		$args['post__in'] = array_map('absint', explode(',', $donor->payment_ids));
74 74
 
75 75
 	}
76 76
 
77
-	$donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) );
77
+	$donations = give_get_payments(apply_filters('give_get_users_donations_args', $args));
78 78
 
79 79
 	// No donations
80
-	if ( ! $donations ) {
80
+	if ( ! $donations) {
81 81
 		return false;
82 82
 	}
83 83
 
@@ -96,65 +96,65 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @return bool|object List of unique forms donated by user
98 98
  */
99
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
100
-	if ( empty( $user ) ) {
99
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
100
+	if (empty($user)) {
101 101
 		$user = get_current_user_id();
102 102
 	}
103 103
 
104
-	if ( empty( $user ) ) {
104
+	if (empty($user)) {
105 105
 		return false;
106 106
 	}
107 107
 
108
-	$by_user_id = is_numeric( $user ) ? true : false;
108
+	$by_user_id = is_numeric($user) ? true : false;
109 109
 
110
-	$donor = new Give_Donor( $user, $by_user_id );
110
+	$donor = new Give_Donor($user, $by_user_id);
111 111
 
112
-	if ( empty( $donor->payment_ids ) ) {
112
+	if (empty($donor->payment_ids)) {
113 113
 		return false;
114 114
 	}
115 115
 
116 116
 	// Get all the items donated.
117
-	$payment_ids    = array_reverse( explode( ',', $donor->payment_ids ) );
118
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
119
-	if ( ! empty( $limit_payments ) ) {
120
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
117
+	$payment_ids    = array_reverse(explode(',', $donor->payment_ids));
118
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
119
+	if ( ! empty($limit_payments)) {
120
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
121 121
 	}
122 122
 	$donation_data = array();
123
-	foreach ( $payment_ids as $payment_id ) {
124
-		$donation_data[] = give_get_payment_meta( $payment_id );
123
+	foreach ($payment_ids as $payment_id) {
124
+		$donation_data[] = give_get_payment_meta($payment_id);
125 125
 	}
126 126
 
127
-	if ( empty( $donation_data ) ) {
127
+	if (empty($donation_data)) {
128 128
 		return false;
129 129
 	}
130 130
 
131 131
 	// Grab only the post ids "form_id" of the forms donated on this order
132 132
 	$completed_donations_ids = array();
133
-	foreach ( $donation_data as $donation_meta ) {
134
-		$completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : '';
133
+	foreach ($donation_data as $donation_meta) {
134
+		$completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : '';
135 135
 	}
136 136
 
137
-	if ( empty( $completed_donations_ids ) ) {
137
+	if (empty($completed_donations_ids)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	// Only include each donation once
142
-	$form_ids = array_unique( $completed_donations_ids );
142
+	$form_ids = array_unique($completed_donations_ids);
143 143
 
144 144
 	// Make sure we still have some products and a first item
145
-	if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) {
145
+	if (empty($form_ids) || ! isset($form_ids[0])) {
146 146
 		return false;
147 147
 	}
148 148
 
149
-	$post_type = get_post_type( $form_ids[0] );
149
+	$post_type = get_post_type($form_ids[0]);
150 150
 
151
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
151
+	$args = apply_filters('give_get_users_completed_donations_args', array(
152 152
 		'include'        => $form_ids,
153 153
 		'post_type'      => $post_type,
154
-		'posts_per_page' => - 1,
155
-	) );
154
+		'posts_per_page' => -1,
155
+	));
156 156
 
157
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
157
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
158 158
 }
159 159
 
160 160
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @return      bool True if has donated, false other wise.
172 172
  */
173
-function give_has_donations( $user_id = null ) {
174
-	if ( empty( $user_id ) ) {
173
+function give_has_donations($user_id = null) {
174
+	if (empty($user_id)) {
175 175
 		$user_id = get_current_user_id();
176 176
 	}
177 177
 
178
-	if ( give_get_users_donations( $user_id, 1 ) ) {
178
+	if (give_get_users_donations($user_id, 1)) {
179 179
 		return true; // User has at least one donation.
180 180
 	}
181 181
 
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return      array
198 198
  */
199
-function give_get_donation_stats_by_user( $user = '' ) {
199
+function give_get_donation_stats_by_user($user = '') {
200 200
 
201 201
 	$field = '';
202 202
 
203
-	if ( is_email( $user ) ) {
203
+	if (is_email($user)) {
204 204
 		$field = 'email';
205
-	} elseif ( is_numeric( $user ) ) {
205
+	} elseif (is_numeric($user)) {
206 206
 		$field = 'user_id';
207 207
 	}
208 208
 
209
-	$stats    = array();
210
-	$donor = Give()->donors->get_donor_by( $field, $user );
209
+	$stats = array();
210
+	$donor = Give()->donors->get_donor_by($field, $user);
211 211
 
212
-	if ( $donor ) {
213
-		$donor = new Give_Donor( $donor->id );
214
-		$stats['purchases']   = absint( $donor->purchase_count );
215
-		$stats['total_spent'] = give_maybe_sanitize_amount( $donor->purchase_value );
212
+	if ($donor) {
213
+		$donor = new Give_Donor($donor->id);
214
+		$stats['purchases']   = absint($donor->purchase_count);
215
+		$stats['total_spent'] = give_maybe_sanitize_amount($donor->purchase_value);
216 216
 	}
217 217
 
218 218
 	/**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @since 1.7
222 222
 	 */
223
-	$stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user );
223
+	$stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user);
224 224
 
225 225
 	return $stats;
226 226
 }
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
  *
239 239
  * @return      int The total number of donations.
240 240
  */
241
-function give_count_donations_of_donor( $user = null ) {
241
+function give_count_donations_of_donor($user = null) {
242 242
 
243 243
 	// Logged in?
244
-	if ( empty( $user ) ) {
244
+	if (empty($user)) {
245 245
 		$user = get_current_user_id();
246 246
 	}
247 247
 
248 248
 	// Email access?
249
-	if ( empty( $user ) && Give()->email_access->token_email ) {
249
+	if (empty($user) && Give()->email_access->token_email) {
250 250
 		$user = Give()->email_access->token_email;
251 251
 	}
252 252
 
253
-	$stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false;
253
+	$stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false;
254 254
 
255
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
255
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
256 256
 }
257 257
 
258 258
 /**
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
  *
266 266
  * @return      float The total amount the user has spent
267 267
  */
268
-function give_donation_total_of_user( $user = null ) {
268
+function give_donation_total_of_user($user = null) {
269 269
 
270
-	$stats = give_get_donation_stats_by_user( $user );
270
+	$stats = give_get_donation_stats_by_user($user);
271 271
 
272 272
 	return $stats['total_spent'];
273 273
 }
@@ -283,40 +283,40 @@  discard block
 block discarded – undo
283 283
  *
284 284
  * @return bool
285 285
  */
286
-function give_validate_username( $username, $form_id = 0 ) {
286
+function give_validate_username($username, $form_id = 0) {
287 287
 	$valid = true;
288 288
 
289 289
 	// Validate username.
290
-	if ( ! empty( $username ) ) {
290
+	if ( ! empty($username)) {
291 291
 
292 292
 		// Sanitize username.
293
-		$sanitized_user_name = sanitize_user( $username, false );
293
+		$sanitized_user_name = sanitize_user($username, false);
294 294
 
295 295
 		// We have an user name, check if it already exists.
296
-		if ( username_exists( $username ) ) {
296
+		if (username_exists($username)) {
297 297
 			// Username already registered.
298
-			give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) );
298
+			give_set_error('username_unavailable', __('Username already taken.', 'give'));
299 299
 			$valid = false;
300 300
 
301 301
 			// Check if it's valid.
302
-		} elseif ( $sanitized_user_name !== $username ) {
302
+		} elseif ($sanitized_user_name !== $username) {
303 303
 			// Invalid username.
304
-			if ( is_multisite() ) {
305
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) );
304
+			if (is_multisite()) {
305
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'));
306 306
 				$valid = false;
307 307
 			} else {
308
-				give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) );
308
+				give_set_error('username_invalid', __('Invalid username.', 'give'));
309 309
 				$valid = false;
310 310
 			}
311 311
 		}
312 312
 	} else {
313 313
 		// Username is empty.
314
-		give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) );
314
+		give_set_error('username_empty', __('Enter a username.', 'give'));
315 315
 		$valid = false;
316 316
 
317 317
 		// Check if guest checkout is disable for form.
318
-		if ( $form_id && give_logged_in_only( $form_id ) ) {
319
-			give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) );
318
+		if ($form_id && give_logged_in_only($form_id)) {
319
+			give_set_error('registration_required', __('You must register or login to complete your donation.', 'give'));
320 320
 			$valid = false;
321 321
 		}
322 322
 	}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @param string $username
331 331
 	 * @param bool   $form_id
332 332
 	 */
333
-	$valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id );
333
+	$valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id);
334 334
 
335 335
 	return $valid;
336 336
 }
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return bool
348 348
  */
349
-function give_validate_user_email( $email, $registering_new_user = false ) {
349
+function give_validate_user_email($email, $registering_new_user = false) {
350 350
 	$valid = true;
351 351
 
352
-	if ( empty( $email ) ) {
352
+	if (empty($email)) {
353 353
 		// No email.
354
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
354
+		give_set_error('email_empty', __('Enter an email.', 'give'));
355 355
 		$valid = false;
356 356
 
357
-	} elseif ( ! is_email( $email ) ) {
357
+	} elseif ( ! is_email($email)) {
358 358
 		// Validate email.
359
-		give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
359
+		give_set_error('email_invalid', __('Invalid email.', 'give'));
360 360
 		$valid = false;
361 361
 
362
-	} elseif ( $registering_new_user && ( give_donor_email_exists( $email ) || email_exists( $email ) ) ) {
362
+	} elseif ($registering_new_user && (give_donor_email_exists($email) || email_exists($email))) {
363 363
 		// Check if email exists.
364
-		give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) );
364
+		give_set_error('email_used', __('The email address provided is already active for another user.', 'give'));
365 365
 		$valid = false;
366 366
 	}
367 367
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @param string $email
375 375
 	 * @param bool   $registering_new_user
376 376
 	 */
377
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user );
377
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user);
378 378
 
379 379
 	return $valid;
380 380
 }
@@ -390,34 +390,34 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return bool
392 392
  */
393
-function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) {
393
+function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) {
394 394
 	$valid = true;
395 395
 
396 396
 	// Passwords Validation For New Donors Only
397
-	if ( $registering_new_user ) {
397
+	if ($registering_new_user) {
398 398
 		// Password or confirmation missing.
399
-		if ( ! $password ) {
399
+		if ( ! $password) {
400 400
 			// The password is invalid.
401
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
401
+			give_set_error('password_empty', __('Enter a password.', 'give'));
402 402
 			$valid = false;
403
-		} elseif ( ! $confirm_password ) {
403
+		} elseif ( ! $confirm_password) {
404 404
 			// Confirmation password is invalid.
405
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) );
405
+			give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give'));
406 406
 			$valid = false;
407 407
 		}
408 408
 	}
409 409
 	// Passwords Validation For New Donors as well as Existing Donors
410
-	if( $password || $confirm_password ) {
411
-		if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) {
410
+	if ($password || $confirm_password) {
411
+		if (strlen($password) < 6 || strlen($confirm_password) < 6) {
412 412
 			// Seems Weak Password
413
-			give_set_error( 'password_weak', __( 'Passwords should have at least 6 characters.', 'give' ) );
413
+			give_set_error('password_weak', __('Passwords should have at least 6 characters.', 'give'));
414 414
 			$valid = false;
415 415
 		}
416
-		if ( $password && $confirm_password ) {
416
+		if ($password && $confirm_password) {
417 417
 			// Verify confirmation matches.
418
-			if ( $password != $confirm_password ) {
418
+			if ($password != $confirm_password) {
419 419
 				// Passwords do not match
420
-				give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) );
420
+				give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give'));
421 421
 				$valid = false;
422 422
 			}
423 423
 		}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @param string $confirm_password
434 434
 	 * @param bool   $registering_new_user
435 435
 	 */
436
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user );
436
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user);
437 437
 
438 438
 	return $valid;
439 439
 }
@@ -451,33 +451,33 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return      void
453 453
  */
454
-function give_add_past_donations_to_new_user( $user_id ) {
454
+function give_add_past_donations_to_new_user($user_id) {
455 455
 
456
-	$email = get_the_author_meta( 'user_email', $user_id );
456
+	$email = get_the_author_meta('user_email', $user_id);
457 457
 
458
-	$payments = give_get_payments( array(
458
+	$payments = give_get_payments(array(
459 459
 		's' => $email,
460
-	) );
460
+	));
461 461
 
462
-	if ( $payments ) {
463
-		foreach ( $payments as $payment ) {
464
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
462
+	if ($payments) {
463
+		foreach ($payments as $payment) {
464
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
465 465
 				continue;
466 466
 			} // End if().
467 467
 
468
-			$meta                    = give_get_payment_meta( $payment->ID );
469
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
468
+			$meta                    = give_get_payment_meta($payment->ID);
469
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
470 470
 			$meta['user_info']['id'] = $user_id;
471 471
 
472 472
 			// Store the updated user ID in the payment meta.
473
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
474
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
473
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
474
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
475 475
 		}
476 476
 	}
477 477
 
478 478
 }
479 479
 
480
-add_action( 'user_register', 'give_add_past_donations_to_new_user' );
480
+add_action('user_register', 'give_add_past_donations_to_new_user');
481 481
 
482 482
 
483 483
 /**
@@ -503,34 +503,34 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return        array The donor's address, if any
505 505
  */
506
-function give_get_donor_address( $user_id = 0 ) {
507
-	if ( empty( $user_id ) ) {
506
+function give_get_donor_address($user_id = 0) {
507
+	if (empty($user_id)) {
508 508
 		$user_id = get_current_user_id();
509 509
 	}
510 510
 
511
-	$address = get_user_meta( $user_id, '_give_user_address', true );
511
+	$address = get_user_meta($user_id, '_give_user_address', true);
512 512
 
513
-	if ( ! isset( $address['line1'] ) ) {
513
+	if ( ! isset($address['line1'])) {
514 514
 		$address['line1'] = '';
515 515
 	}
516 516
 
517
-	if ( ! isset( $address['line2'] ) ) {
517
+	if ( ! isset($address['line2'])) {
518 518
 		$address['line2'] = '';
519 519
 	}
520 520
 
521
-	if ( ! isset( $address['city'] ) ) {
521
+	if ( ! isset($address['city'])) {
522 522
 		$address['city'] = '';
523 523
 	}
524 524
 
525
-	if ( ! isset( $address['zip'] ) ) {
525
+	if ( ! isset($address['zip'])) {
526 526
 		$address['zip'] = '';
527 527
 	}
528 528
 
529
-	if ( ! isset( $address['country'] ) ) {
529
+	if ( ! isset($address['country'])) {
530 530
 		$address['country'] = '';
531 531
 	}
532 532
 
533
-	if ( ! isset( $address['state'] ) ) {
533
+	if ( ! isset($address['state'])) {
534 534
 		$address['state'] = '';
535 535
 	}
536 536
 
@@ -550,32 +550,32 @@  discard block
 block discarded – undo
550 550
  *
551 551
  * @return        void
552 552
  */
553
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
553
+function give_new_user_notification($user_id = 0, $user_data = array()) {
554 554
 
555
-	if ( empty( $user_id ) || empty( $user_data ) ) {
555
+	if (empty($user_id) || empty($user_data)) {
556 556
 		return;
557 557
 	}
558
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
558
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
559 559
 
560 560
 
561 561
 	// New User Registration: Email sends to the site admin.
562 562
 	$emails = Give()->emails;
563
-	$emails->__set( 'heading', esc_html__( 'New User Registration', 'give' ) );
563
+	$emails->__set('heading', esc_html__('New User Registration', 'give'));
564 564
 
565 565
 	/* translators: %s: site name */
566
-	$message = sprintf( esc_attr__( 'A new user has registered on %s:', 'give' ), $blogname ) . "\r\n\r\n";
566
+	$message = sprintf(esc_attr__('A new user has registered on %s:', 'give'), $blogname)."\r\n\r\n";
567 567
 	/* translators: %s: user login */
568
-	$message .= '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' . $user_data['user_login'] . "\r\n";
568
+	$message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n";
569 569
 	/* translators: %s: user email */
570
-	$message .= '<strong>' . esc_attr__( 'E-mail:', 'give' ) . '</strong> ' . $user_data['user_email']  . "\r\n\r\n";
570
+	$message .= '<strong>'.esc_attr__('E-mail:', 'give').'</strong> '.$user_data['user_email']."\r\n\r\n";
571 571
 
572
-	$message .= '<a href="' . admin_url('user-edit.php?user_id=' . $user_id) . '" target="_blank"> ' . esc_attr__( 'Click here to view &raquo;', 'give' ) . '</a>' . "\r\n";
572
+	$message .= '<a href="'.admin_url('user-edit.php?user_id='.$user_id).'" target="_blank"> '.esc_attr__('Click here to view &raquo;', 'give').'</a>'."\r\n";
573 573
 
574 574
 	$emails->send(
575
-		get_option( 'admin_email' ),
575
+		get_option('admin_email'),
576 576
 		sprintf(
577 577
 			/* translators: %s: site name */
578
-			esc_attr__( '[%s] New User Registration', 'give' ),
578
+			esc_attr__('[%s] New User Registration', 'give'),
579 579
 			$blogname
580 580
 		),
581 581
 		$message
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 
585 585
 	// Account Information: Email sends to donor who registered.
586
-	$emails->__set( 'heading', esc_html__( 'Account Information', 'give' ) );
586
+	$emails->__set('heading', esc_html__('Account Information', 'give'));
587 587
 
588
-	$message = sprintf( esc_attr__( 'The following email contains your account information for %s:', 'give' ), $blogname ) . "\r\n\r\n";
588
+	$message = sprintf(esc_attr__('The following email contains your account information for %s:', 'give'), $blogname)."\r\n\r\n";
589 589
 
590 590
 	/* translators: %s: user login */
591
-	$message .=  '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' .  $user_data['user_login'] . "\r\n";
591
+	$message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n";
592 592
 	/* translators: %s: password */
593
-	$message .=  '<strong>' . esc_attr__( 'Password:', 'give' ) . '</strong> ' . esc_attr__( '[Password entered during donation]', 'give' ) . "\r\n\r\n";
593
+	$message .= '<strong>'.esc_attr__('Password:', 'give').'</strong> '.esc_attr__('[Password entered during donation]', 'give')."\r\n\r\n";
594 594
 
595
-	$message .= '<a href="' . wp_login_url() . '" target="_blank"> ' . esc_attr__( 'Click here to login &raquo;', 'give' ) . '</a>' . "\r\n";
595
+	$message .= '<a href="'.wp_login_url().'" target="_blank"> '.esc_attr__('Click here to login &raquo;', 'give').'</a>'."\r\n";
596 596
 
597 597
 	$emails->send(
598 598
 		$user_data['user_email'],
599 599
 		sprintf(
600 600
 			/* translators: %s: site name */
601
-			esc_attr__( '[%s] Your username and password', 'give' ),
601
+			esc_attr__('[%s] Your username and password', 'give'),
602 602
 			$blogname
603 603
 		),
604 604
 		$message
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
 }
608 608
 
609
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
609
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
610 610
 
611 611
 
612 612
 /**
@@ -622,34 +622,34 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return      string
624 624
  */
625
-function give_get_donor_name_by( $id = 0, $from = 'donation' ) {
625
+function give_get_donor_name_by($id = 0, $from = 'donation') {
626 626
 
627 627
 	// ID shouldn't be empty
628
-	if ( empty( $id ) ) {
628
+	if (empty($id)) {
629 629
 		return;
630 630
 	}
631 631
 
632 632
 	$name = '';
633 633
 
634
-	switch ( $from ) {
634
+	switch ($from) {
635 635
 
636 636
 		case 'donation':
637 637
 
638
-			$user_info = give_get_payment_meta_user_info( $id );
639
-			$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
638
+			$user_info = give_get_payment_meta_user_info($id);
639
+			$name = $user_info['first_name'].' '.$user_info['last_name'];
640 640
 
641 641
 		break;
642 642
 
643 643
 		case 'donor':
644 644
 
645
-			$donor = new Give_Donor( $id );
645
+			$donor = new Give_Donor($id);
646 646
 			$name = $donor->name;
647 647
 
648 648
 		break;
649 649
 
650 650
 	}
651 651
 
652
-	return trim( $name );
652
+	return trim($name);
653 653
 
654 654
 }
655 655
 
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
  * @param  string   $email Donor Email.
662 662
  * @return boolean  The user's ID on success, and false on failure.
663 663
  */
664
-function give_donor_email_exists( $email ) {
665
-	if ( Give()->donors->get_donor_by( 'email', $email ) ) {
664
+function give_donor_email_exists($email) {
665
+	if (Give()->donors->get_donor_by('email', $email)) {
666 666
 		return true;
667 667
 	}
668 668
 	return false;
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +107 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = "_give_hide_outdated_php_notices_shortly";
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Add payment bulk notice.
131 131
 	if (
132
-		current_user_can( 'edit_give_payments' )
133
-		&& isset( $_GET['action'] )
134
-		&& ! empty( $_GET['action'] )
135
-		&& isset( $_GET['payment'] )
136
-		&& ! empty( $_GET['payment'] )
132
+		current_user_can('edit_give_payments')
133
+		&& isset($_GET['action'])
134
+		&& ! empty($_GET['action'])
135
+		&& isset($_GET['payment'])
136
+		&& ! empty($_GET['payment'])
137 137
 	) {
138
-		$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
138
+		$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
139 139
 
140
-		switch ( $_GET['action'] ) {
140
+		switch ($_GET['action']) {
141 141
 			case 'delete':
142
-				Give()->notices->register_notice( array(
142
+				Give()->notices->register_notice(array(
143 143
 					'id'          => 'bulk_action_delete',
144 144
 					'type'        => 'updated',
145 145
 					'description' => sprintf(
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 						),
152 152
 						$payment_count ),
153 153
 					'show'        => true,
154
-				) );
154
+				));
155 155
 
156 156
 				break;
157 157
 
158 158
 			case 'resend-receipt':
159
-				Give()->notices->register_notice( array(
159
+				Give()->notices->register_notice(array(
160 160
 					'id'          => 'bulk_action_resend_receipt',
161 161
 					'type'        => 'updated',
162 162
 					'description' => sprintf(
@@ -169,196 +169,196 @@  discard block
 block discarded – undo
169 169
 						$payment_count
170 170
 					),
171 171
 					'show'        => true,
172
-				) );
172
+				));
173 173
 				break;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	// Add give message notices.
178
-	if ( ! empty( $_GET['give-message'] ) ) {
178
+	if ( ! empty($_GET['give-message'])) {
179 179
 		// Donation reports errors.
180
-		if ( current_user_can( 'view_give_reports' ) ) {
181
-			switch ( $_GET['give-message'] ) {
180
+		if (current_user_can('view_give_reports')) {
181
+			switch ($_GET['give-message']) {
182 182
 				case 'donation_deleted' :
183
-					Give()->notices->register_notice( array(
183
+					Give()->notices->register_notice(array(
184 184
 						'id'          => 'give-donation-deleted',
185 185
 						'type'        => 'updated',
186
-						'description' => __( 'The donation has been deleted.', 'give' ),
186
+						'description' => __('The donation has been deleted.', 'give'),
187 187
 						'show'        => true,
188
-					) );
188
+					));
189 189
 					break;
190 190
 				case 'email_sent' :
191
-					Give()->notices->register_notice( array(
191
+					Give()->notices->register_notice(array(
192 192
 						'id'          => 'give-payment-sent',
193 193
 						'type'        => 'updated',
194
-						'description' => __( 'The donation receipt has been resent.', 'give' ),
194
+						'description' => __('The donation receipt has been resent.', 'give'),
195 195
 						'show'        => true,
196
-					) );
196
+					));
197 197
 					break;
198 198
 				case 'refreshed-reports' :
199
-					Give()->notices->register_notice( array(
199
+					Give()->notices->register_notice(array(
200 200
 						'id'          => 'give-refreshed-reports',
201 201
 						'type'        => 'updated',
202
-						'description' => __( 'The reports cache has been cleared.', 'give' ),
202
+						'description' => __('The reports cache has been cleared.', 'give'),
203 203
 						'show'        => true,
204
-					) );
204
+					));
205 205
 					break;
206 206
 				case 'donation-note-deleted' :
207
-					Give()->notices->register_notice( array(
207
+					Give()->notices->register_notice(array(
208 208
 						'id'          => 'give-donation-note-deleted',
209 209
 						'type'        => 'updated',
210
-						'description' => __( 'The donation note has been deleted.', 'give' ),
210
+						'description' => __('The donation note has been deleted.', 'give'),
211 211
 						'show'        => true,
212
-					) );
212
+					));
213 213
 					break;
214 214
 			}
215 215
 		}
216 216
 
217 217
 		// Give settings notices and errors.
218
-		if ( current_user_can( 'manage_give_settings' ) ) {
219
-			switch ( $_GET['give-message'] ) {
218
+		if (current_user_can('manage_give_settings')) {
219
+			switch ($_GET['give-message']) {
220 220
 				case 'settings-imported' :
221
-					Give()->notices->register_notice( array(
221
+					Give()->notices->register_notice(array(
222 222
 						'id'          => 'give-settings-imported',
223 223
 						'type'        => 'updated',
224
-						'description' => __( 'The settings have been imported.', 'give' ),
224
+						'description' => __('The settings have been imported.', 'give'),
225 225
 						'show'        => true,
226
-					) );
226
+					));
227 227
 					break;
228 228
 				case 'api-key-generated' :
229
-					Give()->notices->register_notice( array(
229
+					Give()->notices->register_notice(array(
230 230
 						'id'          => 'give-api-key-generated',
231 231
 						'type'        => 'updated',
232
-						'description' => __( 'API keys have been generated.', 'give' ),
232
+						'description' => __('API keys have been generated.', 'give'),
233 233
 						'show'        => true,
234
-					) );
234
+					));
235 235
 					break;
236 236
 				case 'api-key-exists' :
237
-					Give()->notices->register_notice( array(
237
+					Give()->notices->register_notice(array(
238 238
 						'id'          => 'give-api-key-exists',
239 239
 						'type'        => 'updated',
240
-						'description' => __( 'The specified user already has API keys.', 'give' ),
240
+						'description' => __('The specified user already has API keys.', 'give'),
241 241
 						'show'        => true,
242
-					) );
242
+					));
243 243
 					break;
244 244
 				case 'api-key-regenerated' :
245
-					Give()->notices->register_notice( array(
245
+					Give()->notices->register_notice(array(
246 246
 						'id'          => 'give-api-key-regenerated',
247 247
 						'type'        => 'updated',
248
-						'description' => __( 'API keys have been regenerated.', 'give' ),
248
+						'description' => __('API keys have been regenerated.', 'give'),
249 249
 						'show'        => true,
250
-					) );
250
+					));
251 251
 					break;
252 252
 				case 'api-key-revoked' :
253
-					Give()->notices->register_notice( array(
253
+					Give()->notices->register_notice(array(
254 254
 						'id'          => 'give-api-key-revoked',
255 255
 						'type'        => 'updated',
256
-						'description' => __( 'API keys have been revoked.', 'give' ),
256
+						'description' => __('API keys have been revoked.', 'give'),
257 257
 						'show'        => true,
258
-					) );
258
+					));
259 259
 					break;
260 260
 				case 'sent-test-email' :
261
-					Give()->notices->register_notice( array(
261
+					Give()->notices->register_notice(array(
262 262
 						'id'          => 'give-sent-test-email',
263 263
 						'type'        => 'updated',
264
-						'description' => __( 'The test email has been sent.', 'give' ),
264
+						'description' => __('The test email has been sent.', 'give'),
265 265
 						'show'        => true,
266
-					) );
266
+					));
267 267
 					break;
268 268
 				case 'matched-success-failure-page':
269
-					Give()->notices->register_notice( array(
269
+					Give()->notices->register_notice(array(
270 270
 						'id'          => 'give-matched-success-failure-page',
271 271
 						'type'        => 'updated',
272
-						'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
272
+						'description' => __('You cannot set the success and failed pages to the same page', 'give'),
273 273
 						'show'        => true,
274
-					) );
274
+					));
275 275
 					break;
276 276
 			}
277 277
 		}
278 278
 		// Payments errors.
279
-		if ( current_user_can( 'edit_give_payments' ) ) {
280
-			switch ( $_GET['give-message'] ) {
279
+		if (current_user_can('edit_give_payments')) {
280
+			switch ($_GET['give-message']) {
281 281
 				case 'note-added' :
282
-					Give()->notices->register_notice( array(
282
+					Give()->notices->register_notice(array(
283 283
 						'id'          => 'give-note-added',
284 284
 						'type'        => 'updated',
285
-						'description' => __( 'The donation note has been added.', 'give' ),
285
+						'description' => __('The donation note has been added.', 'give'),
286 286
 						'show'        => true,
287
-					) );
287
+					));
288 288
 					break;
289 289
 				case 'payment-updated' :
290
-					Give()->notices->register_notice( array(
290
+					Give()->notices->register_notice(array(
291 291
 						'id'          => 'give-payment-updated',
292 292
 						'type'        => 'updated',
293
-						'description' => __( 'The donation has been updated.', 'give' ),
293
+						'description' => __('The donation has been updated.', 'give'),
294 294
 						'show'        => true,
295
-					) );
295
+					));
296 296
 					break;
297 297
 			}
298 298
 		}
299 299
 
300 300
 		// Donor Notices.
301
-		if ( current_user_can( 'edit_give_payments' ) ) {
302
-			switch ( $_GET['give-message'] ) {
301
+		if (current_user_can('edit_give_payments')) {
302
+			switch ($_GET['give-message']) {
303 303
 				case 'donor-deleted' :
304
-					Give()->notices->register_notice( array(
304
+					Give()->notices->register_notice(array(
305 305
 						'id'          => 'give-donor-deleted',
306 306
 						'type'        => 'updated',
307
-						'description' => __( 'The donor has been deleted.', 'give' ),
307
+						'description' => __('The donor has been deleted.', 'give'),
308 308
 						'show'        => true,
309
-					) );
309
+					));
310 310
 					break;
311 311
 
312 312
 				case 'email-added' :
313
-					Give()->notices->register_notice( array(
313
+					Give()->notices->register_notice(array(
314 314
 						'id'          => 'give-donor-email-added',
315 315
 						'type'        => 'updated',
316
-						'description' => __( 'Donor email added.', 'give' ),
316
+						'description' => __('Donor email added.', 'give'),
317 317
 						'show'        => true,
318
-					) );
318
+					));
319 319
 					break;
320 320
 
321 321
 				case 'email-removed' :
322
-					Give()->notices->register_notice( array(
322
+					Give()->notices->register_notice(array(
323 323
 						'id'          => 'give-donor-email-removed',
324 324
 						'type'        => 'updated',
325
-						'description' => __( 'Donor email removed.', 'give' ),
325
+						'description' => __('Donor email removed.', 'give'),
326 326
 						'show'        => true,
327
-					) );
327
+					));
328 328
 					break;
329 329
 
330 330
 				case 'email-remove-failed' :
331
-					Give()->notices->register_notice( array(
331
+					Give()->notices->register_notice(array(
332 332
 						'id'          => 'give-donor-email-remove-failed',
333 333
 						'type'        => 'updated',
334
-						'description' => __( 'Failed to remove donor email.', 'give' ),
334
+						'description' => __('Failed to remove donor email.', 'give'),
335 335
 						'show'        => true,
336
-					) );
336
+					));
337 337
 					break;
338 338
 
339 339
 				case 'primary-email-updated' :
340
-					Give()->notices->register_notice( array(
340
+					Give()->notices->register_notice(array(
341 341
 						'id'          => 'give-donor-primary-email-updated',
342 342
 						'type'        => 'updated',
343
-						'description' => __( 'Primary email updated for donor.', 'give' ),
343
+						'description' => __('Primary email updated for donor.', 'give'),
344 344
 						'show'        => true,
345
-					) );
345
+					));
346 346
 					break;
347 347
 
348 348
 				case 'primary-email-failed' :
349
-					Give()->notices->register_notice( array(
349
+					Give()->notices->register_notice(array(
350 350
 						'id'          => 'give-donor-primary-email-failed',
351 351
 						'type'        => 'updated',
352
-						'description' => __( 'Failed to set primary email.', 'give' ),
352
+						'description' => __('Failed to set primary email.', 'give'),
353 353
 						'show'        => true,
354
-					) );
354
+					));
355 355
 					break;
356 356
 			}
357 357
 		}
358 358
 	}
359 359
 }
360 360
 
361
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
361
+add_action('admin_notices', '_give_register_admin_notices', - 1);
362 362
 
363 363
 
364 364
 /**
@@ -368,27 +368,26 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return bool
370 370
  */
371
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
372
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
373
-		give_is_setting_enabled( $_POST['test_mode'] ) :
374
-		give_is_test_mode();
371
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
372
+	$is_test_mode = ! empty($_POST['test_mode']) ?
373
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
375 374
 
376 375
 	if (
377
-		! current_user_can( 'view_give_reports' ) ||
376
+		! current_user_can('view_give_reports') ||
378 377
 		! $is_test_mode
379 378
 	) {
380 379
 		return false;
381 380
 	}
382 381
 
383 382
 	// Add the main siteadmin menu item.
384
-	$wp_admin_bar->add_menu( array(
383
+	$wp_admin_bar->add_menu(array(
385 384
 		'id'     => 'give-test-notice',
386
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
385
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
387 386
 		'parent' => 'top-secondary',
388
-		'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
389
-		'meta'   => array( 'class' => 'give-test-mode-active' ),
390
-	) );
387
+		'title'  => esc_html__('Give Test Mode Active', 'give'),
388
+		'meta'   => array('class' => 'give-test-mode-active'),
389
+	));
391 390
 
392 391
 	return true;
393 392
 }
394
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
395 393
\ No newline at end of file
394
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
396 395
\ No newline at end of file
Please login to merge, or discard this patch.
templates/shortcode-receipt.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
 global $give_receipt_args, $payment;
7 7
 
8 8
 // Validation: Ensure $payment var is set.
9
-if ( empty( $payment ) ) {
10
-	$payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
9
+if (empty($payment)) {
10
+	$payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0;
11 11
 }
12 12
 
13 13
 // Double-Validation: Check for $payment global.
14
-if ( empty( $payment ) ) {
15
-	Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
14
+if (empty($payment)) {
15
+	Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give'));
16 16
 
17 17
 	return;
18 18
 }
19 19
 
20 20
 $donation_id    = $payment->ID;
21
-$form_id        = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
22
-$meta           = give_get_payment_meta( $donation_id );
23
-$donation       = give_get_payment_form_title( $meta );
24
-$user           = give_get_payment_meta_user_info( $donation_id );
25
-$email          = give_get_payment_user_email( $donation_id );
21
+$form_id        = give_get_payment_meta($donation_id, '_give_payment_form_id', true);
22
+$meta           = give_get_payment_meta($donation_id);
23
+$donation       = give_get_payment_form_title($meta);
24
+$user           = give_get_payment_meta_user_info($donation_id);
25
+$email          = give_get_payment_user_email($donation_id);
26 26
 $status         = $payment->post_status;
27
-$status_label   = give_get_payment_status( $payment, true );
27
+$status_label   = give_get_payment_status($payment, true);
28 28
 
29 29
 /**
30 30
  * Generate Donation Receipt Arguments.
@@ -34,56 +34,56 @@  discard block
 block discarded – undo
34 34
  * @since 1.8.8
35 35
  */
36 36
 $give_receipt_args['donation_receipt']['donor'] = array(
37
-	'name'      => __( 'Donor', 'give' ),
38
-	'value'     => $user['first_name'] . ' ' . $user['last_name'],
37
+	'name'      => __('Donor', 'give'),
38
+	'value'     => $user['first_name'].' '.$user['last_name'],
39 39
 	'display'   => $give_receipt_args['donor'],
40 40
 );
41 41
 
42 42
 $give_receipt_args['donation_receipt']['date'] = array(
43
-	'name'      => __( 'Date', 'give' ),
44
-	'value'     => date_i18n( give_date_format(), strtotime( $meta['date'] ) ),
43
+	'name'      => __('Date', 'give'),
44
+	'value'     => date_i18n(give_date_format(), strtotime($meta['date'])),
45 45
 	'display'   => $give_receipt_args['date'],
46 46
 );
47 47
 
48 48
 $give_receipt_args['donation_receipt']['total_donation'] = array(
49
-	'name'      => __( 'Total Donation', 'give' ),
50
-	'value'     => give_payment_amount( $donation_id ),
49
+	'name'      => __('Total Donation', 'give'),
50
+	'value'     => give_payment_amount($donation_id),
51 51
 	'display'   => true,
52 52
 );
53 53
 
54 54
 $give_receipt_args['donation_receipt']['donation'] = array(
55
-	'name'      => __( 'Donation', 'give' ),
55
+	'name'      => __('Donation', 'give'),
56 56
 	'value'     => $donation,
57 57
 	'display'   => true,
58 58
 );
59 59
 
60 60
 $give_receipt_args['donation_receipt']['donation_status'] = array(
61
-	'name'      => __( 'Donation Status', 'give' ),
62
-	'value'     => esc_attr( $status ),
61
+	'name'      => __('Donation Status', 'give'),
62
+	'value'     => esc_attr($status),
63 63
 	'display'   => $give_receipt_args['payment_status'],
64 64
 );
65 65
 
66 66
 $give_receipt_args['donation_receipt']['donation_id'] = array(
67
-	'name'      => __( 'Donation ID', 'give' ),
67
+	'name'      => __('Donation ID', 'give'),
68 68
 	'value'     => $donation_id,
69
-	'display'   => ($give_receipt_args['payment_id'])?true:false,
69
+	'display'   => ($give_receipt_args['payment_id']) ?true:false,
70 70
 );
71 71
 
72 72
 $give_receipt_args['donation_receipt']['payment_details'] = array(
73
-	'name'      => __( 'Payment:', 'give' ),
74
-	'value'     => __( 'Details:', 'give' ),
75
-	'display'   => ($give_receipt_args['payment_id'])?false:true,
73
+	'name'      => __('Payment:', 'give'),
74
+	'value'     => __('Details:', 'give'),
75
+	'display'   => ($give_receipt_args['payment_id']) ?false:true,
76 76
 );
77 77
 
78 78
 $give_receipt_args['donation_receipt']['payment_key'] = array(
79
-	'name'      => __( 'Payment Key', 'give' ),
80
-	'value'     => get_post_meta( $donation_id, '_give_payment_purchase_key', true ),
79
+	'name'      => __('Payment Key', 'give'),
80
+	'value'     => get_post_meta($donation_id, '_give_payment_purchase_key', true),
81 81
 	'display'   => $give_receipt_args['payment_key'],
82 82
 );
83 83
 
84 84
 $give_receipt_args['donation_receipt']['payment_method'] = array(
85
-	'name'      => __( 'Payment Method', 'give' ),
86
-	'value'     => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
85
+	'name'      => __('Payment Method', 'give'),
86
+	'value'     => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)),
87 87
 	'display'   => true,
88 88
 );
89 89
 
@@ -98,49 +98,49 @@  discard block
 block discarded – undo
98 98
  *
99 99
  * @since 1.8.8
100 100
  */
101
-$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
101
+$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id);
102 102
 
103 103
 // Show payment status notice based on shortcode attribute.
104
-if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
104
+if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) {
105 105
 	$notice_message = '';
106 106
 	$notice_type    = 'warning';
107 107
 
108
-	switch ( $status ) {
108
+	switch ($status) {
109 109
 		case 'publish':
110
-			$notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
110
+			$notice_message = __('Payment Complete: Thank you for your donation.', 'give');
111 111
 			$notice_type    = 'success';
112 112
 			break;
113 113
 		case 'pending':
114
-			$notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
114
+			$notice_message = __('Payment Pending: Your donation is currently processing.', 'give');
115 115
 			$notice_type    = 'warning';
116 116
 			break;
117 117
 		case 'refunded':
118
-			$notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
118
+			$notice_message = __('Payment Refunded: Your donation has been refunded.', 'give');
119 119
 			$notice_type    = 'warning';
120 120
 			break;
121 121
 		case 'preapproval':
122
-			$notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
122
+			$notice_message = __('Payment Preapproved: Thank you for your donation.', 'give');
123 123
 			$notice_type    = 'warning';
124 124
 			break;
125 125
 		case 'failed':
126
-			$notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
126
+			$notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give');
127 127
 			$notice_type    = 'error';
128 128
 			break;
129 129
 		case 'cancelled':
130
-			$notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
130
+			$notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give');
131 131
 			$notice_type    = 'error';
132 132
 			break;
133 133
 		case 'abandoned':
134
-			$notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
134
+			$notice_message = __('Payment Abandoned: This donation has not been completed.', 'give');
135 135
 			$notice_type    = 'error';
136 136
 			break;
137 137
 		case 'revoked':
138
-			$notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
138
+			$notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give');
139 139
 			$notice_type    = 'error';
140 140
 			break;
141 141
 	}
142 142
 
143
-	if ( ! empty( $notice_message ) ) {
143
+	if ( ! empty($notice_message)) {
144 144
 		/**
145 145
 		 * Filters payment status notice for receipts.
146 146
 		 *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		 * @param string $status Payment status.
156 156
 		 * @param array  $meta   Array of meta data related to the payment.
157 157
 		 */
158
-		echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta );
158
+		echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta);
159 159
 	}
160 160
 }// End if().
161 161
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  * @param object $payment           The payment object.
170 170
  * @param array  $give_receipt_args Receipt_argument.
171 171
  */
172
-do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args );
172
+do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
173 173
 ?>
174 174
 
175 175
 	<table id="give_donation_receipt" class="give-table">
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		 * @param object $payment           The payment object.
186 186
 		 * @param array  $give_receipt_args Receipt_argument.
187 187
 		 */
188
-		do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args );
188
+		do_action('give_payment_receipt_header_before', $payment, $give_receipt_args);
189 189
 		?>
190 190
 		<tr>
191 191
 			<th scope="colgroup" colspan="2">
192
-				<span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
192
+				<span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span>
193 193
 			</th>
194 194
 		</tr>
195 195
 		<?php
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		 * @param object $payment           The payment object.
204 204
 		 * @param array  $give_receipt_args Receipt_argument.
205 205
 		 */
206
-		do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args );
206
+		do_action('give_payment_receipt_header_after', $payment, $give_receipt_args);
207 207
 		?>
208 208
 		</thead>
209 209
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 		 * @param object $payment           The payment object.
220 220
 		 * @param array  $give_receipt_args Receipt_argument.
221 221
 		 */
222
-		do_action( 'give_payment_receipt_before', $payment, $give_receipt_args );
222
+		do_action('give_payment_receipt_before', $payment, $give_receipt_args);
223 223
 		?>
224 224
 
225
-		<?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
226
-			<?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
225
+		<?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?>
226
+			<?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?>
227 227
 			<tr>
228 228
 				<td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
229 229
 				<td><?php echo $receipt_item['value']; ?></td>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param object $payment           The payment object.
243 243
 		 * @param array  $give_receipt_args Receipt_argument.
244 244
 		 */
245
-		do_action( 'give_payment_receipt_after', $payment, $give_receipt_args );
245
+		do_action('give_payment_receipt_after', $payment, $give_receipt_args);
246 246
 		?>
247 247
 		</tbody>
248 248
 	</table>
@@ -258,5 +258,5 @@  discard block
 block discarded – undo
258 258
  * @param object $payment           The payment object.
259 259
  * @param array  $give_receipt_args Receipt_argument.
260 260
  */
261
-do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args );
261
+do_action('give_payment_receipt_after_table', $payment, $give_receipt_args);
262 262
 ?>
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function get_predefined_dates() {
95 95
 		$predefined = array(
96
-			'today'        => esc_html__( 'Today', 'give' ),
97
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
98
-			'this_week'    => esc_html__( 'This Week', 'give' ),
99
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
100
-			'this_month'   => esc_html__( 'This Month', 'give' ),
101
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
102
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
103
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
104
-			'this_year'    => esc_html__( 'This Year', 'give' ),
105
-			'last_year'    => esc_html__( 'Last Year', 'give' ),
96
+			'today'        => esc_html__('Today', 'give'),
97
+			'yesterday'    => esc_html__('Yesterday', 'give'),
98
+			'this_week'    => esc_html__('This Week', 'give'),
99
+			'last_week'    => esc_html__('Last Week', 'give'),
100
+			'this_month'   => esc_html__('This Month', 'give'),
101
+			'last_month'   => esc_html__('Last Month', 'give'),
102
+			'this_quarter' => esc_html__('This Quarter', 'give'),
103
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
104
+			'this_year'    => esc_html__('This Year', 'give'),
105
+			'last_year'    => esc_html__('Last Year', 'give'),
106 106
 		);
107 107
 
108
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
108
+		return apply_filters('give_stats_predefined_dates', $predefined);
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return void
123 123
 	 */
124
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
124
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
125 125
 
126
-		if ( empty( $_start_date ) ) {
126
+		if (empty($_start_date)) {
127 127
 			$_start_date = 'this_month';
128 128
 		}
129 129
 
130
-		if ( empty( $_end_date ) ) {
130
+		if (empty($_end_date)) {
131 131
 			$_end_date = $_start_date;
132 132
 		}
133 133
 
134
-		$this->start_date = $this->convert_date( $_start_date );
135
-		$this->end_date   = $this->convert_date( $_end_date, true );
134
+		$this->start_date = $this->convert_date($_start_date);
135
+		$this->end_date   = $this->convert_date($_end_date, true);
136 136
 	}
137 137
 
138 138
 	/**
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
150 150
 	 */
151
-	public function convert_date( $date, $end_date = false ) {
151
+	public function convert_date($date, $end_date = false) {
152 152
 
153 153
 		$this->timestamp = false;
154 154
 		$second          = $end_date ? 59 : 0;
155 155
 		$minute          = $end_date ? 59 : 0;
156 156
 		$hour            = $end_date ? 23 : 0;
157 157
 		$day             = 1;
158
-		$month           = date( 'n', current_time( 'timestamp' ) );
159
-		$year            = date( 'Y', current_time( 'timestamp' ) );
158
+		$month           = date('n', current_time('timestamp'));
159
+		$year            = date('Y', current_time('timestamp'));
160 160
 
161
-		if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) {
161
+		if (array_key_exists((string) $date, $this->get_predefined_dates())) {
162 162
 
163 163
 			// This is a predefined date rate, such as last_week
164
-			switch ( $date ) {
164
+			switch ($date) {
165 165
 
166 166
 				case 'this_month' :
167 167
 
168
-					if ( $end_date ) {
168
+					if ($end_date) {
169 169
 
170
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
170
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
171 171
 						$hour   = 23;
172 172
 						$minute = 59;
173 173
 						$second = 59;
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
 
178 178
 				case 'last_month' :
179 179
 
180
-					if ( $month == 1 ) {
180
+					if ($month == 1) {
181 181
 
182 182
 						$month = 12;
183
-						$year --;
183
+						$year--;
184 184
 
185 185
 					} else {
186 186
 
187
-						$month --;
187
+						$month--;
188 188
 
189 189
 					}
190 190
 
191
-					if ( $end_date ) {
192
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
191
+					if ($end_date) {
192
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
193 193
 					}
194 194
 
195 195
 					break;
196 196
 
197 197
 				case 'today' :
198 198
 
199
-					$day = date( 'd', current_time( 'timestamp' ) );
199
+					$day = date('d', current_time('timestamp'));
200 200
 
201
-					if ( $end_date ) {
201
+					if ($end_date) {
202 202
 						$hour   = 23;
203 203
 						$minute = 59;
204 204
 						$second = 59;
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
 
209 209
 				case 'yesterday' :
210 210
 
211
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
211
+					$day = date('d', current_time('timestamp')) - 1;
212 212
 
213 213
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
214
-					if ( $day < 1 ) {
214
+					if ($day < 1) {
215 215
 
216 216
 						// If current month is 1
217
-						if ( 1 == $month ) {
217
+						if (1 == $month) {
218 218
 
219 219
 							$year -= 1; // Today is January 1, so skip back to last day of December
220 220
 							$month = 12;
221
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
221
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
222 222
 
223 223
 						} else {
224 224
 
225 225
 							// Go back one month and get the last day of the month
226 226
 							$month -= 1;
227
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
227
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
228 228
 
229 229
 						}
230 230
 					}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 
234 234
 				case 'this_week' :
235 235
 
236
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
237
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
236
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
237
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
238 238
 
239
-					if ( $today < $days_to_week_start ) {
239
+					if ($today < $days_to_week_start) {
240 240
 
241
-						if ( $month > 1 ) {
241
+						if ($month > 1) {
242 242
 							$month -= 1;
243 243
 						} else {
244 244
 							$month = 12;
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
 
247 247
 					}
248 248
 
249
-					if ( ! $end_date ) {
249
+					if ( ! $end_date) {
250 250
 
251 251
 						// Getting the start day
252 252
 
253
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
254
-						$day += get_option( 'start_of_week' );
253
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
254
+						$day += get_option('start_of_week');
255 255
 
256 256
 					} else {
257 257
 
258 258
 						// Getting the end day
259 259
 
260
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
261
-						$day += get_option( 'start_of_week' ) + 6;
260
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
261
+						$day += get_option('start_of_week') + 6;
262 262
 
263 263
 					}
264 264
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 
267 267
 				case 'last_week' :
268 268
 
269
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
270
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
269
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
270
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
271 271
 
272
-					if ( $today < $days_to_week_start ) {
272
+					if ($today < $days_to_week_start) {
273 273
 
274
-						if ( $month > 1 ) {
274
+						if ($month > 1) {
275 275
 							$month -= 1;
276 276
 						} else {
277 277
 							$month = 12;
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
 
280 280
 					}
281 281
 
282
-					if ( ! $end_date ) {
282
+					if ( ! $end_date) {
283 283
 
284 284
 						// Getting the start day
285 285
 
286
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
287
-						$day += get_option( 'start_of_week' );
286
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
287
+						$day += get_option('start_of_week');
288 288
 
289 289
 					} else {
290 290
 
291 291
 						// Getting the end day
292 292
 
293
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
294
-						$day += get_option( 'start_of_week' ) + 6;
293
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
294
+						$day += get_option('start_of_week') + 6;
295 295
 
296 296
 					}
297 297
 
@@ -299,39 +299,39 @@  discard block
 block discarded – undo
299 299
 
300 300
 				case 'this_quarter' :
301 301
 
302
-					$month_now = date( 'n', current_time( 'timestamp' ) );
302
+					$month_now = date('n', current_time('timestamp'));
303 303
 
304
-					if ( $month_now <= 3 ) {
304
+					if ($month_now <= 3) {
305 305
 
306
-						if ( ! $end_date ) {
306
+						if ( ! $end_date) {
307 307
 							$month = 1;
308 308
 						} else {
309 309
 							$month  = 3;
310
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
310
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
311 311
 							$hour   = 23;
312 312
 							$minute = 59;
313 313
 							$second = 59;
314 314
 						}
315 315
 
316
-					} else if ( $month_now <= 6 ) {
316
+					} else if ($month_now <= 6) {
317 317
 
318
-						if ( ! $end_date ) {
318
+						if ( ! $end_date) {
319 319
 							$month = 4;
320 320
 						} else {
321 321
 							$month  = 6;
322
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
322
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
323 323
 							$hour   = 23;
324 324
 							$minute = 59;
325 325
 							$second = 59;
326 326
 						}
327 327
 
328
-					} else if ( $month_now <= 9 ) {
328
+					} else if ($month_now <= 9) {
329 329
 
330
-						if ( ! $end_date ) {
330
+						if ( ! $end_date) {
331 331
 							$month = 7;
332 332
 						} else {
333 333
 							$month  = 9;
334
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
334
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
335 335
 							$hour   = 23;
336 336
 							$minute = 59;
337 337
 							$second = 59;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 
340 340
 					} else {
341 341
 
342
-						if ( ! $end_date ) {
342
+						if ( ! $end_date) {
343 343
 							$month = 10;
344 344
 						} else {
345 345
 							$month  = 12;
346
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
346
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
347 347
 							$hour   = 23;
348 348
 							$minute = 59;
349 349
 							$second = 59;
@@ -355,40 +355,40 @@  discard block
 block discarded – undo
355 355
 
356 356
 				case 'last_quarter' :
357 357
 
358
-					$month_now = date( 'n', current_time( 'timestamp' ) );
358
+					$month_now = date('n', current_time('timestamp'));
359 359
 
360
-					if ( $month_now <= 3 ) {
360
+					if ($month_now <= 3) {
361 361
 
362
-						if ( ! $end_date ) {
362
+						if ( ! $end_date) {
363 363
 							$month = 10;
364 364
 						} else {
365 365
 							$year -= 1;
366 366
 							$month  = 12;
367
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
367
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
368 368
 							$hour   = 23;
369 369
 							$minute = 59;
370 370
 							$second = 59;
371 371
 						}
372 372
 
373
-					} else if ( $month_now <= 6 ) {
373
+					} else if ($month_now <= 6) {
374 374
 
375
-						if ( ! $end_date ) {
375
+						if ( ! $end_date) {
376 376
 							$month = 1;
377 377
 						} else {
378 378
 							$month  = 3;
379
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
379
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
380 380
 							$hour   = 23;
381 381
 							$minute = 59;
382 382
 							$second = 59;
383 383
 						}
384 384
 
385
-					} else if ( $month_now <= 9 ) {
385
+					} else if ($month_now <= 9) {
386 386
 
387
-						if ( ! $end_date ) {
387
+						if ( ! $end_date) {
388 388
 							$month = 4;
389 389
 						} else {
390 390
 							$month  = 6;
391
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
391
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
392 392
 							$hour   = 23;
393 393
 							$minute = 59;
394 394
 							$second = 59;
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 
397 397
 					} else {
398 398
 
399
-						if ( ! $end_date ) {
399
+						if ( ! $end_date) {
400 400
 							$month = 7;
401 401
 						} else {
402 402
 							$month  = 9;
403
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
403
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
404 404
 							$hour   = 23;
405 405
 							$minute = 59;
406 406
 							$second = 59;
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 				case 'this_year' :
414 414
 
415
-					if ( ! $end_date ) {
415
+					if ( ! $end_date) {
416 416
 						$month = 1;
417 417
 					} else {
418 418
 						$month  = 12;
419
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
419
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
420 420
 						$hour   = 23;
421 421
 						$minute = 59;
422 422
 						$second = 59;
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				case 'last_year' :
428 428
 
429 429
 					$year -= 1;
430
-					if ( ! $end_date ) {
430
+					if ( ! $end_date) {
431 431
 						$month = 1;
432 432
 					} else {
433 433
 						$month  = 12;
434
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
434
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
435 435
 						$hour   = 23;
436 436
 						$minute = 59;
437 437
 						$second = 59;
@@ -442,30 +442,30 @@  discard block
 block discarded – undo
442 442
 			}
443 443
 
444 444
 
445
-		} else if ( is_numeric( $date ) ) {
445
+		} else if (is_numeric($date)) {
446 446
 
447 447
 			// return $date unchanged since it is a timestamp
448 448
 			$this->timestamp = true;
449 449
 
450
-		} else if ( false !== strtotime( $date ) ) {
450
+		} else if (false !== strtotime($date)) {
451 451
 
452
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
453
-			$year  = date( 'Y', $date );
454
-			$month = date( 'm', $date );
455
-			$day   = date( 'd', $date );
452
+			$date  = strtotime($date, current_time('timestamp'));
453
+			$year  = date('Y', $date);
454
+			$month = date('m', $date);
455
+			$day   = date('d', $date);
456 456
 
457 457
 		} else {
458 458
 
459
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
459
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
460 460
 
461 461
 		}
462 462
 
463
-		if ( false === $this->timestamp ) {
463
+		if (false === $this->timestamp) {
464 464
 			// Create an exact timestamp
465
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
465
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
466 466
 		}
467 467
 
468
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
468
+		return apply_filters('give_stats_date', $date, $end_date, $this);
469 469
 
470 470
 	}
471 471
 
@@ -481,33 +481,33 @@  discard block
 block discarded – undo
481 481
 	 * 
482 482
 	 * @return string
483 483
 	 */
484
-	public function count_where( $where = '' ) {
484
+	public function count_where($where = '') {
485 485
 		// Only get payments in our date range
486 486
 
487 487
 		$start_where = '';
488 488
 		$end_where   = '';
489 489
 
490
-		if ( $this->start_date ) {
490
+		if ($this->start_date) {
491 491
 
492
-			if ( $this->timestamp ) {
492
+			if ($this->timestamp) {
493 493
 				$format = 'Y-m-d H:i:s';
494 494
 			} else {
495 495
 				$format = 'Y-m-d 00:00:00';
496 496
 			}
497 497
 
498
-			$start_date  = date( $format, $this->start_date );
498
+			$start_date  = date($format, $this->start_date);
499 499
 			$start_where = " AND p.post_date >= '{$start_date}'";
500 500
 		}
501 501
 
502
-		if ( $this->end_date ) {
502
+		if ($this->end_date) {
503 503
 
504
-			if ( $this->timestamp ) {
504
+			if ($this->timestamp) {
505 505
 				$format = 'Y-m-d H:i:s';
506 506
 			} else {
507 507
 				$format = 'Y-m-d 23:59:59';
508 508
 			}
509 509
 
510
-			$end_date = date( $format, $this->end_date );
510
+			$end_date = date($format, $this->end_date);
511 511
 
512 512
 			$end_where = " AND p.post_date <= '{$end_date}'";
513 513
 		}
@@ -529,34 +529,34 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @return string
531 531
 	 */
532
-	public function payments_where( $where = '' ) {
532
+	public function payments_where($where = '') {
533 533
 
534 534
 		global $wpdb;
535 535
 
536 536
 		$start_where = '';
537 537
 		$end_where   = '';
538 538
 
539
-		if ( ! is_wp_error( $this->start_date ) ) {
539
+		if ( ! is_wp_error($this->start_date)) {
540 540
 
541
-			if ( $this->timestamp ) {
541
+			if ($this->timestamp) {
542 542
 				$format = 'Y-m-d H:i:s';
543 543
 			} else {
544 544
 				$format = 'Y-m-d 00:00:00';
545 545
 			}
546 546
 
547
-			$start_date  = date( $format, $this->start_date );
547
+			$start_date  = date($format, $this->start_date);
548 548
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
549 549
 		}
550 550
 
551
-		if ( ! is_wp_error( $this->end_date ) ) {
551
+		if ( ! is_wp_error($this->end_date)) {
552 552
 
553
-			if ( $this->timestamp ) {
553
+			if ($this->timestamp) {
554 554
 				$format = 'Y-m-d H:i:s';
555 555
 			} else {
556 556
 				$format = 'Y-m-d 23:59:59';
557 557
 			}
558 558
 
559
-			$end_date = date( $format, $this->end_date );
559
+			$end_date = date($format, $this->end_date);
560 560
 
561 561
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
562 562
 		}
Please login to merge, or discard this patch.
includes/class-give-roles.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 		add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array(
90 90
 			'read'         => true,
91 91
 			'edit_posts'   => true,
92
-            'edit_pages'   => true,
92
+			'edit_pages'   => true,
93 93
 			'upload_files' => true,
94 94
 			'delete_posts' => false,
95 95
 		) );
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 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
 	 * @access public
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39 39
 	}
40 40
 
41 41
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function add_roles() {
52
-		add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array(
52
+		add_role('give_manager', esc_html__('Give Manager', 'give'), array(
53 53
 			'read'                   => true,
54 54
 			'edit_posts'             => true,
55 55
 			'delete_posts'           => true,
@@ -78,21 +78,21 @@  discard block
 block discarded – undo
78 78
 			'publish_posts'          => true,
79 79
 			'read_private_pages'     => true,
80 80
 			'read_private_posts'     => true,
81
-		) );
81
+		));
82 82
 
83
-		add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array(
83
+		add_role('give_accountant', esc_html__('Give Accountant', 'give'), array(
84 84
 			'read'         => true,
85 85
 			'edit_posts'   => false,
86 86
 			'delete_posts' => false
87
-		) );
87
+		));
88 88
 
89
-		add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array(
89
+		add_role('give_worker', esc_html__('Give Worker', 'give'), array(
90 90
 			'read'         => true,
91 91
 			'edit_posts'   => true,
92 92
             'edit_pages'   => true,
93 93
 			'upload_files' => true,
94 94
 			'delete_posts' => false,
95
-		) );
95
+		));
96 96
 
97 97
 	}
98 98
 
@@ -111,38 +111,38 @@  discard block
 block discarded – undo
111 111
 	public function add_caps() {
112 112
 		global $wp_roles;
113 113
 
114
-		if ( class_exists( 'WP_Roles' ) ) {
115
-			if ( ! isset( $wp_roles ) ) {
114
+		if (class_exists('WP_Roles')) {
115
+			if ( ! isset($wp_roles)) {
116 116
 				$wp_roles = new WP_Roles();
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( is_object( $wp_roles ) ) {
121
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
122
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
123
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
124
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
120
+		if (is_object($wp_roles)) {
121
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
122
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
123
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
124
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
125 125
 
126
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
127
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
128
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
129
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
126
+			$wp_roles->add_cap('administrator', 'view_give_reports');
127
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
128
+			$wp_roles->add_cap('administrator', 'export_give_reports');
129
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
130 130
 
131 131
 			// Add the main post type capabilities.
132 132
 			$capabilities = $this->get_core_caps();
133
-			foreach ( $capabilities as $cap_group ) {
134
-				foreach ( $cap_group as $cap ) {
135
-					$wp_roles->add_cap( 'administrator', $cap );
136
-					$wp_roles->add_cap( 'give_manager', $cap );
137
-					$wp_roles->add_cap( 'give_worker', $cap );
133
+			foreach ($capabilities as $cap_group) {
134
+				foreach ($cap_group as $cap) {
135
+					$wp_roles->add_cap('administrator', $cap);
136
+					$wp_roles->add_cap('give_manager', $cap);
137
+					$wp_roles->add_cap('give_worker', $cap);
138 138
 				}
139 139
 			}
140 140
 
141
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
142
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
143
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
144
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
145
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
141
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
142
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
143
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
144
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
145
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
146 146
 
147 147
 		}
148 148
 	}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	public function get_core_caps() {
161 161
 		$capabilities = array();
162 162
 
163
-		$capability_types = array( 'give_form', 'give_payment' );
163
+		$capability_types = array('give_form', 'give_payment');
164 164
 
165
-		foreach ( $capability_types as $capability_type ) {
166
-			$capabilities[ $capability_type ] = array(
165
+		foreach ($capability_types as $capability_type) {
166
+			$capabilities[$capability_type] = array(
167 167
 				// Post type.
168 168
 				"edit_{$capability_type}",
169 169
 				"read_{$capability_type}",
@@ -209,22 +209,22 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return array  $caps    Meta capabilities.
211 211
 	 */
212
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
212
+	public function meta_caps($caps, $cap, $user_id, $args) {
213 213
 
214
-		switch ( $cap ) {
214
+		switch ($cap) {
215 215
 
216 216
 			case 'view_give_form_stats' :
217 217
 
218
-				if ( empty( $args[0] ) ) {
218
+				if (empty($args[0])) {
219 219
 					break;
220 220
 				}
221 221
 
222
-				$form = get_post( $args[0] );
223
-				if ( empty( $form ) ) {
222
+				$form = get_post($args[0]);
223
+				if (empty($form)) {
224 224
 					break;
225 225
 				}
226 226
 
227
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
227
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
228 228
 					$caps = array();
229 229
 				}
230 230
 
@@ -251,41 +251,41 @@  discard block
 block discarded – undo
251 251
 
252 252
 		global $wp_roles;
253 253
 
254
-		if ( class_exists( 'WP_Roles' ) ) {
255
-			if ( ! isset( $wp_roles ) ) {
254
+		if (class_exists('WP_Roles')) {
255
+			if ( ! isset($wp_roles)) {
256 256
 				$wp_roles = new WP_Roles();
257 257
 			}
258 258
 		}
259 259
 
260
-		if ( is_object( $wp_roles ) ) {
260
+		if (is_object($wp_roles)) {
261 261
 			// Give Manager Capabilities.
262
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
263
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
264
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
265
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
262
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
263
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
264
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
265
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
266 266
 
267 267
 			// Site Administrator Capabilities.
268
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
269
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
270
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
271
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
268
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
269
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
270
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
271
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
272 272
 
273 273
 			// Remove the Main Post Type Capabilities.
274 274
 			$capabilities = $this->get_core_caps();
275 275
 
276
-			foreach ( $capabilities as $cap_group ) {
277
-				foreach ( $cap_group as $cap ) {
278
-					$wp_roles->remove_cap( 'give_manager', $cap );
279
-					$wp_roles->remove_cap( 'administrator', $cap );
280
-					$wp_roles->remove_cap( 'give_worker', $cap );
276
+			foreach ($capabilities as $cap_group) {
277
+				foreach ($cap_group as $cap) {
278
+					$wp_roles->remove_cap('give_manager', $cap);
279
+					$wp_roles->remove_cap('administrator', $cap);
280
+					$wp_roles->remove_cap('give_worker', $cap);
281 281
 				}
282 282
 			}
283 283
 
284 284
 			/** Give Accountant Capabilities */
285
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
286
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
287
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
288
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
285
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
286
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
287
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
288
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
289 289
 
290 290
 		}
291 291
 	}
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @see    Give_Cron::weekly_events()
35 35
 	 */
36 36
 	public function __construct() {
37
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
38
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
37
+		add_filter('cron_schedules', array($this, 'add_schedules'));
38
+		add_action('wp', array($this, 'schedule_Events'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @return array            An array of non-default cron schedules.
50 50
 	 */
51
-	public function add_schedules( $schedules = array() ) {
51
+	public function add_schedules($schedules = array()) {
52 52
 		// Adds once weekly to the existing schedules.
53 53
 		$schedules['weekly'] = array(
54 54
 			'interval' => 604800,
55
-			'display'  => esc_html__( 'Once Weekly', 'give' ),
55
+			'display'  => esc_html__('Once Weekly', 'give'),
56 56
 		);
57 57
 
58 58
 		return $schedules;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	private function weekly_events() {
83
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
84
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
83
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
84
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
85 85
 		}
86 86
 	}
87 87
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	private function daily_events() {
97
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
98
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
97
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
98
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
99 99
 		}
100 100
 	}
101 101
 
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 1 patch
Spacing   +196 added lines, -196 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
 /**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @subcommand    logo
70 70
 	 */
71
-	public function ascii( $args, $assoc_args ) {
72
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) );
71
+	public function ascii($args, $assoc_args) {
72
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt'));
73 73
 	}
74 74
 
75 75
 
@@ -94,54 +94,54 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @subcommand    details
96 96
 	 */
97
-	public function details( $args, $assoc_args ) {
97
+	public function details($args, $assoc_args) {
98 98
 
99 99
 		/**
100 100
 		 * Plugin Information
101 101
 		 */
102
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
102
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
103 103
 
104 104
 		/**
105 105
 		 * General Information.
106 106
 		 */
107
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
107
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
108 108
 
109
-		$success_page = give_get_option( 'success_page' );
110
-		$failure_page = give_get_option( 'failure_page' );
111
-		$history_page = give_get_option( 'history_page' );
109
+		$success_page = give_get_option('success_page');
110
+		$failure_page = give_get_option('failure_page');
111
+		$history_page = give_get_option('history_page');
112 112
 
113
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
114
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
115
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
116
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
113
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
114
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
115
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
116
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
117 117
 
118 118
 		/**
119 119
 		 * Currency Information.
120 120
 		 */
121
-		$default_gateway = give_get_option( 'default_gateway' );
121
+		$default_gateway = give_get_option('default_gateway');
122 122
 
123
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
123
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
124 124
 
125
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
126
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
127
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
128
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
129
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
130
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
131
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
125
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
126
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
127
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
128
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
129
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
130
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
131
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
132 132
 
133 133
 		// Payment gateways Information.
134
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
135
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
134
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
135
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
136 136
 
137
-		if ( ! empty( $gateways ) ) {
137
+		if ( ! empty($gateways)) {
138 138
 			self::$counter = 1;
139
-			foreach ( $gateways as $gateway ) {
140
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
141
-				self::$counter ++;
139
+			foreach ($gateways as $gateway) {
140
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
141
+				self::$counter++;
142 142
 			}
143 143
 		} else {
144
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
144
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
145 145
 		}
146 146
 	}
147 147
 
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @subcommand    forms
175 175
 	 */
176
-	public function forms( $args, $assoc_args ) {
176
+	public function forms($args, $assoc_args) {
177 177
 		global $wp_query;
178
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
179
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
178
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
179
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
180 180
 		$start   = time();
181 181
 
182 182
 		// Cache previous number query var.
183 183
 		$is_set_number = $cache_per_page = false;
184
-		if ( isset( $wp_query->query_vars['number'] ) ) {
184
+		if (isset($wp_query->query_vars['number'])) {
185 185
 			$cache_per_page = $wp_query->query_vars['number'];
186 186
 			$is_set_number  = true;
187 187
 		}
@@ -190,22 +190,22 @@  discard block
 block discarded – undo
190 190
 		$wp_query->query_vars['number'] = $number;
191 191
 
192 192
 		// Get forms.
193
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
193
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
194 194
 
195 195
 		// Reset number query var.
196
-		if ( $is_set_number ) {
196
+		if ($is_set_number) {
197 197
 			$wp_query->query_vars['number'] = $cache_per_page;
198 198
 		}
199 199
 
200 200
 		// Bailout.
201
-		if ( array_key_exists( 'error', $forms ) ) {
201
+		if (array_key_exists('error', $forms)) {
202 202
 
203
-			WP_CLI::warning( $forms['error'] );
203
+			WP_CLI::warning($forms['error']);
204 204
 
205 205
 			return;
206
-		} elseif ( empty( $forms['forms'] ) ) {
206
+		} elseif (empty($forms['forms'])) {
207 207
 
208
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
208
+			WP_CLI::error(__('No forms found.', 'give'));
209 209
 
210 210
 			return;
211 211
 		}
@@ -213,25 +213,25 @@  discard block
 block discarded – undo
213 213
 		// Param to check if form typeis already showed or not.
214 214
 		$is_show_form_type = false;
215 215
 
216
-		if ( 1 === count( $forms ) && $form_id ) {
216
+		if (1 === count($forms) && $form_id) {
217 217
 			// Show single form.
218
-			foreach ( $forms['forms'][0] as $key => $info ) {
219
-				switch ( $key ) {
218
+			foreach ($forms['forms'][0] as $key => $info) {
219
+				switch ($key) {
220 220
 					case 'stats':
221
-						$this->color_main_heading( ucfirst( $key ) );
221
+						$this->color_main_heading(ucfirst($key));
222 222
 
223
-						foreach ( $info as $heading => $data ) {
224
-							$this->color_sub_heading( ucfirst( $heading ) );
225
-							switch ( $heading ) {
223
+						foreach ($info as $heading => $data) {
224
+							$this->color_sub_heading(ucfirst($heading));
225
+							switch ($heading) {
226 226
 								default:
227
-									foreach ( $data as $subheading => $subdata ) {
227
+									foreach ($data as $subheading => $subdata) {
228 228
 
229
-										switch ( $subheading ) {
229
+										switch ($subheading) {
230 230
 											case 'earnings':
231
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
231
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
232 232
 												break;
233 233
 											default:
234
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
234
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
235 235
 										}
236 236
 									}
237 237
 							}
@@ -241,26 +241,26 @@  discard block
 block discarded – undo
241 241
 					case 'pricing':
242 242
 					case 'info':
243 243
 					default:
244
-						$this->color_main_heading( ucfirst( $key ) );
244
+						$this->color_main_heading(ucfirst($key));
245 245
 
246 246
 						// Show form type.
247
-						if ( ! $is_show_form_type ) {
248
-							$form              = new Give_Donate_Form( $form_id );
247
+						if ( ! $is_show_form_type) {
248
+							$form              = new Give_Donate_Form($form_id);
249 249
 							$is_show_form_type = true;
250 250
 
251
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
251
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
252 252
 						}
253 253
 
254
-						foreach ( $info as $heading => $data ) {
254
+						foreach ($info as $heading => $data) {
255 255
 
256
-							switch ( $heading ) {
256
+							switch ($heading) {
257 257
 								case 'id':
258
-									WP_CLI::log( $this->color_message( $heading, $data ) );
258
+									WP_CLI::log($this->color_message($heading, $data));
259 259
 									break;
260 260
 
261 261
 								default:
262
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
263
-									WP_CLI::log( $this->color_message( $heading, $data ) );
262
+									$data = empty($data) ? __('Not set', 'give') : $data;
263
+									WP_CLI::log($this->color_message($heading, $data));
264 264
 							}
265 265
 						}
266 266
 				}// End switch().
@@ -271,37 +271,37 @@  discard block
 block discarded – undo
271 271
 			$is_table_first_row_set = false;
272 272
 			$table_column_count     = 0;
273 273
 
274
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
274
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
275 275
 
276
-			foreach ( $forms['forms'] as $index => $form_data ) {
276
+			foreach ($forms['forms'] as $index => $form_data) {
277 277
 
278 278
 				// Default table data.
279 279
 				$table_first_row = array();
280 280
 				$table_row       = array();
281 281
 
282
-				foreach ( $form_data['info'] as $key => $form ) {
282
+				foreach ($form_data['info'] as $key => $form) {
283 283
 
284 284
 					// Do not show thumbnail, content and link in table.
285
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
285
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
286 286
 						continue;
287 287
 					}
288 288
 
289
-					if ( ! $is_table_first_row_set ) {
289
+					if ( ! $is_table_first_row_set) {
290 290
 						$table_first_row[] = $key;
291 291
 					}
292 292
 
293 293
 					$table_row[] = $form;
294 294
 
295
-					if ( 'status' === $key ) {
295
+					if ('status' === $key) {
296 296
 						// First array item will be an form id in our case.
297
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
297
+						$form = new Give_Donate_Form(absint($table_row[0]));
298 298
 
299 299
 						$table_row[] = $form->get_type();
300 300
 					}
301 301
 				}
302 302
 
303 303
 				// Set table first row.
304
-				if ( ! $is_table_first_row_set ) {
304
+				if ( ! $is_table_first_row_set) {
305 305
 
306 306
 					// Add extra column to table.
307 307
 					$table_first_row[] = 'type';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 				$table_data[] = $table_row;
315 315
 			}// End foreach().
316 316
 
317
-			$this->display_table( $table_data );
317
+			$this->display_table($table_data);
318 318
 		}// End if().
319 319
 	}
320 320
 
@@ -367,37 +367,37 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @subcommand    donors
369 369
 	 */
370
-	public function donors( $args, $assoc_args ) {
370
+	public function donors($args, $assoc_args) {
371 371
 		global $wp_query;
372
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
373
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
374
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
375
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
376
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
377
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
378
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
372
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
373
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
374
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
375
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
376
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
377
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
378
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
379 379
 		$start    = time();
380 380
 
381
-		if ( $create ) {
381
+		if ($create) {
382 382
 			$number = 1;
383 383
 
384
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
385
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
384
+			if (isset($assoc_args['email']) && ! is_email($email)) {
385
+				WP_CLI::warning('Wrong email address provided.', 'give');
386 386
 
387 387
 				return;
388 388
 			}
389 389
 
390 390
 			// Create one or more donors.
391
-			if ( ! $email ) {
391
+			if ( ! $email) {
392 392
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
393
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
393
+				$number = is_numeric($create) ? absint($create) : 1;
394 394
 			}
395 395
 
396
-			for ( $i = 0; $i < $number; $i ++ ) {
397
-				if ( ! $email ) {
396
+			for ($i = 0; $i < $number; $i++) {
397
+				if ( ! $email) {
398 398
 
399 399
 					// Generate fake email.
400
-					$email = 'customer-' . uniqid() . '@test.com';
400
+					$email = 'customer-'.uniqid().'@test.com';
401 401
 				}
402 402
 
403 403
 				$args = array(
@@ -405,19 +405,19 @@  discard block
 block discarded – undo
405 405
 					'name'  => $name,
406 406
 				);
407 407
 
408
-				$donor_id = Give()->donors->add( $args );
408
+				$donor_id = Give()->donors->add($args);
409 409
 
410
-				if ( $donor_id ) {
411
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
410
+				if ($donor_id) {
411
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
412 412
 				} else {
413
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
413
+					WP_CLI::error(__('Failed to create donor', 'give'));
414 414
 				}
415 415
 
416 416
 				// Reset email to false so it is generated on the next loop (if creating donors).
417 417
 				$email = false;
418 418
 			}
419 419
 
420
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
420
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
421 421
 
422 422
 		} else {
423 423
 			// Counter.
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			 */
432 432
 			// Cache previous number query var.
433 433
 			$is_set_number = $cache_per_page = false;
434
-			if ( isset( $wp_query->query_vars['number'] ) ) {
434
+			if (isset($wp_query->query_vars['number'])) {
435 435
 				$cache_per_page = $wp_query->query_vars['number'];
436 436
 				$is_set_number  = true;
437 437
 			}
@@ -440,24 +440,24 @@  discard block
 block discarded – undo
440 440
 			$wp_query->query_vars['number'] = $number;
441 441
 
442 442
 			// Get donors.
443
-			if ( $form_id ) {
443
+			if ($form_id) {
444 444
 				// @TODO: Allow user to get a list of donors by donation status.
445
-				$donors = $this->get_donors_by_form_id( $form_id );
445
+				$donors = $this->get_donors_by_form_id($form_id);
446 446
 			} else {
447
-				$donors = $this->api->get_donors( $search );
447
+				$donors = $this->api->get_donors($search);
448 448
 			}
449 449
 
450 450
 			// Reset number query var.
451
-			if ( $is_set_number ) {
451
+			if ($is_set_number) {
452 452
 				$wp_query->query_vars['number'] = $cache_per_page;
453 453
 			}
454 454
 
455
-			if ( isset( $donors['error'] ) ) {
456
-				WP_CLI::error( $donors['error'] );
455
+			if (isset($donors['error'])) {
456
+				WP_CLI::error($donors['error']);
457 457
 			}
458 458
 
459
-			if ( empty( $donors ) ) {
460
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
459
+			if (empty($donors)) {
460
+				WP_CLI::error(__('No donors found.', 'give'));
461 461
 
462 462
 				return;
463 463
 			}
@@ -465,24 +465,24 @@  discard block
 block discarded – undo
465 465
 			$table_data             = array();
466 466
 			$is_table_first_row_set = false;
467 467
 
468
-			foreach ( $donors['donors'] as $donor_data ) {
468
+			foreach ($donors['donors'] as $donor_data) {
469 469
 				// Set default table row data.
470
-				$table_first_row = array( __( 's_no', 'give' ) );
471
-				$table_row       = array( self::$counter );
470
+				$table_first_row = array(__('s_no', 'give'));
471
+				$table_row       = array(self::$counter);
472 472
 
473
-				foreach ( $donor_data as $key => $donor ) {
474
-					switch ( $key ) {
473
+				foreach ($donor_data as $key => $donor) {
474
+					switch ($key) {
475 475
 						case 'stats':
476
-							foreach ( $donor as $heading => $data ) {
476
+							foreach ($donor as $heading => $data) {
477 477
 
478 478
 								// Get first row.
479
-								if ( ! $is_table_first_row_set ) {
479
+								if ( ! $is_table_first_row_set) {
480 480
 									$table_first_row[] = $heading;
481 481
 								}
482 482
 
483
-								switch ( $heading ) {
483
+								switch ($heading) {
484 484
 									case 'total_spent':
485
-										$table_row[] = give_currency_filter( $data );
485
+										$table_row[] = give_currency_filter($data);
486 486
 										break;
487 487
 
488 488
 									default:
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 
494 494
 						case 'info':
495 495
 						default:
496
-							foreach ( $donor as $heading => $data ) {
496
+							foreach ($donor as $heading => $data) {
497 497
 
498 498
 								// Get first row.
499
-								if ( ! $is_table_first_row_set ) {
499
+								if ( ! $is_table_first_row_set) {
500 500
 									$table_first_row[] = $heading;
501 501
 								}
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 				}
507 507
 
508 508
 				// Add first row data to table data.
509
-				if ( ! $is_table_first_row_set ) {
509
+				if ( ! $is_table_first_row_set) {
510 510
 					$table_data[]           = $table_first_row;
511 511
 					$is_table_first_row_set = true;
512 512
 				}
@@ -515,44 +515,44 @@  discard block
 block discarded – undo
515 515
 				$table_data[] = $table_row;
516 516
 
517 517
 				// Increase counter.
518
-				self::$counter ++;
518
+				self::$counter++;
519 519
 			}// End foreach().
520 520
 
521
-			switch ( $format ) {
521
+			switch ($format) {
522 522
 				case 'json':
523 523
 					$table_column_name = $table_data[0];
524
-					unset( $table_data[0] );
524
+					unset($table_data[0]);
525 525
 
526 526
 					$new_table_data = array();
527
-					foreach ( $table_data as $index => $data ) {
528
-						foreach ( $data as $key => $value ) {
529
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
527
+					foreach ($table_data as $index => $data) {
528
+						foreach ($data as $key => $value) {
529
+							$new_table_data[$index][$table_column_name[$key]] = $value;
530 530
 						}
531 531
 					}
532 532
 
533
-					WP_CLI::log( json_encode( $new_table_data ) );
533
+					WP_CLI::log(json_encode($new_table_data));
534 534
 					break;
535 535
 
536 536
 				case 'csv':
537
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
538
-					$fp        = fopen( $file_path, 'w' );
537
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
538
+					$fp        = fopen($file_path, 'w');
539 539
 
540
-					if ( is_writable( $file_path ) ) {
541
-						foreach ( $table_data as $fields ) {
542
-							fputcsv( $fp, $fields );
540
+					if (is_writable($file_path)) {
541
+						foreach ($table_data as $fields) {
542
+							fputcsv($fp, $fields);
543 543
 						}
544 544
 
545
-						fclose( $fp );
545
+						fclose($fp);
546 546
 
547
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
547
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
548 548
 					} else {
549
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
549
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
550 550
 					}
551 551
 
552 552
 					break;
553 553
 
554 554
 				default:
555
-					$this->display_table( $table_data );
555
+					$this->display_table($table_data);
556 556
 			}// End switch().
557 557
 		}// End if().
558 558
 	}
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
 	 *
583 583
 	 * @subcommand    donations
584 584
 	 */
585
-	public function donations( $args, $assoc_args ) {
585
+	public function donations($args, $assoc_args) {
586 586
 		global $wp_query;
587
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
587
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
588 588
 
589 589
 		// Cache previous number query var.
590 590
 		$is_set_number = $cache_per_page = false;
591
-		if ( isset( $wp_query->query_vars['number'] ) ) {
591
+		if (isset($wp_query->query_vars['number'])) {
592 592
 			$cache_per_page = $wp_query->query_vars['number'];
593 593
 			$is_set_number  = true;
594 594
 		}
@@ -600,46 +600,46 @@  discard block
 block discarded – undo
600 600
 		$donations = $this->api->get_recent_donations();
601 601
 
602 602
 		// Reset number query var.
603
-		if ( $is_set_number ) {
603
+		if ($is_set_number) {
604 604
 			$wp_query->query_vars['number'] = $cache_per_page;
605 605
 		}
606 606
 
607
-		if ( empty( $donations ) ) {
608
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
607
+		if (empty($donations)) {
608
+			WP_CLI::error(__('No donations found.', 'give'));
609 609
 
610 610
 			return;
611 611
 		}
612 612
 
613 613
 		self::$counter = 1;
614 614
 
615
-		foreach ( $donations['donations'] as $key => $donation ) {
616
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
617
-			self::$counter ++;
615
+		foreach ($donations['donations'] as $key => $donation) {
616
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
617
+			self::$counter++;
618 618
 
619
-			foreach ( $donation as $column => $data ) {
619
+			foreach ($donation as $column => $data) {
620 620
 
621
-				if ( is_array( $data ) ) {
622
-					$this->color_sub_heading( $column );
623
-					foreach ( $data as $subcolumn => $subdata ) {
621
+				if (is_array($data)) {
622
+					$this->color_sub_heading($column);
623
+					foreach ($data as $subcolumn => $subdata) {
624 624
 
625 625
 						// Decode html codes.
626
-						switch ( $subcolumn ) {
626
+						switch ($subcolumn) {
627 627
 							case 'name':
628
-								$subdata = html_entity_decode( $subdata );
628
+								$subdata = html_entity_decode($subdata);
629 629
 								break;
630 630
 						}
631 631
 
632 632
 						// @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.
633
-						if ( is_array( $subdata ) ) {
633
+						if (is_array($subdata)) {
634 634
 							continue;
635 635
 						}
636 636
 
637
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
637
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
638 638
 					}
639 639
 					continue;
640 640
 				}
641 641
 
642
-				WP_CLI::log( $this->color_message( $column, $data ) );
642
+				WP_CLI::log($this->color_message($column, $data));
643 643
 			}
644 644
 		}
645 645
 	}
@@ -679,27 +679,27 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @return        void
681 681
 	 */
682
-	public function report( $args, $assoc_args ) {
682
+	public function report($args, $assoc_args) {
683 683
 		$stats      = new Give_Payment_Stats();
684
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
685
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
686
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
687
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
684
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
685
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
686
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
687
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
688 688
 
689
-		if ( ! empty( $date ) ) {
689
+		if ( ! empty($date)) {
690 690
 			$start_date = $date;
691 691
 			$end_date   = false;
692
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
692
+		} elseif (empty($date) && empty($start_date)) {
693 693
 			$start_date = 'this_month';
694 694
 			$end_date   = false;
695 695
 		}
696 696
 
697 697
 		// Get stats.
698
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
699
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
698
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
699
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
700 700
 
701
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
702
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
701
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
702
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
703 703
 	}
704 704
 
705 705
 
@@ -726,27 +726,27 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @subcommand    cache
728 728
 	 */
729
-	public function cache( $args, $assoc_args ) {
730
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
729
+	public function cache($args, $assoc_args) {
730
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
731 731
 
732 732
 		// Bailout.
733
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
734
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
733
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
734
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
735 735
 
736 736
 			return;
737 737
 		}
738 738
 
739
-		switch ( $action ) {
739
+		switch ($action) {
740 740
 			case 'delete' :
741 741
 				// Reset counter.
742 742
 				self::$counter = 1;
743 743
 
744
-				if ( $this->delete_stats_transients() ) {
744
+				if ($this->delete_stats_transients()) {
745 745
 					// Report .eading.
746
-					WP_CLI::success( 'Give cache deleted.' );
746
+					WP_CLI::success('Give cache deleted.');
747 747
 				} else {
748 748
 					// Report .eading.
749
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
749
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
750 750
 				}
751 751
 				break;
752 752
 		}
@@ -775,27 +775,27 @@  discard block
 block discarded – undo
775 775
 			ARRAY_A
776 776
 		);
777 777
 
778
-		if ( ! empty( $stat_option_names ) ) {
778
+		if ( ! empty($stat_option_names)) {
779 779
 
780
-			foreach ( $stat_option_names as $option_name ) {
780
+			foreach ($stat_option_names as $option_name) {
781 781
 				$error       = false;
782 782
 				$option_name = $option_name['option_name'];
783 783
 
784
-				switch ( true ) {
785
-					case ( false !== strpos( $option_name, 'transient' ) ):
786
-						$option_name = str_replace( '_transient_', '', $option_name );
787
-						$error       = delete_transient( $option_name );
784
+				switch (true) {
785
+					case (false !== strpos($option_name, 'transient')):
786
+						$option_name = str_replace('_transient_', '', $option_name);
787
+						$error       = delete_transient($option_name);
788 788
 						break;
789 789
 
790 790
 					default:
791
-						$error = delete_option( $option_name );
791
+						$error = delete_option($option_name);
792 792
 				}
793 793
 
794
-				if ( $error ) {
795
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
796
-					self::$counter ++;
794
+				if ($error) {
795
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
796
+					self::$counter++;
797 797
 				} else {
798
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
798
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
799 799
 				}
800 800
 			}
801 801
 
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 	 *
817 817
 	 * @return   string
818 818
 	 */
819
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
819
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
820 820
 		// Add colon.
821
-		if ( $colon ) {
822
-			$heading = $heading . ': ';
821
+		if ($colon) {
822
+			$heading = $heading.': ';
823 823
 		}
824 824
 
825
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
825
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
826 826
 	}
827 827
 
828 828
 
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 *
838 838
 	 * @return    void
839 839
 	 */
840
-	private function color_main_heading( $heading, $color = 'g' ) {
841
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
840
+	private function color_main_heading($heading, $color = 'g') {
841
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
842 842
 	}
843 843
 
844 844
 	/**
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return    void
853 853
 	 */
854
-	private function color_sub_heading( $subheading ) {
855
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
854
+	private function color_sub_heading($subheading) {
855
+		WP_CLI::log("\n--->".$subheading.'', '', false);
856 856
 	}
857 857
 
858 858
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return    void
868 868
 	 */
869
-	private function display_table( $data ) {
869
+	private function display_table($data) {
870 870
 		$table = new \cli\Table();
871 871
 
872 872
 		// Set table header.
873
-		$table->setHeaders( $data[0] );
873
+		$table->setHeaders($data[0]);
874 874
 
875 875
 		// Remove table header.
876
-		unset( $data[0] );
876
+		unset($data[0]);
877 877
 
878 878
 		// Set table data.
879
-		$table->setRows( $data );
879
+		$table->setRows($data);
880 880
 
881 881
 		// Display table.
882 882
 		$table->display();
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 	 * @return array
894 894
 	 */
895 895
 
896
-	private function get_donors_by_form_id( $form_id ) {
896
+	private function get_donors_by_form_id($form_id) {
897 897
 		$donors = array();
898 898
 
899 899
 		$donations = new Give_Payments_Query(
900 900
 			array(
901
-				'give_forms' => array( $form_id ),
902
-				'number'     => - 1,
903
-				'status'     => array( 'publish' ),
901
+				'give_forms' => array($form_id),
902
+				'number'     => -1,
903
+				'status'     => array('publish'),
904 904
 			)
905 905
 		);
906 906
 
@@ -908,16 +908,16 @@  discard block
 block discarded – undo
908 908
 		$skip_donors = array();
909 909
 
910 910
 		/* @var Give_Payment|object $donation Payment object. */
911
-		foreach ( $donations as $donation ) {
911
+		foreach ($donations as $donation) {
912 912
 
913
-			if ( in_array( $donation->customer_id, $skip_donors ,true ) ) {
913
+			if (in_array($donation->customer_id, $skip_donors, true)) {
914 914
 				continue;
915 915
 			}
916 916
 
917
-			if ( ! empty( $donors ) ) {
918
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
917
+			if ( ! empty($donors)) {
918
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
919 919
 			} else {
920
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
920
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
921 921
 			}
922 922
 
923 923
 			$skip_donors[] = $donation->customer_id;
Please login to merge, or discard this patch.