Completed
Push — master ( 27fde9...0af146 )
by Devin
17:43
created
includes/forms/functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  * Used to redirect a user back to the purchase
157 157
  * page if there are errors present.
158 158
  *
159
- * @param array $args
159
+ * @param string $args
160 160
  *
161 161
  * @access public
162 162
  * @since  1.0
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @param int $form_id Give Form ID
392 392
  *
393
- * @return int $earnings Earnings for a certain form
393
+ * @return double $earnings Earnings for a certain form
394 394
  */
395 395
 function give_get_form_earnings_stats( $form_id = 0 ) {
396 396
 	$give_form = new Give_Donate_Form( $form_id );
Please login to merge, or discard this patch.
Spacing   +211 added lines, -211 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) ) {
75
-		$float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled';
74
+	if (empty($float_labels)) {
75
+		$float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled';
76 76
 	}
77 77
 
78
-	return ( $float_labels == 'enabled' ) ? true : false;
78
+	return ($float_labels == 'enabled') ? true : false;
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 
168 168
 	//Set the form_id.
169
-	if ( isset( $_POST['give-form-id'] ) ) {
170
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
169
+	if (isset($_POST['give-form-id'])) {
170
+		$form_id = sanitize_text_field($_POST['give-form-id']);
171 171
 	} else {
172 172
 		$form_id = 0;
173 173
 	}
174 174
 
175 175
 	//Need a URL to continue. If none, redirect back to single form.
176
-	if ( empty( $url ) ) {
177
-		wp_safe_redirect( get_permalink( $form_id ) );
176
+	if (empty($url)) {
177
+		wp_safe_redirect(get_permalink($form_id));
178 178
 		give_die();
179 179
 	}
180 180
 
@@ -183,36 +183,36 @@  discard block
 block discarded – undo
183 183
 	);
184 184
 
185 185
 	// Check for backward compatibility.
186
-	if ( is_string( $args ) ) {
187
-		$args = str_replace( '?', '', $args );
186
+	if (is_string($args)) {
187
+		$args = str_replace('?', '', $args);
188 188
 	}
189 189
 
190
-	$args = wp_parse_args( $args, $defaults );
190
+	$args = wp_parse_args($args, $defaults);
191 191
 
192 192
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
193
-	$url_data = wp_parse_url( $url );
193
+	$url_data = wp_parse_url($url);
194 194
 
195 195
 	//Check if an array to prevent notices before parsing.
196
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
197
-		parse_str( $url_data['query'], $query );
196
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
197
+		parse_str($url_data['query'], $query);
198 198
 
199 199
 		//Precaution: don't allow any CC info.
200
-		unset( $query['card_number'] );
201
-		unset( $query['card_cvc'] );
200
+		unset($query['card_number']);
201
+		unset($query['card_cvc']);
202 202
 
203 203
 	} else {
204 204
 		//No $url_data so pass empty array.
205 205
 		$query = array();
206 206
 	}
207 207
 
208
-	$new_query        = array_merge( $args, $query );
209
-	$new_query_string = http_build_query( $new_query );
208
+	$new_query        = array_merge($args, $query);
209
+	$new_query_string = http_build_query($new_query);
210 210
 
211 211
 	// Assemble URL parts.
212
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
212
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
213 213
 
214 214
 	//Redirect them.
215
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
215
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
216 216
 	give_die();
217 217
 
218 218
 }
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
  * @since       1.0
229 229
  * @return      string
230 230
  */
231
-function give_get_success_page_url( $query_string = null ) {
231
+function give_get_success_page_url($query_string = null) {
232 232
 
233
-	$success_page = give_get_option( 'success_page', 0 );
234
-	$success_page = get_permalink( $success_page );
233
+	$success_page = give_get_option('success_page', 0);
234
+	$success_page = get_permalink($success_page);
235 235
 
236
-	if ( $query_string ) {
236
+	if ($query_string) {
237 237
 		$success_page .= $query_string;
238 238
 	}
239 239
 
240
-	return apply_filters( 'give_success_page_url', $success_page );
240
+	return apply_filters('give_success_page_url', $success_page);
241 241
 
242 242
 }
243 243
 
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist
252 252
  */
253
-function give_get_failed_transaction_uri( $extras = false ) {
253
+function give_get_failed_transaction_uri($extras = false) {
254 254
 	$give_options = give_get_settings();
255 255
 
256
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
257
-	if ( $extras ) {
256
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
257
+	if ($extras) {
258 258
 		$uri .= $extras;
259 259
 	}
260 260
 
261
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
261
+	return apply_filters('give_get_failed_transaction_uri', $uri);
262 262
 }
263 263
 
264 264
 /**
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function give_is_failed_transaction_page() {
271 271
 	$give_options = give_get_settings();
272
-	$ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
272
+	$ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
273 273
 
274
-	return apply_filters( 'give_is_failure_page', $ret );
274
+	return apply_filters('give_is_failure_page', $ret);
275 275
 }
276 276
 
277 277
 /**
@@ -283,18 +283,18 @@  discard block
 block discarded – undo
283 283
  */
284 284
 function give_listen_for_failed_payments() {
285 285
 
286
-	$failed_page = give_get_option( 'failure_page', 0 );
286
+	$failed_page = give_get_option('failure_page', 0);
287 287
 
288
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
288
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
289 289
 
290
-		$payment_id = absint( $_GET['payment-id'] );
291
-		give_update_payment_status( $payment_id, 'failed' );
290
+		$payment_id = absint($_GET['payment-id']);
291
+		give_update_payment_status($payment_id, 'failed');
292 292
 
293 293
 	}
294 294
 
295 295
 }
296 296
 
297
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
297
+add_action('template_redirect', 'give_listen_for_failed_payments');
298 298
 
299 299
 /**
300 300
  * Retrieve the Donation History page URI
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
 function give_get_history_page_uri() {
308 308
 	$give_options = give_get_settings();
309 309
 
310
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
310
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
311 311
 
312
-	return apply_filters( 'give_get_history_page_uri', $history_page );
312
+	return apply_filters('give_get_history_page_uri', $history_page);
313 313
 }
314 314
 
315 315
 /**
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
  * @since       1.0
323 323
  * @return      bool
324 324
  */
325
-function give_field_is_required( $field = '', $form_id ) {
325
+function give_field_is_required($field = '', $form_id) {
326 326
 
327
-	$required_fields = give_get_required_fields( $form_id );
327
+	$required_fields = give_get_required_fields($form_id);
328 328
 
329
-	return array_key_exists( $field, $required_fields );
329
+	return array_key_exists($field, $required_fields);
330 330
 }
331 331
 
332 332
 /**
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
  *
345 345
  * @return void
346 346
  */
347
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
347
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
348 348
 	global $give_logs;
349 349
 
350 350
 	$log_data = array(
351 351
 		'post_parent'   => $give_form_id,
352 352
 		'log_type'      => 'sale',
353
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
354
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null
353
+		'post_date'     => isset($sale_date) ? $sale_date : null,
354
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null
355 355
 	);
356 356
 
357 357
 	$log_meta = array(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		'price_id'   => (int) $price_id
360 360
 	);
361 361
 
362
-	$give_logs->insert_log( $log_data, $log_meta );
362
+	$give_logs->insert_log($log_data, $log_meta);
363 363
 }
364 364
 
365 365
 
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool|int
375 375
  */
376
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
376
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
377 377
 	$quantity = (int) $quantity;
378
-	$form     = new Give_Donate_Form( $form_id );
378
+	$form     = new Give_Donate_Form($form_id);
379 379
 
380
-	return $form->increase_sales( $quantity );
380
+	return $form->increase_sales($quantity);
381 381
 }
382 382
 
383 383
 /**
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return bool|int
392 392
  */
393
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
393
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
394 394
 	$quantity = (int) $quantity;
395
-	$form     = new Give_Donate_Form( $form_id );
395
+	$form     = new Give_Donate_Form($form_id);
396 396
 
397
-	return $form->decrease_sales( $quantity );
397
+	return $form->decrease_sales($quantity);
398 398
 }
399 399
 
400 400
 /**
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
  *
408 408
  * @return bool|int
409 409
  */
410
-function give_increase_earnings( $give_form_id = 0, $amount ) {
411
-	$form = new Give_Donate_Form( $give_form_id );
410
+function give_increase_earnings($give_form_id = 0, $amount) {
411
+	$form = new Give_Donate_Form($give_form_id);
412 412
 
413
-	return $form->increase_earnings( $amount );
413
+	return $form->increase_earnings($amount);
414 414
 }
415 415
 
416 416
 /**
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
  *
424 424
  * @return bool|int
425 425
  */
426
-function give_decrease_earnings( $form_id = 0, $amount ) {
427
-	$form = new Give_Donate_Form( $form_id );
426
+function give_decrease_earnings($form_id = 0, $amount) {
427
+	$form = new Give_Donate_Form($form_id);
428 428
 
429
-	return $form->decrease_earnings( $amount );
429
+	return $form->decrease_earnings($amount);
430 430
 }
431 431
 
432 432
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
  *
440 440
  * @return int $earnings Earnings for a certain form
441 441
  */
442
-function give_get_form_earnings_stats( $form_id = 0 ) {
443
-	$give_form = new Give_Donate_Form( $form_id );
442
+function give_get_form_earnings_stats($form_id = 0) {
443
+	$give_form = new Give_Donate_Form($form_id);
444 444
 
445 445
 	return $give_form->earnings;
446 446
 }
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
  *
456 456
  * @return int $sales Amount of sales for a certain form
457 457
  */
458
-function give_get_form_sales_stats( $give_form_id = 0 ) {
459
-	$give_form = new Give_Donate_Form( $give_form_id );
458
+function give_get_form_sales_stats($give_form_id = 0) {
459
+	$give_form = new Give_Donate_Form($give_form_id);
460 460
 
461 461
 	return $give_form->sales;
462 462
 }
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
  *
472 472
  * @return float $sales Average monthly sales
473 473
  */
474
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
475
-	$sales        = give_get_form_sales_stats( $form_id );
476
-	$release_date = get_post_field( 'post_date', $form_id );
474
+function give_get_average_monthly_form_sales($form_id = 0) {
475
+	$sales        = give_get_form_sales_stats($form_id);
476
+	$release_date = get_post_field('post_date', $form_id);
477 477
 
478
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
478
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
479 479
 
480
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
480
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
481 481
 
482
-	if ( $months > 0 ) {
483
-		$sales = ( $sales / $months );
482
+	if ($months > 0) {
483
+		$sales = ($sales / $months);
484 484
 	}
485 485
 
486 486
 	return $sales;
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
  *
497 497
  * @return float $earnings Average monthly earnings
498 498
  */
499
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
500
-	$earnings     = give_get_form_earnings_stats( $form_id );
501
-	$release_date = get_post_field( 'post_date', $form_id );
499
+function give_get_average_monthly_form_earnings($form_id = 0) {
500
+	$earnings     = give_get_form_earnings_stats($form_id);
501
+	$release_date = get_post_field('post_date', $form_id);
502 502
 
503
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
503
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
504 504
 
505
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
505
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
506 506
 
507
-	if ( $months > 0 ) {
508
-		$earnings = ( $earnings / $months );
507
+	if ($months > 0) {
508
+		$earnings = ($earnings / $months);
509 509
 	}
510 510
 
511 511
 	return $earnings < 0 ? 0 : $earnings;
@@ -525,25 +525,25 @@  discard block
 block discarded – undo
525 525
  *
526 526
  * @return string $price_name Name of the price option
527 527
  */
528
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
528
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
529 529
 
530
-	$prices     = give_get_variable_prices( $form_id );
530
+	$prices     = give_get_variable_prices($form_id);
531 531
 	$price_name = '';
532 532
 
533
-	foreach ( $prices as $price ) {
533
+	foreach ($prices as $price) {
534 534
 
535
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
535
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
536 536
 
537
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
538
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
539
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
537
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
538
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
539
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
540 540
 
541 541
 		}
542 542
 
543 543
 	}
544 544
 
545 545
 
546
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
546
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
547 547
 }
548 548
 
549 549
 
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
  *
557 557
  * @return string $range A fully formatted price range
558 558
  */
559
-function give_price_range( $form_id = 0 ) {
560
-	$low   = give_get_lowest_price_option( $form_id );
561
-	$high  = give_get_highest_price_option( $form_id );
562
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
559
+function give_price_range($form_id = 0) {
560
+	$low   = give_get_lowest_price_option($form_id);
561
+	$high  = give_get_highest_price_option($form_id);
562
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
563 563
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
564
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
564
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
565 565
 
566
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
566
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
567 567
 }
568 568
 
569 569
 
@@ -578,36 +578,36 @@  discard block
 block discarded – undo
578 578
  *
579 579
  * @return int ID of the lowest price
580 580
  */
581
-function give_get_lowest_price_id( $form_id = 0 ) {
581
+function give_get_lowest_price_id($form_id = 0) {
582 582
 
583
-	if ( empty( $form_id ) ) {
583
+	if (empty($form_id)) {
584 584
 		$form_id = get_the_ID();
585 585
 	}
586 586
 
587
-	if ( ! give_has_variable_prices( $form_id ) ) {
588
-		return give_get_form_price( $form_id );
587
+	if ( ! give_has_variable_prices($form_id)) {
588
+		return give_get_form_price($form_id);
589 589
 	}
590 590
 
591
-	$prices = give_get_variable_prices( $form_id );
591
+	$prices = give_get_variable_prices($form_id);
592 592
 
593 593
 	$low    = 0.00;
594 594
 	$min_id = 1;
595 595
 
596
-	if ( ! empty( $prices ) ) {
596
+	if ( ! empty($prices)) {
597 597
 
598
-		foreach ( $prices as $key => $price ) {
598
+		foreach ($prices as $key => $price) {
599 599
 
600
-			if ( empty( $price['_give_amount'] ) ) {
600
+			if (empty($price['_give_amount'])) {
601 601
 				continue;
602 602
 			}
603 603
 
604
-			if ( ! isset( $min ) ) {
604
+			if ( ! isset($min)) {
605 605
 				$min = $price['_give_amount'];
606 606
 			} else {
607
-				$min = min( $min, $price['_give_amount'] );
607
+				$min = min($min, $price['_give_amount']);
608 608
 			}
609 609
 
610
-			if ( $price['_give_amount'] == $min ) {
610
+			if ($price['_give_amount'] == $min) {
611 611
 				$min_id = $price['_give_id']['level_id'];
612 612
 			}
613 613
 		}
@@ -625,43 +625,43 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return float Amount of the lowest price
627 627
  */
628
-function give_get_lowest_price_option( $form_id = 0 ) {
629
-	if ( empty( $form_id ) ) {
628
+function give_get_lowest_price_option($form_id = 0) {
629
+	if (empty($form_id)) {
630 630
 		$form_id = get_the_ID();
631 631
 	}
632 632
 
633
-	if ( ! give_has_variable_prices( $form_id ) ) {
634
-		return give_get_form_price( $form_id );
633
+	if ( ! give_has_variable_prices($form_id)) {
634
+		return give_get_form_price($form_id);
635 635
 	}
636 636
 
637
-	$prices = give_get_variable_prices( $form_id );
637
+	$prices = give_get_variable_prices($form_id);
638 638
 
639 639
 	$low = 0.00;
640 640
 
641
-	if ( ! empty( $prices ) ) {
641
+	if ( ! empty($prices)) {
642 642
 
643
-		foreach ( $prices as $key => $price ) {
643
+		foreach ($prices as $key => $price) {
644 644
 
645
-			if ( empty( $price['_give_amount'] ) ) {
645
+			if (empty($price['_give_amount'])) {
646 646
 				continue;
647 647
 			}
648 648
 
649
-			if ( ! isset( $min ) ) {
649
+			if ( ! isset($min)) {
650 650
 				$min = $price['_give_amount'];
651 651
 			} else {
652
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
652
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
653 653
 			}
654 654
 
655
-			if ( $price['_give_amount'] == $min ) {
655
+			if ($price['_give_amount'] == $min) {
656 656
 				$min_id = $key;
657 657
 			}
658 658
 		}
659 659
 
660
-		$low = $prices[ $min_id ]['_give_amount'];
660
+		$low = $prices[$min_id]['_give_amount'];
661 661
 
662 662
 	}
663 663
 
664
-	return give_sanitize_amount( $low );
664
+	return give_sanitize_amount($low);
665 665
 }
666 666
 
667 667
 /**
@@ -673,41 +673,41 @@  discard block
 block discarded – undo
673 673
  *
674 674
  * @return float Amount of the highest price
675 675
  */
676
-function give_get_highest_price_option( $form_id = 0 ) {
676
+function give_get_highest_price_option($form_id = 0) {
677 677
 
678
-	if ( empty( $form_id ) ) {
678
+	if (empty($form_id)) {
679 679
 		$form_id = get_the_ID();
680 680
 	}
681 681
 
682
-	if ( ! give_has_variable_prices( $form_id ) ) {
683
-		return give_get_form_price( $form_id );
682
+	if ( ! give_has_variable_prices($form_id)) {
683
+		return give_get_form_price($form_id);
684 684
 	}
685 685
 
686
-	$prices = give_get_variable_prices( $form_id );
686
+	$prices = give_get_variable_prices($form_id);
687 687
 
688 688
 	$high = 0.00;
689 689
 
690
-	if ( ! empty( $prices ) ) {
690
+	if ( ! empty($prices)) {
691 691
 
692 692
 		$max = 0;
693 693
 
694
-		foreach ( $prices as $key => $price ) {
695
-			if ( empty( $price['_give_amount'] ) ) {
694
+		foreach ($prices as $key => $price) {
695
+			if (empty($price['_give_amount'])) {
696 696
 				continue;
697 697
 			}
698
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
698
+			$give_amount = give_sanitize_amount($price['_give_amount']);
699 699
 
700
-			$max = max( $max, $give_amount );
700
+			$max = max($max, $give_amount);
701 701
 
702
-			if ( $give_amount == $max ) {
702
+			if ($give_amount == $max) {
703 703
 				$max_id = $key;
704 704
 			}
705 705
 		}
706 706
 
707
-		$high = $prices[ $max_id ]['_give_amount'];
707
+		$high = $prices[$max_id]['_give_amount'];
708 708
 	}
709 709
 
710
-	return give_sanitize_amount( $high );
710
+	return give_sanitize_amount($high);
711 711
 }
712 712
 
713 713
 /**
@@ -719,15 +719,15 @@  discard block
 block discarded – undo
719 719
  *
720 720
  * @return mixed string|int Price of the form
721 721
  */
722
-function give_get_form_price( $form_id = 0 ) {
722
+function give_get_form_price($form_id = 0) {
723 723
 
724
-	if ( empty( $form_id ) ) {
724
+	if (empty($form_id)) {
725 725
 		return false;
726 726
 	}
727 727
 
728
-	$form = new Give_Donate_Form( $form_id );
728
+	$form = new Give_Donate_Form($form_id);
729 729
 
730
-	return $form->__get( 'price' );
730
+	return $form->__get('price');
731 731
 }
732 732
 
733 733
 /**
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
  *
740 740
  * @return mixed string|int Minimum price of the form
741 741
  */
742
-function give_get_form_minimum_price( $form_id = 0 ) {
742
+function give_get_form_minimum_price($form_id = 0) {
743 743
 
744
-	if ( empty( $form_id ) ) {
744
+	if (empty($form_id)) {
745 745
 		return false;
746 746
 	}
747 747
 
748
-	$form = new Give_Donate_Form( $form_id );
748
+	$form = new Give_Donate_Form($form_id);
749 749
 
750
-	return $form->__get( 'minimum_price' );
750
+	return $form->__get('minimum_price');
751 751
 
752 752
 }
753 753
 
@@ -762,52 +762,52 @@  discard block
 block discarded – undo
762 762
  *
763 763
  * @return int $formatted_price
764 764
  */
765
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
765
+function give_price($form_id = 0, $echo = true, $price_id = false) {
766 766
 
767
-	if ( empty( $form_id ) ) {
767
+	if (empty($form_id)) {
768 768
 		$form_id = get_the_ID();
769 769
 	}
770 770
 
771
-	if ( give_has_variable_prices( $form_id ) ) {
771
+	if (give_has_variable_prices($form_id)) {
772 772
 
773
-		$prices = give_get_variable_prices( $form_id );
773
+		$prices = give_get_variable_prices($form_id);
774 774
 
775
-		if ( false !== $price_id ) {
775
+		if (false !== $price_id) {
776 776
 
777 777
 			//loop through multi-prices to see which is default
778
-			foreach ( $prices as $price ) {
778
+			foreach ($prices as $price) {
779 779
 				//this is the default price
780
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
780
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
781 781
 					$price = (float) $price['_give_amount'];
782 782
 				};
783 783
 			}
784 784
 
785 785
 		} else {
786 786
 
787
-			$price = give_get_lowest_price_option( $form_id );
787
+			$price = give_get_lowest_price_option($form_id);
788 788
 		}
789 789
 
790
-		$price = give_sanitize_amount( $price );
790
+		$price = give_sanitize_amount($price);
791 791
 
792 792
 	} else {
793 793
 
794
-		$price = give_get_form_price( $form_id );
794
+		$price = give_get_form_price($form_id);
795 795
 
796 796
 	}
797 797
 
798
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
799
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
800
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
798
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
799
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
800
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
801 801
 
802
-	if ( $echo ) {
802
+	if ($echo) {
803 803
 		echo $formatted_price;
804 804
 	} else {
805 805
 		return $formatted_price;
806 806
 	}
807 807
 }
808 808
 
809
-add_filter( 'give_form_price', 'give_format_amount', 10 );
810
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
809
+add_filter('give_form_price', 'give_format_amount', 10);
810
+add_filter('give_form_price', 'give_currency_filter', 20);
811 811
 
812 812
 
813 813
 /**
@@ -820,19 +820,19 @@  discard block
 block discarded – undo
820 820
  *
821 821
  * @return float $amount Amount of the price option
822 822
  */
823
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
824
-	$prices = give_get_variable_prices( $form_id );
823
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
824
+	$prices = give_get_variable_prices($form_id);
825 825
 
826 826
 	$amount = 0.00;
827 827
 
828
-	foreach ( $prices as $price ) {
829
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
830
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
828
+	foreach ($prices as $price) {
829
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
830
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
831 831
 			break;
832 832
 		};
833 833
 	}
834 834
 
835
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
835
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
836 836
 }
837 837
 
838 838
 /**
@@ -844,13 +844,13 @@  discard block
 block discarded – undo
844 844
  *
845 845
  * @return mixed string|int Goal of the form
846 846
  */
847
-function give_get_form_goal( $form_id = 0 ) {
847
+function give_get_form_goal($form_id = 0) {
848 848
 
849
-	if ( empty( $form_id ) ) {
849
+	if (empty($form_id)) {
850 850
 		return false;
851 851
 	}
852 852
 
853
-	$form = new Give_Donate_Form( $form_id );
853
+	$form = new Give_Donate_Form($form_id);
854 854
 
855 855
 	return $form->goal;
856 856
 
@@ -866,27 +866,27 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return string $formatted_goal
868 868
  */
869
-function give_goal( $form_id = 0, $echo = true ) {
869
+function give_goal($form_id = 0, $echo = true) {
870 870
 
871
-	if ( empty( $form_id ) ) {
871
+	if (empty($form_id)) {
872 872
 		$form_id = get_the_ID();
873 873
 	}
874 874
 
875
-	$goal = give_get_form_goal( $form_id );
875
+	$goal = give_get_form_goal($form_id);
876 876
 
877
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
878
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
879
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
877
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
878
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
879
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
880 880
 
881
-	if ( $echo ) {
881
+	if ($echo) {
882 882
 		echo $formatted_goal;
883 883
 	} else {
884 884
 		return $formatted_goal;
885 885
 	}
886 886
 }
887 887
 
888
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
889
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
888
+add_filter('give_form_goal', 'give_format_amount', 10);
889
+add_filter('give_form_goal', 'give_currency_filter', 20);
890 890
 
891 891
 
892 892
 /**
@@ -898,13 +898,13 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return bool  $ret Whether or not the logged_in_only setting is set
900 900
  */
901
-function give_logged_in_only( $form_id ) {
901
+function give_logged_in_only($form_id) {
902 902
 
903
-	$form_option = get_post_meta( $form_id, '_give_logged_in_only', true );
903
+	$form_option = get_post_meta($form_id, '_give_logged_in_only', true);
904 904
 
905
-	$ret = ! empty( $form_option ) ? $form_option : false;
905
+	$ret = ! empty($form_option) ? $form_option : false;
906 906
 
907
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
907
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
908 908
 
909 909
 }
910 910
 
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @return string
920 920
  */
921
-function give_show_login_register_option( $form_id ) {
921
+function give_show_login_register_option($form_id) {
922 922
 
923
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
923
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
924 924
 
925
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
925
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
926 926
 
927 927
 }
928 928
 
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
  * @param  int   $form_id Form ID.
937 937
  * @return array
938 938
  */
939
-function _give_get_prefill_form_field_values( $form_id ) {
939
+function _give_get_prefill_form_field_values($form_id) {
940 940
 	$logged_in_donor_info = array();
941 941
 
942
-	if ( is_user_logged_in() ) :
943
-		$donor_data    = get_userdata( get_current_user_id() );
944
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
942
+	if (is_user_logged_in()) :
943
+		$donor_data    = get_userdata(get_current_user_id());
944
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
945 945
 
946 946
 		$logged_in_donor_info = array(
947 947
 			// First name.
@@ -954,42 +954,42 @@  discard block
 block discarded – undo
954 954
 			'give_email' => $donor_data->user_email,
955 955
 
956 956
 			// Street address 1.
957
-			'card_address' => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
957
+			'card_address' => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
958 958
 
959 959
 			// Street address 2.
960
-			'card_address_2' => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
960
+			'card_address_2' => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
961 961
 
962 962
 			// Country.
963
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
963
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
964 964
 
965 965
 			// State.
966
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
966
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
967 967
 
968 968
 			// City.
969
-			'card_city'      => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
969
+			'card_city'      => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
970 970
 
971 971
 			// Zipcode
972
-			'card_zip'       => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' )
972
+			'card_zip'       => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : '')
973 973
 		);
974 974
 	endif;
975 975
 
976 976
 	// Bailout: Auto fill form field values only form form which donor is donating.
977
-	if(
978
-		empty( $_GET['form-id'] )
977
+	if (
978
+		empty($_GET['form-id'])
979 979
 		|| ! $form_id
980
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
980
+		|| ($form_id !== absint($_GET['form-id']))
981 981
 	) {
982 982
 		return $logged_in_donor_info;
983 983
 	}
984 984
 
985 985
 	// Get purchase data.
986
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
986
+	$give_purchase_data = Give()->session->get('give_purchase');
987 987
 
988 988
 	// Get donor info from form data.
989
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
989
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
990 990
 		? array()
991 991
 		: $give_purchase_data['post_data'];
992 992
 
993 993
 	// Output.
994
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
994
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
995 995
 }
996 996
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function get_predefined_dates() {
87 87
 		$predefined = array(
88
-			'today'        => esc_html__( 'Today', 'give' ),
89
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
90
-			'this_week'    => esc_html__( 'This Week', 'give' ),
91
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
92
-			'this_month'   => esc_html__( 'This Month', 'give' ),
93
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
94
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
95
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
96
-			'this_year'    => esc_html__( 'This Year', 'give' ),
97
-			'last_year'    => esc_html__( 'Last Year', 'give' )
88
+			'today'        => esc_html__('Today', 'give'),
89
+			'yesterday'    => esc_html__('Yesterday', 'give'),
90
+			'this_week'    => esc_html__('This Week', 'give'),
91
+			'last_week'    => esc_html__('Last Week', 'give'),
92
+			'this_month'   => esc_html__('This Month', 'give'),
93
+			'last_month'   => esc_html__('Last Month', 'give'),
94
+			'this_quarter' => esc_html__('This Quarter', 'give'),
95
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
96
+			'this_year'    => esc_html__('This Year', 'give'),
97
+			'last_year'    => esc_html__('Last Year', 'give')
98 98
 		);
99 99
 
100
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
100
+		return apply_filters('give_stats_predefined_dates', $predefined);
101 101
 	}
102 102
 
103 103
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return void
115 115
 	 */
116
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
116
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
117 117
 
118
-		if ( empty( $_start_date ) ) {
118
+		if (empty($_start_date)) {
119 119
 			$_start_date = 'this_month';
120 120
 		}
121 121
 
122
-		if ( empty( $_end_date ) ) {
122
+		if (empty($_end_date)) {
123 123
 			$_end_date = $_start_date;
124 124
 		}
125 125
 
126
-		$this->start_date = $this->convert_date( $_start_date );
127
-		$this->end_date   = $this->convert_date( $_end_date, true );
126
+		$this->start_date = $this->convert_date($_start_date);
127
+		$this->end_date   = $this->convert_date($_end_date, true);
128 128
 	}
129 129
 
130 130
 	/**
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
142 142
 	 */
143
-	public function convert_date( $date, $end_date = false ) {
143
+	public function convert_date($date, $end_date = false) {
144 144
 
145 145
 		$this->timestamp = false;
146 146
 		$second          = $end_date ? 59 : 0;
147 147
 		$minute          = $end_date ? 59 : 0;
148 148
 		$hour            = $end_date ? 23 : 0;
149 149
 		$day             = 1;
150
-		$month           = date( 'n', current_time( 'timestamp' ) );
151
-		$year            = date( 'Y', current_time( 'timestamp' ) );
150
+		$month           = date('n', current_time('timestamp'));
151
+		$year            = date('Y', current_time('timestamp'));
152 152
 
153
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
153
+		if (array_key_exists($date, $this->get_predefined_dates())) {
154 154
 
155 155
 			// This is a predefined date rate, such as last_week
156
-			switch ( $date ) {
156
+			switch ($date) {
157 157
 
158 158
 				case 'this_month' :
159 159
 
160
-					if ( $end_date ) {
160
+					if ($end_date) {
161 161
 
162
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
162
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
163 163
 						$hour   = 23;
164 164
 						$minute = 59;
165 165
 						$second = 59;
@@ -169,28 +169,28 @@  discard block
 block discarded – undo
169 169
 
170 170
 				case 'last_month' :
171 171
 
172
-					if ( $month == 1 ) {
172
+					if ($month == 1) {
173 173
 
174 174
 						$month = 12;
175
-						$year --;
175
+						$year--;
176 176
 
177 177
 					} else {
178 178
 
179
-						$month --;
179
+						$month--;
180 180
 
181 181
 					}
182 182
 
183
-					if ( $end_date ) {
184
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
183
+					if ($end_date) {
184
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
185 185
 					}
186 186
 
187 187
 					break;
188 188
 
189 189
 				case 'today' :
190 190
 
191
-					$day = date( 'd', current_time( 'timestamp' ) );
191
+					$day = date('d', current_time('timestamp'));
192 192
 
193
-					if ( $end_date ) {
193
+					if ($end_date) {
194 194
 						$hour   = 23;
195 195
 						$minute = 59;
196 196
 						$second = 59;
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 
201 201
 				case 'yesterday' :
202 202
 
203
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
203
+					$day = date('d', current_time('timestamp')) - 1;
204 204
 
205 205
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
206
-					if ( $day < 1 ) {
206
+					if ($day < 1) {
207 207
 
208 208
 						// If current month is 1
209
-						if ( 1 == $month ) {
209
+						if (1 == $month) {
210 210
 
211 211
 							$year -= 1; // Today is January 1, so skip back to last day of December
212 212
 							$month = 12;
213
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
213
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
214 214
 
215 215
 						} else {
216 216
 
217 217
 							// Go back one month and get the last day of the month
218 218
 							$month -= 1;
219
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
219
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
220 220
 
221 221
 						}
222 222
 					}
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
 				case 'this_week' :
227 227
 
228
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
229
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
228
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
229
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
230 230
 
231
-					if ( $today < $days_to_week_start ) {
231
+					if ($today < $days_to_week_start) {
232 232
 
233
-						if ( $month > 1 ) {
233
+						if ($month > 1) {
234 234
 							$month -= 1;
235 235
 						} else {
236 236
 							$month = 12;
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 
239 239
 					}
240 240
 
241
-					if ( ! $end_date ) {
241
+					if ( ! $end_date) {
242 242
 
243 243
 						// Getting the start day
244 244
 
245
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
246
-						$day += get_option( 'start_of_week' );
245
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
246
+						$day += get_option('start_of_week');
247 247
 
248 248
 					} else {
249 249
 
250 250
 						// Getting the end day
251 251
 
252
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
253
-						$day += get_option( 'start_of_week' ) + 6;
252
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
253
+						$day += get_option('start_of_week') + 6;
254 254
 
255 255
 					}
256 256
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 				case 'last_week' :
260 260
 
261
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
262
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
261
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
262
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
263 263
 
264
-					if ( $today < $days_to_week_start ) {
264
+					if ($today < $days_to_week_start) {
265 265
 
266
-						if ( $month > 1 ) {
266
+						if ($month > 1) {
267 267
 							$month -= 1;
268 268
 						} else {
269 269
 							$month = 12;
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 
272 272
 					}
273 273
 
274
-					if ( ! $end_date ) {
274
+					if ( ! $end_date) {
275 275
 
276 276
 						// Getting the start day
277 277
 
278
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
279
-						$day += get_option( 'start_of_week' );
278
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
279
+						$day += get_option('start_of_week');
280 280
 
281 281
 					} else {
282 282
 
283 283
 						// Getting the end day
284 284
 
285
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
286
-						$day += get_option( 'start_of_week' ) + 6;
285
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
286
+						$day += get_option('start_of_week') + 6;
287 287
 
288 288
 					}
289 289
 
@@ -291,39 +291,39 @@  discard block
 block discarded – undo
291 291
 
292 292
 				case 'this_quarter' :
293 293
 
294
-					$month_now = date( 'n', current_time( 'timestamp' ) );
294
+					$month_now = date('n', current_time('timestamp'));
295 295
 
296
-					if ( $month_now <= 3 ) {
296
+					if ($month_now <= 3) {
297 297
 
298
-						if ( ! $end_date ) {
298
+						if ( ! $end_date) {
299 299
 							$month = 1;
300 300
 						} else {
301 301
 							$month  = 3;
302
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
302
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
303 303
 							$hour   = 23;
304 304
 							$minute = 59;
305 305
 							$second = 59;
306 306
 						}
307 307
 
308
-					} else if ( $month_now <= 6 ) {
308
+					} else if ($month_now <= 6) {
309 309
 
310
-						if ( ! $end_date ) {
310
+						if ( ! $end_date) {
311 311
 							$month = 4;
312 312
 						} else {
313 313
 							$month  = 6;
314
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
314
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
315 315
 							$hour   = 23;
316 316
 							$minute = 59;
317 317
 							$second = 59;
318 318
 						}
319 319
 
320
-					} else if ( $month_now <= 9 ) {
320
+					} else if ($month_now <= 9) {
321 321
 
322
-						if ( ! $end_date ) {
322
+						if ( ! $end_date) {
323 323
 							$month = 7;
324 324
 						} else {
325 325
 							$month  = 9;
326
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
326
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
327 327
 							$hour   = 23;
328 328
 							$minute = 59;
329 329
 							$second = 59;
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 
332 332
 					} else {
333 333
 
334
-						if ( ! $end_date ) {
334
+						if ( ! $end_date) {
335 335
 							$month = 10;
336 336
 						} else {
337 337
 							$month  = 12;
338
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
338
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
339 339
 							$hour   = 23;
340 340
 							$minute = 59;
341 341
 							$second = 59;
@@ -347,40 +347,40 @@  discard block
 block discarded – undo
347 347
 
348 348
 				case 'last_quarter' :
349 349
 
350
-					$month_now = date( 'n', current_time( 'timestamp' ) );
350
+					$month_now = date('n', current_time('timestamp'));
351 351
 
352
-					if ( $month_now <= 3 ) {
352
+					if ($month_now <= 3) {
353 353
 
354
-						if ( ! $end_date ) {
354
+						if ( ! $end_date) {
355 355
 							$month = 10;
356 356
 						} else {
357 357
 							$year -= 1;
358 358
 							$month  = 12;
359
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
359
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
360 360
 							$hour   = 23;
361 361
 							$minute = 59;
362 362
 							$second = 59;
363 363
 						}
364 364
 
365
-					} else if ( $month_now <= 6 ) {
365
+					} else if ($month_now <= 6) {
366 366
 
367
-						if ( ! $end_date ) {
367
+						if ( ! $end_date) {
368 368
 							$month = 1;
369 369
 						} else {
370 370
 							$month  = 3;
371
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
371
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
372 372
 							$hour   = 23;
373 373
 							$minute = 59;
374 374
 							$second = 59;
375 375
 						}
376 376
 
377
-					} else if ( $month_now <= 9 ) {
377
+					} else if ($month_now <= 9) {
378 378
 
379
-						if ( ! $end_date ) {
379
+						if ( ! $end_date) {
380 380
 							$month = 4;
381 381
 						} else {
382 382
 							$month  = 6;
383
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
383
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
384 384
 							$hour   = 23;
385 385
 							$minute = 59;
386 386
 							$second = 59;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 
389 389
 					} else {
390 390
 
391
-						if ( ! $end_date ) {
391
+						if ( ! $end_date) {
392 392
 							$month = 7;
393 393
 						} else {
394 394
 							$month  = 9;
395
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
395
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
396 396
 							$hour   = 23;
397 397
 							$minute = 59;
398 398
 							$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 				case 'this_year' :
406 406
 
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 				case 'last_year' :
420 420
 
421 421
 					$year -= 1;
422
-					if ( ! $end_date ) {
422
+					if ( ! $end_date) {
423 423
 						$month = 1;
424 424
 					} else {
425 425
 						$month  = 12;
426
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
426
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
427 427
 						$hour   = 23;
428 428
 						$minute = 59;
429 429
 						$second = 59;
@@ -434,30 +434,30 @@  discard block
 block discarded – undo
434 434
 			}
435 435
 
436 436
 
437
-		} else if ( is_numeric( $date ) ) {
437
+		} else if (is_numeric($date)) {
438 438
 
439 439
 			// return $date unchanged since it is a timestamp
440 440
 			$this->timestamp = true;
441 441
 
442
-		} else if ( false !== strtotime( $date ) ) {
442
+		} else if (false !== strtotime($date)) {
443 443
 
444
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
445
-			$year  = date( 'Y', $date );
446
-			$month = date( 'm', $date );
447
-			$day   = date( 'd', $date );
444
+			$date  = strtotime($date, current_time('timestamp'));
445
+			$year  = date('Y', $date);
446
+			$month = date('m', $date);
447
+			$day   = date('d', $date);
448 448
 
449 449
 		} else {
450 450
 
451
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
451
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
452 452
 
453 453
 		}
454 454
 
455
-		if ( false === $this->timestamp ) {
455
+		if (false === $this->timestamp) {
456 456
 			// Create an exact timestamp
457
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
457
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
458 458
 		}
459 459
 
460
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
460
+		return apply_filters('give_stats_date', $date, $end_date, $this);
461 461
 
462 462
 	}
463 463
 
@@ -473,33 +473,33 @@  discard block
 block discarded – undo
473 473
 	 * 
474 474
 	 * @return string
475 475
 	 */
476
-	public function count_where( $where = '' ) {
476
+	public function count_where($where = '') {
477 477
 		// Only get payments in our date range
478 478
 
479 479
 		$start_where = '';
480 480
 		$end_where   = '';
481 481
 
482
-		if ( $this->start_date ) {
482
+		if ($this->start_date) {
483 483
 
484
-			if ( $this->timestamp ) {
484
+			if ($this->timestamp) {
485 485
 				$format = 'Y-m-d H:i:s';
486 486
 			} else {
487 487
 				$format = 'Y-m-d 00:00:00';
488 488
 			}
489 489
 
490
-			$start_date  = date( $format, $this->start_date );
490
+			$start_date  = date($format, $this->start_date);
491 491
 			$start_where = " AND p.post_date >= '{$start_date}'";
492 492
 		}
493 493
 
494
-		if ( $this->end_date ) {
494
+		if ($this->end_date) {
495 495
 
496
-			if ( $this->timestamp ) {
496
+			if ($this->timestamp) {
497 497
 				$format = 'Y-m-d H:i:s';
498 498
 			} else {
499 499
 				$format = 'Y-m-d 23:59:59';
500 500
 			}
501 501
 
502
-			$end_date = date( $format, $this->end_date );
502
+			$end_date = date($format, $this->end_date);
503 503
 
504 504
 			$end_where = " AND p.post_date <= '{$end_date}'";
505 505
 		}
@@ -521,34 +521,34 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string
523 523
 	 */
524
-	public function payments_where( $where = '' ) {
524
+	public function payments_where($where = '') {
525 525
 
526 526
 		global $wpdb;
527 527
 
528 528
 		$start_where = '';
529 529
 		$end_where   = '';
530 530
 
531
-		if ( ! is_wp_error( $this->start_date ) ) {
531
+		if ( ! is_wp_error($this->start_date)) {
532 532
 
533
-			if ( $this->timestamp ) {
533
+			if ($this->timestamp) {
534 534
 				$format = 'Y-m-d H:i:s';
535 535
 			} else {
536 536
 				$format = 'Y-m-d 00:00:00';
537 537
 			}
538 538
 
539
-			$start_date  = date( $format, $this->start_date );
539
+			$start_date  = date($format, $this->start_date);
540 540
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
541 541
 		}
542 542
 
543
-		if ( ! is_wp_error( $this->end_date ) ) {
543
+		if ( ! is_wp_error($this->end_date)) {
544 544
 
545
-			if ( $this->timestamp ) {
545
+			if ($this->timestamp) {
546 546
 				$format = 'Y-m-d 00:00:00';
547 547
 			} else {
548 548
 				$format = 'Y-m-d 23:59:59';
549 549
 			}
550 550
 
551
-			$end_date = date( $format, $this->end_date );
551
+			$end_date = date($format, $this->end_date);
552 552
 
553 553
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
554 554
 		}
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 		/**
39 39
 		 * Templates
40 40
 		 */
41
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
41
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
42 42
 
43 43
 		/**
44 44
 		 * Content Wrappers
45 45
 		 */
46
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
47
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
46
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
47
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
48 48
 
49 49
 		/**
50 50
 		 * Entry Summary Classes
51 51
 		 */
52
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
52
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
53 53
 
54 54
 		/**
55 55
 		 * Sidebar
56 56
 		 */
57
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
57
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
58 58
 
59 59
 		/**
60 60
 		 * Single Forms Summary Box
61 61
 		 */
62
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
63
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
62
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
63
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
64 64
 
65 65
 	}
66 66
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return string $classes List of space separated class names.
77 77
 	 */
78
-	public function give_set_single_summary_classes( $classes ) {
78
+	public function give_set_single_summary_classes($classes) {
79 79
 
80
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
80
+		$sidebar_option = give_get_option('disable_form_sidebar');
81 81
 
82 82
 		//Add full width class when feature image is disabled AND no widgets are present
83
-		if ( $sidebar_option == 'on' ) {
83
+		if ($sidebar_option == 'on') {
84 84
 			$classes .= ' give-full-width';
85 85
 		}
86 86
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function give_output_sidebar_option() {
102 102
 
103
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
103
+		$sidebar_option = give_get_option('disable_form_sidebar');
104 104
 
105 105
 		//Add full width class when feature image is disabled AND no widgets are present
106
-		if ( $sidebar_option !== 'on' ) {
107
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
108
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
109
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
110
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
106
+		if ($sidebar_option !== 'on') {
107
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
108
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
109
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
110
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
111 111
 		}
112 112
 
113 113
 	}
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string $template
131 131
 	 */
132
-	public static function template_loader( $template ) {
133
-		$find = array( 'give.php' );
132
+	public static function template_loader($template) {
133
+		$find = array('give.php');
134 134
 		$file = '';
135 135
 
136
-		if ( is_single() && get_post_type() == 'give_forms' ) {
136
+		if (is_single() && get_post_type() == 'give_forms') {
137 137
 			$file   = 'single-give-form.php';
138 138
 			$find[] = $file;
139
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
139
+			$find[] = apply_filters('give_template_path', 'give/').$file;
140 140
 		}
141 141
 
142
-		if ( $file ) {
143
-			$template = locate_template( array_unique( $find ) );
144
-			if ( ! $template ) {
145
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
142
+		if ($file) {
143
+			$template = locate_template(array_unique($find));
144
+			if ( ! $template) {
145
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
146 146
 			}
147 147
 		}
148 148
 
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 * @since  1.0
112 112
 	 * @access public
113 113
 	 *
114
-     * @param  int $column Column ID.
115
-     * @param  int $row_id Row ID.
116
-     *
117
-     * @return object
114
+	 * @param  int $column Column ID.
115
+	 * @param  int $row_id Row ID.
116
+	 *
117
+	 * @return object
118 118
 	 */
119 119
 	public function get_by( $column, $row_id ) {
120
-        /* @var WPDB $wpdb */
121
-        global $wpdb;
120
+		/* @var WPDB $wpdb */
121
+		global $wpdb;
122 122
 
123 123
 		$column = esc_sql( $column );
124 124
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since  1.0
131 131
 	 * @access public
132
-     *
133
-     * @param  int $column Column ID.
134
-     * @param  int $row_id Row ID.
135
-     *
132
+	 *
133
+	 * @param  int $column Column ID.
134
+	 * @param  int $row_id Row ID.
135
+	 *
136 136
 	 * @return string      Column value.
137 137
 	 */
138 138
 	public function get_column( $column, $row_id ) {
139
-        /* @var WPDB $wpdb */
140
-        global $wpdb;
139
+		/* @var WPDB $wpdb */
140
+		global $wpdb;
141 141
 
142 142
 		$column = esc_sql( $column );
143 143
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @since  1.0
150 150
 	 * @access public
151
-     *
152
-     * @param  int    $column       Column ID.
153
-     * @param  string $column_where Column name.
154
-     * @param  string $column_value Column value.
155
-     *
151
+	 *
152
+	 * @param  int    $column       Column ID.
153
+	 * @param  string $column_where Column name.
154
+	 * @param  string $column_value Column value.
155
+	 *
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function get_column_by( $column, $column_where, $column_value ) {
159
-        /* @var WPDB $wpdb */
160
-        global $wpdb;
159
+		/* @var WPDB $wpdb */
160
+		global $wpdb;
161 161
 
162 162
 		$column_where = esc_sql( $column_where );
163 163
 		$column       = esc_sql( $column );
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @since  1.0
171 171
 	 * @access public
172
-     *
173
-     * @param  array  $data
174
-     * @param  string $type
175
-     *
172
+	 *
173
+	 * @param  array  $data
174
+	 * @param  string $type
175
+	 *
176 176
 	 * @return int
177 177
 	 */
178 178
 	public function insert( $data, $type = '' ) {
179
-        /* @var WPDB $wpdb */
180
-        global $wpdb;
179
+		/* @var WPDB $wpdb */
180
+		global $wpdb;
181 181
 
182 182
 		// Set default values
183 183
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @since  1.0
211 211
 	 * @access public
212
-     *
213
-     * @param  int    $row_id Column ID
214
-     * @param  array  $data
215
-     * @param  string $where  Column value
216
-     *
212
+	 *
213
+	 * @param  int    $row_id Column ID
214
+	 * @param  array  $data
215
+	 * @param  string $where  Column value
216
+	 *
217 217
 	 * @return bool
218 218
 	 */
219 219
 	public function update( $row_id, $data = array(), $where = '' ) {
220
-        /* @var WPDB $wpdb */
221
-        global $wpdb;
220
+		/* @var WPDB $wpdb */
221
+		global $wpdb;
222 222
 
223 223
 		// Row ID must be positive integer
224 224
 		$row_id = absint( $row_id );
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @since  1.0
258 258
 	 * @access public
259
-     *
260
-     * @param  int $row_id Column ID.
261
-     *
259
+	 *
260
+	 * @param  int $row_id Column ID.
261
+	 *
262 262
 	 * @return bool
263 263
 	 */
264 264
 	public function delete( $row_id = 0 ) {
265
-        /* @var WPDB $wpdb */
266
-        global $wpdb;
265
+		/* @var WPDB $wpdb */
266
+		global $wpdb;
267 267
 
268 268
 		// Row ID must be positive integer
269 269
 		$row_id = absint( $row_id );
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @since  1.3.2
286 286
 	 * @access public
287
-     *
287
+	 *
288 288
 	 * @param  string $table The table name.
289
-     *
289
+	 *
290 290
 	 * @return bool          If the table name exists.
291 291
 	 */
292 292
 	public function table_exists( $table ) {
293
-        /* @var WPDB $wpdb */
293
+		/* @var WPDB $wpdb */
294 294
 		global $wpdb;
295 295
 
296 296
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
105
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return object
118 118
 	 */
119
-	public function get_by( $column, $row_id ) {
119
+	public function get_by($column, $row_id) {
120 120
         /* @var WPDB $wpdb */
121 121
         global $wpdb;
122 122
 
123
-		$column = esc_sql( $column );
124
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
123
+		$column = esc_sql($column);
124
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
125 125
 	}
126 126
 
127 127
 	/**
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
      *
136 136
 	 * @return string      Column value.
137 137
 	 */
138
-	public function get_column( $column, $row_id ) {
138
+	public function get_column($column, $row_id) {
139 139
         /* @var WPDB $wpdb */
140 140
         global $wpdb;
141 141
 
142
-		$column = esc_sql( $column );
143
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
142
+		$column = esc_sql($column);
143
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
144 144
 	}
145 145
 
146 146
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
 	 * @return string
157 157
 	 */
158
-	public function get_column_by( $column, $column_where, $column_value ) {
158
+	public function get_column_by($column, $column_where, $column_value) {
159 159
         /* @var WPDB $wpdb */
160 160
         global $wpdb;
161 161
 
162
-		$column_where = esc_sql( $column_where );
163
-		$column       = esc_sql( $column );
164
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
162
+		$column_where = esc_sql($column_where);
163
+		$column       = esc_sql($column);
164
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
165 165
 	}
166 166
 
167 167
 	/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
 	 * @return int
177 177
 	 */
178
-	public function insert( $data, $type = '' ) {
178
+	public function insert($data, $type = '') {
179 179
         /* @var WPDB $wpdb */
180 180
         global $wpdb;
181 181
 
182 182
 		// Set default values.
183
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
183
+		$data = wp_parse_args($data, $this->get_column_defaults());
184 184
 
185 185
 		/**
186 186
 		 * Fires before inserting data to the database.
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 		 *
190 190
 		 * @param array $data
191 191
 		 */
192
-		do_action( "give_pre_insert_{$type}", $data );
192
+		do_action("give_pre_insert_{$type}", $data);
193 193
 
194 194
 		// Initialise column format array
195 195
 		$column_formats = $this->get_columns();
196 196
 
197 197
 		// Force fields to lower case
198
-		$data = array_change_key_case( $data );
198
+		$data = array_change_key_case($data);
199 199
 
200 200
 		// White list columns
201
-		$data = array_intersect_key( $data, $column_formats );
201
+		$data = array_intersect_key($data, $column_formats);
202 202
 
203 203
 		// Reorder $column_formats to match the order of columns given in $data
204
-		$data_keys      = array_keys( $data );
205
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
204
+		$data_keys      = array_keys($data);
205
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
206 206
 
207
-		$wpdb->insert( $this->table_name, $data, $column_formats );
207
+		$wpdb->insert($this->table_name, $data, $column_formats);
208 208
 
209 209
 		/**
210 210
 		 * Fires after inserting data to the database.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		 * @param int   $insert_id
215 215
 		 * @param array $data
216 216
 		 */
217
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
217
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
218 218
 
219 219
 		return $wpdb->insert_id;
220 220
 	}
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
      *
232 232
 	 * @return bool
233 233
 	 */
234
-	public function update( $row_id, $data = array(), $where = '' ) {
234
+	public function update($row_id, $data = array(), $where = '') {
235 235
         /* @var WPDB $wpdb */
236 236
         global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239
-		$row_id = absint( $row_id );
239
+		$row_id = absint($row_id);
240 240
 
241
-		if ( empty( $row_id ) ) {
241
+		if (empty($row_id)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( empty( $where ) ) {
245
+		if (empty($where)) {
246 246
 			$where = $this->primary_key;
247 247
 		}
248 248
 
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 		$column_formats = $this->get_columns();
251 251
 
252 252
 		// Force fields to lower case
253
-		$data = array_change_key_case( $data );
253
+		$data = array_change_key_case($data);
254 254
 
255 255
 		// White list columns
256
-		$data = array_intersect_key( $data, $column_formats );
256
+		$data = array_intersect_key($data, $column_formats);
257 257
 
258 258
 		// Reorder $column_formats to match the order of columns given in $data
259
-		$data_keys      = array_keys( $data );
260
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
259
+		$data_keys      = array_keys($data);
260
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
261 261
 
262
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
262
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
263 263
 			return false;
264 264
 		}
265 265
 
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
      *
277 277
 	 * @return bool
278 278
 	 */
279
-	public function delete( $row_id = 0 ) {
279
+	public function delete($row_id = 0) {
280 280
         /* @var WPDB $wpdb */
281 281
         global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284
-		$row_id = absint( $row_id );
284
+		$row_id = absint($row_id);
285 285
 
286
-		if ( empty( $row_id ) ) {
286
+		if (empty($row_id)) {
287 287
 			return false;
288 288
 		}
289 289
 
290
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
290
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
291 291
 			return false;
292 292
 		}
293 293
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
      *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307
-	public function table_exists( $table ) {
307
+	public function table_exists($table) {
308 308
         /* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311
-		$table = sanitize_text_field( $table );
311
+		$table = sanitize_text_field($table);
312 312
 
313
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
313
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
323 323
 	 */
324 324
 	public function installed() {
325
-		return $this->table_exists( $this->table_name );
325
+		return $this->table_exists($this->table_name);
326 326
 	}
327 327
 
328 328
 }
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -398,6 +398,7 @@
 block discarded – undo
398 398
 	 *
399 399
 	 * @since 1.6
400 400
 	 *
401
+	 * @param Give_Payment $payment
401 402
 	 * @return mixed|void
402 403
 	 */
403 404
 	function get_row_actions( $payment ) {
Please login to merge, or discard this patch.
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults.
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
123
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
124
-			'ajax'     => false,                              // Does this table support ajax?
125
-		) );
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
124
+			'ajax'     => false, // Does this table support ajax?
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 	 * @return void
136 136
 	 */
137 137
 	public function advanced_filters() {
138
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
139
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
140
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
138
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
139
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
140
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
141 141
 		?>
142 142
 		<div id="give-payment-filters">
143 143
 			<span id="give-payment-date-filters">
144
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
144
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
145 145
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
146
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
146
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
147 147
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
148
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
148
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
149 149
 			</span>
150
-			<?php if ( ! empty( $status ) ) : ?>
151
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
150
+			<?php if ( ! empty($status)) : ?>
151
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
152 152
 			<?php endif; ?>
153
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
154
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
153
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
154
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
155 155
 			<?php endif; ?>
156
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
156
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
157 157
 		</div>
158 158
 
159 159
 		<?php
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return void
172 172
 	 */
173
-	public function search_box( $text, $input_id ) {
174
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
173
+	public function search_box($text, $input_id) {
174
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
175 175
 			return;
176 176
 		}
177 177
 
178
-		$input_id = $input_id . '-search-input';
178
+		$input_id = $input_id.'-search-input';
179 179
 
180
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
181
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
180
+		if ( ! empty($_REQUEST['orderby'])) {
181
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
182 182
 		}
183
-		if ( ! empty( $_REQUEST['order'] ) ) {
184
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
183
+		if ( ! empty($_REQUEST['order'])) {
184
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
185 185
 		}
186 186
 		?>
187 187
 		<p class="search-box" role="search">
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 			 *
194 194
 			 * @since 1.7
195 195
 			 */
196
-			do_action( 'give_payment_history_search' );
196
+			do_action('give_payment_history_search');
197 197
 			?>
198 198
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
199 199
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
200
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
200
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
201 201
 		</p>
202 202
 		<?php
203 203
 	}
@@ -211,52 +211,52 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function get_views() {
213 213
 
214
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
215
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
216
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
217
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
218
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
219
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
220
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
221
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
222
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
214
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
215
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
216
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
217
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
218
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
219
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
220
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
221
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
222
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
223 223
 
224 224
 		$views = array(
225
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
225
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
226 226
 				'status',
227 227
 				'paged',
228
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
229
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
228
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
229
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
230 230
 				'status' => 'publish',
231 231
 				'paged'  => false,
232
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
233
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
233
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'pending',
235 235
 				'paged'  => false,
236
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
237
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
237
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'refunded',
239 239
 				'paged'  => false,
240
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
241
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
241
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'revoked',
243 243
 				'paged'  => false,
244
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
245
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
244
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
245
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
246 246
 				'status' => 'failed',
247 247
 				'paged'  => false,
248
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
249
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
248
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
249
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
250 250
 				'status' => 'cancelled',
251 251
 				'paged'  => false,
252
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
253
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
252
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
253
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
254 254
 				'status' => 'abandoned',
255 255
 				'paged'  => false,
256
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ),
256
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count),
257 257
 		);
258 258
 
259
-		return apply_filters( 'give_payments_table_views', $views );
259
+		return apply_filters('give_payments_table_views', $views);
260 260
 	}
261 261
 
262 262
 	/**
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
 	public function get_columns() {
270 270
 		$columns = array(
271 271
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
272
-			'donation'      => esc_html__( 'Donation', 'give' ),
273
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
274
-			'status'        => esc_html__( 'Status', 'give' ),
275
-			'date'          => esc_html__( 'Date', 'give' ),
276
-			'amount'        => esc_html__( 'Amount', 'give' ),
277
-			'details'       => esc_html__( 'Details', 'give' ),
272
+			'donation'      => esc_html__('Donation', 'give'),
273
+			'donation_form' => esc_html__('Donation Form', 'give'),
274
+			'status'        => esc_html__('Status', 'give'),
275
+			'date'          => esc_html__('Date', 'give'),
276
+			'amount'        => esc_html__('Amount', 'give'),
277
+			'details'       => esc_html__('Details', 'give'),
278 278
 		);
279 279
 
280
-		return apply_filters( 'give_payments_table_columns', $columns );
280
+		return apply_filters('give_payments_table_columns', $columns);
281 281
 	}
282 282
 
283 283
 	/**
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function get_sortable_columns() {
291 291
 		$columns = array(
292
-			'donation'      => array( 'ID', true ),
293
-			'donation_form' => array( 'donation_form', false ),
294
-			'status'        => array( 'status', false ),
295
-			'amount'        => array( 'amount', false ),
296
-			'date'          => array( 'date', false ),
292
+			'donation'      => array('ID', true),
293
+			'donation_form' => array('donation_form', false),
294
+			'status'        => array('status', false),
295
+			'amount'        => array('amount', false),
296
+			'date'          => array('date', false),
297 297
 		);
298 298
 
299
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
299
+		return apply_filters('give_payments_table_sortable_columns', $columns);
300 300
 	}
301 301
 
302 302
 	/**
@@ -322,65 +322,65 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return string Column Name
324 324
 	 */
325
-	public function column_default( $payment, $column_name ) {
325
+	public function column_default($payment, $column_name) {
326 326
 
327
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
328
-		$row_actions         = $this->get_row_actions( $payment );
327
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
328
+		$row_actions         = $this->get_row_actions($payment);
329 329
 
330
-		switch ( $column_name ) {
330
+		switch ($column_name) {
331 331
 			case 'donation' :
332 332
 				$value = sprintf(
333 333
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
334 334
 					$single_donation_url,
335
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
335
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
336 336
 					$payment->ID,
337
-					esc_html__( 'by', 'give' ),
338
-					$this->get_donor( $payment )
337
+					esc_html__('by', 'give'),
338
+					$this->get_donor($payment)
339 339
 				);
340
-				$value .= $this->get_donor_email( $payment );
341
-				$value .= $this->row_actions( $row_actions );
340
+				$value .= $this->get_donor_email($payment);
341
+				$value .= $this->row_actions($row_actions);
342 342
 				break;
343 343
 
344 344
 			case 'amount' :
345
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
346
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
345
+				$amount = ! empty($payment->total) ? $payment->total : 0;
346
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
347 347
 				break;
348 348
 
349 349
 			case 'donation_form' :
350 350
 
351
-				$value = empty( $payment->form_title ) ? __( 'Untitled', 'give' ) : '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>';
352
-				$level = give_get_payment_form_title( $payment->meta, true );
351
+				$value = empty($payment->form_title) ? __('Untitled', 'give') : '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>';
352
+				$level = give_get_payment_form_title($payment->meta, true);
353 353
 
354
-				if ( ! empty( $level ) ) {
354
+				if ( ! empty($level)) {
355 355
 					$value .= $level;
356 356
 				}
357 357
 
358 358
 				break;
359 359
 
360 360
 			case 'date' :
361
-				$date  = strtotime( $payment->date );
362
-				$value = date_i18n( give_date_format(), $date );
361
+				$date  = strtotime($payment->date);
362
+				$value = date_i18n(give_date_format(), $date);
363 363
 				break;
364 364
 
365 365
 			case 'status' :
366
-				$value = $this->get_payment_status( $payment );
366
+				$value = $this->get_payment_status($payment);
367 367
 				break;
368 368
 
369 369
 			case 'details' :
370 370
 				$value = sprintf(
371 371
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
372 372
 					$single_donation_url,
373
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
373
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
374 374
 				);
375 375
 				break;
376 376
 
377 377
 			default:
378
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
378
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
379 379
 				break;
380 380
 
381 381
 		}
382 382
 
383
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
383
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
384 384
 	}
385 385
 
386 386
 	/**
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string                Data shown in the Email column
395 395
 	 */
396
-	public function get_donor_email( $payment ) {
396
+	public function get_donor_email($payment) {
397 397
 
398
-		$email = give_get_payment_user_email( $payment->ID );
398
+		$email = give_get_payment_user_email($payment->ID);
399 399
 
400
-		if ( empty( $email ) ) {
401
-			$email = esc_html__( '(unknown)', 'give' );
400
+		if (empty($email)) {
401
+			$email = esc_html__('(unknown)', 'give');
402 402
 		}
403 403
 
404
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
404
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
405 405
 
406
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
406
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
407 407
 	}
408 408
 
409 409
 	/**
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 	 *
414 414
 	 * @return mixed|void
415 415
 	 */
416
-	function get_row_actions( $payment ) {
416
+	function get_row_actions($payment) {
417 417
 
418 418
 		$actions = array();
419
-		$email   = give_get_payment_user_email( $payment->ID );
419
+		$email   = give_get_payment_user_email($payment->ID);
420 420
 
421 421
 		// Add search term string back to base URL.
422
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
423
-		if ( ! empty( $search_terms ) ) {
424
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
422
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
423
+		if ( ! empty($search_terms)) {
424
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
425 425
 		}
426 426
 
427
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
427
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
428 428
 
429 429
 			$actions['email_links'] = sprintf(
430 430
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 					),
439 439
 					'give_payment_nonce'
440 440
 				),
441
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
442
-				esc_html__( 'Resend Receipt', 'give' )
441
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
442
+				esc_html__('Resend Receipt', 'give')
443 443
 			);
444 444
 
445 445
 		}
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 				),
457 457
 				'give_donation_nonce'
458 458
 			),
459
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
460
-			esc_html__( 'Delete', 'give' )
459
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
460
+			esc_html__('Delete', 'give')
461 461
 		);
462 462
 
463
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
463
+		return apply_filters('give_payment_row_actions', $actions, $payment);
464 464
 	}
465 465
 
466 466
 
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return string                Data shown in the Email column
476 476
 	 */
477
-	function get_payment_status( $payment ) {
478
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
479
-		if ( $payment->mode == 'test' ) {
480
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
477
+	function get_payment_status($payment) {
478
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
479
+		if ($payment->mode == 'test') {
480
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
481 481
 		}
482 482
 
483 483
 		return $value;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return string Displays a checkbox.
495 495
 	 */
496
-	public function column_cb( $payment ) {
496
+	public function column_cb($payment) {
497 497
 		return sprintf(
498 498
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
499 499
 			'payment',
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return string Displays a checkbox.
513 513
 	 */
514
-	public function get_payment_id( $payment ) {
515
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
514
+	public function get_payment_id($payment) {
515
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
516 516
 	}
517 517
 
518 518
 	/**
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return string Data shown in the User column
527 527
 	 */
528
-	public function get_donor( $payment ) {
528
+	public function get_donor($payment) {
529 529
 
530
-		$customer_id = give_get_payment_customer_id( $payment->ID );
530
+		$customer_id = give_get_payment_customer_id($payment->ID);
531 531
 
532
-		if ( ! empty( $customer_id ) ) {
533
-			$customer = new Give_Customer( $customer_id );
534
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
532
+		if ( ! empty($customer_id)) {
533
+			$customer = new Give_Customer($customer_id);
534
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
535 535
 		} else {
536
-			$email = give_get_payment_user_email( $payment->ID );
537
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
536
+			$email = give_get_payment_user_email($payment->ID);
537
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
538 538
 		}
539 539
 
540
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
540
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
541 541
 	}
542 542
 
543 543
 	/**
@@ -549,18 +549,18 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	public function get_bulk_actions() {
551 551
 		$actions = array(
552
-			'delete'               => esc_html__( 'Delete', 'give' ),
553
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
554
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
555
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
556
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
557
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
558
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
559
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
560
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' ),
552
+			'delete'               => esc_html__('Delete', 'give'),
553
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
554
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
555
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
556
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
557
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
558
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
559
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
560
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give'),
561 561
 		);
562 562
 
563
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
563
+		return apply_filters('give_payments_table_bulk_actions', $actions);
564 564
 	}
565 565
 
566 566
 	/**
@@ -571,59 +571,59 @@  discard block
 block discarded – undo
571 571
 	 * @return void
572 572
 	 */
573 573
 	public function process_bulk_action() {
574
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
574
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
575 575
 		$action = $this->current_action();
576 576
 
577
-		if ( ! is_array( $ids ) ) {
578
-			$ids = array( $ids );
577
+		if ( ! is_array($ids)) {
578
+			$ids = array($ids);
579 579
 		}
580 580
 
581
-		if ( empty( $action ) ) {
581
+		if (empty($action)) {
582 582
 			return;
583 583
 		}
584 584
 
585
-		foreach ( $ids as $id ) {
585
+		foreach ($ids as $id) {
586 586
 
587 587
 			// Detect when a bulk action is being triggered.
588
-			switch ( $this->current_action() ) {
588
+			switch ($this->current_action()) {
589 589
 
590 590
 				case'delete':
591
-					give_delete_purchase( $id );
591
+					give_delete_purchase($id);
592 592
 					break;
593 593
 
594 594
 				case 'set-status-publish':
595
-					give_update_payment_status( $id, 'publish' );
595
+					give_update_payment_status($id, 'publish');
596 596
 					break;
597 597
 
598 598
 				case 'set-status-pending':
599
-					give_update_payment_status( $id, 'pending' );
599
+					give_update_payment_status($id, 'pending');
600 600
 					break;
601 601
 
602 602
 				case 'set-status-refunded':
603
-					give_update_payment_status( $id, 'refunded' );
603
+					give_update_payment_status($id, 'refunded');
604 604
 					break;
605 605
 				case 'set-status-revoked':
606
-					give_update_payment_status( $id, 'revoked' );
606
+					give_update_payment_status($id, 'revoked');
607 607
 					break;
608 608
 
609 609
 				case 'set-status-failed':
610
-					give_update_payment_status( $id, 'failed' );
610
+					give_update_payment_status($id, 'failed');
611 611
 					break;
612 612
 
613 613
 				case 'set-status-cancelled':
614
-					give_update_payment_status( $id, 'cancelled' );
614
+					give_update_payment_status($id, 'cancelled');
615 615
 					break;
616 616
 
617 617
 				case 'set-status-abandoned':
618
-					give_update_payment_status( $id, 'abandoned' );
618
+					give_update_payment_status($id, 'abandoned');
619 619
 					break;
620 620
 
621 621
 				case 'set-status-preapproval':
622
-					give_update_payment_status( $id, 'preapproval' );
622
+					give_update_payment_status($id, 'preapproval');
623 623
 					break;
624 624
 
625 625
 				case 'resend-receipt':
626
-					give_email_donation_receipt( $id, false );
626
+					give_email_donation_receipt($id, false);
627 627
 					break;
628 628
 			}
629 629
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			 * @param int    $id             The ID of the payment.
636 636
 			 * @param string $current_action The action that is being triggered.
637 637
 			 */
638
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
638
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
639 639
 		}
640 640
 
641 641
 	}
@@ -651,27 +651,27 @@  discard block
 block discarded – undo
651 651
 
652 652
 		$args = array();
653 653
 
654
-		if ( isset( $_GET['user'] ) ) {
655
-			$args['user'] = urldecode( $_GET['user'] );
656
-		} elseif ( isset( $_GET['s'] ) ) {
657
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
658
-			if ( $is_user ) {
659
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
660
-				unset( $args['s'] );
654
+		if (isset($_GET['user'])) {
655
+			$args['user'] = urldecode($_GET['user']);
656
+		} elseif (isset($_GET['s'])) {
657
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
658
+			if ($is_user) {
659
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
660
+				unset($args['s']);
661 661
 			} else {
662
-				$args['s'] = sanitize_text_field( $_GET['s'] );
662
+				$args['s'] = sanitize_text_field($_GET['s']);
663 663
 			}
664 664
 		}
665 665
 
666
-		if ( ! empty( $_GET['start-date'] ) ) {
667
-			$args['start-date'] = urldecode( $_GET['start-date'] );
666
+		if ( ! empty($_GET['start-date'])) {
667
+			$args['start-date'] = urldecode($_GET['start-date']);
668 668
 		}
669 669
 
670
-		if ( ! empty( $_GET['end-date'] ) ) {
671
-			$args['end-date'] = urldecode( $_GET['end-date'] );
670
+		if ( ! empty($_GET['end-date'])) {
671
+			$args['end-date'] = urldecode($_GET['end-date']);
672 672
 		}
673 673
 
674
-		$payment_count         = give_count_payments( $args );
674
+		$payment_count         = give_count_payments($args);
675 675
 		$this->complete_count  = $payment_count->publish;
676 676
 		$this->pending_count   = $payment_count->pending;
677 677
 		$this->refunded_count  = $payment_count->refunded;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		$this->cancelled_count = $payment_count->cancelled;
681 681
 		$this->abandoned_count = $payment_count->abandoned;
682 682
 
683
-		foreach ( $payment_count as $count ) {
683
+		foreach ($payment_count as $count) {
684 684
 			$this->total_count += $count;
685 685
 		}
686 686
 	}
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
 	public function payments_data() {
696 696
 
697 697
 		$per_page   = $this->per_page;
698
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
699
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
700
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
701
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
702
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
703
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
704
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
705
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
706
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
707
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
708
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
709
-
710
-		if ( ! empty( $search ) ) {
698
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
699
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
700
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
701
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
702
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
703
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
704
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
705
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
706
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
707
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
708
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
709
+
710
+		if ( ! empty($search)) {
711 711
 			$status = 'any'; // Force all payment statuses when searching.
712 712
 		}
713 713
 
714 714
 		$args = array(
715 715
 			'output'     => 'payments',
716 716
 			'number'     => $per_page,
717
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
717
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
718 718
 			'orderby'    => $orderby,
719 719
 			'order'      => $order,
720 720
 			'user'       => $user,
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 			'end_date'   => $end_date,
729 729
 		);
730 730
 
731
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
731
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
732 732
 
733 733
 			$args['search_in_notes'] = true;
734
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
734
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
735 735
 
736 736
 		}
737 737
 
738
-		$p_query = new Give_Payments_Query( $args );
738
+		$p_query = new Give_Payments_Query($args);
739 739
 
740 740
 		return $p_query->get_payments();
741 741
 
@@ -755,17 +755,17 @@  discard block
 block discarded – undo
755 755
 	 */
756 756
 	public function prepare_items() {
757 757
 
758
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
758
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
759 759
 
760 760
 		$columns  = $this->get_columns();
761 761
 		$hidden   = array(); // No hidden columns.
762 762
 		$sortable = $this->get_sortable_columns();
763 763
 		$data     = $this->payments_data();
764
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
764
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
765 765
 
766
-		$this->_column_headers = array( $columns, $hidden, $sortable );
766
+		$this->_column_headers = array($columns, $hidden, $sortable);
767 767
 
768
-		switch ( $status ) {
768
+		switch ($status) {
769 769
 			case 'publish':
770 770
 				$total_items = $this->complete_count;
771 771
 				break;
@@ -792,19 +792,19 @@  discard block
 block discarded – undo
792 792
 				break;
793 793
 			default:
794 794
 				// Retrieve the count of the non-default-Give status.
795
-				$count       = wp_count_posts( 'give_payment' );
795
+				$count       = wp_count_posts('give_payment');
796 796
 				$total_items = $count->{$status};
797 797
 				break;
798 798
 		}
799 799
 
800 800
 		$this->items = $data;
801 801
 
802
-		$this->set_pagination_args( array(
802
+		$this->set_pagination_args(array(
803 803
 				'total_items' => $total_items,
804 804
 				// We have to calculate the total number of items.
805 805
 				'per_page'    => $this->per_page,
806 806
 				// We have to determine how many items to show on a page.
807
-				'total_pages' => ceil( $total_items / $this->per_page ),
807
+				'total_pages' => ceil($total_items / $this->per_page),
808 808
 				// We have to calculate the total number of pages.
809 809
 			)
810 810
 		);
Please login to merge, or discard this patch.
give.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,9 +358,9 @@
 block discarded – undo
358 358
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359 359
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360 360
 
361
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
362
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
-            }
361
+			if( defined( 'WP_CLI' ) && WP_CLI ) {
362
+				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
+			}
364 364
 
365 365
 			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
366 366
 
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.7.2' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.7.2');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,117 +300,117 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
304 304
 			$give_options = give_get_settings();
305 305
 
306
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
311
-
312
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
326
-
327
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
329
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
330
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
342
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
343
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
344
-
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
348
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
349
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
350
-
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
354
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
355
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
356
-
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
360
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
361
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
362
-
363
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
364
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
311
+
312
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
326
+
327
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
329
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
330
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
342
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
343
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
344
+
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
348
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
349
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
350
+
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
354
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
355
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
356
+
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
360
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
361
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
362
+
363
+            if (defined('WP_CLI') && WP_CLI) {
364
+                require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
365 365
             }
366 366
 
367
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
368
-
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
379
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
380
-
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
382
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
383
-
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
388
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
389
-
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
396
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
397
-
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
404
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
405
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
406
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
407
-
408
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
409
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
367
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
368
+
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
379
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
380
+
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
382
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
383
+
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
388
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
389
+
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
396
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
397
+
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
404
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
405
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
406
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
407
+
408
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
409
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
410 410
 
411 411
 			}
412 412
 
413
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
413
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
414 414
 
415 415
 		}
416 416
 
@@ -424,26 +424,26 @@  discard block
 block discarded – undo
424 424
 		 */
425 425
 		public function load_textdomain() {
426 426
 			// Set filter for Give's languages directory
427
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
428
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
427
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
428
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
429 429
 
430 430
 			// Traditional WordPress plugin locale filter
431
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
432
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
431
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
432
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
433 433
 
434 434
 			// Setup paths to current locale file
435
-			$mofile_local  = $give_lang_dir . $mofile;
436
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
435
+			$mofile_local  = $give_lang_dir.$mofile;
436
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
437 437
 
438
-			if ( file_exists( $mofile_global ) ) {
438
+			if (file_exists($mofile_global)) {
439 439
 				// Look in global /wp-content/languages/give folder
440
-				load_textdomain( 'give', $mofile_global );
441
-			} elseif ( file_exists( $mofile_local ) ) {
440
+				load_textdomain('give', $mofile_global);
441
+			} elseif (file_exists($mofile_local)) {
442 442
 				// Look in local location from filter `give_languages_directory`
443
-				load_textdomain( 'give', $mofile_local );
443
+				load_textdomain('give', $mofile_local);
444 444
 			} else {
445 445
 				// Load the default language files packaged up w/ Give
446
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
446
+				load_plugin_textdomain('give', false, $give_lang_dir);
447 447
 			}
448 448
 		}
449 449
 
Please login to merge, or discard this patch.
includes/template-functions.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47 47
 function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-    if ( ! empty( $args ) && is_array( $args ) ) {
49
-        extract( $args );
50
-    }
48
+	if ( ! empty( $args ) && is_array( $args ) ) {
49
+		extract( $args );
50
+	}
51 51
 
52
-    $template_names = array( $template_name . '.php' );
52
+	$template_names = array( $template_name . '.php' );
53 53
 
54
-    $located = give_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_locate_template( $template_names, $template_path, $default_path );
55 55
 
56
-    if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists( $located ) ) {
57 57
 		/* translators: %s: the template */
58
-        give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
59
-        return;
60
-    }
58
+		give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
59
+		return;
60
+	}
61 61
 
62
-    // Allow 3rd party plugin filter template file from their plugin.
63
-    $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
62
+	// Allow 3rd party plugin filter template file from their plugin.
63
+	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64 64
 
65 65
 	/**
66 66
 	 * Fires in give template, before the file is included.
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 * @param string $located       Template file filter by 3rd party plugin.
75 75
 	 * @param array  $args          Passed arguments.
76 76
 	 */
77
-    do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
77
+	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78 78
 
79
-    include( $located );
79
+	include( $located );
80 80
 
81 81
 	/**
82 82
 	 * Fires in give template, after the file is included.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param string $located       Template file filter by 3rd party plugin.
91 91
 	 * @param array  $args          Passed arguments.
92 92
 	 */
93
-    do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
93
+	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94 94
 }
95 95
 
96 96
 /**
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-    if ( ! empty( $args ) && is_array( $args ) ) {
49
-        extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+    if ( ! empty($args) && is_array($args)) {
49
+        extract($args);
50 50
     }
51 51
 
52
-    $template_names = array( $template_name . '.php' );
52
+    $template_names = array($template_name.'.php');
53 53
 
54
-    $located = give_locate_template( $template_names, $template_path, $default_path );
54
+    $located = give_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-    if ( ! file_exists( $located ) ) {
56
+    if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-        give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+        give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
         return;
60 60
     }
61 61
 
62 62
     // Allow 3rd party plugin filter template file from their plugin.
63
-    $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
63
+    $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
64 64
 
65 65
 	/**
66 66
 	 * Fires in give template, before the file is included.
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 * @param string $located       Template file filter by 3rd party plugin.
75 75
 	 * @param array  $args          Passed arguments.
76 76
 	 */
77
-    do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
77
+    do_action('give_before_template_part', $template_name, $template_path, $located, $args);
78 78
 
79
-    include( $located );
79
+    include($located);
80 80
 
81 81
 	/**
82 82
 	 * Fires in give template, after the file is included.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param string $located       Template file filter by 3rd party plugin.
91 91
 	 * @param array  $args          Passed arguments.
92 92
 	 */
93
-    do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
93
+    do_action('give_after_template_part', $template_name, $template_path, $located, $args);
94 94
 }
95 95
 
96 96
 /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  *
107 107
  * @return string 
108 108
  */
109
-function give_get_template_part( $slug, $name = null, $load = true ) {
109
+function give_get_template_part($slug, $name = null, $load = true) {
110 110
 
111 111
 	/**
112 112
 	 * Fires in give template part, before the template part is retrieved.
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param string $slug Template part file slug {slug}.php.
119 119
 	 * @param string $name Template part file name {slug}-{name}.php.
120 120
 	 */
121
-	do_action( "get_template_part_{$slug}", $slug, $name );
121
+	do_action("get_template_part_{$slug}", $slug, $name);
122 122
 
123 123
 	// Setup possible parts
124 124
 	$templates = array();
125
-	if ( isset( $name ) ) {
126
-		$templates[] = $slug . '-' . $name . '.php';
125
+	if (isset($name)) {
126
+		$templates[] = $slug.'-'.$name.'.php';
127 127
 	}
128
-	$templates[] = $slug . '.php';
128
+	$templates[] = $slug.'.php';
129 129
 
130 130
 	// Allow template parts to be filtered
131
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
131
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
132 132
 
133 133
 	// Return the part that is found
134
-	return give_locate_template( $templates, $load, false );
134
+	return give_locate_template($templates, $load, false);
135 135
 }
136 136
 
137 137
 /**
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
  *
153 153
  * @return string The template filename if one is located.
154 154
  */
155
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
155
+function give_locate_template($template_names, $load = false, $require_once = true) {
156 156
 	// No file found yet
157 157
 	$located = false;
158 158
 
159 159
 	// Try to find a template file
160
-	foreach ( (array) $template_names as $template_name ) {
160
+	foreach ((array) $template_names as $template_name) {
161 161
 
162 162
 		// Continue if template is empty
163
-		if ( empty( $template_name ) ) {
163
+		if (empty($template_name)) {
164 164
 			continue;
165 165
 		}
166 166
 
167 167
 		// Trim off any slashes from the template name
168
-		$template_name = ltrim( $template_name, '/' );
168
+		$template_name = ltrim($template_name, '/');
169 169
 
170 170
 		// try locating this template file by looping through the template paths
171
-		foreach ( give_get_theme_template_paths() as $template_path ) {
171
+		foreach (give_get_theme_template_paths() as $template_path) {
172 172
 
173
-			if ( file_exists( $template_path . $template_name ) ) {
174
-				$located = $template_path . $template_name;
173
+			if (file_exists($template_path.$template_name)) {
174
+				$located = $template_path.$template_name;
175 175
 				break;
176 176
 			}
177 177
 		}
178 178
 
179
-		if ( $located ) {
179
+		if ($located) {
180 180
 			break;
181 181
 		}
182 182
 	}
183 183
 
184
-	if ( ( true == $load ) && ! empty( $located ) ) {
185
-		load_template( $located, $require_once );
184
+	if ((true == $load) && ! empty($located)) {
185
+		load_template($located, $require_once);
186 186
 	}
187 187
 
188 188
 	return $located;
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	$template_dir = give_get_theme_template_dir_name();
200 200
 
201 201
 	$file_paths = array(
202
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
203
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
202
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
203
+		10  => trailingslashit(get_template_directory()).$template_dir,
204 204
 		100 => give_get_templates_dir()
205 205
 	);
206 206
 
207
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
207
+	$file_paths = apply_filters('give_template_paths', $file_paths);
208 208
 
209 209
 	// sort the file paths based on priority
210
-	ksort( $file_paths, SORT_NUMERIC );
210
+	ksort($file_paths, SORT_NUMERIC);
211 211
 
212
-	return array_map( 'trailingslashit', $file_paths );
212
+	return array_map('trailingslashit', $file_paths);
213 213
 }
214 214
 
215 215
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return string
222 222
  */
223 223
 function give_get_theme_template_dir_name() {
224
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
224
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
225 225
 }
226 226
 
227 227
 /**
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
  * @return void
232 232
  */
233 233
 function give_version_in_header() {
234
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
234
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
235 235
 }
236 236
 
237
-add_action( 'wp_head', 'give_version_in_header' );
237
+add_action('wp_head', 'give_version_in_header');
238 238
 
239 239
 /**
240 240
  * Determines if we're currently on the Donations History page.
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function give_is_donation_history_page() {
246 246
 
247
-	$ret = is_page( give_get_option( 'history_page' ) );
247
+	$ret = is_page(give_get_option('history_page'));
248 248
 
249
-	return apply_filters( 'give_is_donation_history_page', $ret );
249
+	return apply_filters('give_is_donation_history_page', $ret);
250 250
 }
251 251
 
252 252
 /**
@@ -258,25 +258,25 @@  discard block
 block discarded – undo
258 258
  *
259 259
  * @return array Modified array of classes
260 260
  */
261
-function give_add_body_classes( $class ) {
261
+function give_add_body_classes($class) {
262 262
 	$classes = (array) $class;
263 263
 
264
-	if ( give_is_success_page() ) {
264
+	if (give_is_success_page()) {
265 265
 		$classes[] = 'give-success';
266 266
 		$classes[] = 'give-page';
267 267
 	}
268 268
 
269
-	if ( give_is_failed_transaction_page() ) {
269
+	if (give_is_failed_transaction_page()) {
270 270
 		$classes[] = 'give-failed-transaction';
271 271
 		$classes[] = 'give-page';
272 272
 	}
273 273
 
274
-	if ( give_is_donation_history_page() ) {
274
+	if (give_is_donation_history_page()) {
275 275
 		$classes[] = 'give-donation-history';
276 276
 		$classes[] = 'give-page';
277 277
 	}
278 278
 
279
-	if ( give_is_test_mode() ) {
279
+	if (give_is_test_mode()) {
280 280
 		$classes[] = 'give-test-mode';
281 281
 		$classes[] = 'give-page';
282 282
 	}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	//Theme-specific Classes used to prevent conflicts via CSS
285 285
 	$current_theme = wp_get_theme();
286 286
 
287
-	switch ( $current_theme->template ) {
287
+	switch ($current_theme->template) {
288 288
 
289 289
 		case 'Divi':
290 290
 			$classes[] = 'give-divi';
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 
299 299
 	}
300 300
 
301
-	return array_unique( $classes );
301
+	return array_unique($classes);
302 302
 }
303 303
 
304
-add_filter( 'body_class', 'give_add_body_classes' );
304
+add_filter('body_class', 'give_add_body_classes');
305 305
 
306 306
 
307 307
 /**
@@ -317,22 +317,22 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return array
319 319
  */
320
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
321
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
320
+function give_add_post_class($classes, $class = '', $post_id = '') {
321
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
322 322
 		return $classes;
323 323
 	}
324 324
 
325 325
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
326 326
 
327
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
328
-		unset( $classes[ $key ] );
327
+	if (false !== ($key = array_search('hentry', $classes))) {
328
+		unset($classes[$key]);
329 329
 	}
330 330
 
331 331
 	return $classes;
332 332
 }
333 333
 
334 334
 
335
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
335
+add_filter('post_class', 'give_add_post_class', 20, 3);
336 336
 
337 337
 /**
338 338
  * Get the placeholder image URL for forms etc
@@ -342,85 +342,85 @@  discard block
 block discarded – undo
342 342
  */
343 343
 function give_get_placeholder_img_src() {
344 344
 
345
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
345
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
346 346
 
347
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
347
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
348 348
 }
349 349
 
350 350
 
351 351
 /**
352 352
  * Global
353 353
  */
354
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
354
+if ( ! function_exists('give_output_content_wrapper')) {
355 355
 
356 356
 	/**
357 357
 	 * Output the start of the page wrapper.
358 358
 	 */
359 359
 	function give_output_content_wrapper() {
360
-		give_get_template_part( 'global/wrapper-start' );
360
+		give_get_template_part('global/wrapper-start');
361 361
 	}
362 362
 }
363
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
363
+if ( ! function_exists('give_output_content_wrapper_end')) {
364 364
 
365 365
 	/**
366 366
 	 * Output the end of the page wrapper.
367 367
 	 */
368 368
 	function give_output_content_wrapper_end() {
369
-		give_get_template_part( 'global/wrapper-end' );
369
+		give_get_template_part('global/wrapper-end');
370 370
 	}
371 371
 }
372 372
 
373 373
 /**
374 374
  * Single Give Form
375 375
  */
376
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
376
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
377 377
 	function give_left_sidebar_pre_wrap() {
378
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
378
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
379 379
 	}
380 380
 }
381 381
 
382
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
382
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
383 383
 	function give_left_sidebar_post_wrap() {
384
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
384
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
385 385
 	}
386 386
 }
387 387
 
388
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
388
+if ( ! function_exists('give_get_forms_sidebar')) {
389 389
 	function give_get_forms_sidebar() {
390
-		give_get_template_part( 'single-give-form/sidebar' );
390
+		give_get_template_part('single-give-form/sidebar');
391 391
 	}
392 392
 }
393 393
 
394
-if ( ! function_exists( 'give_show_form_images' ) ) {
394
+if ( ! function_exists('give_show_form_images')) {
395 395
 
396 396
 	/**
397 397
 	 * Output the product image before the single product summary.
398 398
 	 */
399 399
 	function give_show_form_images() {
400
-		$featured_image_option = give_get_option( 'disable_form_featured_img' );
401
-		if ( $featured_image_option !== 'on' ) {
402
-			give_get_template_part( 'single-give-form/featured-image' );
400
+		$featured_image_option = give_get_option('disable_form_featured_img');
401
+		if ($featured_image_option !== 'on') {
402
+			give_get_template_part('single-give-form/featured-image');
403 403
 		}
404 404
 	}
405 405
 }
406 406
 
407
-if ( ! function_exists( 'give_template_single_title' ) ) {
407
+if ( ! function_exists('give_template_single_title')) {
408 408
 
409 409
 	/**
410 410
 	 * Output the product title.
411 411
 	 */
412 412
 	function give_template_single_title() {
413
-		give_get_template_part( 'single-give-form/title' );
413
+		give_get_template_part('single-give-form/title');
414 414
 	}
415 415
 }
416 416
 
417
-if ( ! function_exists( 'give_show_avatars' ) ) {
417
+if ( ! function_exists('give_show_avatars')) {
418 418
 
419 419
 	/**
420 420
 	 * Output the product title.
421 421
 	 */
422 422
 	function give_show_avatars() {
423
-		echo do_shortcode( '[give_donors_gravatars]' );
423
+		echo do_shortcode('[give_donors_gravatars]');
424 424
 	}
425 425
 }
426 426
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  * Conditional Functions
429 429
  */
430 430
 
431
-if ( ! function_exists( 'is_give_form' ) ) {
431
+if ( ! function_exists('is_give_form')) {
432 432
 
433 433
 	/**
434 434
 	 * is_give_form
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
 	 * @return bool
441 441
 	 */
442 442
 	function is_give_form() {
443
-		return is_singular( array( 'give_form' ) );
443
+		return is_singular(array('give_form'));
444 444
 	}
445 445
 }
446 446
 
447
-if ( ! function_exists( 'is_give_category' ) ) {
447
+if ( ! function_exists('is_give_category')) {
448 448
 
449 449
 	/**
450 450
 	 * is_give_category
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @return bool
461 461
 	 */
462
-	function is_give_category( $term = '' ) {
463
-		return is_tax( 'give_forms_category', $term );
462
+	function is_give_category($term = '') {
463
+		return is_tax('give_forms_category', $term);
464 464
 	}
465 465
 }
466 466
 
467
-if ( ! function_exists( 'is_give_tag' ) ) {
467
+if ( ! function_exists('is_give_tag')) {
468 468
 
469 469
 	/**
470 470
 	 * is_give_tag
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return bool
481 481
 	 */
482
-	function is_give_tag( $term = '' ) {
483
-		return is_tax( 'give_forms_tag', $term );
482
+	function is_give_tag($term = '') {
483
+		return is_tax('give_forms_tag', $term);
484 484
 	}
485 485
 }
486 486
 
487
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
487
+if ( ! function_exists('is_give_taxonomy')) {
488 488
 
489 489
 	/**
490 490
 	 * is_give_taxonomy
@@ -496,6 +496,6 @@  discard block
 block discarded – undo
496 496
 	 * @return bool
497 497
 	 */
498 498
 	function is_give_taxonomy() {
499
-		return is_tax( get_object_taxonomies( 'give_form' ) );
499
+		return is_tax(get_object_taxonomies('give_form'));
500 500
 	}
501 501
 }
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
-    }
36
+	if ( empty( $logout_redirect ) ) {
37
+		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
+	}
39 39
 
40 40
 
41
-    // Add user_logout action to logout url.
42
-    $logout_redirect = add_query_arg(
43
-        array(
44
-            'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
47
-        ),
48
-        home_url('/')
49
-    );
41
+	// Add user_logout action to logout url.
42
+	$logout_redirect = add_query_arg(
43
+		array(
44
+			'give_action'       => 'user_logout',
45
+			'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
+			'give_logout_redirect' => urlencode( $logout_redirect )
47
+		),
48
+		home_url('/')
49
+	);
50 50
 
51 51
 	$give_login_redirect = $login_redirect;
52 52
 	$give_logout_redirect = $logout_redirect;
@@ -136,31 +136,31 @@  discard block
 block discarded – undo
136 136
  * @return void
137 137
  */
138 138
 function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
139
+	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
140 140
 
141
-        // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
141
+		// Prevent occurring of any custom action on wp_logout.
142
+		remove_all_actions( 'wp_logout' );
143 143
 
144 144
 		/**
145 145
 		 * Fires before processing user logout.
146 146
 		 *
147 147
 		 * @since 1.0
148 148
 		 */
149
-        do_action( 'give_before_user_logout' );
149
+		do_action( 'give_before_user_logout' );
150 150
 
151
-        // Logout user.
152
-        wp_logout();
151
+		// Logout user.
152
+		wp_logout();
153 153
 
154 154
 		/**
155 155
 		 * Fires after processing user logout.
156 156
 		 *
157 157
 		 * @since 1.0
158 158
 		 */
159
-        do_action( 'give_after_user_logout' );
159
+		do_action( 'give_after_user_logout' );
160 160
 
161
-        wp_redirect( $data['give_logout_redirect'] );
162
-        give_die();
163
-    }
161
+		wp_redirect( $data['give_logout_redirect'] );
162
+		give_die();
163
+	}
164 164
 }
165 165
 
166 166
 add_action( 'give_user_logout', 'give_process_user_logout' );
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 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
 
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30 30
 	global $give_login_redirect, $give_logout_redirect;
31 31
 
32
-	if ( empty( $login_redirect ) ) {
32
+	if (empty($login_redirect)) {
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
36
+    if (empty($logout_redirect)) {
37
+        $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
38 38
     }
39 39
 
40 40
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $logout_redirect = add_query_arg(
43 43
         array(
44 44
             'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
45
+            'give_logout_nonce' => wp_create_nonce('give-logout-nonce'),
46
+            'give_logout_redirect' => urlencode($logout_redirect)
47 47
         ),
48 48
         home_url('/')
49 49
     );
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 	ob_start();
55 55
 
56
-	give_get_template_part( 'shortcode', 'login' );
56
+	give_get_template_part('shortcode', 'login');
57 57
 
58
-	return apply_filters( 'give_login_form', ob_get_clean() );
58
+	return apply_filters('give_login_form', ob_get_clean());
59 59
 }
60 60
 
61 61
 /**
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string Register form
70 70
  */
71
-function give_register_form( $redirect = '' ) {
71
+function give_register_form($redirect = '') {
72 72
 	global $give_register_redirect;
73 73
 
74
-	if ( empty( $redirect ) ) {
74
+	if (empty($redirect)) {
75 75
 		$redirect = give_get_current_page_url();
76 76
 	}
77 77
 
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 
80 80
 	ob_start();
81 81
 
82
-	if ( ! is_user_logged_in() ) {
83
-		give_get_template_part( 'shortcode', 'register' );
82
+	if ( ! is_user_logged_in()) {
83
+		give_get_template_part('shortcode', 'register');
84 84
 	}
85 85
 
86
-	return apply_filters( 'give_register_form', ob_get_clean() );
86
+	return apply_filters('give_register_form', ob_get_clean());
87 87
 }
88 88
 
89 89
 /**
@@ -95,34 +95,34 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @return void
97 97
  */
98
-function give_process_login_form( $data ) {
99
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
100
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
101
-		if ( ! $user_data ) {
102
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
98
+function give_process_login_form($data) {
99
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
100
+		$user_data = get_user_by('login', $data['give_user_login']);
101
+		if ( ! $user_data) {
102
+			$user_data = get_user_by('email', $data['give_user_login']);
103 103
 		}
104
-		if ( $user_data ) {
104
+		if ($user_data) {
105 105
 			$user_ID    = $user_data->ID;
106 106
 			$user_email = $user_data->user_email;
107
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
108
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
107
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
108
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
109 109
 			} else {
110
-				give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) );
110
+				give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give'));
111 111
 			}
112 112
 		} else {
113
-			give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
113
+			give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
114 114
 		}
115 115
 		// Check for errors and redirect if none present
116 116
 		$errors = give_get_errors();
117
-		if ( ! $errors ) {
118
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
119
-			wp_redirect( $redirect );
117
+		if ( ! $errors) {
118
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
119
+			wp_redirect($redirect);
120 120
 			give_die();
121 121
 		}
122 122
 	}
123 123
 }
124 124
 
125
-add_action( 'give_user_login', 'give_process_login_form' );
125
+add_action('give_user_login', 'give_process_login_form');
126 126
 
127 127
 
128 128
 /**
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return void
136 136
  */
137
-function give_process_user_logout( $data ) {
138
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
137
+function give_process_user_logout($data) {
138
+    if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
139 139
 
140 140
         // Prevent occurring of any custom action on wp_logout.
141
-        remove_all_actions( 'wp_logout' );
141
+        remove_all_actions('wp_logout');
142 142
 
143 143
 		/**
144 144
 		 * Fires before processing user logout.
145 145
 		 *
146 146
 		 * @since 1.0
147 147
 		 */
148
-        do_action( 'give_before_user_logout' );
148
+        do_action('give_before_user_logout');
149 149
 
150 150
         // Logout user.
151 151
         wp_logout();
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @since 1.0
157 157
 		 */
158
-        do_action( 'give_after_user_logout' );
158
+        do_action('give_after_user_logout');
159 159
 
160
-        wp_redirect( $data['give_logout_redirect'] );
160
+        wp_redirect($data['give_logout_redirect']);
161 161
         give_die();
162 162
     }
163 163
 }
164 164
 
165
-add_action( 'give_user_logout', 'give_process_user_logout' );
165
+add_action('give_user_logout', 'give_process_user_logout');
166 166
 
167 167
 /**
168 168
  * Log User In
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
179
-	if ( $user_id < 1 ) {
178
+function give_log_user_in($user_id, $user_login, $user_pass) {
179
+	if ($user_id < 1) {
180 180
 		return;
181 181
 	}
182 182
 
183
-	wp_set_auth_cookie( $user_id );
184
-	wp_set_current_user( $user_id, $user_login );
183
+	wp_set_auth_cookie($user_id);
184
+	wp_set_current_user($user_id, $user_login);
185 185
 
186 186
 	/**
187 187
 	 * Fires after the user has successfully logged in.
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @param string  $user_login Username.
192 192
 	 * @param WP_User $$user      WP_User object of the logged-in user.
193 193
 	 */
194
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
194
+	do_action('wp_login', $user_login, get_userdata($user_id));
195 195
 
196 196
 	/**
197 197
 	 * Fires after give user has successfully logged in.
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @param string $user_login Username.
203 203
 	 * @param string $user_pass  User password.
204 204
 	 */
205
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
205
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
206 206
 }
207 207
 
208 208
 
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
  *
216 216
  * @return void
217 217
  */
218
-function give_process_register_form( $data ) {
218
+function give_process_register_form($data) {
219 219
 
220
-	if ( is_user_logged_in() ) {
220
+	if (is_user_logged_in()) {
221 221
 		return;
222 222
 	}
223 223
 
224
-	if ( empty( $_POST['give_register_submit'] ) ) {
224
+	if (empty($_POST['give_register_submit'])) {
225 225
 		return;
226 226
 	}
227 227
 
@@ -230,38 +230,38 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @since 1.0
232 232
 	 */
233
-	do_action( 'give_pre_process_register_form' );
233
+	do_action('give_pre_process_register_form');
234 234
 
235
-	if ( empty( $data['give_user_login'] ) ) {
236
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
235
+	if (empty($data['give_user_login'])) {
236
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
237 237
 	}
238 238
 
239
-	if ( username_exists( $data['give_user_login'] ) ) {
240
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
239
+	if (username_exists($data['give_user_login'])) {
240
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
241 241
 	}
242 242
 
243
-	if ( ! validate_username( $data['give_user_login'] ) ) {
244
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
243
+	if ( ! validate_username($data['give_user_login'])) {
244
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
245 245
 	}
246 246
 
247
-	if ( email_exists( $data['give_user_email'] ) ) {
248
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
247
+	if (email_exists($data['give_user_email'])) {
248
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
249 249
 	}
250 250
 
251
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
252
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
251
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
252
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
253 253
 	}
254 254
 
255
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
256
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
255
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
256
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
257 257
 	}
258 258
 
259
-	if ( empty( $_POST['give_user_pass'] ) ) {
260
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
259
+	if (empty($_POST['give_user_pass'])) {
260
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
261 261
 	}
262 262
 
263
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
264
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
263
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
264
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
265 265
 	}
266 266
 
267 267
 	/**
@@ -269,26 +269,26 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @since 1.0
271 271
 	 */
272
-	do_action( 'give_process_register_form' );
272
+	do_action('give_process_register_form');
273 273
 
274 274
 	// Check for errors and redirect if none present
275 275
 	$errors = give_get_errors();
276 276
 
277
-	if ( empty( $errors ) ) {
277
+	if (empty($errors)) {
278 278
 
279
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
279
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
280 280
 
281
-		give_register_and_login_new_user( array(
281
+		give_register_and_login_new_user(array(
282 282
 			'user_login'      => $data['give_user_login'],
283 283
 			'user_pass'       => $data['give_user_pass'],
284 284
 			'user_email'      => $data['give_user_email'],
285
-			'user_registered' => date( 'Y-m-d H:i:s' ),
286
-			'role'            => get_option( 'default_role' )
287
-		) );
285
+			'user_registered' => date('Y-m-d H:i:s'),
286
+			'role'            => get_option('default_role')
287
+		));
288 288
 
289
-		wp_redirect( $redirect );
289
+		wp_redirect($redirect);
290 290
 		give_die();
291 291
 	}
292 292
 }
293 293
 
294
-add_action( 'give_user_register', 'give_process_register_form' );
295 294
\ No newline at end of file
295
+add_action('give_user_register', 'give_process_register_form');
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +33 added lines, -33 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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donations', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donations', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 		// These aren't really bulk actions but this outputs the markup in the right place
115 115
 		give_report_views();
116 116
 	}
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param string $which
125 125
 	 */
126
-	protected function display_tablenav( $which ) {
126
+	protected function display_tablenav($which) {
127 127
 
128
-		if ( 'top' == $which ) {
129
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
128
+		if ('top' == $which) {
129
+			wp_nonce_field('bulk-'.$this->_args['plural']);
130 130
 		}
131 131
 		?>
132
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
132
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
133 133
 
134
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span></h3>
134
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Methods Report', 'give'); ?></span></h3>
135 135
 
136 136
 			<div class="alignright tablenav-right">
137 137
 				<div class="actions bulkactions">
138
-					<?php $this->bulk_actions( $which ); ?>
138
+					<?php $this->bulk_actions($which); ?>
139 139
 				</div>
140 140
 				<?php
141
-				$this->extra_tablenav( $which );
142
-				$this->pagination( $which );
141
+				$this->extra_tablenav($which);
142
+				$this->pagination($which);
143 143
 				?>
144 144
 			</div>
145 145
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 		$gateways     = give_get_payment_gateways();
165 165
 		$stats        = new Give_Payment_Stats();
166 166
 
167
-		foreach ( $gateways as $gateway_id => $gateway ) {
167
+		foreach ($gateways as $gateway_id => $gateway) {
168 168
 
169
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
170
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
169
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
170
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
171 171
 
172 172
 			$reports_data[] = array(
173 173
 				'ID'              => $gateway_id,
174 174
 				'label'           => $gateway['admin_label'],
175
-				'complete_sales'  => give_format_amount( $complete_count, false ),
176
-				'pending_sales'   => give_format_amount( $pending_count, false ),
177
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
178
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
175
+				'complete_sales'  => give_format_amount($complete_count, false),
176
+				'pending_sales'   => give_format_amount($pending_count, false),
177
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
178
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
179 179
 			);
180 180
 		}
181 181
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$columns               = $this->get_columns();
198 198
 		$hidden                = array(); // No hidden columns
199 199
 		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
200
+		$this->_column_headers = array($columns, $hidden, $sortable);
201 201
 		$this->items           = $this->reports_data();
202 202
 
203 203
 	}
Please login to merge, or discard this patch.