Completed
Pull Request — master (#986)
by Rami
20:36
created
includes/payments/functions.php 1 patch
Spacing   +394 added lines, -394 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return object $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	//Set properties
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
@@ -162,31 +162,31 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	//Add the donation
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array()
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array()
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	//Set date if present
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	//Handle sequential payments
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's donation cache
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	//Save payment
192 192
 	$payment->save();
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param int   $payment_id   The payment ID.
200 200
 	 * @param array $payment_data Arguments passed.
201 201
 	 */
202
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
202
+	do_action('give_insert_payment', $payment->ID, $payment_data);
203 203
 
204 204
 	//Return payment ID upon success
205
-	if ( ! empty( $payment->ID ) ) {
205
+	if ( ! empty($payment->ID)) {
206 206
 		return $payment->ID;
207 207
 	}
208 208
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return bool
223 223
  */
224
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
224
+function give_update_payment_status($payment_id, $new_status = 'publish') {
225 225
 
226
-	$payment         = new Give_Payment( $payment_id );
226
+	$payment         = new Give_Payment($payment_id);
227 227
 	$payment->status = $new_status;
228 228
 	$updated         = $payment->save();
229 229
 
@@ -243,37 +243,37 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return void
245 245
  */
246
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
246
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
247 247
 	global $give_logs;
248 248
 
249
-	$payment     = new Give_Payment( $payment_id );
250
-	$amount      = give_get_payment_amount( $payment_id );
249
+	$payment     = new Give_Payment($payment_id);
250
+	$amount      = give_get_payment_amount($payment_id);
251 251
 	$status      = $payment->post_status;
252
-	$customer_id = give_get_payment_customer_id( $payment_id );
253
-	$customer    = new Give_Customer( $customer_id );
252
+	$customer_id = give_get_payment_customer_id($payment_id);
253
+	$customer    = new Give_Customer($customer_id);
254 254
 
255 255
 	//Only undo donations that aren't these statuses
256
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
256
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
257 257
 		'pending',
258 258
 		'cancelled'
259
-	) );
259
+	));
260 260
 
261
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
262
-		give_undo_purchase( false, $payment_id );
261
+	if ( ! in_array($status, $dont_undo_statuses)) {
262
+		give_undo_purchase(false, $payment_id);
263 263
 	}
264 264
 
265
-	if ( $status == 'publish' ) {
265
+	if ($status == 'publish') {
266 266
 
267 267
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment)
268
-		give_decrease_total_earnings( $amount );
268
+		give_decrease_total_earnings($amount);
269 269
 		// Clear the This Month earnings (this_monththis_month is NOT a typo)
270
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
270
+		delete_transient(md5('give_earnings_this_monththis_month'));
271 271
 
272
-		if ( $customer->id && $update_customer ) {
272
+		if ($customer->id && $update_customer) {
273 273
 
274 274
 			// Decrement the stats for the customer
275 275
 			$customer->decrease_purchase_count();
276
-			$customer->decrease_value( $amount );
276
+			$customer->decrease_value($amount);
277 277
 
278 278
 		}
279 279
 	}
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param int $payment_id Payment ID.
287 287
 	 */
288
-	do_action( 'give_donation_delete', $payment_id );
288
+	do_action('give_donation_delete', $payment_id);
289 289
 
290
-	if ( $customer->id && $update_customer ) {
290
+	if ($customer->id && $update_customer) {
291 291
 
292 292
 		// Remove the payment ID from the customer
293
-		$customer->remove_payment( $payment_id );
293
+		$customer->remove_payment($payment_id);
294 294
 
295 295
 	}
296 296
 
297 297
 	// Remove the payment
298
-	wp_delete_post( $payment_id, true );
298
+	wp_delete_post($payment_id, true);
299 299
 
300 300
 	// Remove related sale log entries
301 301
 	$give_logs->delete_logs(
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @param int $payment_id Payment ID.
318 318
 	 */
319
-	do_action( 'give_donation_deleted', $payment_id );
319
+	do_action('give_donation_deleted', $payment_id);
320 320
 }
321 321
 
322 322
 /**
@@ -332,25 +332,25 @@  discard block
 block discarded – undo
332 332
  *
333 333
  * @return void
334 334
  */
335
-function give_undo_purchase( $form_id = false, $payment_id ) {
335
+function give_undo_purchase($form_id = false, $payment_id) {
336 336
 
337
-	if ( ! empty( $form_id ) ) {
337
+	if ( ! empty($form_id)) {
338 338
 		$form_id = false;
339
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
339
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
340 340
 	}
341 341
 
342
-	$payment = new Give_Payment( $payment_id );
342
+	$payment = new Give_Payment($payment_id);
343 343
 
344
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
345
-	if ( true === $maybe_decrease_earnings ) {
344
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
345
+	if (true === $maybe_decrease_earnings) {
346 346
 		// decrease earnings
347
-		give_decrease_earnings( $payment->form_id, $payment->total );
347
+		give_decrease_earnings($payment->form_id, $payment->total);
348 348
 	}
349 349
 
350
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
351
-	if ( true === $maybe_decrease_sales ) {
350
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
351
+	if (true === $maybe_decrease_sales) {
352 352
 		// decrease donation count
353
-		give_decrease_purchase_count( $payment->form_id );
353
+		give_decrease_purchase_count($payment->form_id);
354 354
 	}
355 355
 
356 356
 }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @return array $count Number of payments sorted by payment status
369 369
  */
370
-function give_count_payments( $args = array() ) {
370
+function give_count_payments($args = array()) {
371 371
 
372 372
 	global $wpdb;
373 373
 
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 		'form_id'    => null,
380 380
 	);
381 381
 
382
-	$args = wp_parse_args( $args, $defaults );
382
+	$args = wp_parse_args($args, $defaults);
383 383
 
384 384
 	$select = "SELECT p.post_status,count( * ) AS num_posts";
385 385
 	$join   = '';
386 386
 	$where  = "WHERE p.post_type = 'give_payment'";
387 387
 
388 388
 	// Count payments for a specific user
389
-	if ( ! empty( $args['user'] ) ) {
389
+	if ( ! empty($args['user'])) {
390 390
 
391
-		if ( is_email( $args['user'] ) ) {
391
+		if (is_email($args['user'])) {
392 392
 			$field = 'email';
393
-		} elseif ( is_numeric( $args['user'] ) ) {
393
+		} elseif (is_numeric($args['user'])) {
394 394
 			$field = 'id';
395 395
 		} else {
396 396
 			$field = '';
@@ -398,108 +398,108 @@  discard block
 block discarded – undo
398 398
 
399 399
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
400 400
 
401
-		if ( ! empty( $field ) ) {
401
+		if ( ! empty($field)) {
402 402
 			$where .= "
403 403
 				AND m.meta_key = '_give_payment_user_{$field}'
404 404
 				AND m.meta_value = '{$args['user']}'";
405 405
 		}
406 406
 
407 407
 		// Count payments for a search
408
-	} elseif ( ! empty( $args['s'] ) ) {
408
+	} elseif ( ! empty($args['s'])) {
409 409
 
410
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
410
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
411 411
 
412
-			if ( is_email( $args['s'] ) ) {
412
+			if (is_email($args['s'])) {
413 413
 				$field = '_give_payment_user_email';
414 414
 			} else {
415 415
 				$field = '_give_payment_purchase_key';
416 416
 			}
417 417
 
418 418
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
419
-			$where .= $wpdb->prepare( "
419
+			$where .= $wpdb->prepare("
420 420
 				AND m.meta_key = %s
421 421
 				AND m.meta_value = %s",
422 422
 				$field,
423 423
 				$args['s']
424 424
 			);
425 425
 
426
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
426
+		} elseif ('#' == substr($args['s'], 0, 1)) {
427 427
 
428
-			$search = str_replace( '#:', '', $args['s'] );
429
-			$search = str_replace( '#', '', $search );
428
+			$search = str_replace('#:', '', $args['s']);
429
+			$search = str_replace('#', '', $search);
430 430
 
431 431
 			$select = "SELECT p2.post_status,count( * ) AS num_posts ";
432 432
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
433 433
 			$join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
434 434
 			$where = "WHERE p.post_type = 'give_log' ";
435
-			$where .= $wpdb->prepare( "AND p.post_parent = %d} ", $search );
435
+			$where .= $wpdb->prepare("AND p.post_parent = %d} ", $search);
436 436
 
437
-		} elseif ( is_numeric( $args['s'] ) ) {
437
+		} elseif (is_numeric($args['s'])) {
438 438
 
439 439
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
440
-			$where .= $wpdb->prepare( "
440
+			$where .= $wpdb->prepare("
441 441
 				AND m.meta_key = '_give_payment_user_id'
442 442
 				AND m.meta_value = %d",
443 443
 				$args['s']
444 444
 			);
445 445
 
446 446
 		} else {
447
-			$search = $wpdb->esc_like( $args['s'] );
448
-			$search = '%' . $search . '%';
447
+			$search = $wpdb->esc_like($args['s']);
448
+			$search = '%'.$search.'%';
449 449
 
450
-			$where .= $wpdb->prepare( "AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search );
450
+			$where .= $wpdb->prepare("AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search);
451 451
 		}
452 452
 
453 453
 	}
454 454
 
455
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
455
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
456 456
 
457
-		$where .= $wpdb->prepare( " AND p.post_parent = %d", $args['form_id'] );
457
+		$where .= $wpdb->prepare(" AND p.post_parent = %d", $args['form_id']);
458 458
 
459 459
 	}
460 460
 	// Limit payments count by date
461
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
461
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
462 462
 
463
-		$date_parts = explode( '/', $args['start-date'] );
464
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
465
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
466
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
463
+		$date_parts = explode('/', $args['start-date']);
464
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
465
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
466
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
467 467
 
468
-		$is_date = checkdate( $month, $day, $year );
469
-		if ( false !== $is_date ) {
468
+		$is_date = checkdate($month, $day, $year);
469
+		if (false !== $is_date) {
470 470
 
471
-			$date = new DateTime( $args['start-date'] );
472
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
471
+			$date = new DateTime($args['start-date']);
472
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
473 473
 
474 474
 		}
475 475
 
476 476
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class)
477
-		if ( empty( $args['end-date'] ) ) {
477
+		if (empty($args['end-date'])) {
478 478
 			$args['end-date'] = $args['start-date'];
479 479
 		}
480 480
 
481 481
 	}
482 482
 
483
-	if ( ! empty ( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
483
+	if ( ! empty ($args['end-date']) && false !== strpos($args['end-date'], '/')) {
484 484
 
485
-		$date_parts = explode( '/', $args['end-date'] );
485
+		$date_parts = explode('/', $args['end-date']);
486 486
 
487
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
488
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
489
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
487
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
488
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
489
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
490 490
 
491
-		$is_date = checkdate( $month, $day, $year );
492
-		if ( false !== $is_date ) {
491
+		$is_date = checkdate($month, $day, $year);
492
+		if (false !== $is_date) {
493 493
 
494
-			$date = new DateTime( $args['end-date'] );
495
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
494
+			$date = new DateTime($args['end-date']);
495
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
496 496
 
497 497
 		}
498 498
 
499 499
 	}
500 500
 
501
-	$where = apply_filters( 'give_count_payments_where', $where );
502
-	$join  = apply_filters( 'give_count_payments_join', $join );
501
+	$where = apply_filters('give_count_payments_where', $where);
502
+	$join  = apply_filters('give_count_payments_join', $join);
503 503
 
504 504
 	$query = "$select
505 505
 		FROM $wpdb->posts p
@@ -508,36 +508,36 @@  discard block
 block discarded – undo
508 508
 		GROUP BY p.post_status
509 509
 	";
510 510
 
511
-	$cache_key = md5( $query );
511
+	$cache_key = md5($query);
512 512
 
513
-	$count = wp_cache_get( $cache_key, 'counts' );
514
-	if ( false !== $count ) {
513
+	$count = wp_cache_get($cache_key, 'counts');
514
+	if (false !== $count) {
515 515
 		return $count;
516 516
 	}
517 517
 
518
-	$count = $wpdb->get_results( $query, ARRAY_A );
518
+	$count = $wpdb->get_results($query, ARRAY_A);
519 519
 
520 520
 	$stats    = array();
521 521
 	$statuses = get_post_stati();
522
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
523
-		unset( $statuses['private'] );
522
+	if (isset($statuses['private']) && empty($args['s'])) {
523
+		unset($statuses['private']);
524 524
 	}
525 525
 
526
-	foreach ( $statuses as $state ) {
527
-		$stats[ $state ] = 0;
526
+	foreach ($statuses as $state) {
527
+		$stats[$state] = 0;
528 528
 	}
529 529
 
530
-	foreach ( (array) $count as $row ) {
530
+	foreach ((array) $count as $row) {
531 531
 
532
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
532
+		if ('private' == $row['post_status'] && empty($args['s'])) {
533 533
 			continue;
534 534
 		}
535 535
 
536
-		$stats[ $row['post_status'] ] = $row['num_posts'];
536
+		$stats[$row['post_status']] = $row['num_posts'];
537 537
 	}
538 538
 
539 539
 	$stats = (object) $stats;
540
-	wp_cache_set( $cache_key, $stats, 'counts' );
540
+	wp_cache_set($cache_key, $stats, 'counts');
541 541
 
542 542
 	return $stats;
543 543
 }
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
  *
553 553
  * @return bool             True if payment exists, false otherwise
554 554
  */
555
-function give_check_for_existing_payment( $payment_id ) {
555
+function give_check_for_existing_payment($payment_id) {
556 556
 	$exists  = false;
557
-	$payment = new Give_Payment( $payment_id );
557
+	$payment = new Give_Payment($payment_id);
558 558
 
559 559
 
560
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
560
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
561 561
 		$exists = true;
562 562
 	}
563 563
 
@@ -574,29 +574,29 @@  discard block
 block discarded – undo
574 574
  *
575 575
  * @return bool|mixed           True if payment status exists, false otherwise
576 576
  */
577
-function give_get_payment_status( $payment, $return_label = false ) {
577
+function give_get_payment_status($payment, $return_label = false) {
578 578
 
579
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
579
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
580 580
 		return false;
581 581
 	}
582 582
 
583 583
 	$statuses = give_get_payment_statuses();
584 584
 
585
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
585
+	if ( ! is_array($statuses) || empty($statuses)) {
586 586
 		return false;
587 587
 	}
588 588
 
589
-	$payment = new Give_Payment( $payment->ID );
589
+	$payment = new Give_Payment($payment->ID);
590 590
 
591
-	if ( array_key_exists( $payment->status, $statuses ) ) {
592
-		if ( true === $return_label ) {
593
-			return $statuses[ $payment->status ];
591
+	if (array_key_exists($payment->status, $statuses)) {
592
+		if (true === $return_label) {
593
+			return $statuses[$payment->status];
594 594
 		} else {
595 595
 			// Account that our 'publish' status is labeled 'Complete'
596 596
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
597 597
 
598 598
 			// Make sure we're matching cases, since they matter
599
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
599
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
600 600
 		}
601 601
 	}
602 602
 
@@ -612,17 +612,17 @@  discard block
 block discarded – undo
612 612
  */
613 613
 function give_get_payment_statuses() {
614 614
 	$payment_statuses = array(
615
-		'pending'     => esc_html__( 'Pending', 'give' ),
616
-		'publish'     => esc_html__( 'Complete', 'give' ),
617
-		'refunded'    => esc_html__( 'Refunded', 'give' ),
618
-		'failed'      => esc_html__( 'Failed', 'give' ),
619
-		'cancelled'   => esc_html__( 'Cancelled', 'give' ),
620
-		'abandoned'   => esc_html__( 'Abandoned', 'give' ),
621
-		'preapproval' => esc_html__( 'Pre-Approved', 'give' ),
622
-		'revoked'     => esc_html__( 'Revoked', 'give' )
615
+		'pending'     => esc_html__('Pending', 'give'),
616
+		'publish'     => esc_html__('Complete', 'give'),
617
+		'refunded'    => esc_html__('Refunded', 'give'),
618
+		'failed'      => esc_html__('Failed', 'give'),
619
+		'cancelled'   => esc_html__('Cancelled', 'give'),
620
+		'abandoned'   => esc_html__('Abandoned', 'give'),
621
+		'preapproval' => esc_html__('Pre-Approved', 'give'),
622
+		'revoked'     => esc_html__('Revoked', 'give')
623 623
 	);
624 624
 
625
-	return apply_filters( 'give_donation_statuses', $payment_statuses );
625
+	return apply_filters('give_donation_statuses', $payment_statuses);
626 626
 }
627 627
 
628 628
 /**
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
  * @return array $payment_status All the available payment statuses.
636 636
  */
637 637
 function give_get_payment_status_keys() {
638
-	$statuses = array_keys( give_get_payment_statuses() );
639
-	asort( $statuses );
638
+	$statuses = array_keys(give_get_payment_statuses());
639
+	asort($statuses);
640 640
 
641
-	return array_values( $statuses );
641
+	return array_values($statuses);
642 642
 }
643 643
 
644 644
 /**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
  *
654 654
  * @return int $earnings  Earnings
655 655
  */
656
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
656
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
657 657
 
658 658
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead
659 659
 
@@ -664,41 +664,41 @@  discard block
 block discarded – undo
664 664
 		'nopaging'               => true,
665 665
 		'year'                   => $year,
666 666
 		'monthnum'               => $month_num,
667
-		'post_status'            => array( 'publish' ),
667
+		'post_status'            => array('publish'),
668 668
 		'fields'                 => 'ids',
669 669
 		'update_post_term_cache' => false
670 670
 	);
671
-	if ( ! empty( $day ) ) {
671
+	if ( ! empty($day)) {
672 672
 		$args['day'] = $day;
673 673
 	}
674 674
 
675
-	if ( ! empty( $hour ) ) {
675
+	if ( ! empty($hour)) {
676 676
 		$args['hour'] = $hour;
677 677
 	}
678 678
 
679
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
680
-	$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
679
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
680
+	$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
681 681
 
682
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
682
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
683 683
 		$earnings = false;
684 684
 	} else {
685
-		$earnings = get_transient( $key );
685
+		$earnings = get_transient($key);
686 686
 	}
687 687
 
688
-	if ( false === $earnings ) {
689
-		$sales    = get_posts( $args );
688
+	if (false === $earnings) {
689
+		$sales    = get_posts($args);
690 690
 		$earnings = 0;
691
-		if ( $sales ) {
692
-			$sales = implode( ',', $sales );
691
+		if ($sales) {
692
+			$sales = implode(',', $sales);
693 693
 
694
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
694
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
695 695
 
696 696
 		}
697 697
 		// Cache the results for one hour
698
-		set_transient( $key, $earnings, HOUR_IN_SECONDS );
698
+		set_transient($key, $earnings, HOUR_IN_SECONDS);
699 699
 	}
700 700
 
701
-	return round( $earnings, 2 );
701
+	return round($earnings, 2);
702 702
 }
703 703
 
704 704
 /**
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return int $count     Sales
715 715
  */
716
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
716
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
717 717
 
718 718
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead
719 719
 	$args = array(
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 		'nopaging'               => true,
722 722
 		'year'                   => $year,
723 723
 		'fields'                 => 'ids',
724
-		'post_status'            => array( 'publish' ),
724
+		'post_status'            => array('publish'),
725 725
 		'update_post_meta_cache' => false,
726 726
 		'update_post_term_cache' => false
727 727
 	);
728 728
 
729
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
729
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
730 730
 
731
-	if ( false === $show_free ) {
731
+	if (false === $show_free) {
732 732
 		$args['meta_query'] = array(
733 733
 			array(
734 734
 				'key'     => '_give_payment_total',
@@ -739,33 +739,33 @@  discard block
 block discarded – undo
739 739
 		);
740 740
 	}
741 741
 
742
-	if ( ! empty( $month_num ) ) {
742
+	if ( ! empty($month_num)) {
743 743
 		$args['monthnum'] = $month_num;
744 744
 	}
745 745
 
746
-	if ( ! empty( $day ) ) {
746
+	if ( ! empty($day)) {
747 747
 		$args['day'] = $day;
748 748
 	}
749 749
 
750
-	if ( ! empty( $hour ) ) {
750
+	if ( ! empty($hour)) {
751 751
 		$args['hour'] = $hour;
752 752
 	}
753 753
 
754
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
754
+	$args = apply_filters('give_get_sales_by_date_args', $args);
755 755
 
756
-	$key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
756
+	$key = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
757 757
 
758
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
758
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
759 759
 		$count = false;
760 760
 	} else {
761
-		$count = get_transient( $key );
761
+		$count = get_transient($key);
762 762
 	}
763 763
 
764
-	if ( false === $count ) {
765
-		$sales = new WP_Query( $args );
764
+	if (false === $count) {
765
+		$sales = new WP_Query($args);
766 766
 		$count = (int) $sales->post_count;
767 767
 		// Cache the results for one hour
768
-		set_transient( $key, $count, HOUR_IN_SECONDS );
768
+		set_transient($key, $count, HOUR_IN_SECONDS);
769 769
 	}
770 770
 
771 771
 	return $count;
@@ -780,20 +780,20 @@  discard block
 block discarded – undo
780 780
  *
781 781
  * @return bool            True if complete, false otherwise.
782 782
  */
783
-function give_is_payment_complete( $payment_id ) {
784
-	$payment = new Give_Payment( $payment_id );
783
+function give_is_payment_complete($payment_id) {
784
+	$payment = new Give_Payment($payment_id);
785 785
 
786 786
 	$ret = false;
787 787
 
788
-	if ( $payment->ID > 0 ) {
788
+	if ($payment->ID > 0) {
789 789
 
790
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
790
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
791 791
 			$ret = true;
792 792
 		}
793 793
 
794 794
 	}
795 795
 
796
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
796
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
797 797
 }
798 798
 
799 799
 /**
@@ -819,29 +819,29 @@  discard block
 block discarded – undo
819 819
  */
820 820
 function give_get_total_earnings() {
821 821
 
822
-	$total = get_option( 'give_earnings_total', false );
822
+	$total = get_option('give_earnings_total', false);
823 823
 
824 824
 	// If no total stored in DB, use old method of calculating total earnings
825
-	if ( false === $total ) {
825
+	if (false === $total) {
826 826
 
827 827
 		global $wpdb;
828 828
 
829
-		$total = get_transient( 'give_earnings_total' );
829
+		$total = get_transient('give_earnings_total');
830 830
 
831
-		if ( false === $total ) {
831
+		if (false === $total) {
832 832
 
833 833
 			$total = (float) 0;
834 834
 
835
-			$args = apply_filters( 'give_get_total_earnings_args', array(
835
+			$args = apply_filters('give_get_total_earnings_args', array(
836 836
 				'offset' => 0,
837
-				'number' => - 1,
838
-				'status' => array( 'publish' ),
837
+				'number' => -1,
838
+				'status' => array('publish'),
839 839
 				'fields' => 'ids'
840
-			) );
840
+			));
841 841
 
842 842
 
843
-			$payments = give_get_payments( $args );
844
-			if ( $payments ) {
843
+			$payments = give_get_payments($args);
844
+			if ($payments) {
845 845
 
846 846
 				/*
847 847
 				 * If performing a donation, we need to skip the very last payment in the database, since it calls
@@ -849,30 +849,30 @@  discard block
 block discarded – undo
849 849
 				 * first donation
850 850
 				 */
851 851
 
852
-				if ( did_action( 'give_update_payment_status' ) ) {
853
-					array_pop( $payments );
852
+				if (did_action('give_update_payment_status')) {
853
+					array_pop($payments);
854 854
 				}
855 855
 
856
-				if ( ! empty( $payments ) ) {
857
-					$payments = implode( ',', $payments );
858
-					$total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
856
+				if ( ! empty($payments)) {
857
+					$payments = implode(',', $payments);
858
+					$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
859 859
 				}
860 860
 
861 861
 			}
862 862
 
863 863
 			// Cache results for 1 day. This cache is cleared automatically when a payment is made
864
-			set_transient( 'give_earnings_total', $total, 86400 );
864
+			set_transient('give_earnings_total', $total, 86400);
865 865
 
866 866
 			// Store the total for the first time
867
-			update_option( 'give_earnings_total', $total );
867
+			update_option('give_earnings_total', $total);
868 868
 		}
869 869
 	}
870 870
 
871
-	if ( $total < 0 ) {
871
+	if ($total < 0) {
872 872
 		$total = 0; // Don't ever show negative earnings
873 873
 	}
874 874
 
875
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
875
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
876 876
 }
877 877
 
878 878
 /**
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
  *
886 886
  * @return float $total  Total earnings.
887 887
  */
888
-function give_increase_total_earnings( $amount = 0 ) {
888
+function give_increase_total_earnings($amount = 0) {
889 889
 	$total = give_get_total_earnings();
890 890
 	$total += $amount;
891
-	update_option( 'give_earnings_total', $total );
891
+	update_option('give_earnings_total', $total);
892 892
 
893 893
 	return $total;
894 894
 }
@@ -902,13 +902,13 @@  discard block
 block discarded – undo
902 902
  *
903 903
  * @return float $total Total earnings
904 904
  */
905
-function give_decrease_total_earnings( $amount = 0 ) {
905
+function give_decrease_total_earnings($amount = 0) {
906 906
 	$total = give_get_total_earnings();
907 907
 	$total -= $amount;
908
-	if ( $total < 0 ) {
908
+	if ($total < 0) {
909 909
 		$total = 0;
910 910
 	}
911
-	update_option( 'give_earnings_total', $total );
911
+	update_option('give_earnings_total', $total);
912 912
 
913 913
 	return $total;
914 914
 }
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @return mixed $meta Payment Meta
926 926
  */
927
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
928
-	$payment = new Give_Payment( $payment_id );
927
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
928
+	$payment = new Give_Payment($payment_id);
929 929
 
930
-	return $payment->get_meta( $meta_key, $single );
930
+	return $payment->get_meta($meta_key, $single);
931 931
 }
932 932
 
933 933
 /**
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
  *
941 941
  * @return mixed               Meta ID if successful, false if unsuccessful
942 942
  */
943
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
944
-	$payment = new Give_Payment( $payment_id );
943
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
944
+	$payment = new Give_Payment($payment_id);
945 945
 
946
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
946
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
947 947
 }
948 948
 
949 949
 /**
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
  *
956 956
  * @return array $user_info User Info Meta Values
957 957
  */
958
-function give_get_payment_meta_user_info( $payment_id ) {
959
-	$payment = new Give_Payment( $payment_id );
958
+function give_get_payment_meta_user_info($payment_id) {
959
+	$payment = new Give_Payment($payment_id);
960 960
 
961 961
 	return $payment->user_info;
962 962
 }
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
  *
972 972
  * @return int $form_id
973 973
  */
974
-function give_get_payment_form_id( $payment_id ) {
975
-	$payment = new Give_Payment( $payment_id );
974
+function give_get_payment_form_id($payment_id) {
975
+	$payment = new Give_Payment($payment_id);
976 976
 
977 977
 	return $payment->form_id;
978 978
 }
@@ -986,8 +986,8 @@  discard block
 block discarded – undo
986 986
  *
987 987
  * @return string $email User Email
988 988
  */
989
-function give_get_payment_user_email( $payment_id ) {
990
-	$payment = new Give_Payment( $payment_id );
989
+function give_get_payment_user_email($payment_id) {
990
+	$payment = new Give_Payment($payment_id);
991 991
 
992 992
 	return $payment->email;
993 993
 }
@@ -1001,11 +1001,11 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @return bool            If the payment is associated with a user (false) or not (true)
1003 1003
  */
1004
-function give_is_guest_payment( $payment_id ) {
1005
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
1006
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
1004
+function give_is_guest_payment($payment_id) {
1005
+	$payment_user_id  = give_get_payment_user_id($payment_id);
1006
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
1007 1007
 
1008
-	return (bool) apply_filters( 'give_is_guest_donation', $is_guest_payment, $payment_id );
1008
+	return (bool) apply_filters('give_is_guest_donation', $is_guest_payment, $payment_id);
1009 1009
 }
1010 1010
 
1011 1011
 /**
@@ -1017,8 +1017,8 @@  discard block
 block discarded – undo
1017 1017
  *
1018 1018
  * @return string $user_id User ID
1019 1019
  */
1020
-function give_get_payment_user_id( $payment_id ) {
1021
-	$payment = new Give_Payment( $payment_id );
1020
+function give_get_payment_user_id($payment_id) {
1021
+	$payment = new Give_Payment($payment_id);
1022 1022
 
1023 1023
 	return $payment->user_id;
1024 1024
 }
@@ -1032,8 +1032,8 @@  discard block
 block discarded – undo
1032 1032
  *
1033 1033
  * @return string $customer_id Customer ID
1034 1034
  */
1035
-function give_get_payment_customer_id( $payment_id ) {
1036
-	$payment = new Give_Payment( $payment_id );
1035
+function give_get_payment_customer_id($payment_id) {
1036
+	$payment = new Give_Payment($payment_id);
1037 1037
 
1038 1038
 	return $payment->customer_id;
1039 1039
 }
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
  *
1048 1048
  * @return string $ip User IP
1049 1049
  */
1050
-function give_get_payment_user_ip( $payment_id ) {
1051
-	$payment = new Give_Payment( $payment_id );
1050
+function give_get_payment_user_ip($payment_id) {
1051
+	$payment = new Give_Payment($payment_id);
1052 1052
 
1053 1053
 	return $payment->ip;
1054 1054
 }
@@ -1062,8 +1062,8 @@  discard block
 block discarded – undo
1062 1062
  *
1063 1063
  * @return string $date The date the payment was completed
1064 1064
  */
1065
-function give_get_payment_completed_date( $payment_id = 0 ) {
1066
-	$payment = new Give_Payment( $payment_id );
1065
+function give_get_payment_completed_date($payment_id = 0) {
1066
+	$payment = new Give_Payment($payment_id);
1067 1067
 
1068 1068
 	return $payment->completed_date;
1069 1069
 }
@@ -1077,8 +1077,8 @@  discard block
 block discarded – undo
1077 1077
  *
1078 1078
  * @return string $gateway Gateway
1079 1079
  */
1080
-function give_get_payment_gateway( $payment_id ) {
1081
-	$payment = new Give_Payment( $payment_id );
1080
+function give_get_payment_gateway($payment_id) {
1081
+	$payment = new Give_Payment($payment_id);
1082 1082
 
1083 1083
 	return $payment->gateway;
1084 1084
 }
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
  *
1093 1093
  * @return string $currency The currency code
1094 1094
  */
1095
-function give_get_payment_currency_code( $payment_id = 0 ) {
1096
-	$payment = new Give_Payment( $payment_id );
1095
+function give_get_payment_currency_code($payment_id = 0) {
1096
+	$payment = new Give_Payment($payment_id);
1097 1097
 
1098 1098
 	return $payment->currency;
1099 1099
 }
@@ -1107,10 +1107,10 @@  discard block
 block discarded – undo
1107 1107
  *
1108 1108
  * @return string $currency The currency name
1109 1109
  */
1110
-function give_get_payment_currency( $payment_id = 0 ) {
1111
-	$currency = give_get_payment_currency_code( $payment_id );
1110
+function give_get_payment_currency($payment_id = 0) {
1111
+	$currency = give_get_payment_currency_code($payment_id);
1112 1112
 
1113
-	return apply_filters( 'give_donation_currency', give_get_currency_name( $currency ), $payment_id );
1113
+	return apply_filters('give_donation_currency', give_get_currency_name($currency), $payment_id);
1114 1114
 }
1115 1115
 
1116 1116
 /**
@@ -1122,8 +1122,8 @@  discard block
 block discarded – undo
1122 1122
  *
1123 1123
  * @return string $key Donation key
1124 1124
  */
1125
-function give_get_payment_key( $payment_id = 0 ) {
1126
-	$payment = new Give_Payment( $payment_id );
1125
+function give_get_payment_key($payment_id = 0) {
1126
+	$payment = new Give_Payment($payment_id);
1127 1127
 
1128 1128
 	return $payment->key;
1129 1129
 }
@@ -1139,8 +1139,8 @@  discard block
 block discarded – undo
1139 1139
  *
1140 1140
  * @return string $number Payment order number
1141 1141
  */
1142
-function give_get_payment_number( $payment_id = 0 ) {
1143
-	$payment = new Give_Payment( $payment_id );
1142
+function give_get_payment_number($payment_id = 0) {
1143
+	$payment = new Give_Payment($payment_id);
1144 1144
 
1145 1145
 	return $payment->number;
1146 1146
 }
@@ -1154,23 +1154,23 @@  discard block
 block discarded – undo
1154 1154
  *
1155 1155
  * @return string      The formatted payment number
1156 1156
  */
1157
-function give_format_payment_number( $number ) {
1157
+function give_format_payment_number($number) {
1158 1158
 
1159
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1159
+	if ( ! give_get_option('enable_sequential')) {
1160 1160
 		return $number;
1161 1161
 	}
1162 1162
 
1163
-	if ( ! is_numeric( $number ) ) {
1163
+	if ( ! is_numeric($number)) {
1164 1164
 		return $number;
1165 1165
 	}
1166 1166
 
1167
-	$prefix  = give_get_option( 'sequential_prefix' );
1168
-	$number  = absint( $number );
1169
-	$postfix = give_get_option( 'sequential_postfix' );
1167
+	$prefix  = give_get_option('sequential_prefix');
1168
+	$number  = absint($number);
1169
+	$postfix = give_get_option('sequential_postfix');
1170 1170
 
1171
-	$formatted_number = $prefix . $number . $postfix;
1171
+	$formatted_number = $prefix.$number.$postfix;
1172 1172
 
1173
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1173
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1174 1174
 }
1175 1175
 
1176 1176
 /**
@@ -1183,17 +1183,17 @@  discard block
 block discarded – undo
1183 1183
  */
1184 1184
 function give_get_next_payment_number() {
1185 1185
 
1186
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1186
+	if ( ! give_get_option('enable_sequential')) {
1187 1187
 		return false;
1188 1188
 	}
1189 1189
 
1190
-	$number           = get_option( 'give_last_payment_number' );
1191
-	$start            = give_get_option( 'sequential_start', 1 );
1190
+	$number           = get_option('give_last_payment_number');
1191
+	$start            = give_get_option('sequential_start', 1);
1192 1192
 	$increment_number = true;
1193 1193
 
1194
-	if ( false !== $number ) {
1194
+	if (false !== $number) {
1195 1195
 
1196
-		if ( empty( $number ) ) {
1196
+		if (empty($number)) {
1197 1197
 
1198 1198
 			$number           = $start;
1199 1199
 			$increment_number = false;
@@ -1203,24 +1203,24 @@  discard block
 block discarded – undo
1203 1203
 	} else {
1204 1204
 
1205 1205
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason
1206
-		$payments     = new Give_Payments_Query( array(
1206
+		$payments = new Give_Payments_Query(array(
1207 1207
 			'number'  => 1,
1208 1208
 			'order'   => 'DESC',
1209 1209
 			'orderby' => 'ID',
1210 1210
 			'output'  => 'posts',
1211 1211
 			'fields'  => 'ids'
1212
-		) );
1212
+		));
1213 1213
 		$last_payment = $payments->get_payments();
1214 1214
 
1215
-		if ( ! empty( $last_payment ) ) {
1215
+		if ( ! empty($last_payment)) {
1216 1216
 
1217
-			$number = give_get_payment_number( $last_payment[0] );
1217
+			$number = give_get_payment_number($last_payment[0]);
1218 1218
 
1219 1219
 		}
1220 1220
 
1221
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1221
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1222 1222
 
1223
-			$number = give_remove_payment_prefix_postfix( $number );
1223
+			$number = give_remove_payment_prefix_postfix($number);
1224 1224
 
1225 1225
 		} else {
1226 1226
 
@@ -1230,13 +1230,13 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
 	}
1232 1232
 
1233
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1233
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1234 1234
 
1235
-	if ( $increment_number ) {
1236
-		$number ++;
1235
+	if ($increment_number) {
1236
+		$number++;
1237 1237
 	}
1238 1238
 
1239
-	return apply_filters( 'give_get_next_payment_number', $number );
1239
+	return apply_filters('give_get_next_payment_number', $number);
1240 1240
 }
1241 1241
 
1242 1242
 /**
@@ -1248,25 +1248,25 @@  discard block
 block discarded – undo
1248 1248
  *
1249 1249
  * @return string          The new Payment number without prefix and postfix
1250 1250
  */
1251
-function give_remove_payment_prefix_postfix( $number ) {
1251
+function give_remove_payment_prefix_postfix($number) {
1252 1252
 
1253
-	$prefix  = give_get_option( 'sequential_prefix' );
1254
-	$postfix = give_get_option( 'sequential_postfix' );
1253
+	$prefix  = give_get_option('sequential_prefix');
1254
+	$postfix = give_get_option('sequential_postfix');
1255 1255
 
1256 1256
 	// Remove prefix
1257
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1257
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1258 1258
 
1259 1259
 	// Remove the postfix
1260
-	$length      = strlen( $number );
1261
-	$postfix_pos = strrpos( $number, $postfix );
1262
-	if ( false !== $postfix_pos ) {
1263
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1260
+	$length      = strlen($number);
1261
+	$postfix_pos = strrpos($number, $postfix);
1262
+	if (false !== $postfix_pos) {
1263
+		$number = substr_replace($number, '', $postfix_pos, $length);
1264 1264
 	}
1265 1265
 
1266 1266
 	// Ensure it's a whole number
1267
-	$number = intval( $number );
1267
+	$number = intval($number);
1268 1268
 
1269
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1269
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1270 1270
 
1271 1271
 }
1272 1272
 
@@ -1282,10 +1282,10 @@  discard block
 block discarded – undo
1282 1282
  *
1283 1283
  * @return string $amount Fully formatted payment amount
1284 1284
  */
1285
-function give_payment_amount( $payment_id = 0 ) {
1286
-	$amount = give_get_payment_amount( $payment_id );
1285
+function give_payment_amount($payment_id = 0) {
1286
+	$amount = give_get_payment_amount($payment_id);
1287 1287
 
1288
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1288
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1289 1289
 }
1290 1290
 
1291 1291
 /**
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
  *
1299 1299
  * @return mixed|void
1300 1300
  */
1301
-function give_get_payment_amount( $payment_id ) {
1301
+function give_get_payment_amount($payment_id) {
1302 1302
 
1303
-	$payment = new Give_Payment( $payment_id );
1303
+	$payment = new Give_Payment($payment_id);
1304 1304
 
1305
-	return apply_filters( 'give_donation_amount', floatval( $payment->total ), $payment_id );
1305
+	return apply_filters('give_donation_amount', floatval($payment->total), $payment_id);
1306 1306
 }
1307 1307
 
1308 1308
 /**
@@ -1318,10 +1318,10 @@  discard block
 block discarded – undo
1318 1318
  *
1319 1319
  * @return array Fully formatted payment subtotal
1320 1320
  */
1321
-function give_payment_subtotal( $payment_id = 0 ) {
1322
-	$subtotal = give_get_payment_subtotal( $payment_id );
1321
+function give_payment_subtotal($payment_id = 0) {
1322
+	$subtotal = give_get_payment_subtotal($payment_id);
1323 1323
 
1324
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1324
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1325 1325
 }
1326 1326
 
1327 1327
 /**
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
  *
1336 1336
  * @return float $subtotal Subtotal for payment (non formatted)
1337 1337
  */
1338
-function give_get_payment_subtotal( $payment_id = 0 ) {
1339
-	$payment = new G_Payment( $payment_id );
1338
+function give_get_payment_subtotal($payment_id = 0) {
1339
+	$payment = new G_Payment($payment_id);
1340 1340
 
1341 1341
 	return $payment->subtotal;
1342 1342
 }
@@ -1351,10 +1351,10 @@  discard block
 block discarded – undo
1351 1351
  *
1352 1352
  * @return mixed array if payment fees found, false otherwise
1353 1353
  */
1354
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1355
-	$payment = new Give_Payment( $payment_id );
1354
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1355
+	$payment = new Give_Payment($payment_id);
1356 1356
 
1357
-	return $payment->get_fees( $type );
1357
+	return $payment->get_fees($type);
1358 1358
 }
1359 1359
 
1360 1360
 /**
@@ -1366,8 +1366,8 @@  discard block
 block discarded – undo
1366 1366
  *
1367 1367
  * @return string The donation ID
1368 1368
  */
1369
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1370
-	$payment = new Give_Payment( $payment_id );
1369
+function give_get_payment_transaction_id($payment_id = 0) {
1370
+	$payment = new Give_Payment($payment_id);
1371 1371
 
1372 1372
 	return $payment->transaction_id;
1373 1373
 }
@@ -1382,15 +1382,15 @@  discard block
 block discarded – undo
1382 1382
  *
1383 1383
  * @return bool|mixed
1384 1384
  */
1385
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1385
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1386 1386
 
1387
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1387
+	if (empty($payment_id) || empty($transaction_id)) {
1388 1388
 		return false;
1389 1389
 	}
1390 1390
 
1391
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1391
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1392 1392
 
1393
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1393
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1394 1394
 }
1395 1395
 
1396 1396
 /**
@@ -1404,12 +1404,12 @@  discard block
 block discarded – undo
1404 1404
  *
1405 1405
  * @return int $purchase Donation ID
1406 1406
  */
1407
-function give_get_purchase_id_by_key( $key ) {
1407
+function give_get_purchase_id_by_key($key) {
1408 1408
 	global $wpdb;
1409 1409
 
1410
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1410
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1411 1411
 
1412
-	if ( $purchase != null ) {
1412
+	if ($purchase != null) {
1413 1413
 		return $purchase;
1414 1414
 	}
1415 1415
 
@@ -1428,12 +1428,12 @@  discard block
 block discarded – undo
1428 1428
  *
1429 1429
  * @return int $purchase Donation ID
1430 1430
  */
1431
-function give_get_purchase_id_by_transaction_id( $key ) {
1431
+function give_get_purchase_id_by_transaction_id($key) {
1432 1432
 	global $wpdb;
1433 1433
 
1434
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1434
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1435 1435
 
1436
-	if ( $purchase != null ) {
1436
+	if ($purchase != null) {
1437 1437
 		return $purchase;
1438 1438
 	}
1439 1439
 
@@ -1450,19 +1450,19 @@  discard block
 block discarded – undo
1450 1450
  *
1451 1451
  * @return array $notes Donation Notes
1452 1452
  */
1453
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1453
+function give_get_payment_notes($payment_id = 0, $search = '') {
1454 1454
 
1455
-	if ( empty( $payment_id ) && empty( $search ) ) {
1455
+	if (empty($payment_id) && empty($search)) {
1456 1456
 		return false;
1457 1457
 	}
1458 1458
 
1459
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1460
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1459
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1460
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1461 1461
 
1462
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1462
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1463 1463
 
1464
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1465
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1464
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1465
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1466 1466
 
1467 1467
 	return $notes;
1468 1468
 }
@@ -1478,8 +1478,8 @@  discard block
 block discarded – undo
1478 1478
  *
1479 1479
  * @return int The new note ID
1480 1480
  */
1481
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1482
-	if ( empty( $payment_id ) ) {
1481
+function give_insert_payment_note($payment_id = 0, $note = '') {
1482
+	if (empty($payment_id)) {
1483 1483
 		return false;
1484 1484
 	}
1485 1485
 
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
 	 * @param int    $payment_id Payment ID.
1492 1492
 	 * @param string $note       The note.
1493 1493
 	 */
1494
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1494
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1495 1495
 
1496
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1496
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1497 1497
 		'comment_post_ID'      => $payment_id,
1498 1498
 		'comment_content'      => $note,
1499 1499
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1500
-		'comment_date'         => current_time( 'mysql' ),
1501
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1500
+		'comment_date'         => current_time('mysql'),
1501
+		'comment_date_gmt'     => current_time('mysql', 1),
1502 1502
 		'comment_approved'     => 1,
1503 1503
 		'comment_parent'       => 0,
1504 1504
 		'comment_author'       => '',
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 		'comment_author_email' => '',
1508 1508
 		'comment_type'         => 'give_payment_note'
1509 1509
 
1510
-	) ) );
1510
+	)));
1511 1511
 
1512 1512
 	/**
1513 1513
 	 * Fires after payment note inserted.
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 	 * @param int    $payment_id Payment ID.
1519 1519
 	 * @param string $note       The note.
1520 1520
 	 */
1521
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1521
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1522 1522
 
1523 1523
 	return $note_id;
1524 1524
 }
@@ -1533,8 +1533,8 @@  discard block
 block discarded – undo
1533 1533
  *
1534 1534
  * @return bool True on success, false otherwise
1535 1535
  */
1536
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1537
-	if ( empty( $comment_id ) ) {
1536
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1537
+	if (empty($comment_id)) {
1538 1538
 		return false;
1539 1539
 	}
1540 1540
 
@@ -1546,9 +1546,9 @@  discard block
 block discarded – undo
1546 1546
 	 * @param int $comment_id Note ID.
1547 1547
 	 * @param int $payment_id Payment ID.
1548 1548
 	 */
1549
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1549
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1550 1550
 
1551
-	$ret = wp_delete_comment( $comment_id, true );
1551
+	$ret = wp_delete_comment($comment_id, true);
1552 1552
 
1553 1553
 	/**
1554 1554
 	 * Fires after payment note deleted.
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	 * @param int $comment_id Note ID.
1559 1559
 	 * @param int $payment_id Payment ID.
1560 1560
 	 */
1561
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1561
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1562 1562
 
1563 1563
 	return $ret;
1564 1564
 }
@@ -1573,32 +1573,32 @@  discard block
 block discarded – undo
1573 1573
  *
1574 1574
  * @return string
1575 1575
  */
1576
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1576
+function give_get_payment_note_html($note, $payment_id = 0) {
1577 1577
 
1578
-	if ( is_numeric( $note ) ) {
1579
-		$note = get_comment( $note );
1578
+	if (is_numeric($note)) {
1579
+		$note = get_comment($note);
1580 1580
 	}
1581 1581
 
1582
-	if ( ! empty( $note->user_id ) ) {
1583
-		$user = get_userdata( $note->user_id );
1582
+	if ( ! empty($note->user_id)) {
1583
+		$user = get_userdata($note->user_id);
1584 1584
 		$user = $user->display_name;
1585 1585
 	} else {
1586
-		$user = esc_html__( 'System', 'give' );
1586
+		$user = esc_html__('System', 'give');
1587 1587
 	}
1588 1588
 
1589
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1589
+	$date_format = give_date_format().', '.get_option('time_format');
1590 1590
 
1591
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1591
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1592 1592
 		'give-action' => 'delete_payment_note',
1593 1593
 		'note_id'     => $note->comment_ID,
1594 1594
 		'payment_id'  => $payment_id
1595
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1595
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1596 1596
 
1597
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1597
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1598 1598
 	$note_html .= '<p>';
1599
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1599
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1600 1600
 	$note_html .= $note->comment_content;
1601
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1601
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1602 1602
 	$note_html .= '</p>';
1603 1603
 	$note_html .= '</div>';
1604 1604
 
@@ -1616,20 +1616,20 @@  discard block
 block discarded – undo
1616 1616
  *
1617 1617
  * @return void
1618 1618
  */
1619
-function give_hide_payment_notes( $query ) {
1619
+function give_hide_payment_notes($query) {
1620 1620
 	global $wp_version;
1621 1621
 
1622
-	if ( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) {
1623
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1624
-		if ( ! is_array( $types ) ) {
1625
-			$types = array( $types );
1622
+	if (version_compare(floatval($wp_version), '4.1', '>=')) {
1623
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1624
+		if ( ! is_array($types)) {
1625
+			$types = array($types);
1626 1626
 		}
1627 1627
 		$types[]                           = 'give_payment_note';
1628 1628
 		$query->query_vars['type__not_in'] = $types;
1629 1629
 	}
1630 1630
 }
1631 1631
 
1632
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1632
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1633 1633
 
1634 1634
 /**
1635 1635
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1641,17 +1641,17 @@  discard block
 block discarded – undo
1641 1641
  *
1642 1642
  * @return array $clauses Updated comment clauses
1643 1643
  */
1644
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1644
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1645 1645
 	global $wpdb, $wp_version;
1646 1646
 
1647
-	if ( version_compare( floatval( $wp_version ), '4.1', '<' ) ) {
1647
+	if (version_compare(floatval($wp_version), '4.1', '<')) {
1648 1648
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1649 1649
 	}
1650 1650
 
1651 1651
 	return $clauses;
1652 1652
 }
1653 1653
 
1654
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1654
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1655 1655
 
1656 1656
 
1657 1657
 /**
@@ -1664,15 +1664,15 @@  discard block
 block discarded – undo
1664 1664
  *
1665 1665
  * @return array $where
1666 1666
  */
1667
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1667
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1668 1668
 	global $wpdb;
1669 1669
 
1670
-	$where .= $wpdb->prepare( " AND comment_type != %s", 'give_payment_note' );
1670
+	$where .= $wpdb->prepare(" AND comment_type != %s", 'give_payment_note');
1671 1671
 
1672 1672
 	return $where;
1673 1673
 }
1674 1674
 
1675
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1675
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1676 1676
 
1677 1677
 
1678 1678
 /**
@@ -1686,32 +1686,32 @@  discard block
 block discarded – undo
1686 1686
  *
1687 1687
  * @return array Array of comment counts
1688 1688
  */
1689
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1689
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1690 1690
 	global $wpdb, $pagenow;
1691 1691
 
1692
-	if ( 'index.php' != $pagenow ) {
1692
+	if ('index.php' != $pagenow) {
1693 1693
 		return $stats;
1694 1694
 	}
1695 1695
 
1696 1696
 	$post_id = (int) $post_id;
1697 1697
 
1698
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1698
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1699 1699
 		return $stats;
1700 1700
 	}
1701 1701
 
1702
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1702
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1703 1703
 
1704
-	if ( false !== $stats ) {
1704
+	if (false !== $stats) {
1705 1705
 		return $stats;
1706 1706
 	}
1707 1707
 
1708 1708
 	$where = 'WHERE comment_type != "give_payment_note"';
1709 1709
 
1710
-	if ( $post_id > 0 ) {
1711
-		$where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
1710
+	if ($post_id > 0) {
1711
+		$where .= $wpdb->prepare(" AND comment_post_ID = %d", $post_id);
1712 1712
 	}
1713 1713
 
1714
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1714
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1715 1715
 
1716 1716
 	$total    = 0;
1717 1717
 	$approved = array(
@@ -1721,30 +1721,30 @@  discard block
 block discarded – undo
1721 1721
 		'trash'        => 'trash',
1722 1722
 		'post-trashed' => 'post-trashed'
1723 1723
 	);
1724
-	foreach ( (array) $count as $row ) {
1724
+	foreach ((array) $count as $row) {
1725 1725
 		// Don't count post-trashed toward totals
1726
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1726
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1727 1727
 			$total += $row['num_comments'];
1728 1728
 		}
1729
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1730
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1729
+		if (isset($approved[$row['comment_approved']])) {
1730
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1731 1731
 		}
1732 1732
 	}
1733 1733
 
1734 1734
 	$stats['total_comments'] = $total;
1735
-	foreach ( $approved as $key ) {
1736
-		if ( empty( $stats[ $key ] ) ) {
1737
-			$stats[ $key ] = 0;
1735
+	foreach ($approved as $key) {
1736
+		if (empty($stats[$key])) {
1737
+			$stats[$key] = 0;
1738 1738
 		}
1739 1739
 	}
1740 1740
 
1741 1741
 	$stats = (object) $stats;
1742
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1742
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1743 1743
 
1744 1744
 	return $stats;
1745 1745
 }
1746 1746
 
1747
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1747
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1748 1748
 
1749 1749
 
1750 1750
 /**
@@ -1757,9 +1757,9 @@  discard block
 block discarded – undo
1757 1757
  *
1758 1758
  * @return string $where Modified where clause
1759 1759
  */
1760
-function give_filter_where_older_than_week( $where = '' ) {
1760
+function give_filter_where_older_than_week($where = '') {
1761 1761
 	// Payments older than one week
1762
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1762
+	$start = date('Y-m-d', strtotime('-7 days'));
1763 1763
 	$where .= " AND post_date <= '{$start}'";
1764 1764
 
1765 1765
 	return $where;
@@ -1778,37 +1778,37 @@  discard block
 block discarded – undo
1778 1778
  *
1779 1779
  * @return string $form_title Returns the full title if $level_title false, otherwise returns the levels title
1780 1780
  */
1781
-function give_get_payment_form_title( $payment_meta, $level_title = false, $separator = '' ) {
1781
+function give_get_payment_form_title($payment_meta, $level_title = false, $separator = '') {
1782 1782
 
1783
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1784
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1785
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1783
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1784
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1785
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1786 1786
 
1787
-	if ( $level_title == true ) {
1787
+	if ($level_title == true) {
1788 1788
 		$form_title = '';
1789 1789
 	}
1790 1790
 
1791
-	if ( give_has_variable_prices( $form_id ) ) {
1791
+	if (give_has_variable_prices($form_id)) {
1792 1792
 
1793
-		if ( ! empty( $separator ) ) {
1794
-			$form_title .= ' ' . $separator;
1793
+		if ( ! empty($separator)) {
1794
+			$form_title .= ' '.$separator;
1795 1795
 		}
1796 1796
 		$form_title .= ' <span class="donation-level-text-wrap">';
1797 1797
 
1798
-		if ( $price_id == 'custom' ) {
1798
+		if ($price_id == 'custom') {
1799 1799
 
1800
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1801
-			$form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' );
1800
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1801
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give');
1802 1802
 
1803 1803
 		} else {
1804
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1804
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1805 1805
 		}
1806 1806
 
1807 1807
 		$form_title .= '</span>';
1808 1808
 
1809 1809
 	}
1810 1810
 
1811
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1811
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1812 1812
 
1813 1813
 }
1814 1814
 
@@ -1822,20 +1822,20 @@  discard block
 block discarded – undo
1822 1822
  *
1823 1823
  * @return string $price_id
1824 1824
  */
1825
-function give_get_price_id( $form_id, $price ) {
1825
+function give_get_price_id($form_id, $price) {
1826 1826
 
1827 1827
 	$price_id = 0;
1828 1828
 
1829
-	if ( give_has_variable_prices( $form_id ) ) {
1829
+	if (give_has_variable_prices($form_id)) {
1830 1830
 
1831
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1831
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1832 1832
 
1833
-		foreach ( $levels as $level ) {
1833
+		foreach ($levels as $level) {
1834 1834
 
1835
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1835
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1836 1836
 
1837 1837
 			//check that this indeed the recurring price
1838
-			if ( $level_amount == $price ) {
1838
+			if ($level_amount == $price) {
1839 1839
 
1840 1840
 				$price_id = $level['_give_id']['level_id'];
1841 1841
 
@@ -1862,10 +1862,10 @@  discard block
 block discarded – undo
1862 1862
  * 
1863 1863
  * @return string/void
1864 1864
  */
1865
-function give_get_form_dropdown( $args = array(), $echo = false ){
1866
-    $form_dropdown_html = Give()->html->forms_dropdown( $args );
1865
+function give_get_form_dropdown($args = array(), $echo = false) {
1866
+    $form_dropdown_html = Give()->html->forms_dropdown($args);
1867 1867
 
1868
-    if( ! $echo ) {
1868
+    if ( ! $echo) {
1869 1869
         return $form_dropdown_html;
1870 1870
     }
1871 1871
 
@@ -1882,39 +1882,39 @@  discard block
 block discarded – undo
1882 1882
  *
1883 1883
  * @return string/void
1884 1884
  */
1885
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ){
1885
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1886 1886
     
1887 1887
     // Check for give form id.
1888
-    if( empty( $args['id'] ) ) {
1888
+    if (empty($args['id'])) {
1889 1889
         return false;
1890 1890
     }
1891 1891
 
1892 1892
     // Check if form has variable prices or not.
1893
-    if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1893
+    if ( ! ($variable_prices = give_has_variable_prices($args['id']))) {
1894 1894
         return false;
1895 1895
     }
1896 1896
     
1897
-    $variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1897
+    $variable_prices = give_get_variable_prices(absint($args['id']));
1898 1898
     $variable_price_options = array();
1899 1899
 
1900 1900
     // Check if multi donation form support custom donation or not.
1901
-    if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1902
-        $variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1901
+    if (give_is_custom_price_mode(absint($args['id']))) {
1902
+        $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1903 1903
     }
1904 1904
 
1905 1905
     // Get variable price and ID from variable price array.
1906
-    foreach ( $variable_prices as $variable_price ) {
1907
-        $variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1906
+    foreach ($variable_prices as $variable_price) {
1907
+        $variable_price_options[$variable_price['_give_id']['level_id']] = $variable_price['_give_text'];
1908 1908
     }
1909 1909
 
1910 1910
 
1911 1911
     // Update options.
1912
-    $args = array_merge( $args, array( 'options' => $variable_price_options ) );
1912
+    $args = array_merge($args, array('options' => $variable_price_options));
1913 1913
 
1914 1914
     // Generate select html.
1915
-    $form_dropdown_html = Give()->html->select( $args );
1915
+    $form_dropdown_html = Give()->html->select($args);
1916 1916
 
1917
-    if( ! $echo ) {
1917
+    if ( ! $echo) {
1918 1918
         return $form_dropdown_html;
1919 1919
     }
1920 1920
 
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 1 patch
Spacing   +112 added lines, -112 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
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
58 58
 	 */
59
-	public function __construct( $args = array() ) {
59
+	public function __construct($args = array()) {
60 60
 		$defaults = array(
61 61
 			'output'          => 'payments', // Use 'posts' to get standard post objects
62
-			'post_type'       => array( 'give_payment' ),
62
+			'post_type'       => array('give_payment'),
63 63
 			'start_date'      => false,
64 64
 			'end_date'        => false,
65 65
 			'number'          => 20,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			'give_forms'      => null
80 80
 		);
81 81
 
82
-		$this->args = wp_parse_args( $args, $defaults );
82
+		$this->args = wp_parse_args($args, $defaults);
83 83
 
84 84
 		$this->init();
85 85
 	}
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	 * @since  1.0
91 91
 	 * @access public
92 92
 	 */
93
-	public function __set( $query_var, $value ) {
94
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
95
-			$this->args[ $query_var ][] = $value;
93
+	public function __set($query_var, $value) {
94
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
95
+			$this->args[$query_var][] = $value;
96 96
 		} else {
97
-			$this->args[ $query_var ] = $value;
97
+			$this->args[$query_var] = $value;
98 98
 		}
99 99
 	}
100 100
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @since  1.0
105 105
 	 * @access public
106 106
 	 */
107
-	public function __unset( $query_var ) {
108
-		unset( $this->args[ $query_var ] );
107
+	public function __unset($query_var) {
108
+		unset($this->args[$query_var]);
109 109
 	}
110 110
 
111 111
 	/**
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function init() {
120 120
 
121
-		add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) );
122
-		add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) );
123
-
124
-		add_action( 'give_pre_get_payments', array( $this, 'orderby' ) );
125
-		add_action( 'give_pre_get_payments', array( $this, 'status' ) );
126
-		add_action( 'give_pre_get_payments', array( $this, 'month' ) );
127
-		add_action( 'give_pre_get_payments', array( $this, 'per_page' ) );
128
-		add_action( 'give_pre_get_payments', array( $this, 'page' ) );
129
-		add_action( 'give_pre_get_payments', array( $this, 'user' ) );
130
-		add_action( 'give_pre_get_payments', array( $this, 'search' ) );
131
-		add_action( 'give_pre_get_payments', array( $this, 'mode' ) );
132
-		add_action( 'give_pre_get_payments', array( $this, 'children' ) );
133
-		add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) );
121
+		add_action('give_pre_get_payments', array($this, 'date_filter_pre'));
122
+		add_action('give_post_get_payments', array($this, 'date_filter_post'));
123
+
124
+		add_action('give_pre_get_payments', array($this, 'orderby'));
125
+		add_action('give_pre_get_payments', array($this, 'status'));
126
+		add_action('give_pre_get_payments', array($this, 'month'));
127
+		add_action('give_pre_get_payments', array($this, 'per_page'));
128
+		add_action('give_pre_get_payments', array($this, 'page'));
129
+		add_action('give_pre_get_payments', array($this, 'user'));
130
+		add_action('give_pre_get_payments', array($this, 'search'));
131
+		add_action('give_pre_get_payments', array($this, 'mode'));
132
+		add_action('give_pre_get_payments', array($this, 'children'));
133
+		add_action('give_pre_get_payments', array($this, 'give_forms'));
134 134
 	}
135 135
 
136 136
 	/**
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 		 *
155 155
 		 * @param Give_Payments_Query $this Payments query object.
156 156
 		 */
157
-		do_action( 'give_pre_get_payments', $this );
157
+		do_action('give_pre_get_payments', $this);
158 158
 
159
-		$query = new WP_Query( $this->args );
159
+		$query = new WP_Query($this->args);
160 160
 
161 161
 		$custom_output = array(
162 162
 			'payments',
163 163
 			'give_payments',
164 164
 		);
165 165
 
166
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
166
+		if ( ! in_array($this->args['output'], $custom_output)) {
167 167
 			return $query->posts;
168 168
 		}
169 169
 
170
-		if ( $query->have_posts() ) {
171
-			while ( $query->have_posts() ) {
170
+		if ($query->have_posts()) {
171
+			while ($query->have_posts()) {
172 172
 				$query->the_post();
173 173
 
174 174
 				$payment_id = get_post()->ID;
175
-				$payment    = new Give_Payment( $payment_id );
175
+				$payment    = new Give_Payment($payment_id);
176 176
 
177
-				$this->payments[] = apply_filters( 'give_donation', $payment, $payment_id, $this );
177
+				$this->payments[] = apply_filters('give_donation', $payment, $payment_id, $this);
178 178
 			}
179 179
 
180 180
 			wp_reset_postdata();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 *
188 188
 		 * @param Give_Payments_Query $this Payments query object.
189 189
 		 */
190
-		do_action( 'give_post_get_payments', $this );
190
+		do_action('give_post_get_payments', $this);
191 191
 
192 192
 		return $this->payments;
193 193
 	}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 * @return void
202 202
 	 */
203 203
 	public function date_filter_pre() {
204
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
204
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
205 205
 			return;
206 206
 		}
207 207
 
208
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
208
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
209 209
 
210
-		add_filter( 'posts_where', array( $this, 'payments_where' ) );
210
+		add_filter('posts_where', array($this, 'payments_where'));
211 211
 	}
212 212
 
213 213
 	/**
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	 * @return void
221 221
 	 */
222 222
 	public function date_filter_post() {
223
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
223
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
224 224
 			return;
225 225
 		}
226 226
 
227
-		remove_filter( 'posts_where', array( $this, 'payments_where' ) );
227
+		remove_filter('posts_where', array($this, 'payments_where'));
228 228
 	}
229 229
 
230 230
 	/**
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	 * @return void
237 237
 	 */
238 238
 	public function status() {
239
-		if ( ! isset ( $this->args['status'] ) ) {
239
+		if ( ! isset ($this->args['status'])) {
240 240
 			return;
241 241
 		}
242 242
 
243
-		$this->__set( 'post_status', $this->args['status'] );
244
-		$this->__unset( 'status' );
243
+		$this->__set('post_status', $this->args['status']);
244
+		$this->__unset('status');
245 245
 	}
246 246
 
247 247
 	/**
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 	 * @return void
254 254
 	 */
255 255
 	public function page() {
256
-		if ( ! isset ( $this->args['page'] ) ) {
256
+		if ( ! isset ($this->args['page'])) {
257 257
 			return;
258 258
 		}
259 259
 
260
-		$this->__set( 'paged', $this->args['page'] );
261
-		$this->__unset( 'page' );
260
+		$this->__set('paged', $this->args['page']);
261
+		$this->__unset('page');
262 262
 	}
263 263
 
264 264
 	/**
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function per_page() {
273 273
 
274
-		if ( ! isset( $this->args['number'] ) ) {
274
+		if ( ! isset($this->args['number'])) {
275 275
 			return;
276 276
 		}
277 277
 
278
-		if ( $this->args['number'] == - 1 ) {
279
-			$this->__set( 'nopaging', true );
278
+		if ($this->args['number'] == - 1) {
279
+			$this->__set('nopaging', true);
280 280
 		} else {
281
-			$this->__set( 'posts_per_page', $this->args['number'] );
281
+			$this->__set('posts_per_page', $this->args['number']);
282 282
 		}
283 283
 
284
-		$this->__unset( 'number' );
284
+		$this->__unset('number');
285 285
 	}
286 286
 
287 287
 	/**
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 	 * @return void
294 294
 	 */
295 295
 	public function month() {
296
-		if ( ! isset ( $this->args['month'] ) ) {
296
+		if ( ! isset ($this->args['month'])) {
297 297
 			return;
298 298
 		}
299 299
 
300
-		$this->__set( 'monthnum', $this->args['month'] );
301
-		$this->__unset( 'month' );
300
+		$this->__set('monthnum', $this->args['month']);
301
+		$this->__unset('month');
302 302
 	}
303 303
 
304 304
 	/**
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
 	 * @return void
311 311
 	 */
312 312
 	public function orderby() {
313
-		switch ( $this->args['orderby'] ) {
313
+		switch ($this->args['orderby']) {
314 314
 			case 'amount' :
315
-				$this->__set( 'orderby', 'meta_value_num' );
316
-				$this->__set( 'meta_key', '_give_payment_total' );
315
+				$this->__set('orderby', 'meta_value_num');
316
+				$this->__set('meta_key', '_give_payment_total');
317 317
 				break;
318 318
 			default :
319
-				$this->__set( 'orderby', $this->args['orderby'] );
319
+				$this->__set('orderby', $this->args['orderby']);
320 320
 				break;
321 321
 		}
322 322
 	}
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
 	 * @return void
331 331
 	 */
332 332
 	public function user() {
333
-		if ( is_null( $this->args['user'] ) ) {
333
+		if (is_null($this->args['user'])) {
334 334
 			return;
335 335
 		}
336 336
 
337
-		if ( is_numeric( $this->args['user'] ) ) {
337
+		if (is_numeric($this->args['user'])) {
338 338
 			$user_key = '_give_payment_user_id';
339 339
 		} else {
340 340
 			$user_key = '_give_payment_user_email';
341 341
 		}
342 342
 
343
-		$this->__set( 'meta_query', array(
343
+		$this->__set('meta_query', array(
344 344
 			'key'   => $user_key,
345 345
 			'value' => $this->args['user']
346
-		) );
346
+		));
347 347
 	}
348 348
 
349 349
 	/**
@@ -356,33 +356,33 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	public function search() {
358 358
 
359
-		if ( ! isset( $this->args['s'] ) ) {
359
+		if ( ! isset($this->args['s'])) {
360 360
 			return;
361 361
 		}
362 362
 
363
-		$search = trim( $this->args['s'] );
363
+		$search = trim($this->args['s']);
364 364
 
365
-		if ( empty( $search ) ) {
365
+		if (empty($search)) {
366 366
 			return;
367 367
 		}
368 368
 
369
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
370
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
369
+		$is_email = is_email($search) || strpos($search, '@') !== false;
370
+		$is_user  = strpos($search, strtolower('user:')) !== false;
371 371
 
372
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
372
+		if ( ! empty($this->args['search_in_notes'])) {
373 373
 
374
-			$notes = give_get_payment_notes( 0, $search );
374
+			$notes = give_get_payment_notes(0, $search);
375 375
 
376
-			if ( ! empty( $notes ) ) {
376
+			if ( ! empty($notes)) {
377 377
 
378
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
378
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
379 379
 
380
-				$this->__set( 'post__in', $payment_ids );
380
+				$this->__set('post__in', $payment_ids);
381 381
 			}
382 382
 
383
-			$this->__unset( 's' );
383
+			$this->__unset('s');
384 384
 
385
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
385
+		} elseif ($is_email || strlen($search) == 32) {
386 386
 
387 387
 			$key         = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key';
388 388
 			$search_meta = array(
@@ -391,19 +391,19 @@  discard block
 block discarded – undo
391 391
 				'compare' => 'LIKE'
392 392
 			);
393 393
 
394
-			$this->__set( 'meta_query', $search_meta );
395
-			$this->__unset( 's' );
394
+			$this->__set('meta_query', $search_meta);
395
+			$this->__unset('s');
396 396
 
397
-		} elseif ( $is_user ) {
397
+		} elseif ($is_user) {
398 398
 
399 399
 			$search_meta = array(
400 400
 				'key'   => '_give_payment_user_id',
401
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) )
401
+				'value' => trim(str_replace('user:', '', strtolower($search)))
402 402
 			);
403 403
 
404
-			$this->__set( 'meta_query', $search_meta );
404
+			$this->__set('meta_query', $search_meta);
405 405
 
406
-			if ( give_get_option( 'enable_sequential' ) ) {
406
+			if (give_get_option('enable_sequential')) {
407 407
 
408 408
 				$search_meta = array(
409 409
 					'key'     => '_give_payment_number',
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 					'compare' => 'LIKE'
412 412
 				);
413 413
 
414
-				$this->__set( 'meta_query', $search_meta );
414
+				$this->__set('meta_query', $search_meta);
415 415
 
416 416
 				$this->args['meta_query']['relation'] = 'OR';
417 417
 
418 418
 			}
419 419
 
420
-			$this->__unset( 's' );
420
+			$this->__unset('s');
421 421
 
422 422
 		} elseif (
423
-			give_get_option( 'enable_sequential' ) &&
423
+			give_get_option('enable_sequential') &&
424 424
 			(
425
-				false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) ||
426
-				false !== strpos( $search, give_get_option( 'sequential_postfix' ) )
425
+				false !== strpos($search, give_get_option('sequential_prefix')) ||
426
+				false !== strpos($search, give_get_option('sequential_postfix'))
427 427
 			)
428 428
 		) {
429 429
 
@@ -433,30 +433,30 @@  discard block
 block discarded – undo
433 433
 				'compare' => 'LIKE'
434 434
 			);
435 435
 
436
-			$this->__set( 'meta_query', $search_meta );
437
-			$this->__unset( 's' );
436
+			$this->__set('meta_query', $search_meta);
437
+			$this->__unset('s');
438 438
 
439
-		} elseif ( is_numeric( $search ) ) {
439
+		} elseif (is_numeric($search)) {
440 440
 
441
-			$post = get_post( $search );
441
+			$post = get_post($search);
442 442
 
443
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
443
+			if (is_object($post) && $post->post_type == 'give_payment') {
444 444
 
445 445
 				$arr   = array();
446 446
 				$arr[] = $search;
447
-				$this->__set( 'post__in', $arr );
448
-				$this->__unset( 's' );
447
+				$this->__set('post__in', $arr);
448
+				$this->__unset('s');
449 449
 			}
450 450
 
451
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
451
+		} elseif ('#' == substr($search, 0, 1)) {
452 452
 
453
-			$search = str_replace( '#:', '', $search );
454
-			$search = str_replace( '#', '', $search );
455
-			$this->__set( 'give_forms', $search );
456
-			$this->__unset( 's' );
453
+			$search = str_replace('#:', '', $search);
454
+			$search = str_replace('#', '', $search);
455
+			$this->__set('give_forms', $search);
456
+			$this->__unset('s');
457 457
 
458 458
 		} else {
459
-			$this->__set( 's', $search );
459
+			$this->__set('s', $search);
460 460
 
461 461
 		}
462 462
 
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
 	 * @return void
472 472
 	 */
473 473
 	public function mode() {
474
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
475
-			$this->__unset( 'mode' );
474
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
475
+			$this->__unset('mode');
476 476
 
477 477
 			return;
478 478
 		}
479 479
 
480
-		$this->__set( 'meta_query', array(
480
+		$this->__set('meta_query', array(
481 481
 			'key'   => '_give_payment_mode',
482 482
 			'value' => $this->args['mode']
483
-		) );
483
+		));
484 484
 	}
485 485
 
486 486
 	/**
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 	 * @return void
493 493
 	 */
494 494
 	public function children() {
495
-		if ( empty( $this->args['children'] ) ) {
496
-			$this->__set( 'post_parent', 0 );
495
+		if (empty($this->args['children'])) {
496
+			$this->__set('post_parent', 0);
497 497
 		}
498
-		$this->__unset( 'children' );
498
+		$this->__unset('children');
499 499
 	}
500 500
 
501 501
 	/**
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 */
509 509
 	public function give_forms() {
510 510
 
511
-		if ( empty( $this->args['give_forms'] ) ) {
511
+		if (empty($this->args['give_forms'])) {
512 512
 			return;
513 513
 		}
514 514
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		$args = array(
518 518
 			'post_parent'            => $this->args['give_forms'],
519 519
 			'log_type'               => 'sale',
520
-			'post_status'            => array( 'publish' ),
520
+			'post_status'            => array('publish'),
521 521
 			'nopaging'               => true,
522 522
 			'no_found_rows'          => true,
523 523
 			'update_post_term_cache' => false,
@@ -526,31 +526,31 @@  discard block
 block discarded – undo
526 526
 			'fields'                 => 'ids'
527 527
 		);
528 528
 
529
-		if ( is_array( $this->args['give_forms'] ) ) {
530
-			unset( $args['post_parent'] );
529
+		if (is_array($this->args['give_forms'])) {
530
+			unset($args['post_parent']);
531 531
 			$args['post_parent__in'] = $this->args['give_forms'];
532 532
 		}
533 533
 
534
-		$sales = $give_logs->get_connected_logs( $args );
534
+		$sales = $give_logs->get_connected_logs($args);
535 535
 
536
-		if ( ! empty( $sales ) ) {
536
+		if ( ! empty($sales)) {
537 537
 
538 538
 			$payments = array();
539 539
 
540
-			foreach ( $sales as $sale ) {
541
-				$payments[] = get_post_meta( $sale, '_give_log_payment_id', true );
540
+			foreach ($sales as $sale) {
541
+				$payments[] = get_post_meta($sale, '_give_log_payment_id', true);
542 542
 			}
543 543
 
544
-			$this->__set( 'post__in', $payments );
544
+			$this->__set('post__in', $payments);
545 545
 
546 546
 		} else {
547 547
 
548 548
 			// Set post_parent to something crazy so it doesn't find anything
549
-			$this->__set( 'post_parent', 999999999999999 );
549
+			$this->__set('post_parent', 999999999999999);
550 550
 
551 551
 		}
552 552
 
553
-		$this->__unset( 'give_forms' );
553
+		$this->__unset('give_forms');
554 554
 
555 555
 	}
556 556
 
Please login to merge, or discard this patch.
includes/deprecated/deprecated-actions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@
 block discarded – undo
55 55
 	'give_donation_mode_bottom'                => 'give_payment_mode_bottom',
56 56
 );
57 57
 
58
-foreach ( $give_map_deprecated_actions as $new => $old ) {
58
+foreach ($give_map_deprecated_actions as $new => $old) {
59 59
 	// Allow action to accept four param in which remaining three has default value.
60 60
 	// By this way, we can dynamically pass upto four params to fire new action manually.
61
-	add_action( $new, 'give_deprecated_action_mapping', 10, 4 );
61
+	add_action($new, 'give_deprecated_action_mapping', 10, 4);
62 62
 }
63 63
 
64
-function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
64
+function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') {
65 65
 	global $give_map_deprecated_actions;
66 66
 
67 67
 	$action = current_filter();
68 68
 	
69
-	if ( isset( $give_map_deprecated_actions[ $action ] ) ) {
70
-		if ( has_action( $give_map_deprecated_actions[ $action ] ) ) {
71
-			do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 );
69
+	if (isset($give_map_deprecated_actions[$action])) {
70
+		if (has_action($give_map_deprecated_actions[$action])) {
71
+			do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3);
72 72
 
73
-			if ( ! defined( 'DOING_AJAX' ) ) {
74
-				_give_deprecated_function( 'The ' . $give_map_deprecated_actions[ $action ] . ' action', '1.7', $action );
73
+			if ( ! defined('DOING_AJAX')) {
74
+				_give_deprecated_function('The '.$give_map_deprecated_actions[$action].' action', '1.7', $action);
75 75
 			}
76 76
 		}
77 77
 	}
Please login to merge, or discard this patch.
includes/deprecated/deprecated-filters.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 // Dynamic filters.
51
-switch ( true ) {
52
-	case ( ! empty( $_GET['payment-confirmation'] ) ) :
51
+switch (true) {
52
+	case ( ! empty($_GET['payment-confirmation'])) :
53 53
 		$give_map_deprecated_filters["give_donation_confirm_{$_GET['payment-confirmation']}"] = "give_payment_confirm_{$_GET['payment-confirmation']}";
54 54
 }
55 55
 
56
-foreach ( $give_map_deprecated_filters as $new => $old ) {
57
-	add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 );
56
+foreach ($give_map_deprecated_filters as $new => $old) {
57
+	add_filter($new, 'give_deprecated_filter_mapping', 10, 4);
58 58
 }
59 59
 
60 60
 /**
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed|void
69 69
  */
70
-function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
70
+function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') {
71 71
 	global $give_map_deprecated_filters;
72 72
 
73 73
 	$filter = current_filter();
74 74
 
75
-	if ( isset( $give_map_deprecated_filters[ $filter ] ) ) {
76
-		if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) {
77
-			$data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 );
75
+	if (isset($give_map_deprecated_filters[$filter])) {
76
+		if (has_filter($give_map_deprecated_filters[$filter])) {
77
+			$data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3);
78 78
 
79
-			if ( ! defined( 'DOING_AJAX' ) ) {
80
-				_give_deprecated_function( 'The ' . $give_map_deprecated_filters[ $filter ] . ' filter', '1.7', $filter );
79
+			if ( ! defined('DOING_AJAX')) {
80
+				_give_deprecated_function('The '.$give_map_deprecated_filters[$filter].' filter', '1.7', $filter);
81 81
 			}
82 82
 		}
83 83
 	}
Please login to merge, or discard this patch.
includes/error-tracking.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,33 +29,33 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @return void
31 31
  */
32
-function give_print_errors( $form_id ) {
32
+function give_print_errors($form_id) {
33 33
 
34 34
 	$errors = give_get_errors();
35 35
 
36
-	$request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0;
36
+	$request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0;
37 37
 
38 38
 	//Sanity checks first: Ensure that gateway returned errors display on the appropriate form
39
-	if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
39
+	if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( $errors ) {
44
-		$classes = apply_filters( 'give_error_class', array(
43
+	if ($errors) {
44
+		$classes = apply_filters('give_error_class', array(
45 45
 			'give_errors'
46
-		) );
47
-		echo '<div class="' . implode( ' ', $classes ) . '">';
46
+		));
47
+		echo '<div class="'.implode(' ', $classes).'">';
48 48
 		// Loop error codes and display errors
49
-		foreach ( $errors as $error_id => $error ) {
50
-			echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . esc_html__( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>';
49
+		foreach ($errors as $error_id => $error) {
50
+			echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.esc_html__('Error', 'give').'</strong>: '.$error.'</p></div>';
51 51
 		}
52 52
 		echo '</div>';
53 53
 		give_clear_errors();
54 54
 	}
55 55
 }
56 56
 
57
-add_action( 'give_donation_form_before_personal_info', 'give_print_errors' );
58
-add_action( 'give_ajax_checkout_errors', 'give_print_errors' );
57
+add_action('give_donation_form_before_personal_info', 'give_print_errors');
58
+add_action('give_ajax_checkout_errors', 'give_print_errors');
59 59
 
60 60
 /**
61 61
  * Get Errors
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return mixed array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71
-	return Give()->session->get( 'give_errors' );
71
+	return Give()->session->get('give_errors');
72 72
 }
73 73
 
74 74
 /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return void
86 86
  */
87
-function give_set_error( $error_id, $error_message ) {
87
+function give_set_error($error_id, $error_message) {
88 88
 	$errors = give_get_errors();
89
-	if ( ! $errors ) {
89
+	if ( ! $errors) {
90 90
 		$errors = array();
91 91
 	}
92
-	$errors[ $error_id ] = $error_message;
93
-	Give()->session->set( 'give_errors', $errors );
92
+	$errors[$error_id] = $error_message;
93
+	Give()->session->set('give_errors', $errors);
94 94
 }
95 95
 
96 96
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return void
102 102
  */
103 103
 function give_clear_errors() {
104
-	Give()->session->set( 'give_errors', null );
104
+	Give()->session->set('give_errors', null);
105 105
 }
106 106
 
107 107
 /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_unset_error( $error_id ) {
117
+function give_unset_error($error_id) {
118 118
 	$errors = give_get_errors();
119
-	if ( $errors ) {
120
-		unset( $errors[ $error_id ] );
121
-		Give()->session->set( 'give_errors', $errors );
119
+	if ($errors) {
120
+		unset($errors[$error_id]);
121
+		Give()->session->set('give_errors', $errors);
122 122
 	}
123 123
 }
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * @return string/void
130 130
  */
131 131
 function _give_die_handler() {
132
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
132
+	if (defined('GIVE_UNIT_TESTS')) {
133 133
 		return '_give_die_handler';
134 134
 	} else {
135 135
 		die();
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
  * 
150 150
  * @return void
151 151
  */
152
-function give_die( $message = '', $title = '', $status = 400 ) {
153
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
154
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
155
-	wp_die( $message, $title, array( 'response' => $status ) );
152
+function give_die($message = '', $title = '', $status = 400) {
153
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
154
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
155
+	wp_die($message, $title, array('response' => $status));
156 156
 }
157 157
 
158 158
 /**
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return   string  $error
169 169
  */
170
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
171
-	$error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error  give_' . $error_id . '">' . $message . '</p></div>';
170
+function give_output_error($message, $echo = true, $error_id = 'warning') {
171
+	$error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error  give_'.$error_id.'">'.$message.'</p></div>';
172 172
 
173
-	if ( $echo ) {
173
+	if ($echo) {
174 174
 		echo $error;
175 175
 	} else {
176 176
 		return $error;
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -64,50 +64,50 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool If the gravatar exists or not
66 66
 	 */
67
-	public function validate_gravatar( $id_or_email ) {
67
+	public function validate_gravatar($id_or_email) {
68 68
 		//id or email code borrowed from wp-includes/pluggable.php
69 69
 		$email = '';
70
-		if ( is_numeric( $id_or_email ) ) {
70
+		if (is_numeric($id_or_email)) {
71 71
 			$id   = (int) $id_or_email;
72
-			$user = get_userdata( $id );
73
-			if ( $user ) {
72
+			$user = get_userdata($id);
73
+			if ($user) {
74 74
 				$email = $user->user_email;
75 75
 			}
76
-		} elseif ( is_object( $id_or_email ) ) {
76
+		} elseif (is_object($id_or_email)) {
77 77
 			// No avatar for pingbacks or trackbacks
78
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
79
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
78
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
79
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
80 80
 				return false;
81 81
 			}
82 82
 
83
-			if ( ! empty( $id_or_email->user_id ) ) {
83
+			if ( ! empty($id_or_email->user_id)) {
84 84
 				$id   = (int) $id_or_email->user_id;
85
-				$user = get_userdata( $id );
86
-				if ( $user ) {
85
+				$user = get_userdata($id);
86
+				if ($user) {
87 87
 					$email = $user->user_email;
88 88
 				}
89
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
89
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
90 90
 				$email = $id_or_email->comment_author_email;
91 91
 			}
92 92
 		} else {
93 93
 			$email = $id_or_email;
94 94
 		}
95 95
 
96
-		$hashkey = md5( strtolower( trim( $email ) ) );
97
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
96
+		$hashkey = md5(strtolower(trim($email)));
97
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
98 98
 
99
-		$data = wp_cache_get( $hashkey );
100
-		if ( false === $data ) {
101
-			$response = wp_remote_head( $uri );
102
-			if ( is_wp_error( $response ) ) {
99
+		$data = wp_cache_get($hashkey);
100
+		if (false === $data) {
101
+			$response = wp_remote_head($uri);
102
+			if (is_wp_error($response)) {
103 103
 				$data = 'not200';
104 104
 			} else {
105 105
 				$data = $response['response']['code'];
106 106
 			}
107
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
107
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
108 108
 
109 109
 		}
110
-		if ( $data == '200' ) {
110
+		if ($data == '200') {
111 111
 			return true;
112 112
 		} else {
113 113
 			return false;
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return array        IDs if logs, false otherwise
126 126
 	 */
127
-	public function get_log_ids( $form_id = '' ) {
127
+	public function get_log_ids($form_id = '') {
128 128
 
129 129
 		// get Give_Logging class
130 130
 		global $give_logs;
131 131
 
132 132
 		// get log for this form
133
-		$logs = $give_logs->get_logs( $form_id );
133
+		$logs = $give_logs->get_logs($form_id);
134 134
 
135
-		if ( $logs ) {
135
+		if ($logs) {
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,49 +155,49 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		global $give_options;
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have donated more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
178
+				$email = get_post_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			// strip duplicate emails
191
-			$unique_emails = array_unique( $unique_emails );
191
+			$unique_emails = array_unique($unique_emails);
192 192
 
193 193
 			// convert the unique IDs back into simple array
194
-			foreach ( $unique_emails as $id => $email ) {
194
+			foreach ($unique_emails as $id => $email) {
195 195
 				$unique_ids[] = $id;
196 196
 			}
197 197
 
198 198
 			// randomize the payment IDs if enabled
199
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
200
-				shuffle( $unique_ids );
199
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
200
+				shuffle($unique_ids);
201 201
 			}
202 202
 
203 203
 			// return our unique IDs
@@ -218,22 +218,22 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return string
220 220
 	 */
221
-	public function gravatars( $form_id = false, $title = '' ) {
221
+	public function gravatars($form_id = false, $title = '') {
222 222
 
223 223
 		// unique $payment_ids 
224
-		$payment_ids = $this->get_payment_ids( $form_id );
224
+		$payment_ids = $this->get_payment_ids($form_id);
225 225
 
226 226
 		global $give_options;
227 227
 
228 228
 		// return if no ID
229
-		if ( ! $form_id ) {
229
+		if ( ! $form_id) {
230 230
 			return;
231 231
 		}
232 232
 
233 233
 		// minimum amount of donations before showing gravatars
234 234
 		// if the number of items in array is not greater or equal to the number specified, then exit
235
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
236
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
235
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
236
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
237 237
 				return;
238 238
 			}
239 239
 		}
@@ -244,51 +244,51 @@  discard block
 block discarded – undo
244 244
 		echo '<div id="give-purchase-gravatars">';
245 245
 
246 246
 
247
-		if ( isset ( $title ) ) {
247
+		if (isset ($title)) {
248 248
 
249
-			if ( $title ) {
250
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
251
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
252
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' );
249
+			if ($title) {
250
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
251
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
252
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>');
253 253
 			}
254 254
 
255 255
 		}
256 256
 		echo '<ul class="give-purchase-gravatars-list">';
257 257
 		$i = 0;
258 258
 
259
-		if ( $payment_ids ) {
260
-			foreach ( $payment_ids as $id ) {
259
+		if ($payment_ids) {
260
+			foreach ($payment_ids as $id) {
261 261
 
262 262
 				// Give saves a blank option even when the control is turned off, hence the extra check
263
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
263
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
264 264
 					continue;
265 265
 				}
266 266
 
267 267
 				// get the payment meta
268
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
268
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
269 269
 
270 270
 				// unserialize the payment meta
271
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
271
+				$user_info = maybe_unserialize($payment_meta['user_info']);
272 272
 
273 273
 				// get donor's first name
274 274
 				$name = $user_info['first_name'];
275 275
 
276 276
 				// get donor's email
277
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
277
+				$email = get_post_meta($id, '_give_payment_user_email', true);
278 278
 
279 279
 				// set gravatar size and provide filter
280
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
280
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
281 281
 
282 282
 				// default image
283
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
283
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
284 284
 
285 285
 				// assemble output
286 286
 				$output .= '<li>';
287 287
 
288
-				$output .= get_avatar( $email, $size, $default_image, $name );
288
+				$output .= get_avatar($email, $size, $default_image, $name);
289 289
 				$output .= '</li>';
290 290
 
291
-				$i ++;
291
+				$i++;
292 292
 
293 293
 			} // end foreach
294 294
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		echo '</ul>';
298 298
 		echo '</div>';
299 299
 
300
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
300
+		return apply_filters('give_donors_gravatars', ob_get_clean());
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return void
310 310
 	 */
311 311
 	public function register_widget() {
312
-		register_widget( 'Give_Donors_Gravatars_Widget' );
312
+		register_widget('Give_Donors_Gravatars_Widget');
313 313
 	}
314 314
 
315 315
 	/**
@@ -325,19 +325,19 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @todo   Set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
327 327
 	 */
328
-	public function shortcode( $atts, $content = null ) {
328
+	public function shortcode($atts, $content = null) {
329 329
 
330
-		$atts = shortcode_atts( array(
330
+		$atts = shortcode_atts(array(
331 331
 			'id'    => '',
332 332
 			'title' => ''
333
-		), $atts, 'give_donors_gravatars' );
333
+		), $atts, 'give_donors_gravatars');
334 334
 
335 335
 		// if no ID is passed on single give_forms pages, get the correct ID
336
-		if ( is_singular( 'give_forms' ) ) {
336
+		if (is_singular('give_forms')) {
337 337
 			$id = get_the_ID();
338 338
 		}
339 339
 
340
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
340
+		$content = $this->gravatars($atts['id'], $atts['title']);
341 341
 
342 342
 		return $content;
343 343
 
@@ -353,57 +353,57 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return array           Gravatar settings.
355 355
 	 */
356
-	public function settings( $settings ) {
356
+	public function settings($settings) {
357 357
 
358 358
 		$give_gravatar_settings = array(
359 359
 			array(
360
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
360
+				'name' => esc_html__('Donator Gravatars', 'give'),
361 361
 				'desc' => '<hr>',
362 362
 				'id'   => 'give_title',
363 363
 				'type' => 'give_title'
364 364
 			),
365 365
 			array(
366
-				'name' => esc_html__( 'Heading', 'give' ),
367
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
366
+				'name' => esc_html__('Heading', 'give'),
367
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
368 368
 				'type' => 'text',
369 369
 				'id'   => 'give_donors_gravatars_heading'
370 370
 			),
371 371
 			array(
372
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
373
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
372
+				'name'    => esc_html__('Gravatar Size', 'give'),
373
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
374 374
 				'type'    => 'text_small',
375 375
 				'id'      => 'give_donors_gravatars_gravatar_size',
376 376
 				'default' => '64'
377 377
 			),
378 378
 			array(
379
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
379
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
380 380
 				/* translators: %s: form singular label */
381
-				'desc' => sprintf( esc_html__( 'The minimum number of unique donations a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
381
+				'desc' => sprintf(esc_html__('The minimum number of unique donations a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
382 382
 				'type' => 'text_small',
383 383
 				'id'   => 'give_donors_gravatars_min_purchases_required',
384 384
 			),
385 385
 			array(
386
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
387
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
386
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
387
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
388 388
 				'type'    => 'text',
389 389
 				'id'      => 'give_donors_gravatars_maximum_number',
390 390
 				'default' => '20',
391 391
 			),
392 392
 			array(
393
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
394
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
393
+				'name' => esc_html__('Gravatar Visibility', 'give'),
394
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
395 395
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
396 396
 				'type' => 'checkbox',
397 397
 			),
398 398
 			array(
399
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
400
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
399
+				'name' => esc_html__('Randomize Gravatars', 'give'),
400
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
401 401
 				'id'   => 'give_donors_gravatars_random_gravatars',
402 402
 				'type' => 'checkbox',
403 403
 			),
404 404
 		);
405 405
 
406
-		return array_merge( $settings, $give_gravatar_settings );
406
+		return array_merge($settings, $give_gravatar_settings);
407 407
 	}
408 408
 
409 409
 }
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function __construct() {
430 430
 
431
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
431
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
432 432
 
433 433
 		// widget settings
434 434
 		$widget_ops = array(
435 435
 			'classname'   => 'give-donors-gravatars',
436 436
 			/* translators: 1: form singular label 2: form singular label */
437
-			'description' => sprintf( esc_html__( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular )
437
+			'description' => sprintf(esc_html__('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular)
438 438
 		);
439 439
 
440 440
 		// widget control settings
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		// create the widget
448 448
 		parent::__construct(
449 449
 			'give_donors_gravatars_widget',
450
-			esc_html__( 'Give Donors Gravatars', 'give' ),
450
+			esc_html__('Give Donors Gravatars', 'give'),
451 451
 			$widget_ops,
452 452
 			$control_ops
453 453
 		);
@@ -467,30 +467,30 @@  discard block
 block discarded – undo
467 467
 	 *
468 468
 	 * @return void
469 469
 	 */
470
-	public function widget( $args, $instance ) {
470
+	public function widget($args, $instance) {
471 471
 		global $give_options;
472 472
 
473 473
 		//@TODO: Don't extract it!!!
474
-		extract( $args );
474
+		extract($args);
475 475
 
476
-		if ( ! is_singular( 'give_forms' ) ) {
476
+		if ( ! is_singular('give_forms')) {
477 477
 			return;
478 478
 		}
479 479
 
480 480
 		// Variables from widget settings
481
-		$title = apply_filters( 'widget_title', $instance['title'] );
481
+		$title = apply_filters('widget_title', $instance['title']);
482 482
 
483 483
 		// Used by themes. Opens the widget
484 484
 		echo $before_widget;
485 485
 
486 486
 		// Display the widget title
487
-		if ( $title ) {
488
-			echo $before_title . $title . $after_title;
487
+		if ($title) {
488
+			echo $before_title.$title.$after_title;
489 489
 		}
490 490
 
491 491
 		$gravatars = new Give_Donors_Gravatars();
492 492
 
493
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
493
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
494 494
 
495 495
 		// Used by themes. Closes the widget
496 496
 		echo $after_widget;
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 *
511 511
 	 * @return array Updated settings to save.
512 512
 	 */
513
-	public function update( $new_instance, $old_instance ) {
513
+	public function update($new_instance, $old_instance) {
514 514
 
515 515
 		$instance = $old_instance;
516 516
 
517
-		$instance['title'] = strip_tags( $new_instance['title'] );
517
+		$instance['title'] = strip_tags($new_instance['title']);
518 518
 
519 519
 		return $instance;
520 520
 
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return void
534 534
 	 */
535
-	public function form( $instance ) {
535
+	public function form($instance) {
536 536
 
537 537
 		// Set up some default widget settings.
538 538
 		$defaults = array(
539 539
 			'title' => '',
540 540
 		);
541 541
 
542
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
542
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
543 543
 
544 544
 		<!-- Title -->
545 545
 		<p>
546
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
547
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
546
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
547
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
548 548
 		</p>
549 549
 
550 550
 		<?php
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => esc_html__( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => esc_html__('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => esc_html__( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => esc_html__( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => esc_html__( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => esc_html__( 'New %1$s', 'give' ),
48
-		'all_items'          => esc_html__( 'All %2$s', 'give' ),
49
-		'view_item'          => esc_html__( 'View %1$s', 'give' ),
50
-		'search_items'       => esc_html__( 'Search %2$s', 'give' ),
51
-		'not_found'          => esc_html__( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => esc_html__( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => esc_html__('Add %1$s', 'give'),
45
+		'add_new_item'       => esc_html__('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => esc_html__('Edit Donation %1$s', 'give'),
47
+		'new_item'           => esc_html__('New %1$s', 'give'),
48
+		'all_items'          => esc_html__('All %2$s', 'give'),
49
+		'view_item'          => esc_html__('View %1$s', 'give'),
50
+		'search_items'       => esc_html__('Search %2$s', 'give'),
51
+		'not_found'          => esc_html__('No %2$s found', 'give'),
52
+		'not_found_in_trash' => esc_html__('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Donation Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => esc_html__( 'Add New', 'give' ),
104
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
105
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
106
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
107
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
108
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
109
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
110
-		'not_found'          => esc_html__( 'No Donations Found', 'give' ),
111
-		'not_found_in_trash' => esc_html__( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => esc_html__('Add New', 'give'),
104
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
105
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
106
+		'new_item'           => esc_html__('New Donation', 'give'),
107
+		'all_items'          => esc_html__('All Donations', 'give'),
108
+		'view_item'          => esc_html__('View Donation', 'give'),
109
+		'search_items'       => esc_html__('Search Donations', 'give'),
110
+		'not_found'          => esc_html__('No Donations Found', 'give'),
111
+		'not_found_in_trash' => esc_html__('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => esc_html__( 'Donations', 'give' )
113
+		'menu_name'          => esc_html__('Donations', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_donation_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_donation_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147 147
 		/* translators: %s: form singular label */
148
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
149
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
150
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
151
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
152
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
153
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
154
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
155
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
148
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
149
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
150
+		'search_items'      => esc_html__('Search Categories', 'give'),
151
+		'all_items'         => esc_html__('All Categories', 'give'),
152
+		'parent_item'       => esc_html__('Parent Category', 'give'),
153
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
154
+		'edit_item'         => esc_html__('Edit Category', 'give'),
155
+		'update_item'       => esc_html__('Update Category', 'give'),
156 156
 		/* translators: %s: form singular label */
157
-		'add_new_item'      => sprintf( esc_html__( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
158
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
159
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
157
+		'add_new_item'      => sprintf(esc_html__('Add New %s Category', 'give'), give_get_forms_label_singular()),
158
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
159
+		'menu_name'         => esc_html__('Categories', 'give'),
160 160
 	);
161 161
 
162
-	$category_args = apply_filters( 'give_forms_category_args', array(
162
+	$category_args = apply_filters('give_forms_category_args', array(
163 163
 			'hierarchical' => true,
164
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
164
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
165 165
 			'show_ui'      => true,
166 166
 			'query_var'    => 'give_forms_category',
167 167
 			'rewrite'      => array(
168
-				'slug'         => $slug . '/category',
168
+				'slug'         => $slug.'/category',
169 169
 				'with_front'   => false,
170 170
 				'hierarchical' => true
171 171
 			),
@@ -179,36 +179,36 @@  discard block
 block discarded – undo
179 179
 	);
180 180
 
181 181
 	//Does the user want categories?
182
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
183
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
184
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
182
+	if (give_get_option('enable_categories') == 'on') {
183
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
184
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
185 185
 	}
186 186
 
187 187
 
188 188
 	/** Tags */
189 189
 	$tag_labels = array(
190 190
 		/* translators: %s: form singular label */
191
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
192
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
193
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
194
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
195
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
196
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
197
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
198
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
199
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
200
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
201
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
191
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
192
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
193
+		'search_items'          => esc_html__('Search Tags', 'give'),
194
+		'all_items'             => esc_html__('All Tags', 'give'),
195
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
196
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
197
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
198
+		'update_item'           => esc_html__('Update Tag', 'give'),
199
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
200
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
201
+		'menu_name'             => esc_html__('Tags', 'give'),
202 202
 		/* translators: %s: form singular label */
203
-		'choose_from_most_used' => sprintf( esc_html__( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ),
203
+		'choose_from_most_used' => sprintf(esc_html__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()),
204 204
 	);
205 205
 
206
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
206
+	$tag_args = apply_filters('give_forms_tag_args', array(
207 207
 			'hierarchical' => false,
208
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
208
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
209 209
 			'show_ui'      => true,
210 210
 			'query_var'    => 'give_forms_tag',
211
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
211
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
212 212
 			'capabilities' => array(
213 213
 				'manage_terms' => 'manage_give_form_terms',
214 214
 				'edit_terms'   => 'edit_give_form_terms',
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		)
219 219
 	);
220 220
 
221
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
222
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
223
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
221
+	if (give_get_option('enable_tags') == 'on') {
222
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
223
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
224 224
 	}
225 225
 
226 226
 
227 227
 }
228 228
 
229
-add_action( 'init', 'give_setup_taxonomies', 0 );
229
+add_action('init', 'give_setup_taxonomies', 0);
230 230
 
231 231
 
232 232
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function give_get_default_form_labels() {
239 239
 	$defaults = array(
240
-		'singular' => esc_html__( 'Form', 'give' ),
241
-		'plural'   => esc_html__( 'Forms', 'give' )
240
+		'singular' => esc_html__('Form', 'give'),
241
+		'plural'   => esc_html__('Forms', 'give')
242 242
 	);
243 243
 
244
-	return apply_filters( 'give_default_form_name', $defaults );
244
+	return apply_filters('give_default_form_name', $defaults);
245 245
 }
246 246
 
247 247
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string $defaults['singular'] Singular label
255 255
  */
256
-function give_get_forms_label_singular( $lowercase = false ) {
256
+function give_get_forms_label_singular($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
259
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
260 260
 }
261 261
 
262 262
 /**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
  * @since 1.0
266 266
  * @return string $defaults['plural'] Plural label
267 267
  */
268
-function give_get_forms_label_plural( $lowercase = false ) {
268
+function give_get_forms_label_plural($lowercase = false) {
269 269
 	$defaults = give_get_default_form_labels();
270 270
 
271
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
271
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
272 272
 }
273 273
 
274 274
 /**
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return string $title New placeholder text
282 282
  */
283
-function give_change_default_title( $title ) {
283
+function give_change_default_title($title) {
284 284
 	// If a frontend plugin uses this filter (check extensions before changing this function)
285
-	if ( ! is_admin() ) {
285
+	if ( ! is_admin()) {
286 286
 		$title = sprintf(
287 287
 			/* translators: %s: form singular label */
288
-			esc_html__( 'Enter %s title here', 'give' ),
288
+			esc_html__('Enter %s title here', 'give'),
289 289
 			give_get_forms_label_singular()
290 290
 		);
291 291
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 
295 295
 	$screen = get_current_screen();
296 296
 
297
-	if ( 'give_forms' == $screen->post_type ) {
297
+	if ('give_forms' == $screen->post_type) {
298 298
 		$title = sprintf(
299 299
 			/* translators: %s: form singular label */
300
-			esc_html__( 'Enter %s title here', 'give' ),
300
+			esc_html__('Enter %s title here', 'give'),
301 301
 			give_get_forms_label_singular()
302 302
 		);
303 303
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	return $title;
306 306
 }
307 307
 
308
-add_filter( 'enter_title_here', 'give_change_default_title' );
308
+add_filter('enter_title_here', 'give_change_default_title');
309 309
 
310 310
 /**
311 311
  * Registers Custom Post Statuses which are used by the Payments
@@ -315,50 +315,50 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function give_register_post_type_statuses() {
317 317
 	// Payment Statuses
318
-	register_post_status( 'refunded', array(
319
-		'label'                     => __( 'Refunded', 'give' ),
318
+	register_post_status('refunded', array(
319
+		'label'                     => __('Refunded', 'give'),
320 320
 		'public'                    => true,
321 321
 		'exclude_from_search'       => false,
322 322
 		'show_in_admin_all_list'    => true,
323 323
 		'show_in_admin_status_list' => true,
324
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
325
-	) );
326
-	register_post_status( 'failed', array(
327
-		'label'                     => __( 'Failed', 'give' ),
324
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
325
+	));
326
+	register_post_status('failed', array(
327
+		'label'                     => __('Failed', 'give'),
328 328
 		'public'                    => true,
329 329
 		'exclude_from_search'       => false,
330 330
 		'show_in_admin_all_list'    => true,
331 331
 		'show_in_admin_status_list' => true,
332
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
333
-	) );
334
-	register_post_status( 'revoked', array(
335
-		'label'                     => __( 'Revoked', 'give' ),
332
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
333
+	));
334
+	register_post_status('revoked', array(
335
+		'label'                     => __('Revoked', 'give'),
336 336
 		'public'                    => true,
337 337
 		'exclude_from_search'       => false,
338 338
 		'show_in_admin_all_list'    => true,
339 339
 		'show_in_admin_status_list' => true,
340
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
341
-	) );
342
-	register_post_status( 'cancelled', array(
343
-		'label'                     => __( 'Cancelled', 'give' ),
340
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
341
+	));
342
+	register_post_status('cancelled', array(
343
+		'label'                     => __('Cancelled', 'give'),
344 344
 		'public'                    => true,
345 345
 		'exclude_from_search'       => false,
346 346
 		'show_in_admin_all_list'    => true,
347 347
 		'show_in_admin_status_list' => true,
348
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
349
-	) );
350
-	register_post_status( 'abandoned', array(
351
-		'label'                     => __( 'Abandoned', 'give' ),
348
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
349
+	));
350
+	register_post_status('abandoned', array(
351
+		'label'                     => __('Abandoned', 'give'),
352 352
 		'public'                    => true,
353 353
 		'exclude_from_search'       => false,
354 354
 		'show_in_admin_all_list'    => true,
355 355
 		'show_in_admin_status_list' => true,
356
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
357
-	) );
356
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
357
+	));
358 358
 
359 359
 }
360 360
 
361
-add_action( 'init', 'give_register_post_type_statuses' );
361
+add_action('init', 'give_register_post_type_statuses');
362 362
 
363 363
 /**
364 364
  * Updated Messages
@@ -371,43 +371,43 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return array $messages New post updated messages
373 373
  */
374
-function give_updated_messages( $messages ) {
374
+function give_updated_messages($messages) {
375 375
 	global $post, $post_ID;
376 376
 
377
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
377
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
378 378
 	$url2 = give_get_forms_label_singular();
379 379
 	$url3 = '</a>';
380 380
 
381 381
 	$messages['give_forms'] = array(
382
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
383
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
384
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
385
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
386
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
382
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
383
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
384
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
385
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
386
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
387 387
 	);
388 388
 
389 389
 	return $messages;
390 390
 }
391 391
 
392
-add_filter( 'post_updated_messages', 'give_updated_messages' );
392
+add_filter('post_updated_messages', 'give_updated_messages');
393 393
 
394 394
 
395 395
 /**
396 396
  * Setup Post Type Images
397 397
  */
398
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
398
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
399 399
 
400 400
 /**
401 401
  * Ensure post thumbnail support is turned on
402 402
  */
403 403
 function give_add_thumbnail_support() {
404
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
404
+	if (give_get_option('disable_form_featured_img') === 'on') {
405 405
 		return;
406 406
 	}
407
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
408
-		add_theme_support( 'post-thumbnails' );
407
+	if ( ! current_theme_supports('post-thumbnails')) {
408
+		add_theme_support('post-thumbnails');
409 409
 	}
410
-	add_post_type_support( 'give_forms', 'thumbnail' );
410
+	add_post_type_support('give_forms', 'thumbnail');
411 411
 }
412 412
 
413 413
 /**
@@ -419,19 +419,19 @@  discard block
 block discarded – undo
419 419
 function give_widgets_init() {
420 420
 
421 421
 	//Single Give Forms (disabled if single turned off in settings)
422
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
422
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
423 423
 
424
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
425
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
424
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
425
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
426 426
 			'id'            => 'give-forms-sidebar',
427
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
427
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
428 428
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
429 429
 			'after_widget'  => '</div>',
430 430
 			'before_title'  => '<h3 class="widgettitle widget-title">',
431 431
 			'after_title'   => '</h3>',
432
-		) ) );
432
+		)));
433 433
 
434 434
 	}
435 435
 }
436 436
 
437
-add_action( 'widgets_init', 'give_widgets_init', 999 );
437
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -1169,26 +1169,26 @@  discard block
 block discarded – undo
1169 1169
  * @return void
1170 1170
  */
1171 1171
 function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1172
-    /* @var CMB2_Types $field_type_object*/
1172
+	/* @var CMB2_Types $field_type_object*/
1173 1173
 
1174
-    $id                   = $field_type_object->field->args['id'];
1174
+	$id                   = $field_type_object->field->args['id'];
1175 1175
 	$field_description    = $field_type_object->field->args['desc'];
1176 1176
 	$license              = $field_type_object->field->args['options']['license'];
1177
-    $license_key          = $escaped_value;
1178
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1179
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1180
-    $shortname            = $field_type_object->field->args['options']['shortname'];
1177
+	$license_key          = $escaped_value;
1178
+	$is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1179
+	$is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1180
+	$shortname            = $field_type_object->field->args['options']['shortname'];
1181 1181
 	$field_classes        = 'regular-text give-license-field';
1182 1182
 	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1183
-    $custom_html          = '';
1184
-    $value                = $escaped_value;
1185
-    $messages             = array();
1186
-    $class                = '';
1187
-    $account_page_link    = $field_type_object->field->args['options']['account_url'];
1188
-    $checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1189
-    $addon_name           = $field_type_object->field->args['options']['item_name'];
1190
-    $license_status       = null;
1191
-    $is_in_subscription   = null;
1183
+	$custom_html          = '';
1184
+	$value                = $escaped_value;
1185
+	$messages             = array();
1186
+	$class                = '';
1187
+	$account_page_link    = $field_type_object->field->args['options']['account_url'];
1188
+	$checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1189
+	$addon_name           = $field_type_object->field->args['options']['item_name'];
1190
+	$license_status       = null;
1191
+	$is_in_subscription   = null;
1192 1192
 
1193 1193
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1194 1194
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
@@ -1197,142 +1197,142 @@  discard block
 block discarded – undo
1197 1197
 	}
1198 1198
 
1199 1199
 
1200
-    // Check if current license is part of subscription or not.
1201
-    $subscriptions = get_option( 'give_subscriptions' );
1202
-
1203
-    if( $is_license_key && $subscriptions ) {
1204
-        foreach ( $subscriptions as $subscription ) {
1205
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1206
-                $is_in_subscription = $subscription['id'];
1207
-                break;
1208
-            }
1209
-        }
1210
-    }
1211
-
1212
-
1213
-    if( $is_license_key ) {
1214
-        if( $is_in_subscription ) {
1215
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1216
-            $subscription_status  = __( 'renew', 'give' );
1217
-
1218
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1219
-                $subscription_status = __( 'expire', 'give' );
1220
-            }
1221
-
1222
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1223
-                $messages[] = sprintf(
1224
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1225
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1226
-                    $subscriptions[$is_in_subscription]['payment_id'],
1227
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1228
-                );
1229
-                $license_status = 'license-expired';
1230
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1231
-                $messages[] = sprintf(
1232
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1233
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1234
-                    $subscriptions[$is_in_subscription]['payment_id'],
1235
-                    $subscription_status,
1236
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1237
-                );
1238
-                $license_status = 'license-expires-soon';
1239
-            } else {
1240
-                $messages[] = sprintf(
1241
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1242
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1243
-                    $subscriptions[$is_in_subscription]['payment_id'],
1244
-                    $subscription_status,
1245
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1246
-                );
1247
-                $license_status = 'license-expiration-date';
1248
-            }
1249
-
1250
-
1251
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1252
-
1253
-            // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1254
-            switch(   $license->error ) {
1255
-                case 'expired' :
1200
+	// Check if current license is part of subscription or not.
1201
+	$subscriptions = get_option( 'give_subscriptions' );
1202
+
1203
+	if( $is_license_key && $subscriptions ) {
1204
+		foreach ( $subscriptions as $subscription ) {
1205
+			if( in_array( $license_key, $subscription['licenses'] ) ) {
1206
+				$is_in_subscription = $subscription['id'];
1207
+				break;
1208
+			}
1209
+		}
1210
+	}
1211
+
1212
+
1213
+	if( $is_license_key ) {
1214
+		if( $is_in_subscription ) {
1215
+			$subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1216
+			$subscription_status  = __( 'renew', 'give' );
1217
+
1218
+			if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1219
+				$subscription_status = __( 'expire', 'give' );
1220
+			}
1221
+
1222
+			if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1223
+				$messages[] = sprintf(
1224
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1225
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1226
+					$subscriptions[$is_in_subscription]['payment_id'],
1227
+					$checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1228
+				);
1229
+				$license_status = 'license-expired';
1230
+			} elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1231
+				$messages[] = sprintf(
1232
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1233
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1234
+					$subscriptions[$is_in_subscription]['payment_id'],
1235
+					$subscription_status,
1236
+					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1237
+				);
1238
+				$license_status = 'license-expires-soon';
1239
+			} else {
1240
+				$messages[] = sprintf(
1241
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1242
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1243
+					$subscriptions[$is_in_subscription]['payment_id'],
1244
+					$subscription_status,
1245
+					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1246
+				);
1247
+				$license_status = 'license-expiration-date';
1248
+			}
1249
+
1250
+
1251
+		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1252
+
1253
+			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1254
+			switch(   $license->error ) {
1255
+				case 'expired' :
1256 1256
 					error_log(print_r( $license->error, true) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log');
1257
-                    $class = $license->error;
1258
-                    $messages[] = sprintf(
1259
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1260
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1261
-                        $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1262
-                    );
1263
-                    $license_status = 'license-' . $class;
1264
-                    break;
1265
-
1266
-                case 'missing' :
1267
-                    $class = $license->error;
1268
-                    $messages[] = sprintf(
1269
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1270
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1271
-                    );
1272
-                    $license_status = 'license-' . $class;
1273
-                    break;
1274
-
1275
-                case 'invalid' :
1276
-                    $class = $license->error;
1277
-                    $messages[] = sprintf(
1278
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1279
-                        $addon_name,
1280
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1281
-                    );
1282
-                    $license_status = 'license-' . $class;
1283
-                    break;
1284
-
1285
-                case 'site_inactive' :
1286
-                    $class = $license->error;
1287
-                    $messages[] = sprintf(
1288
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1289
-                        $addon_name,
1290
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1291
-                    );
1292
-                    $license_status = 'license-' . $class;
1293
-                    break;
1294
-
1295
-                case 'item_name_mismatch' :
1296
-                    $class = $license->error;
1297
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1298
-                    $license_status = 'license-' . $class;
1299
-                    break;
1300
-
1301
-                case 'no_activations_left':
1302
-                    $class = $license->error;
1303
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1304
-                    $license_status = 'license-' . $class;
1305
-                    break;
1306
-            }
1307
-        } else {
1308
-            switch( $license->license ) {
1309
-                case 'valid' :
1310
-                default:
1311
-                    $class = 'valid';
1312
-                    $now        = current_time( 'timestamp' );
1313
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1314
-
1315
-                    if( 'lifetime' === $license->expires ) {
1316
-                        $messages[] = __( 'License key never expires.', 'give' );
1317
-                        $license_status = 'license-lifetime-notice';
1318
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1319
-                        $messages[] = sprintf(
1320
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1321
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1322
-                            $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1323
-                        );
1324
-                        $license_status = 'license-expires-soon';
1325
-                    } else {
1326
-                        $messages[] = sprintf(
1327
-                            __( 'Your license key expires on %s.', 'give' ),
1328
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1329
-                        );
1330
-                        $license_status = 'license-expiration-date';
1331
-                    }
1332
-                    break;
1333
-            }
1334
-        }
1335
-    } else{
1257
+					$class = $license->error;
1258
+					$messages[] = sprintf(
1259
+						__( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1260
+						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1261
+						$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1262
+					);
1263
+					$license_status = 'license-' . $class;
1264
+					break;
1265
+
1266
+				case 'missing' :
1267
+					$class = $license->error;
1268
+					$messages[] = sprintf(
1269
+						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1270
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1271
+					);
1272
+					$license_status = 'license-' . $class;
1273
+					break;
1274
+
1275
+				case 'invalid' :
1276
+					$class = $license->error;
1277
+					$messages[] = sprintf(
1278
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1279
+						$addon_name,
1280
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1281
+					);
1282
+					$license_status = 'license-' . $class;
1283
+					break;
1284
+
1285
+				case 'site_inactive' :
1286
+					$class = $license->error;
1287
+					$messages[] = sprintf(
1288
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1289
+						$addon_name,
1290
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1291
+					);
1292
+					$license_status = 'license-' . $class;
1293
+					break;
1294
+
1295
+				case 'item_name_mismatch' :
1296
+					$class = $license->error;
1297
+					$messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1298
+					$license_status = 'license-' . $class;
1299
+					break;
1300
+
1301
+				case 'no_activations_left':
1302
+					$class = $license->error;
1303
+					$messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1304
+					$license_status = 'license-' . $class;
1305
+					break;
1306
+			}
1307
+		} else {
1308
+			switch( $license->license ) {
1309
+				case 'valid' :
1310
+				default:
1311
+					$class = 'valid';
1312
+					$now        = current_time( 'timestamp' );
1313
+					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1314
+
1315
+					if( 'lifetime' === $license->expires ) {
1316
+						$messages[] = __( 'License key never expires.', 'give' );
1317
+						$license_status = 'license-lifetime-notice';
1318
+					} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1319
+						$messages[] = sprintf(
1320
+							__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1321
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1322
+							$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1323
+						);
1324
+						$license_status = 'license-expires-soon';
1325
+					} else {
1326
+						$messages[] = sprintf(
1327
+							__( 'Your license key expires on %s.', 'give' ),
1328
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1329
+						);
1330
+						$license_status = 'license-expiration-date';
1331
+					}
1332
+					break;
1333
+			}
1334
+		}
1335
+	} else{
1336 1336
 		$class = 'empty';
1337 1337
 		$messages[] = sprintf(
1338 1338
 			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 	}
1343 1343
 
1344 1344
 
1345
-    // Add class for input field if license is active.
1345
+	// Add class for input field if license is active.
1346 1346
 	if ( $is_valid_license ) {
1347 1347
 		$field_classes .= ' give-license-active';
1348 1348
 	}
@@ -1355,12 +1355,12 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
 	// If license is active so show deactivate button
1357 1357
 	if ( $is_valid_license ) {
1358
-        // Get input filed html.
1359
-        $input_field_html = $field_type_object->input( array(
1360
-            'class' => $field_classes,
1361
-            'type'  => $type,
1362
-            'readonly' => 'readonly',
1363
-        ) );
1358
+		// Get input filed html.
1359
+		$input_field_html = $field_type_object->input( array(
1360
+			'class' => $field_classes,
1361
+			'type'  => $type,
1362
+			'readonly' => 'readonly',
1363
+		) );
1364 1364
 
1365 1365
 		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1366 1366
 	}
@@ -1368,27 +1368,27 @@  discard block
 block discarded – undo
1368 1368
 	// Field description.
1369 1369
 	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1370 1370
 
1371
-    // If no messages found then inform user that to get updated in future register yourself.
1372
-    if ( empty( $messages ) ) {
1373
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1374
-    }
1371
+	// If no messages found then inform user that to get updated in future register yourself.
1372
+	if ( empty( $messages ) ) {
1373
+		$messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1374
+	}
1375 1375
 
1376
-    foreach( $messages as $message ) {
1377
-        $custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1378
-        $custom_html .= '<p>' . $message . '</p>';
1379
-        $custom_html .= '</div>';
1380
-    }
1376
+	foreach( $messages as $message ) {
1377
+		$custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1378
+		$custom_html .= '<p>' . $message . '</p>';
1379
+		$custom_html .= '</div>';
1380
+	}
1381 1381
 
1382 1382
 
1383 1383
 
1384
-    // Field html.
1385
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1384
+	// Field html.
1385
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1386 1386
 
1387
-    // Nonce.
1387
+	// Nonce.
1388 1388
 	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1389 1389
 
1390
-    // Print field html.
1391
-    echo '<div>' . $custom_html . '</div>';
1390
+	// Print field html.
1391
+	echo '<div>' . $custom_html . '</div>';
1392 1392
 }
1393 1393
 
1394 1394
 
Please login to merge, or discard this patch.
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -41,26 +41,26 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct() {
43 43
 
44
-		add_action( 'admin_init', array( $this, 'init' ) );
44
+		add_action('admin_init', array($this, 'init'));
45 45
 
46 46
 		//Customize CMB2 URL
47
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
47
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
48 48
 
49 49
 		//Custom CMB2 Settings Fields
50
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
51
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
52
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
53
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
54
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
55
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
56
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
57
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
58
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
50
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
51
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
52
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
53
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
54
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
55
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
56
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
57
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
58
+		add_action('admin_notices', array($this, 'settings_notices'));
59 59
 
60 60
 		// Include CMB CSS in the head to avoid FOUC
61
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
61
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
62 62
 
63
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
63
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
64 64
 
65 65
 	}
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @since  1.0
72 72
 	 */
73 73
 	public function init() {
74
-		register_setting( $this->key, $this->key );
74
+		register_setting($this->key, $this->key);
75 75
 
76 76
 	}
77 77
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return mixed
87 87
 	 */
88
-	public function give_update_cmb_meta_box_url( $url ) {
88
+	public function give_update_cmb_meta_box_url($url) {
89 89
 		//Path to Give's CMB
90
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
90
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
91 91
 	}
92 92
 
93 93
 
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function give_get_settings_tabs() {
101 101
 
102
-		$settings = $this->give_settings( null );
102
+		$settings = $this->give_settings(null);
103 103
 
104 104
 		$tabs             = array();
105
-		$tabs['general']  = esc_html__( 'General', 'give' );
106
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
107
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
108
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
105
+		$tabs['general']  = esc_html__('General', 'give');
106
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
107
+		$tabs['display']  = esc_html__('Display Options', 'give');
108
+		$tabs['emails']   = esc_html__('Emails', 'give');
109 109
 
110
-		if ( ! empty( $settings['addons']['fields'] ) ) {
111
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
110
+		if ( ! empty($settings['addons']['fields'])) {
111
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
112 112
 		}
113 113
 
114
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
115
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
114
+		if ( ! empty($settings['licenses']['fields'])) {
115
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
116 116
 		}
117 117
 
118
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
119
-		$tabs['api']         = esc_html__( 'API', 'give' );
120
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
118
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
119
+		$tabs['api']         = esc_html__('API', 'give');
120
+		$tabs['system_info'] = esc_html__('System Info', 'give');
121 121
 
122
-		return apply_filters( 'give_settings_tabs', $tabs );
122
+		return apply_filters('give_settings_tabs', $tabs);
123 123
 	}
124 124
 
125 125
 
@@ -129,32 +129,32 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function admin_page_display() {
131 131
 
132
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
132
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
133 133
 
134 134
 		?>
135 135
 
136 136
 		<div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>">
137 137
 
138
-			<h1 class="screen-reader-text"><?php esc_html_e( 'Give Settings', 'give' ); ?></h1>
138
+			<h1 class="screen-reader-text"><?php esc_html_e('Give Settings', 'give'); ?></h1>
139 139
 
140 140
 			<h2 class="nav-tab-wrapper">
141 141
 				<?php
142
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
142
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
143 143
 
144
-					$tab_url = esc_url( add_query_arg( array(
144
+					$tab_url = esc_url(add_query_arg(array(
145 145
 						'settings-updated' => false,
146 146
 						'tab'              => $tab_id
147
-					) ) );
147
+					)));
148 148
 
149 149
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
150 150
 
151
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
151
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
152 152
 
153 153
 				}
154 154
 				?>
155 155
 			</h2>
156 156
 
157
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
157
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
158 158
 
159 159
 		</div><!-- .wrap -->
160 160
 
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
179
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
180 180
 
181 181
 		//only modify the give settings form
182
-		if ( 'give_settings' == $object_id ) {
182
+		if ('give_settings' == $object_id) {
183 183
 
184
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
184
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>';
185 185
 
186 186
 		}
187 187
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return array
200 200
 	 */
201
-	public function give_settings( $active_tab ) {
201
+	public function give_settings($active_tab) {
202 202
 
203 203
 		$give_settings = array(
204 204
 			/**
@@ -206,99 +206,99 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			'general'     => array(
208 208
 				'id'         => 'general_settings',
209
-				'give_title' => esc_html__( 'General Settings', 'give' ),
210
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
211
-				'fields'     => apply_filters( 'give_settings_general', array(
209
+				'give_title' => esc_html__('General Settings', 'give'),
210
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
211
+				'fields'     => apply_filters('give_settings_general', array(
212 212
 						array(
213
-							'name' => esc_html__( 'General Settings', 'give' ),
213
+							'name' => esc_html__('General Settings', 'give'),
214 214
 							'desc' => '',
215 215
 							'type' => 'give_title',
216 216
 							'id'   => 'give_title_general_settings_1'
217 217
 						),
218 218
 						array(
219
-							'name'    => esc_html__( 'Success Page', 'give' ),
219
+							'name'    => esc_html__('Success Page', 'give'),
220 220
 							/* translators: %s: [give_receipt] */
221
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
221
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
222 222
 							'id'      => 'success_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226
-								'numberposts' => - 1
227
-							) ),
226
+								'numberposts' => -1
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
231
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
230
+							'name'    => esc_html__('Failed Donation Page', 'give'),
231
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
232 232
 							'id'      => 'failure_page',
233 233
 							'type'    => 'select',
234
-							'options' => give_cmb2_get_post_options( array(
234
+							'options' => give_cmb2_get_post_options(array(
235 235
 								'post_type'   => 'page',
236
-								'numberposts' => - 1
237
-							) ),
236
+								'numberposts' => -1
237
+							)),
238 238
 						),
239 239
 						array(
240
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
240
+							'name'    => esc_html__('Donation History Page', 'give'),
241 241
 							/* translators: %s: [donation_history] */
242
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
242
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
243 243
 							'id'      => 'history_page',
244 244
 							'type'    => 'select',
245
-							'options' => give_cmb2_get_post_options( array(
245
+							'options' => give_cmb2_get_post_options(array(
246 246
 								'post_type'   => 'page',
247
-								'numberposts' => - 1
248
-							) ),
247
+								'numberposts' => -1
248
+							)),
249 249
 						),
250 250
 						array(
251
-							'name'    => esc_html__( 'Base Country', 'give' ),
252
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
251
+							'name'    => esc_html__('Base Country', 'give'),
252
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
253 253
 							'id'      => 'base_country',
254 254
 							'type'    => 'select',
255 255
 							'options' => give_get_country_list(),
256 256
 						),
257 257
 						array(
258
-							'name' => esc_html__( 'Currency Settings', 'give' ),
258
+							'name' => esc_html__('Currency Settings', 'give'),
259 259
 							'desc' => '',
260 260
 							'type' => 'give_title',
261 261
 							'id'   => 'give_title_general_settings_2'
262 262
 						),
263 263
 						array(
264
-							'name'    => esc_html__( 'Currency', 'give' ),
265
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
264
+							'name'    => esc_html__('Currency', 'give'),
265
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
266 266
 							'id'      => 'currency',
267 267
 							'type'    => 'select',
268 268
 							'options' => give_get_currencies(),
269 269
 							'default' => 'USD',
270 270
 						),
271 271
 						array(
272
-							'name'    => esc_html__( 'Currency Position', 'give' ),
273
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
272
+							'name'    => esc_html__('Currency Position', 'give'),
273
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
274 274
 							'id'      => 'currency_position',
275 275
 							'type'    => 'select',
276 276
 							'options' => array(
277 277
 								/* translators: %s: currency symbol */
278
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
278
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
279 279
 								/* translators: %s: currency symbol */
280
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
280
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
281 281
 							),
282 282
 							'default' => 'before',
283 283
 						),
284 284
 						array(
285
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
286
-							'desc'            => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
285
+							'name'            => esc_html__('Thousands Separator', 'give'),
286
+							'desc'            => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
287 287
 							'id'              => 'thousands_separator',
288 288
 							'type'            => 'text_small',
289 289
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
290 290
 							'default'         => ',',
291 291
 						),
292 292
 						array(
293
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
294
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
293
+							'name'    => esc_html__('Decimal Separator', 'give'),
294
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
295 295
 							'id'      => 'decimal_separator',
296 296
 							'type'    => 'text_small',
297 297
 							'default' => '.',
298 298
 						),
299 299
 						array(
300
-							'name'            => __( 'Number of Decimals', 'give' ),
301
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
300
+							'name'            => __('Number of Decimals', 'give'),
301
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
302 302
 							'id'              => 'number_decimals',
303 303
 							'type'            => 'text_small',
304 304
 							'default'         => 2,
@@ -312,83 +312,83 @@  discard block
 block discarded – undo
312 312
 			 */
313 313
 			'gateways'    => array(
314 314
 				'id'         => 'payment_gateways',
315
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
316
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
317
-				'fields'     => apply_filters( 'give_settings_gateways', array(
315
+				'give_title' => esc_html__('Payment Gateways', 'give'),
316
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
317
+				'fields'     => apply_filters('give_settings_gateways', array(
318 318
 						array(
319
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
319
+							'name' => esc_html__('Gateways Settings', 'give'),
320 320
 							'desc' => '',
321 321
 							'id'   => 'give_title_gateway_settings_1',
322 322
 							'type' => 'give_title'
323 323
 						),
324 324
 						array(
325
-							'name' => esc_html__( 'Test Mode', 'give' ),
326
-							'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
325
+							'name' => esc_html__('Test Mode', 'give'),
326
+							'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
327 327
 							'id'   => 'test_mode',
328 328
 							'type' => 'checkbox'
329 329
 						),
330 330
 						array(
331
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
332
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
331
+							'name' => esc_html__('Enabled Gateways', 'give'),
332
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
333 333
 							'id'   => 'gateways',
334 334
 							'type' => 'enabled_gateways'
335 335
 						),
336 336
 						array(
337
-							'name' => esc_html__( 'Default Gateway', 'give' ),
338
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
337
+							'name' => esc_html__('Default Gateway', 'give'),
338
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
339 339
 							'id'   => 'default_gateway',
340 340
 							'type' => 'default_gateway'
341 341
 						),
342 342
 						array(
343
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
343
+							'name' => esc_html__('PayPal Standard', 'give'),
344 344
 							'desc' => '',
345 345
 							'type' => 'give_title',
346 346
 							'id'   => 'give_title_gateway_settings_2',
347 347
 						),
348 348
 						array(
349
-							'name' => esc_html__( 'PayPal Email', 'give' ),
350
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
349
+							'name' => esc_html__('PayPal Email', 'give'),
350
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
351 351
 							'id'   => 'paypal_email',
352 352
 							'type' => 'text_email',
353 353
 						),
354 354
 						array(
355
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
356
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
355
+							'name' => esc_html__('PayPal Page Style', 'give'),
356
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
357 357
 							'id'   => 'paypal_page_style',
358 358
 							'type' => 'text',
359 359
 						),
360 360
 						array(
361
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
362
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
361
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
362
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
363 363
 							'id'      => 'paypal_button_type',
364 364
 							'type'    => 'radio_inline',
365 365
 							'options' => array(
366
-								'donation' => esc_html__( 'Donation', 'give' ),
367
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
366
+								'donation' => esc_html__('Donation', 'give'),
367
+								'standard' => esc_html__('Standard Transaction', 'give')
368 368
 							),
369 369
 							'default' => 'donation',
370 370
 						),
371 371
 						array(
372
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
373
-							'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
372
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
373
+							'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
374 374
 							'id'   => 'disable_paypal_verification',
375 375
 							'type' => 'checkbox'
376 376
 						),
377 377
 						array(
378
-							'name' => esc_html__( 'Offline Donations', 'give' ),
378
+							'name' => esc_html__('Offline Donations', 'give'),
379 379
 							'desc' => '',
380 380
 							'type' => 'give_title',
381 381
 							'id'   => 'give_title_gateway_settings_3',
382 382
 						),
383 383
 						array(
384
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
385
-							'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
384
+							'name' => esc_html__('Collect Billing Details', 'give'),
385
+							'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
386 386
 							'id'   => 'give_offline_donation_enable_billing_fields',
387 387
 							'type' => 'checkbox'
388 388
 						),
389 389
 						array(
390
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
391
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
390
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
391
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
392 392
 							'id'      => 'global_offline_donation_content',
393 393
 							'default' => give_get_default_offline_donation_content(),
394 394
 							'type'    => 'wysiwyg',
@@ -397,15 +397,15 @@  discard block
 block discarded – undo
397 397
 							)
398 398
 						),
399 399
 						array(
400
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
401
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
400
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
401
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
402 402
 							'id'      => 'offline_donation_subject',
403
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
403
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
404 404
 							'type'    => 'text'
405 405
 						),
406 406
 						array(
407
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
408
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
407
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
408
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
409 409
 							'id'      => 'global_offline_donation_email',
410 410
 							'default' => give_get_default_offline_donation_email_content(),
411 411
 							'type'    => 'wysiwyg',
@@ -419,95 +419,95 @@  discard block
 block discarded – undo
419 419
 			/** Display Settings */
420 420
 			'display'     => array(
421 421
 				'id'         => 'display_settings',
422
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
423
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
424
-				'fields'     => apply_filters( 'give_settings_display', array(
422
+				'give_title' => esc_html__('Display Settings', 'give'),
423
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
424
+				'fields'     => apply_filters('give_settings_display', array(
425 425
 						array(
426
-							'name' => esc_html__( 'Display Settings', 'give' ),
426
+							'name' => esc_html__('Display Settings', 'give'),
427 427
 							'desc' => '',
428 428
 							'id'   => 'give_title_display_settings_1',
429 429
 							'type' => 'give_title'
430 430
 						),
431 431
 						array(
432
-							'name' => esc_html__( 'Disable CSS', 'give' ),
433
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
432
+							'name' => esc_html__('Disable CSS', 'give'),
433
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
434 434
 							'id'   => 'disable_css',
435 435
 							'type' => 'checkbox'
436 436
 						),
437 437
 						array(
438
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
438
+							'name' => esc_html__('Enable Floating Labels', 'give'),
439 439
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
440
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
440
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
441 441
 							'id'   => 'enable_floatlabels',
442 442
 							'type' => 'checkbox'
443 443
 						),
444 444
 						array(
445
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
445
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
446 446
 							/* translators: %s: about page URL */
447
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox'
450 450
 						),
451 451
 						array(
452
-							'name' => esc_html__( 'Post Types', 'give' ),
452
+							'name' => esc_html__('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title'
456 456
 						),
457 457
 						array(
458
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
459
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => esc_html__('Disable Form Single Views', 'give'),
459
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox'
462 462
 						),
463 463
 						array(
464
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
465
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => esc_html__('Disable Form Archives', 'give'),
465
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox'
468 468
 						),
469 469
 						array(
470
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
471
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox'
474 474
 						),
475 475
 
476 476
 						array(
477
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
478
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
477
+							'name'    => esc_html__('Featured Image Size', 'give'),
478
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
479 479
 							'id'      => 'featured_image_size',
480 480
 							'type'    => 'select',
481 481
 							'default' => 'large',
482 482
 							'options' => give_get_featured_image_sizes()
483 483
 						),
484 484
 						array(
485
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
486
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
485
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
486
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
487 487
 							'id'   => 'disable_form_featured_img',
488 488
 							'type' => 'checkbox'
489 489
 						),
490 490
 						array(
491
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
492
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
491
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
492
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
493 493
 							'id'   => 'disable_form_sidebar',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => esc_html__( 'Taxonomies', 'give' ),
497
+							'name' => esc_html__('Taxonomies', 'give'),
498 498
 							'desc' => '',
499 499
 							'id'   => 'give_title_display_settings_3',
500 500
 							'type' => 'give_title'
501 501
 						),
502 502
 						array(
503
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
504
-							'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
503
+							'name' => esc_html__('Enable Form Categories', 'give'),
504
+							'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'),
505 505
 							'id'   => 'enable_categories',
506 506
 							'type' => 'checkbox'
507 507
 						),
508 508
 						array(
509
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
510
-							'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
509
+							'name' => esc_html__('Enable Form Tags', 'give'),
510
+							'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'),
511 511
 							'id'   => 'enable_tags',
512 512
 							'type' => 'checkbox'
513 513
 						),
@@ -520,85 +520,85 @@  discard block
 block discarded – undo
520 520
 			 */
521 521
 			'emails'      => array(
522 522
 				'id'         => 'email_settings',
523
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
524
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
525
-				'fields'     => apply_filters( 'give_settings_emails', array(
523
+				'give_title' => esc_html__('Email Settings', 'give'),
524
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
525
+				'fields'     => apply_filters('give_settings_emails', array(
526 526
 						array(
527
-							'name' => esc_html__( 'Email Settings', 'give' ),
527
+							'name' => esc_html__('Email Settings', 'give'),
528 528
 							'desc' => '',
529 529
 							'id'   => 'give_title_email_settings_1',
530 530
 							'type' => 'give_title'
531 531
 						),
532 532
 						array(
533 533
 							'id'      => 'email_template',
534
-							'name'    => esc_html__( 'Email Template', 'give' ),
535
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
534
+							'name'    => esc_html__('Email Template', 'give'),
535
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
536 536
 							'type'    => 'select',
537 537
 							'options' => give_get_email_templates()
538 538
 						),
539 539
 						array(
540 540
 							'id'   => 'email_logo',
541
-							'name' => esc_html__( 'Logo', 'give' ),
542
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
541
+							'name' => esc_html__('Logo', 'give'),
542
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
543 543
 							'type' => 'file'
544 544
 						),
545 545
 						array(
546 546
 							'id'      => 'from_name',
547
-							'name'    => esc_html__( 'From Name', 'give' ),
548
-							'desc'    => esc_html__( 'The name which appears in the "From" field in donation receipt emails.', 'give' ),
549
-							'default' => get_bloginfo( 'name' ),
547
+							'name'    => esc_html__('From Name', 'give'),
548
+							'desc'    => esc_html__('The name which appears in the "From" field in donation receipt emails.', 'give'),
549
+							'default' => get_bloginfo('name'),
550 550
 							'type'    => 'text'
551 551
 						),
552 552
 						array(
553 553
 							'id'      => 'from_email',
554
-							'name'    => esc_html__( 'From Email', 'give' ),
555
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
556
-							'default' => get_bloginfo( 'admin_email' ),
554
+							'name'    => esc_html__('From Email', 'give'),
555
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
556
+							'default' => get_bloginfo('admin_email'),
557 557
 							'type'    => 'text'
558 558
 						),
559 559
 						array(
560
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
560
+							'name' => esc_html__('Donation Receipt', 'give'),
561 561
 							'desc' => '',
562 562
 							'id'   => 'give_title_email_settings_2',
563 563
 							'type' => 'give_title'
564 564
 						),
565 565
 						array(
566 566
 							'id'      => 'donation_subject',
567
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
568
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
569
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
567
+							'name'    => esc_html__('Donation Email Subject', 'give'),
568
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
569
+							'default' => esc_attr__('Donation Receipt', 'give'),
570 570
 							'type'    => 'text'
571 571
 						),
572 572
 						array(
573 573
 							'id'      => 'donation_receipt',
574
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
574
+							'name'    => esc_html__('Donation Receipt', 'give'),
575 575
 							'desc'    => sprintf(
576 576
 								/* translators: %s: emails tags list */
577
-								esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
577
+								esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
578 578
 								'<br/>'.give_get_emails_tags_list()
579 579
 							),
580 580
 							'type'    => 'wysiwyg',
581 581
 							'default' => give_get_default_donation_receipt_email()
582 582
 						),
583 583
 						array(
584
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
584
+							'name' => esc_html__('New Donation Notification', 'give'),
585 585
 							'desc' => '',
586 586
 							'id'   => 'give_title_email_settings_3',
587 587
 							'type' => 'give_title'
588 588
 						),
589 589
 						array(
590 590
 							'id'      => 'donation_notification_subject',
591
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
592
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
591
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
592
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
593 593
 							'type'    => 'text',
594
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
594
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
595 595
 						),
596 596
 						array(
597 597
 							'id'      => 'donation_notification',
598
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
598
+							'name'    => esc_html__('Donation Notification', 'give'),
599 599
 							'desc'    => sprintf(
600 600
 								/* translators: %s: emails tags list */
601
-								esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
601
+								esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
602 602
 								'<br/>'.give_get_emails_tags_list()
603 603
 							),
604 604
 							'type'    => 'wysiwyg',
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
 						),
607 607
 						array(
608 608
 							'id'      => 'admin_notice_emails',
609
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
610
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
609
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
610
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
611 611
 							'type'    => 'textarea',
612
-							'default' => get_bloginfo( 'admin_email' )
612
+							'default' => get_bloginfo('admin_email')
613 613
 						),
614 614
 						array(
615 615
 							'id'   => 'disable_admin_notices',
616
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
617
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
616
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
617
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
618 618
 							'type' => 'checkbox'
619 619
 						)
620 620
 					)
@@ -623,99 +623,99 @@  discard block
 block discarded – undo
623 623
 			/** Extension Settings */
624 624
 			'addons'      => array(
625 625
 				'id'         => 'addons',
626
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
627
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
628
-				'fields'     => apply_filters( 'give_settings_addons', array()
626
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
627
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
628
+				'fields'     => apply_filters('give_settings_addons', array()
629 629
 				)
630 630
 			),
631 631
 			/** Licenses Settings */
632 632
 			'licenses'    => array(
633 633
 				'id'         => 'licenses',
634
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
635
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
636
-				'fields'     => apply_filters( 'give_settings_licenses', array()
634
+				'give_title' => esc_html__('Give Licenses', 'give'),
635
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
636
+				'fields'     => apply_filters('give_settings_licenses', array()
637 637
 				)
638 638
 			),
639 639
 			/** Advanced Options */
640 640
 			'advanced'    => array(
641 641
 				'id'         => 'advanced_options',
642
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
643
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
644
-				'fields'     => apply_filters( 'give_settings_advanced', array(
642
+				'give_title' => esc_html__('Advanced Options', 'give'),
643
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
644
+				'fields'     => apply_filters('give_settings_advanced', array(
645 645
 						array(
646
-							'name' => esc_html__( 'Access Control', 'give' ),
646
+							'name' => esc_html__('Access Control', 'give'),
647 647
 							'desc' => '',
648 648
 							'id'   => 'give_title_session_control_1',
649 649
 							'type' => 'give_title'
650 650
 						),
651 651
 						array(
652 652
 							'id'      => 'session_lifetime',
653
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
654
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
653
+							'name'    => esc_html__('Session Lifetime', 'give'),
654
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
655 655
 							'type'    => 'select',
656 656
 							'options' => array(
657
-								'86400'  => esc_html__( '24 Hours', 'give' ),
658
-								'172800' => esc_html__( '48 Hours', 'give' ),
659
-								'259200' => esc_html__( '72 Hours', 'give' ),
660
-								'604800' => esc_html__( '1 Week', 'give' ),
657
+								'86400'  => esc_html__('24 Hours', 'give'),
658
+								'172800' => esc_html__('48 Hours', 'give'),
659
+								'259200' => esc_html__('72 Hours', 'give'),
660
+								'604800' => esc_html__('1 Week', 'give'),
661 661
 							)
662 662
 						),
663 663
 						array(
664
-							'name' => esc_html__( 'Email Access', 'give' ),
665
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
664
+							'name' => esc_html__('Email Access', 'give'),
665
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
666 666
 							'id'   => 'email_access',
667 667
 							'type' => 'checkbox',
668 668
 						),
669 669
 						array(
670 670
 							'id'      => 'recaptcha_key',
671
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
671
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
672 672
 							/* translators: %s: https://www.google.com/recaptcha/ */
673
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
673
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
674 674
 							'default' => '',
675 675
 							'type'    => 'text'
676 676
 						),
677 677
 						array(
678 678
 							'id'      => 'recaptcha_secret',
679
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
680
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
679
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
680
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
681 681
 							'default' => '',
682 682
 							'type'    => 'text'
683 683
 						),
684 684
 						array(
685
-							'name' => esc_html__( 'Data Control', 'give' ),
685
+							'name' => esc_html__('Data Control', 'give'),
686 686
 							'desc' => '',
687 687
 							'id'   => 'give_title_data_control_2',
688 688
 							'type' => 'give_title'
689 689
 						),
690 690
 						array(
691
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
692
-							'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
691
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
692
+							'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'),
693 693
 							'id'   => 'uninstall_on_delete',
694 694
 							'type' => 'checkbox'
695 695
 						),
696 696
 						array(
697
-							'name' => esc_html__( 'Filter Control', 'give' ),
697
+							'name' => esc_html__('Filter Control', 'give'),
698 698
 							'desc' => '',
699 699
 							'id'   => 'give_title_filter_control',
700 700
 							'type' => 'give_title'
701 701
 						),
702 702
 						array(
703 703
 							/* translators: %s: the_content */
704
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
704
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
705 705
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
706
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
706
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
707 707
 							'id'   => 'disable_the_content_filter',
708 708
 							'type' => 'checkbox'
709 709
 						),
710 710
 						array(
711
-							'name' => esc_html__( 'Script Loading', 'give' ),
711
+							'name' => esc_html__('Script Loading', 'give'),
712 712
 							'desc' => '',
713 713
 							'id'   => 'give_title_script_control',
714 714
 							'type' => 'give_title'
715 715
 						),
716 716
 						array(
717
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
718
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
717
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
718
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
719 719
 							'id'   => 'scripts_footer',
720 720
 							'type' => 'checkbox'
721 721
 						)
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 			/** API Settings */
726 726
 			'api'         => array(
727 727
 				'id'         => 'api',
728
-				'give_title' => esc_html__( 'API', 'give' ),
729
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
728
+				'give_title' => esc_html__('API', 'give'),
729
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
730 730
 				'show_names' => false, // Hide field names on the left
731
-				'fields'     => apply_filters( 'give_settings_system', array(
731
+				'fields'     => apply_filters('give_settings_system', array(
732 732
 						array(
733 733
 							'id'   => 'api',
734
-							'name' => esc_html__( 'API', 'give' ),
734
+							'name' => esc_html__('API', 'give'),
735 735
 							'type' => 'api'
736 736
 						)
737 737
 					)
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 			/** Licenses Settings */
741 741
 			'system_info' => array(
742 742
 				'id'         => 'system_info',
743
-				'give_title' => esc_html__( 'System Info', 'give' ),
744
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
745
-				'fields'     => apply_filters( 'give_settings_system', array(
743
+				'give_title' => esc_html__('System Info', 'give'),
744
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
745
+				'fields'     => apply_filters('give_settings_system', array(
746 746
 						array(
747 747
 							'id'   => 'system-info-textarea',
748
-							'name' => esc_html__( 'System Info', 'give' ),
749
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
748
+							'name' => esc_html__('System Info', 'give'),
749
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
750 750
 							'type' => 'system_info'
751 751
 						)
752 752
 					)
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
 		);
756 756
 
757 757
 		//Return all settings array if no active tab
758
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
758
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
759 759
 
760
-			return apply_filters( 'give_registered_settings', $give_settings );
760
+			return apply_filters('give_registered_settings', $give_settings);
761 761
 
762 762
 		}
763 763
 
764 764
 
765 765
 		// Add other tabs and settings fields as needed
766
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
766
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
767 767
 
768 768
 	}
769 769
 
@@ -772,11 +772,11 @@  discard block
 block discarded – undo
772 772
 	 */
773 773
 	public function settings_notices() {
774 774
 
775
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
775
+		if ( ! isset($_POST['give_settings_saved'])) {
776 776
 			return;
777 777
 		}
778 778
 
779
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
779
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
780 780
 
781 781
 	}
782 782
 
@@ -791,17 +791,17 @@  discard block
 block discarded – undo
791 791
 	 * @return mixed         Field value or exception is thrown.
792 792
 	 * @throws Exception     Throws an exception if the field is invalid.
793 793
 	 */
794
-	public function __get( $field ) {
794
+	public function __get($field) {
795 795
 
796 796
 		// Allowed fields to retrieve
797
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
797
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
798 798
 			return $this->{$field};
799 799
 		}
800
-		if ( 'option_metabox' === $field ) {
800
+		if ('option_metabox' === $field) {
801 801
 			return $this->option_metabox();
802 802
 		}
803 803
 
804
-		throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) );
804
+		throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field));
805 805
 	}
806 806
 
807 807
 
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
  *
820 820
  * @return mixed        Option value
821 821
  */
822
-function give_get_option( $key = '', $default = false ) {
822
+function give_get_option($key = '', $default = false) {
823 823
 	global $give_options;
824
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
825
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
824
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
825
+	$value = apply_filters('give_get_option', $value, $key, $default);
826 826
 
827
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
827
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
828 828
 }
829 829
 
830 830
 
@@ -842,33 +842,33 @@  discard block
 block discarded – undo
842 842
  *
843 843
  * @return boolean True if updated, false if not.
844 844
  */
845
-function give_update_option( $key = '', $value = false ) {
845
+function give_update_option($key = '', $value = false) {
846 846
 
847 847
 	// If no key, exit
848
-	if ( empty( $key ) ) {
848
+	if (empty($key)) {
849 849
 		return false;
850 850
 	}
851 851
 
852
-	if ( empty( $value ) ) {
853
-		$remove_option = give_delete_option( $key );
852
+	if (empty($value)) {
853
+		$remove_option = give_delete_option($key);
854 854
 
855 855
 		return $remove_option;
856 856
 	}
857 857
 
858 858
 	// First let's grab the current settings
859
-	$options = get_option( 'give_settings' );
859
+	$options = get_option('give_settings');
860 860
 
861 861
 	// Let's let devs alter that value coming in
862
-	$value = apply_filters( 'give_update_option', $value, $key );
862
+	$value = apply_filters('give_update_option', $value, $key);
863 863
 
864 864
 	// Next let's try to update the value
865
-	$options[ $key ] = $value;
866
-	$did_update      = update_option( 'give_settings', $options );
865
+	$options[$key] = $value;
866
+	$did_update      = update_option('give_settings', $options);
867 867
 
868 868
 	// If it updated, let's update the global variable
869
-	if ( $did_update ) {
869
+	if ($did_update) {
870 870
 		global $give_options;
871
-		$give_options[ $key ] = $value;
871
+		$give_options[$key] = $value;
872 872
 	}
873 873
 
874 874
 	return $did_update;
@@ -885,27 +885,27 @@  discard block
 block discarded – undo
885 885
  *
886 886
  * @return boolean True if updated, false if not.
887 887
  */
888
-function give_delete_option( $key = '' ) {
888
+function give_delete_option($key = '') {
889 889
 
890 890
 	// If no key, exit
891
-	if ( empty( $key ) ) {
891
+	if (empty($key)) {
892 892
 		return false;
893 893
 	}
894 894
 
895 895
 	// First let's grab the current settings
896
-	$options = get_option( 'give_settings' );
896
+	$options = get_option('give_settings');
897 897
 
898 898
 	// Next let's try to update the value
899
-	if ( isset( $options[ $key ] ) ) {
899
+	if (isset($options[$key])) {
900 900
 
901
-		unset( $options[ $key ] );
901
+		unset($options[$key]);
902 902
 
903 903
 	}
904 904
 
905
-	$did_update = update_option( 'give_settings', $options );
905
+	$did_update = update_option('give_settings', $options);
906 906
 
907 907
 	// If it updated, let's update the global variable
908
-	if ( $did_update ) {
908
+	if ($did_update) {
909 909
 		global $give_options;
910 910
 		$give_options = $options;
911 911
 	}
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
  */
925 925
 function give_get_settings() {
926 926
 
927
-	$settings = get_option( 'give_settings' );
927
+	$settings = get_option('give_settings');
928 928
 
929
-	return (array) apply_filters( 'give_get_settings', $settings );
929
+	return (array) apply_filters('give_get_settings', $settings);
930 930
 
931 931
 }
932 932
 
@@ -944,25 +944,25 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return array
946 946
  */
947
-function give_settings_array_insert( $array, $position, $insert ) {
948
-	if ( is_int( $position ) ) {
949
-		array_splice( $array, $position, 0, $insert );
947
+function give_settings_array_insert($array, $position, $insert) {
948
+	if (is_int($position)) {
949
+		array_splice($array, $position, 0, $insert);
950 950
 	} else {
951 951
 
952
-		foreach ( $array as $index => $subarray ) {
953
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
952
+		foreach ($array as $index => $subarray) {
953
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
954 954
 				$pos = $index;
955 955
 			}
956 956
 		}
957 957
 
958
-		if ( ! isset( $pos ) ) {
958
+		if ( ! isset($pos)) {
959 959
 			return $array;
960 960
 		}
961 961
 
962 962
 		$array = array_merge(
963
-			array_slice( $array, 0, $pos ),
963
+			array_slice($array, 0, $pos),
964 964
 			$insert,
965
-			array_slice( $array, $pos )
965
+			array_slice($array, $pos)
966 966
 		);
967 967
 	}
968 968
 
@@ -985,31 +985,31 @@  discard block
 block discarded – undo
985 985
  *
986 986
  * @return void
987 987
  */
988
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
988
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
989 989
 
990 990
 	$id                = $field_type_object->field->args['id'];
991 991
 	$field_description = $field_type_object->field->args['desc'];
992
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
992
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
993 993
 
994 994
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
995 995
 
996
-	foreach ( $gateways as $key => $option ) :
996
+	foreach ($gateways as $key => $option) :
997 997
 
998
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
998
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
999 999
 			$enabled = '1';
1000 1000
 		} else {
1001 1001
 			$enabled = null;
1002 1002
 		}
1003 1003
 
1004
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1005
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1004
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1005
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1006 1006
 
1007 1007
 	endforeach;
1008 1008
 
1009 1009
 	echo '</ul>';
1010 1010
 
1011
-	if ( $field_description ) {
1012
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1011
+	if ($field_description) {
1012
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1013 1013
 	}
1014 1014
 
1015 1015
 }
@@ -1025,31 +1025,31 @@  discard block
 block discarded – undo
1025 1025
  *
1026 1026
  * @return void
1027 1027
  */
1028
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1028
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1029 1029
 
1030 1030
 	$id                = $field_type_object->field->args['id'];
1031 1031
 	$field_description = $field_type_object->field->args['desc'];
1032 1032
 	$gateways          = give_get_enabled_payment_gateways();
1033 1033
 
1034
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1034
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1035 1035
 
1036 1036
 	//Add a field to the Give Form admin single post view of this field
1037
-	if ( $field_type_object->field->object_type === 'post' ) {
1038
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1037
+	if ($field_type_object->field->object_type === 'post') {
1038
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1039 1039
 	}
1040 1040
 
1041
-	foreach ( $gateways as $key => $option ) :
1041
+	foreach ($gateways as $key => $option) :
1042 1042
 
1043
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1043
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1044 1044
 
1045 1045
 
1046
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1046
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1047 1047
 
1048 1048
 	endforeach;
1049 1049
 
1050 1050
 	echo '</select>';
1051 1051
 
1052
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1052
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1053 1053
 
1054 1054
 }
1055 1055
 
@@ -1064,13 +1064,13 @@  discard block
 block discarded – undo
1064 1064
  *
1065 1065
  * @return void
1066 1066
  */
1067
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1067
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1068 1068
 
1069 1069
 	$id                = $field_type_object->field->args['id'];
1070 1070
 	$title             = $field_type_object->field->args['name'];
1071 1071
 	$field_description = $field_type_object->field->args['desc'];
1072 1072
 
1073
-	echo '<hr>' . $field_description;
1073
+	echo '<hr>'.$field_description;
1074 1074
 
1075 1075
 }
1076 1076
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
  *
1086 1086
  * @return void
1087 1087
  */
1088
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1088
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1089 1089
 
1090 1090
 	$id                = $field_type_object->field->args['id'];
1091 1091
 	$title             = $field_type_object->field->args['name'];
@@ -1105,25 +1105,25 @@  discard block
 block discarded – undo
1105 1105
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1106 1106
  * @return array An array of options that matches the CMB2 options array
1107 1107
  */
1108
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1108
+function give_cmb2_get_post_options($query_args, $force = false) {
1109 1109
 
1110
-	$post_options = array( '' => '' ); // Blank option
1110
+	$post_options = array('' => ''); // Blank option
1111 1111
 
1112
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1112
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1113 1113
 		return $post_options;
1114 1114
 	}
1115 1115
 
1116
-	$args = wp_parse_args( $query_args, array(
1116
+	$args = wp_parse_args($query_args, array(
1117 1117
 		'post_type'   => 'page',
1118 1118
 		'numberposts' => 10,
1119
-	) );
1119
+	));
1120 1120
 
1121
-	$posts = get_posts( $args );
1121
+	$posts = get_posts($args);
1122 1122
 
1123
-	if ( $posts ) {
1124
-		foreach ( $posts as $post ) {
1123
+	if ($posts) {
1124
+		foreach ($posts as $post) {
1125 1125
 
1126
-			$post_options[ $post->ID ] = $post->post_title;
1126
+			$post_options[$post->ID] = $post->post_title;
1127 1127
 
1128 1128
 		}
1129 1129
 	}
@@ -1143,17 +1143,17 @@  discard block
 block discarded – undo
1143 1143
 	global $_wp_additional_image_sizes;
1144 1144
 	$sizes = array();
1145 1145
 
1146
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1146
+	foreach (get_intermediate_image_sizes() as $_size) {
1147 1147
 
1148
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1149
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1150
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1151
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1148
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1149
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1150
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1151
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1152 1152
 		}
1153 1153
 
1154 1154
 	}
1155 1155
 
1156
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1156
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1157 1157
 }
1158 1158
 
1159 1159
 
@@ -1168,18 +1168,18 @@  discard block
 block discarded – undo
1168 1168
  *
1169 1169
  * @return void
1170 1170
  */
1171
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1171
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1172 1172
     /* @var CMB2_Types $field_type_object*/
1173 1173
 
1174 1174
     $id                   = $field_type_object->field->args['id'];
1175 1175
 	$field_description    = $field_type_object->field->args['desc'];
1176 1176
 	$license              = $field_type_object->field->args['options']['license'];
1177 1177
     $license_key          = $escaped_value;
1178
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1179
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1178
+    $is_license_key       = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1179
+    $is_valid_license     = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1180 1180
     $shortname            = $field_type_object->field->args['options']['shortname'];
1181 1181
 	$field_classes        = 'regular-text give-license-field';
1182
-	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1182
+	$type                 = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1183 1183
     $custom_html          = '';
1184 1184
     $value                = $escaped_value;
1185 1185
     $messages             = array();
@@ -1192,17 +1192,17 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1194 1194
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1195
-	if( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1195
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1196 1196
 		$is_license_key = false;
1197 1197
 	}
1198 1198
 
1199 1199
 
1200 1200
     // Check if current license is part of subscription or not.
1201
-    $subscriptions = get_option( 'give_subscriptions' );
1201
+    $subscriptions = get_option('give_subscriptions');
1202 1202
 
1203
-    if( $is_license_key && $subscriptions ) {
1204
-        foreach ( $subscriptions as $subscription ) {
1205
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1203
+    if ($is_license_key && $subscriptions) {
1204
+        foreach ($subscriptions as $subscription) {
1205
+            if (in_array($license_key, $subscription['licenses'])) {
1206 1206
                 $is_in_subscription = $subscription['id'];
1207 1207
                 break;
1208 1208
             }
@@ -1210,132 +1210,132 @@  discard block
 block discarded – undo
1210 1210
     }
1211 1211
 
1212 1212
 
1213
-    if( $is_license_key ) {
1214
-        if( $is_in_subscription ) {
1215
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1216
-            $subscription_status  = __( 'renew', 'give' );
1213
+    if ($is_license_key) {
1214
+        if ($is_in_subscription) {
1215
+            $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1216
+            $subscription_status  = __('renew', 'give');
1217 1217
 
1218
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1219
-                $subscription_status = __( 'expire', 'give' );
1218
+            if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1219
+                $subscription_status = __('expire', 'give');
1220 1220
             }
1221 1221
 
1222
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1222
+            if ($subscription_expires < current_time('timestamp', 1)) {
1223 1223
                 $messages[] = sprintf(
1224
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1225
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1224
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1225
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1226 1226
                     $subscriptions[$is_in_subscription]['payment_id'],
1227
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1227
+                    $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1228 1228
                 );
1229 1229
                 $license_status = 'license-expired';
1230
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1230
+            } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1231 1231
                 $messages[] = sprintf(
1232
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1233
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1232
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'),
1233
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1234 1234
                     $subscriptions[$is_in_subscription]['payment_id'],
1235 1235
                     $subscription_status,
1236
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1236
+                    human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1237 1237
                 );
1238 1238
                 $license_status = 'license-expires-soon';
1239 1239
             } else {
1240 1240
                 $messages[] = sprintf(
1241
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1242
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1241
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'),
1242
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1243 1243
                     $subscriptions[$is_in_subscription]['payment_id'],
1244 1244
                     $subscription_status,
1245
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1245
+                    date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1246 1246
                 );
1247 1247
                 $license_status = 'license-expiration-date';
1248 1248
             }
1249 1249
 
1250 1250
 
1251
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1251
+        } elseif (empty($license->success) && property_exists($license, 'error')) {
1252 1252
 
1253 1253
             // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1254
-            switch(   $license->error ) {
1254
+            switch ($license->error) {
1255 1255
                 case 'expired' :
1256
-					error_log(print_r( $license->error, true) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log');
1256
+					error_log(print_r($license->error, true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log');
1257 1257
                     $class = $license->error;
1258 1258
                     $messages[] = sprintf(
1259
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1260
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1261
-                        $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1259
+                        __('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1260
+                        date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1261
+                        $checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1262 1262
                     );
1263
-                    $license_status = 'license-' . $class;
1263
+                    $license_status = 'license-'.$class;
1264 1264
                     break;
1265 1265
 
1266 1266
                 case 'missing' :
1267 1267
                     $class = $license->error;
1268 1268
                     $messages[] = sprintf(
1269
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1270
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1269
+                        __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1270
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1271 1271
                     );
1272
-                    $license_status = 'license-' . $class;
1272
+                    $license_status = 'license-'.$class;
1273 1273
                     break;
1274 1274
 
1275 1275
                 case 'invalid' :
1276 1276
                     $class = $license->error;
1277 1277
                     $messages[] = sprintf(
1278
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1278
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1279 1279
                         $addon_name,
1280
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1280
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1281 1281
                     );
1282
-                    $license_status = 'license-' . $class;
1282
+                    $license_status = 'license-'.$class;
1283 1283
                     break;
1284 1284
 
1285 1285
                 case 'site_inactive' :
1286 1286
                     $class = $license->error;
1287 1287
                     $messages[] = sprintf(
1288
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1288
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1289 1289
                         $addon_name,
1290
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1290
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1291 1291
                     );
1292
-                    $license_status = 'license-' . $class;
1292
+                    $license_status = 'license-'.$class;
1293 1293
                     break;
1294 1294
 
1295 1295
                 case 'item_name_mismatch' :
1296 1296
                     $class = $license->error;
1297
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1298
-                    $license_status = 'license-' . $class;
1297
+                    $messages[] = sprintf(__('This license %s does not belong to %s.', 'give'), $value, $addon_name);
1298
+                    $license_status = 'license-'.$class;
1299 1299
                     break;
1300 1300
 
1301 1301
                 case 'no_activations_left':
1302 1302
                     $class = $license->error;
1303
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1304
-                    $license_status = 'license-' . $class;
1303
+                    $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1304
+                    $license_status = 'license-'.$class;
1305 1305
                     break;
1306 1306
             }
1307 1307
         } else {
1308
-            switch( $license->license ) {
1308
+            switch ($license->license) {
1309 1309
                 case 'valid' :
1310 1310
                 default:
1311 1311
                     $class = 'valid';
1312
-                    $now        = current_time( 'timestamp' );
1313
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1312
+                    $now        = current_time('timestamp');
1313
+                    $expiration = strtotime($license->expires, current_time('timestamp'));
1314 1314
 
1315
-                    if( 'lifetime' === $license->expires ) {
1316
-                        $messages[] = __( 'License key never expires.', 'give' );
1315
+                    if ('lifetime' === $license->expires) {
1316
+                        $messages[] = __('License key never expires.', 'give');
1317 1317
                         $license_status = 'license-lifetime-notice';
1318
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1318
+                    } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1319 1319
                         $messages[] = sprintf(
1320
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1321
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1322
-                            $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1320
+                            __('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1321
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1322
+                            $checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1323 1323
                         );
1324 1324
                         $license_status = 'license-expires-soon';
1325 1325
                     } else {
1326 1326
                         $messages[] = sprintf(
1327
-                            __( 'Your license key expires on %s.', 'give' ),
1328
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1327
+                            __('Your license key expires on %s.', 'give'),
1328
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1329 1329
                         );
1330 1330
                         $license_status = 'license-expiration-date';
1331 1331
                     }
1332 1332
                     break;
1333 1333
             }
1334 1334
         }
1335
-    } else{
1335
+    } else {
1336 1336
 		$class = 'empty';
1337 1337
 		$messages[] = sprintf(
1338
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1338
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1339 1339
 			$addon_name
1340 1340
 		);
1341 1341
 		$license_status = null;
@@ -1343,52 +1343,52 @@  discard block
 block discarded – undo
1343 1343
 
1344 1344
 
1345 1345
     // Add class for input field if license is active.
1346
-	if ( $is_valid_license ) {
1346
+	if ($is_valid_license) {
1347 1347
 		$field_classes .= ' give-license-active';
1348 1348
 	}
1349 1349
 
1350 1350
 	// Get input filed html.
1351
-	$input_field_html = $field_type_object->input( array(
1351
+	$input_field_html = $field_type_object->input(array(
1352 1352
 		'class' => $field_classes,
1353 1353
 		'type'  => $type
1354
-	) );
1354
+	));
1355 1355
 
1356 1356
 	// If license is active so show deactivate button
1357
-	if ( $is_valid_license ) {
1357
+	if ($is_valid_license) {
1358 1358
         // Get input filed html.
1359
-        $input_field_html = $field_type_object->input( array(
1359
+        $input_field_html = $field_type_object->input(array(
1360 1360
             'class' => $field_classes,
1361 1361
             'type'  => $type,
1362 1362
             'readonly' => 'readonly',
1363
-        ) );
1363
+        ));
1364 1364
 
1365
-		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1365
+		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1366 1366
 	}
1367 1367
 
1368 1368
 	// Field description.
1369
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1369
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1370 1370
 
1371 1371
     // If no messages found then inform user that to get updated in future register yourself.
1372
-    if ( empty( $messages ) ) {
1373
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1372
+    if (empty($messages)) {
1373
+        $messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid Software Licensing license key.', 'give'));
1374 1374
     }
1375 1375
 
1376
-    foreach( $messages as $message ) {
1377
-        $custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1378
-        $custom_html .= '<p>' . $message . '</p>';
1376
+    foreach ($messages as $message) {
1377
+        $custom_html .= '<div class="give-license-notice give-'.$license_status.'">';
1378
+        $custom_html .= '<p>'.$message.'</p>';
1379 1379
         $custom_html .= '</div>';
1380 1380
     }
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
     // Field html.
1385
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1385
+    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1386 1386
 
1387 1387
     // Nonce.
1388
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1388
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1389 1389
 
1390 1390
     // Print field html.
1391
-    echo '<div>' . $custom_html . '</div>';
1391
+    echo '<div>'.$custom_html.'</div>';
1392 1392
 }
1393 1393
 
1394 1394
 
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
  */
1401 1401
 function give_api_callback() {
1402 1402
 
1403
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1403
+	if ( ! current_user_can('manage_give_settings')) {
1404 1404
 		return;
1405 1405
 	}
1406 1406
 
@@ -1409,9 +1409,9 @@  discard block
 block discarded – undo
1409 1409
 	 *
1410 1410
 	 * @since 1.0
1411 1411
 	 */
1412
-	do_action( 'give_tools_api_keys_before' );
1412
+	do_action('give_tools_api_keys_before');
1413 1413
 
1414
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1414
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1415 1415
 
1416 1416
 	$api_keys_table = new Give_API_Keys_Table();
1417 1417
 	$api_keys_table->prepare_items();
@@ -1420,9 +1420,9 @@  discard block
 block discarded – undo
1420 1420
 	<span class="cmb2-metabox-description api-description">
1421 1421
 		<?php echo sprintf(
1422 1422
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1423
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1424
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1425
-			esc_url( 'https://givewp.com/addons/zapier/' )
1423
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1424
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1425
+			esc_url('https://givewp.com/addons/zapier/')
1426 1426
 		); ?>
1427 1427
 	</span>
1428 1428
 	<?php
@@ -1432,10 +1432,10 @@  discard block
 block discarded – undo
1432 1432
 	 *
1433 1433
 	 * @since 1.0
1434 1434
 	 */
1435
-	do_action( 'give_tools_api_keys_after' );
1435
+	do_action('give_tools_api_keys_after');
1436 1436
 }
1437 1437
 
1438
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1438
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1439 1439
 
1440 1440
 /**
1441 1441
  * Hook Callback
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
  *
1449 1449
  * @return void
1450 1450
  */
1451
-function give_hook_callback( $args ) {
1451
+function give_hook_callback($args) {
1452 1452
 
1453 1453
 	$id = $args['id'];
1454 1454
 
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 	 *
1458 1458
 	 * @since 1.0
1459 1459
 	 */
1460
-	do_action( "give_{$id}" );
1460
+	do_action("give_{$id}");
1461 1461
 
1462 1462
 }
1463 1463
 
@@ -1469,10 +1469,10 @@  discard block
 block discarded – undo
1469 1469
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1470 1470
  */
1471 1471
 
1472
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1473
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1474
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1475
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1476
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1477
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1472
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1473
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1474
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1475
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1476
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1477
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1478 1478
 }
1479 1479
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/class-customer-table.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults
64
-		parent::__construct( array(
65
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
66
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
64
+		parent::__construct(array(
65
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
66
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
67 67
 			'ajax'     => false                       // Does this table support ajax?
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
88 88
 		}
89
-		if ( ! empty( $_REQUEST['order'] ) ) {
90
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
89
+		if ( ! empty($_REQUEST['order'])) {
90
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
91 91
 		}
92 92
 		?>
93 93
 		<p class="search-box" role="search">
94 94
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
95 95
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
96
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
96
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
97 97
 		</p>
98 98
 		<?php
99 99
 	}
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string Column Name.
111 111
 	 */
112
-	public function column_default( $item, $column_name ) {
113
-		switch ( $column_name ) {
112
+	public function column_default($item, $column_name) {
113
+		switch ($column_name) {
114 114
 
115 115
 			case 'num_purchases' :
116
-				$value = '<a href="' .
117
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
118
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
116
+				$value = '<a href="'.
117
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
118
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
119 119
 				break;
120 120
 
121 121
 			case 'amount_spent' :
122
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
122
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
123 123
 				break;
124 124
 
125 125
 			case 'date_created' :
126
-				$value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) );
126
+				$value = date_i18n(give_date_format(), strtotime($item['date_created']));
127 127
 				break;
128 128
 
129 129
 			default:
130
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
130
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
131 131
 				break;
132 132
 		}
133 133
 
134
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
134
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
135 135
 
136 136
 	}
137 137
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string
144 144
 	 */
145
-	public function column_name( $item ) {
146
-		$name = '#' . $item['id'] . ' ';
147
-		$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
148
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
149
-		$actions  = $this->get_row_actions( $item );
145
+	public function column_name($item) {
146
+		$name = '#'.$item['id'].' ';
147
+		$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
148
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
149
+		$actions  = $this->get_row_actions($item);
150 150
 
151
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
151
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
152 152
 	}
153 153
 
154 154
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_columns() {
162 162
 		$columns = array(
163
-			'name'          => esc_html__( 'Name', 'give' ),
164
-			'email'         => esc_html__( 'Email', 'give' ),
165
-			'num_purchases' => esc_html__( 'Donations', 'give' ),
166
-			'amount_spent'  => esc_html__( 'Total Donated', 'give' ),
167
-			'date_created'  => esc_html__( 'Date Created', 'give' )
163
+			'name'          => esc_html__('Name', 'give'),
164
+			'email'         => esc_html__('Email', 'give'),
165
+			'num_purchases' => esc_html__('Donations', 'give'),
166
+			'amount_spent'  => esc_html__('Total Donated', 'give'),
167
+			'date_created'  => esc_html__('Date Created', 'give')
168 168
 		);
169 169
 
170
-		return apply_filters( 'give_report_customer_columns', $columns );
170
+		return apply_filters('give_report_customer_columns', $columns);
171 171
 
172 172
 	}
173 173
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function get_sortable_columns() {
182 182
 		return array(
183
-			'date_created'  => array( 'date_created', true ),
184
-			'name'          => array( 'name', true ),
185
-			'num_purchases' => array( 'purchase_count', false ),
186
-			'amount_spent'  => array( 'purchase_value', false ),
183
+			'date_created'  => array('date_created', true),
184
+			'name'          => array('name', true),
185
+			'num_purchases' => array('purchase_count', false),
186
+			'amount_spent'  => array('purchase_value', false),
187 187
 		);
188 188
 	}
189 189
 
@@ -195,34 +195,34 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return array An array of action links.
197 197
 	 */
198
-	public function get_row_actions( $item ) {
198
+	public function get_row_actions($item) {
199 199
 
200 200
 		$actions = array(
201 201
 
202 202
 			'view' => sprintf(
203 203
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
204
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ),
205
-				sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ),
206
-				esc_html__( 'View Donor', 'give' )
204
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']),
205
+				sprintf(esc_attr__('View "%s"', 'give'), $item['name']),
206
+				esc_html__('View Donor', 'give')
207 207
 			),
208 208
 
209 209
 			'notes' => sprintf(
210 210
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
211
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ),
212
-				sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ),
213
-				esc_html__( 'Notes', 'give' )
211
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']),
212
+				sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']),
213
+				esc_html__('Notes', 'give')
214 214
 			),
215 215
 
216 216
 			'delete' => sprintf(
217 217
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
218
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ),
219
-				sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ),
220
-				esc_html__( 'Delete', 'give' )
218
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']),
219
+				sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']),
220
+				esc_html__('Delete', 'give')
221 221
 			)
222 222
 
223 223
 		);
224 224
 
225
-		return apply_filters( 'give_donor_row_actions', $actions, $item );
225
+		return apply_filters('give_donor_row_actions', $actions, $item);
226 226
 
227 227
 	}
228 228
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @since  1.0
234 234
 	 * @return void
235 235
 	 */
236
-	public function bulk_actions( $which = '' ) {
236
+	public function bulk_actions($which = '') {
237 237
 		// These aren't really bulk actions but this outputs the markup in the right place.
238 238
 	}
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number.
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise.
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		} else {
293 293
 			$args['name'] = $search;
294 294
 		}
295 295
 
296
-		$customers = Give()->customers->get_customers( $args );
296
+		$customers = Give()->customers->get_customers($args);
297 297
 
298
-		if ( $customers ) {
298
+		if ($customers) {
299 299
 
300
-			foreach ( $customers as $customer ) {
300
+			foreach ($customers as $customer) {
301 301
 
302
-				$user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0;
302
+				$user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $customer->id,
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
 		$hidden   = array(); // No hidden columns
334 334
 		$sortable = $this->get_sortable_columns();
335 335
 
336
-		$this->_column_headers = array( $columns, $hidden, $sortable );
336
+		$this->_column_headers = array($columns, $hidden, $sortable);
337 337
 
338 338
 		$this->items = $this->reports_data();
339 339
 
340 340
 		$this->total = give_count_total_customers();
341 341
 
342
-		$this->set_pagination_args( array(
342
+		$this->set_pagination_args(array(
343 343
 			'total_items' => $this->total,
344 344
 			'per_page'    => $this->per_page,
345
-			'total_pages' => ceil( $this->total / $this->per_page )
346
-		) );
345
+			'total_pages' => ceil($this->total / $this->per_page)
346
+		));
347 347
 	}
348 348
 }
349 349
\ No newline at end of file
Please login to merge, or discard this patch.