Completed
Pull Request — master (#1055)
by Rami
19:01
created
includes/emails/class-give-email-tags.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@
 block discarded – undo
477 477
  *
478 478
  * @param int $payment_id
479 479
  *
480
- * @return int payment_id
480
+ * @return string payment_id
481 481
  */
482 482
 function give_email_tag_payment_id( $payment_id ) {
483 483
 	return give_get_payment_number( $payment_id );
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 * @param string $description Email tag description text
56 56
 	 * @param callable $func Hook to run when email tag is found
57 57
 	 */
58
-	public function add( $tag, $description, $func ) {
59
-		if ( is_callable( $func ) ) {
60
-			$this->tags[ $tag ] = array(
58
+	public function add($tag, $description, $func) {
59
+		if (is_callable($func)) {
60
+			$this->tags[$tag] = array(
61 61
 				'tag'         => $tag,
62 62
 				'description' => $description,
63 63
 				'func'        => $func
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param string $tag Email tag to remove hook from
74 74
 	 */
75
-	public function remove( $tag ) {
76
-		unset( $this->tags[ $tag ] );
75
+	public function remove($tag) {
76
+		unset($this->tags[$tag]);
77 77
 	}
78 78
 
79 79
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return bool
87 87
 	 */
88
-	public function email_tag_exists( $tag ) {
89
-		return array_key_exists( $tag, $this->tags );
88
+	public function email_tag_exists($tag) {
89
+		return array_key_exists($tag, $this->tags);
90 90
 	}
91 91
 
92 92
 	/**
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string Content with email tags filtered out.
112 112
 	 */
113
-	public function do_tags( $content, $payment_id ) {
113
+	public function do_tags($content, $payment_id) {
114 114
 
115 115
 		// Check if there is atleast one tag added
116
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
116
+		if (empty($this->tags) || ! is_array($this->tags)) {
117 117
 			return $content;
118 118
 		}
119 119
 
120 120
 		$this->payment_id = $payment_id;
121 121
 
122
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
122
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
123 123
 
124 124
 		$this->payment_id = null;
125 125
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return mixed
137 137
 	 */
138
-	public function do_tag( $m ) {
138
+	public function do_tag($m) {
139 139
 
140 140
 		// Get tag
141 141
 		$tag = $m[1];
142 142
 
143 143
 		// Return tag if tag not set
144
-		if ( ! $this->email_tag_exists( $tag ) ) {
144
+		if ( ! $this->email_tag_exists($tag)) {
145 145
 			return $m[0];
146 146
 		}
147 147
 
148
-		return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag );
148
+		return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag);
149 149
 	}
150 150
 
151 151
 }
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  * @param string $description Description of the email tag added
160 160
  * @param callable $func Hook to run when email tag is found
161 161
  */
162
-function give_add_email_tag( $tag, $description, $func ) {
163
-	Give()->email_tags->add( $tag, $description, $func );
162
+function give_add_email_tag($tag, $description, $func) {
163
+	Give()->email_tags->add($tag, $description, $func);
164 164
 }
165 165
 
166 166
 /**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @param string $tag Email tag to remove hook from
172 172
  */
173
-function give_remove_email_tag( $tag ) {
174
-	Give()->email_tags->remove( $tag );
173
+function give_remove_email_tag($tag) {
174
+	Give()->email_tags->remove($tag);
175 175
 }
176 176
 
177 177
 /**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return bool
185 185
  */
186
-function give_email_tag_exists( $tag ) {
187
-	return Give()->email_tags->email_tag_exists( $tag );
186
+function give_email_tag_exists($tag) {
187
+	return Give()->email_tags->email_tag_exists($tag);
188 188
 }
189 189
 
190 190
 /**
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 	$email_tags = give_get_email_tags();
214 214
 
215 215
 	// Check
216
-	if ( count( $email_tags ) > 0 ) {
216
+	if (count($email_tags) > 0) {
217 217
 
218 218
 		// Loop
219
-		foreach ( $email_tags as $email_tag ) {
219
+		foreach ($email_tags as $email_tag) {
220 220
 
221 221
 			// Add email tag to list
222
-			$list .= '<code>{' . $email_tag['tag'] . '}</code> - ' . $email_tag['description'] . '<br/>';
222
+			$list .= '<code>{'.$email_tag['tag'].'}</code> - '.$email_tag['description'].'<br/>';
223 223
 
224 224
 		}
225 225
 
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
  *
240 240
  * @return string Content with email tags filtered out.
241 241
  */
242
-function give_do_email_tags( $content, $payment_id ) {
242
+function give_do_email_tags($content, $payment_id) {
243 243
 
244 244
 	// Replace all tags
245
-	$content = Give()->email_tags->do_tags( $content, $payment_id );
245
+	$content = Give()->email_tags->do_tags($content, $payment_id);
246 246
 
247 247
 	// Maintaining backwards compatibility
248
-	$content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id );
248
+	$content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id);
249 249
 
250 250
 	// Return content
251 251
 	return $content;
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @since 1.0
266 266
 	 */
267
-	do_action( 'give_add_email_tags' );
267
+	do_action('give_add_email_tags');
268 268
 }
269 269
 
270
-add_action( 'init', 'give_load_email_tags', - 999 );
270
+add_action('init', 'give_load_email_tags', - 999);
271 271
 
272 272
 /**
273 273
  * Add default Give email template tags.
@@ -280,87 +280,87 @@  discard block
 block discarded – undo
280 280
 	$email_tags = array(
281 281
 		array(
282 282
 			'tag'         => 'donation',
283
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
283
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
284 284
 			'function'    => 'give_email_tag_donation'
285 285
 		),
286 286
 		array(
287 287
 			'tag'         => 'name',
288
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
288
+			'description' => esc_html__('The donor\'s first name.', 'give'),
289 289
 			'function'    => 'give_email_tag_first_name'
290 290
 		),
291 291
 		array(
292 292
 			'tag'         => 'fullname',
293
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
293
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
294 294
 			'function'    => 'give_email_tag_fullname'
295 295
 		),
296 296
 		array(
297 297
 			'tag'         => 'username',
298
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
298
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
299 299
 			'function'    => 'give_email_tag_username'
300 300
 		),
301 301
 		array(
302 302
 			'tag'         => 'user_email',
303
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
303
+			'description' => esc_html__('The donor\'s email address.', 'give'),
304 304
 			'function'    => 'give_email_tag_user_email'
305 305
 		),
306 306
 		array(
307 307
 			'tag'         => 'billing_address',
308
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
308
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
309 309
 			'function'    => 'give_email_tag_billing_address'
310 310
 		),
311 311
 		array(
312 312
 			'tag'         => 'date',
313
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
313
+			'description' => esc_html__('The date of the donation.', 'give'),
314 314
 			'function'    => 'give_email_tag_date'
315 315
 		),
316 316
 		array(
317 317
 			'tag'         => 'price',
318
-			'description' => esc_html__( 'The total price of the donation.', 'give' ),
318
+			'description' => esc_html__('The total price of the donation.', 'give'),
319 319
 			'function'    => 'give_email_tag_price'
320 320
 		),
321 321
 		array(
322 322
 			'tag'         => 'payment_id',
323
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
323
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
324 324
 			'function'    => 'give_email_tag_payment_id'
325 325
 		),
326 326
 		array(
327 327
 			'tag'         => 'receipt_id',
328
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
328
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
329 329
 			'function'    => 'give_email_tag_receipt_id'
330 330
 		),
331 331
 		array(
332 332
 			'tag'         => 'payment_method',
333
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
333
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
334 334
 			'function'    => 'give_email_tag_payment_method'
335 335
 		),
336 336
 		array(
337 337
 			'tag'         => 'sitename',
338
-			'description' => esc_html__( 'The name of the site.', 'give' ),
338
+			'description' => esc_html__('The name of the site.', 'give'),
339 339
 			'function'    => 'give_email_tag_sitename'
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'receipt_link',
343
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
343
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
344 344
 			'function'    => 'give_email_tag_receipt_link'
345 345
 		),
346 346
 		array(
347 347
 			'tag'         => 'receipt_link_url',
348
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
348
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
349 349
 			'function'    => 'give_email_tag_receipt_link_url'
350 350
 		),
351 351
 	);
352 352
 
353 353
 	// Apply give_email_tags filter
354
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
354
+	$email_tags = apply_filters('give_email_tags', $email_tags);
355 355
 
356 356
 	// Add email tags
357
-	foreach ( $email_tags as $email_tag ) {
358
-		give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] );
357
+	foreach ($email_tags as $email_tag) {
358
+		give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']);
359 359
 	}
360 360
 
361 361
 }
362 362
 
363
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
363
+add_action('give_add_email_tags', 'give_setup_email_tags');
364 364
 
365 365
 
366 366
 /**
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
  *
373 373
  * @return string name
374 374
  */
375
-function give_email_tag_first_name( $payment_id ) {
376
-	$payment   = new Give_Payment( $payment_id );
375
+function give_email_tag_first_name($payment_id) {
376
+	$payment   = new Give_Payment($payment_id);
377 377
 	$user_info = $payment->user_info;
378 378
 
379
-	if ( empty( $user_info ) ) {
379
+	if (empty($user_info)) {
380 380
 		return '';
381 381
 	}
382 382
 
383
-	$email_name = give_get_email_names( $user_info );
383
+	$email_name = give_get_email_names($user_info);
384 384
 
385 385
 	return $email_name['name'];
386 386
 }
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
  *
395 395
  * @return string fullname
396 396
  */
397
-function give_email_tag_fullname( $payment_id ) {
398
-	$payment   = new Give_Payment( $payment_id );
397
+function give_email_tag_fullname($payment_id) {
398
+	$payment   = new Give_Payment($payment_id);
399 399
 	$user_info = $payment->user_info;
400 400
 
401
-	if ( empty( $user_info ) ) {
401
+	if (empty($user_info)) {
402 402
 		return '';
403 403
 	}
404 404
 
405
-	$email_name = give_get_email_names( $user_info );
405
+	$email_name = give_get_email_names($user_info);
406 406
 
407 407
 	return $email_name['fullname'];
408 408
 }
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
  *
417 417
  * @return string username.
418 418
  */
419
-function give_email_tag_username( $payment_id ) {
420
-	$payment   = new Give_Payment( $payment_id );
419
+function give_email_tag_username($payment_id) {
420
+	$payment   = new Give_Payment($payment_id);
421 421
 	$user_info = $payment->user_info;
422 422
 
423
-	if ( empty( $user_info ) ) {
423
+	if (empty($user_info)) {
424 424
 		return '';
425 425
 	}
426 426
 
427
-	$email_name = give_get_email_names( $user_info );
427
+	$email_name = give_get_email_names($user_info);
428 428
 
429 429
 	return $email_name['username'];
430 430
 }
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @return string user_email
440 440
  */
441
-function give_email_tag_user_email( $payment_id ) {
442
-	$payment = new Give_Payment( $payment_id );
441
+function give_email_tag_user_email($payment_id) {
442
+	$payment = new Give_Payment($payment_id);
443 443
 
444 444
 	return $payment->email;
445 445
 }
@@ -453,10 +453,10 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return string billing_address
455 455
  */
456
-function give_email_tag_billing_address( $payment_id ) {
456
+function give_email_tag_billing_address($payment_id) {
457 457
 
458
-	$user_info    = give_get_payment_meta_user_info( $payment_id );
459
-	$user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array(
458
+	$user_info    = give_get_payment_meta_user_info($payment_id);
459
+	$user_address = ! empty($user_info['address']) ? $user_info['address'] : array(
460 460
 		'line1'   => '',
461 461
 		'line2'   => '',
462 462
 		'city'    => '',
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 		'zip'     => ''
466 466
 	);
467 467
 
468
-	$return = $user_address['line1'] . "\n";
469
-	if ( ! empty( $user_address['line2'] ) ) {
470
-		$return .= $user_address['line2'] . "\n";
468
+	$return = $user_address['line1']."\n";
469
+	if ( ! empty($user_address['line2'])) {
470
+		$return .= $user_address['line2']."\n";
471 471
 	}
472
-	$return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
472
+	$return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n";
473 473
 	$return .= $user_address['country'];
474 474
 
475 475
 	return $return;
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
  *
485 485
  * @return string date
486 486
  */
487
-function give_email_tag_date( $payment_id ) {
488
-	$payment = new Give_Payment( $payment_id );
487
+function give_email_tag_date($payment_id) {
488
+	$payment = new Give_Payment($payment_id);
489 489
 
490
-	return date_i18n( give_date_format(), strtotime( $payment->date ) );
490
+	return date_i18n(give_date_format(), strtotime($payment->date));
491 491
 }
492 492
 
493 493
 /**
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
  *
500 500
  * @return string price
501 501
  */
502
-function give_email_tag_price( $payment_id ) {
503
-	$payment = new Give_Payment( $payment_id );
504
-	$price   = give_currency_filter( give_format_amount( $payment->total ), $payment->currency );
502
+function give_email_tag_price($payment_id) {
503
+	$payment = new Give_Payment($payment_id);
504
+	$price   = give_currency_filter(give_format_amount($payment->total), $payment->currency);
505 505
 
506
-	return html_entity_decode( $price, ENT_COMPAT, 'UTF-8' );
506
+	return html_entity_decode($price, ENT_COMPAT, 'UTF-8');
507 507
 }
508 508
 
509 509
 /**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
  *
516 516
  * @return int payment_id
517 517
  */
518
-function give_email_tag_payment_id( $payment_id ) {
519
-	$payment = new Give_Payment( $payment_id );
518
+function give_email_tag_payment_id($payment_id) {
519
+	$payment = new Give_Payment($payment_id);
520 520
 
521 521
 	return $payment->number;
522 522
 }
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @return string receipt_id
532 532
  */
533
-function give_email_tag_receipt_id( $payment_id ) {
534
-	$payment = new Give_Payment( $payment_id );
533
+function give_email_tag_receipt_id($payment_id) {
534
+	$payment = new Give_Payment($payment_id);
535 535
 
536 536
 	return $payment->key;
537 537
 }
@@ -545,14 +545,14 @@  discard block
 block discarded – undo
545 545
  *
546 546
  * @return string $form_title
547 547
  */
548
-function give_email_tag_donation( $payment_id ) {
549
-	$payment      = new Give_Payment( $payment_id );
548
+function give_email_tag_donation($payment_id) {
549
+	$payment      = new Give_Payment($payment_id);
550 550
 	$payment_meta = $payment->payment_meta;
551
-	$level_title  = give_has_variable_prices( $payment_meta['form_id'] );
551
+	$level_title  = give_has_variable_prices($payment_meta['form_id']);
552 552
 	$separator    = $level_title ? '-' : '';
553
-	$form_title   = strip_tags( give_get_payment_form_title( $payment_meta, $level_title, $separator ) );
553
+	$form_title   = strip_tags(give_get_payment_form_title($payment_meta, $level_title, $separator));
554 554
 
555
-	return ! empty( $form_title ) ? $form_title : esc_html__( 'There was an error retrieving the donation form name.', 'give' );
555
+	return ! empty($form_title) ? $form_title : esc_html__('There was an error retrieving the donation form name.', 'give');
556 556
 
557 557
 }
558 558
 
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @return string gateway
567 567
  */
568
-function give_email_tag_payment_method( $payment_id ) {
569
-	$payment = new Give_Payment( $payment_id );
568
+function give_email_tag_payment_method($payment_id) {
569
+	$payment = new Give_Payment($payment_id);
570 570
 
571
-	return give_get_gateway_checkout_label( $payment->gateway );
571
+	return give_get_gateway_checkout_label($payment->gateway);
572 572
 }
573 573
 
574 574
 /**
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
  *
581 581
  * @return string sitename
582 582
  */
583
-function give_email_tag_sitename( $payment_id ) {
584
-	return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
583
+function give_email_tag_sitename($payment_id) {
584
+	return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
585 585
 }
586 586
 
587 587
 /**
@@ -593,19 +593,19 @@  discard block
 block discarded – undo
593 593
  *
594 594
  * @return string receipt_link
595 595
  */
596
-function give_email_tag_receipt_link( $payment_id ) {
596
+function give_email_tag_receipt_link($payment_id) {
597 597
 
598
-	$receipt_url = esc_url( add_query_arg( array(
599
-		'payment_key' => give_get_payment_key( $payment_id ),
598
+	$receipt_url = esc_url(add_query_arg(array(
599
+		'payment_key' => give_get_payment_key($payment_id),
600 600
 		'give_action' => 'view_receipt'
601
-	), home_url() ) );
602
-	$formatted   = sprintf(
601
+	), home_url()));
602
+	$formatted = sprintf(
603 603
 		'<a href="%1$s">%2$s</a>',
604 604
 		$receipt_url,
605
-		esc_html__( 'View it in your browser', 'give' )
605
+		esc_html__('View it in your browser', 'give')
606 606
 	);
607 607
 
608
-	if ( give_get_option( 'email_template' ) !== 'none' ) {
608
+	if (give_get_option('email_template') !== 'none') {
609 609
 		return $formatted;
610 610
 	} else {
611 611
 		return $receipt_url;
@@ -624,12 +624,12 @@  discard block
 block discarded – undo
624 624
  *
625 625
  * @return string receipt_url
626 626
  */
627
-function give_email_tag_receipt_link_url( $payment_id ) {
627
+function give_email_tag_receipt_link_url($payment_id) {
628 628
 
629
-	$receipt_url = esc_url( add_query_arg( array(
630
-		'payment_key' => give_get_payment_key( $payment_id ),
629
+	$receipt_url = esc_url(add_query_arg(array(
630
+		'payment_key' => give_get_payment_key($payment_id),
631 631
 		'give_action' => 'view_receipt'
632
-	), home_url() ) );
632
+	), home_url()));
633 633
 
634 634
 	return $receipt_url;
635 635
 
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -713,7 +713,7 @@
 block discarded – undo
713 713
 	 * @param	bool   $colon   Check if add colon between heading and message.
714 714
 	 * @param	string $color   Heading color.
715 715
 	 *
716
-	 * @return	mixed
716
+	 * @return	string
717 717
 	 */
718 718
 	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
719 719
 	    // Add colon.
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @subcommand	donors
327 327
 	 */
328 328
 	public function donors( $args, $assoc_args ) {
329
-	    global $wp_query;
329
+		global $wp_query;
330 330
 		$donor_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )      ? absint( $assoc_args['id'] ) : false;
331 331
 		$email       = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args )   ? $assoc_args['email']        : false;
332 332
 		$name        = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args )    ? $assoc_args['name']         : '';
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @subcommand	donations
493 493
 	 */
494 494
 	public function donations( $args, $assoc_args ) {
495
-	    global $wp_query;
495
+		global $wp_query;
496 496
 		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
497 497
 
498 498
 		// Cache previous number query var.
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	 * @return	mixed
717 717
 	 */
718 718
 	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
719
-	    // Add colon.
720
-	    if ( $colon ) {
721
-	        $heading = $heading . ': ';
719
+		// Add colon.
720
+		if ( $colon ) {
721
+			$heading = $heading . ': ';
722 722
 		}
723 723
 		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
724 724
 	}
Please login to merge, or discard this patch.
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) { exit; }
10
+if ( ! defined('ABSPATH')) { exit; }
11 11
 
12 12
 // Add give command.
13
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
13
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
14 14
 
15 15
 
16 16
 /**
@@ -66,54 +66,54 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @subcommand  details
68 68
 	 */
69
-	public function details( $args, $assoc_args ) {
69
+	public function details($args, $assoc_args) {
70 70
 
71 71
 		/**
72 72
 		 * Plugin Information
73 73
 		 */
74
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
74
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
75 75
 
76 76
 		/**
77 77
 		 * General Information.
78 78
 		 */
79
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
79
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
80 80
 
81
-		$success_page = give_get_option( 'success_page' );
82
-		$failure_page = give_get_option( 'failure_page' );
83
-		$history_page = give_get_option( 'history_page' );
81
+		$success_page = give_get_option('success_page');
82
+		$failure_page = give_get_option('failure_page');
83
+		$history_page = give_get_option('history_page');
84 84
 
85
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
86
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
87
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
88
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
85
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
86
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
87
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
88
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
89 89
 
90 90
 		/**
91 91
 		 * Currency Information.
92 92
 		 */
93
-		$default_gateway = give_get_option( 'default_gateway' );
93
+		$default_gateway = give_get_option('default_gateway');
94 94
 
95
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
95
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
96 96
 
97
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
98
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
99
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
100
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
101
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
102
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' )  ) ) );
103
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' )  ) ) );
97
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
98
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
99
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
100
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
101
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
102
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
103
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
104 104
 
105 105
 		// Payment gateways Information.
106
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
107
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
106
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
107
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
108 108
 
109
-		if ( ! empty( $gateways ) ) {
109
+		if ( ! empty($gateways)) {
110 110
 			self::$counter = 1;
111
-			foreach ( $gateways as $gateway ) {
112
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
111
+			foreach ($gateways as $gateway) {
112
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
113 113
 				self::$counter++;
114 114
 			}
115 115
 		} else {
116
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
116
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
117 117
 		}
118 118
 	}
119 119
 
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @subcommand	forms
147 147
 	 */
148
-	public function forms( $args, $assoc_args ) {
148
+	public function forms($args, $assoc_args) {
149 149
 		global $wp_query;
150
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )     ? absint( $assoc_args['id'] )     : false;
151
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
150
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
151
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
152 152
 		$start   = time();
153 153
 
154 154
 		// Cache previous number query var.
155 155
 		$is_set_number = $cache_per_page = false;
156
-		if ( isset( $wp_query->query_vars['number'] ) ) {
156
+		if (isset($wp_query->query_vars['number'])) {
157 157
 			$cache_per_page = $wp_query->query_vars['number'];
158 158
 			$is_set_number = true;
159 159
 		}
@@ -162,46 +162,46 @@  discard block
 block discarded – undo
162 162
 		$wp_query->query_vars['number'] = $number;
163 163
 
164 164
 		// Get forms.
165
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
165
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
166 166
 
167 167
 		// Reset number query var.
168
-		if ( $is_set_number ) {
168
+		if ($is_set_number) {
169 169
 			$wp_query->query_vars['number'] = $cache_per_page;
170 170
 		}
171 171
 
172 172
 		// Bailout.
173
-		if ( array_key_exists( 'error', $forms ) ) {
173
+		if (array_key_exists('error', $forms)) {
174 174
 
175
-			WP_CLI::warning( $forms['error'] );
175
+			WP_CLI::warning($forms['error']);
176 176
 			return;
177
-		} elseif ( empty( $forms['forms'] ) ) {
177
+		} elseif (empty($forms['forms'])) {
178 178
 
179
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
179
+			WP_CLI::error(__('No forms found.', 'give'));
180 180
 			return;
181 181
 		}
182 182
 
183 183
 		// Param to check if form typeis already showed or not.
184 184
 		$is_show_form_type = false;
185 185
 
186
-		if ( 1 === count( $forms ) && $form_id ) {
186
+		if (1 === count($forms) && $form_id) {
187 187
 			// Show single form.
188
-			foreach ( $forms['forms'][0] as $key => $info ) {
189
-				switch ( $key ) {
188
+			foreach ($forms['forms'][0] as $key => $info) {
189
+				switch ($key) {
190 190
 					case 'stats':
191
-						$this->color_main_heading( ucfirst( $key ) );
191
+						$this->color_main_heading(ucfirst($key));
192 192
 
193
-						foreach ( $info as $heading => $data ) {
194
-							$this->color_sub_heading( ucfirst( $heading ) );
195
-							switch ( $heading ) {
193
+						foreach ($info as $heading => $data) {
194
+							$this->color_sub_heading(ucfirst($heading));
195
+							switch ($heading) {
196 196
 								default:
197
-									foreach ( $data as $subheading => $subdata ) {
197
+									foreach ($data as $subheading => $subdata) {
198 198
 
199
-										switch ( $subheading ) {
199
+										switch ($subheading) {
200 200
 											case 'earnings':
201
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
201
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
202 202
 												break;
203 203
 											default:
204
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
204
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
205 205
 										}
206 206
 									}
207 207
 							}
@@ -211,26 +211,26 @@  discard block
 block discarded – undo
211 211
 					case 'pricing':
212 212
 					case 'info':
213 213
 					default:
214
-						$this->color_main_heading( ucfirst( $key ) );
214
+						$this->color_main_heading(ucfirst($key));
215 215
 
216 216
 						// Show form type.
217
-						if ( ! $is_show_form_type ) {
218
-							$form = new Give_Donate_Form( $form_id );
217
+						if ( ! $is_show_form_type) {
218
+							$form = new Give_Donate_Form($form_id);
219 219
 							$is_show_form_type = true;
220 220
 
221
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
221
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
222 222
 						}
223 223
 
224
-						foreach ( $info as $heading => $data ) {
224
+						foreach ($info as $heading => $data) {
225 225
 
226
-							switch ( $heading ) {
226
+							switch ($heading) {
227 227
 								case 'id':
228
-									WP_CLI::log( $this->color_message( $heading, $data ) );
228
+									WP_CLI::log($this->color_message($heading, $data));
229 229
 									break;
230 230
 
231 231
 								default:
232
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
233
-									WP_CLI::log( $this->color_message( $heading, $data ) );
232
+									$data = empty($data) ? __('Not set', 'give') : $data;
233
+									WP_CLI::log($this->color_message($heading, $data));
234 234
 							}
235 235
 						}
236 236
 				}
@@ -241,37 +241,37 @@  discard block
 block discarded – undo
241 241
 			$is_table_first_row_set = false;
242 242
 			$table_column_count = 0;
243 243
 
244
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
244
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
245 245
 
246
-			foreach ( $forms['forms'] as $index => $form_data ) {
246
+			foreach ($forms['forms'] as $index => $form_data) {
247 247
 
248 248
 				// Default table data.
249 249
 				$table_first_row = array();
250 250
 				$table_row = array();
251 251
 
252
-				foreach ( $form_data['info'] as $key => $form ) {
252
+				foreach ($form_data['info'] as $key => $form) {
253 253
 
254 254
 					// Do not show thumbnail, content and link in table.
255
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
255
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
256 256
 						continue;
257 257
 					}
258 258
 
259
-					if ( ! $is_table_first_row_set ) {
259
+					if ( ! $is_table_first_row_set) {
260 260
 						$table_first_row[] = $key;
261 261
 					}
262 262
 
263 263
 					$table_row[] = $form;
264 264
 
265
-					if ( 'status' === $key ) {
265
+					if ('status' === $key) {
266 266
 						// First array item will be an form id in our case.
267
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
267
+						$form = new Give_Donate_Form(absint($table_row[0]));
268 268
 
269 269
 						$table_row[] = $form->get_type();
270 270
 					}
271 271
 				}
272 272
 
273 273
 				// Set table first row.
274
-				if ( ! $is_table_first_row_set ) {
274
+				if ( ! $is_table_first_row_set) {
275 275
 
276 276
 					// Add extra column to table.
277 277
 					$table_first_row[]      = 'type';
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				$table_data[] = $table_row;
285 285
 			}
286 286
 
287
-			$this->display_table( $table_data );
287
+			$this->display_table($table_data);
288 288
 		}
289 289
 	}
290 290
 
@@ -325,29 +325,29 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @subcommand	donors
327 327
 	 */
328
-	public function donors( $args, $assoc_args ) {
328
+	public function donors($args, $assoc_args) {
329 329
 	    global $wp_query;
330
-		$donor_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )      ? absint( $assoc_args['id'] ) : false;
331
-		$email       = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args )   ? $assoc_args['email']        : false;
332
-		$name        = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args )    ? $assoc_args['name']         : '';
333
-		$create      = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args )  ? $assoc_args['create']       : false;
334
-		$number      = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args )  ? $assoc_args['number']       : 10;
330
+		$donor_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
331
+		$email       = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
332
+		$name        = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
333
+		$create      = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
334
+		$number      = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
335 335
 		$start       = time();
336 336
 
337
-		if ( $create ) {
337
+		if ($create) {
338 338
 			$number = 1;
339 339
 
340 340
 			// Create one or more donors.
341
-			if ( ! $email ) {
341
+			if ( ! $email) {
342 342
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
343
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
343
+				$number = is_numeric($create) ? absint($create) : 1;
344 344
 			}
345 345
 
346
-			for ( $i = 0; $i < $number; $i++ ) {
347
-				if ( ! $email ) {
346
+			for ($i = 0; $i < $number; $i++) {
347
+				if ( ! $email) {
348 348
 
349 349
 					// Generate fake email.
350
-					$email = 'customer-' . uniqid() . '@test.com';
350
+					$email = 'customer-'.uniqid().'@test.com';
351 351
 				}
352 352
 
353 353
 				$args = array(
@@ -355,33 +355,33 @@  discard block
 block discarded – undo
355 355
 					'name'    => $name,
356 356
 				);
357 357
 
358
-				$customer_id = Give()->customers->add( $args );
358
+				$customer_id = Give()->customers->add($args);
359 359
 
360
-				if ( $customer_id ) {
361
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor %d created successfully', 'give' ), $customer_id ) ) );
360
+				if ($customer_id) {
361
+					WP_CLI::line($this->color_message(sprintf(__('Donor %d created successfully', 'give'), $customer_id)));
362 362
 				} else {
363
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
363
+					WP_CLI::error(__('Failed to create donor', 'give'));
364 364
 				}
365 365
 
366 366
 				// Reset email to false so it is generated on the next loop (if creating donors).
367 367
 				$email = false;
368 368
 			}
369 369
 
370
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
370
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
371 371
 
372 372
 		} else {
373 373
 			// Counter.
374 374
 			self::$counter = 1;
375 375
 
376 376
 			// Search for customers.
377
-			$search    = $donor_id ? $donor_id : $email;
377
+			$search = $donor_id ? $donor_id : $email;
378 378
 
379 379
 			/**
380 380
 			 * Get donors.
381 381
 			 */
382 382
 			// Cache previous number query var.
383 383
 			$is_set_number = $cache_per_page = false;
384
-			if ( isset( $wp_query->query_vars['number'] ) ) {
384
+			if (isset($wp_query->query_vars['number'])) {
385 385
 				$cache_per_page = $wp_query->query_vars['number'];
386 386
 				$is_set_number = true;
387 387
 			}
@@ -390,43 +390,43 @@  discard block
 block discarded – undo
390 390
 			$wp_query->query_vars['number'] = $number;
391 391
 
392 392
 			// Get donors.
393
-			$donors = $this->api->get_customers( $search );
393
+			$donors = $this->api->get_customers($search);
394 394
 
395 395
 			// Reset number query var.
396
-			if ( $is_set_number ) {
396
+			if ($is_set_number) {
397 397
 				$wp_query->query_vars['number'] = $cache_per_page;
398 398
 			}
399 399
 
400
-			if ( isset( $donors['error'] ) ) {
401
-				WP_CLI::error( $donors['error'] );
400
+			if (isset($donors['error'])) {
401
+				WP_CLI::error($donors['error']);
402 402
 			}
403 403
 
404
-			if ( empty( $donors ) ) {
405
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
404
+			if (empty($donors)) {
405
+				WP_CLI::error(__('No donors found.', 'give'));
406 406
 				return;
407 407
 			}
408 408
 
409 409
 			$table_data = array();
410 410
 			$is_table_first_row_set = false;
411 411
 
412
-			foreach ( $donors['donors'] as $donor_data ) {
412
+			foreach ($donors['donors'] as $donor_data) {
413 413
 				// Set default table row data.
414
-				$table_first_row = array( __( 'S. No.', 'give' ) );
415
-				$table_row = array( self::$counter );
414
+				$table_first_row = array(__('S. No.', 'give'));
415
+				$table_row = array(self::$counter);
416 416
 
417
-				foreach ( $donor_data as $key => $donor ) {
418
-					switch ( $key ) {
417
+				foreach ($donor_data as $key => $donor) {
418
+					switch ($key) {
419 419
 						case 'stats':
420
-							foreach ( $donor as $heading => $data ) {
420
+							foreach ($donor as $heading => $data) {
421 421
 
422 422
 								// Get first row.
423
-								if ( ! $is_table_first_row_set ) {
423
+								if ( ! $is_table_first_row_set) {
424 424
 									$table_first_row[] = $heading;
425 425
 								}
426 426
 
427
-								switch ( $heading ) {
427
+								switch ($heading) {
428 428
 									case 'total_spent':
429
-										$table_row[] = give_currency_filter( $data );
429
+										$table_row[] = give_currency_filter($data);
430 430
 										break;
431 431
 
432 432
 									default:
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
 
438 438
 						case 'info':
439 439
 						default:
440
-							foreach ( $donor as $heading => $data ) {
440
+							foreach ($donor as $heading => $data) {
441 441
 
442 442
 								// Get first row.
443
-								if ( ! $is_table_first_row_set ) {
443
+								if ( ! $is_table_first_row_set) {
444 444
 									$table_first_row[] = $heading;
445 445
 								}
446 446
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 				}
451 451
 
452 452
 				// Add first row data to table data.
453
-				if ( ! $is_table_first_row_set ) {
453
+				if ( ! $is_table_first_row_set) {
454 454
 					$table_data[] = $table_first_row;
455 455
 					$is_table_first_row_set = true;
456 456
 				}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 				self::$counter++;
463 463
 			}
464 464
 
465
-			$this->display_table( $table_data );
465
+			$this->display_table($table_data);
466 466
 		}
467 467
 	}
468 468
 
@@ -491,13 +491,13 @@  discard block
 block discarded – undo
491 491
 	 *
492 492
 	 * @subcommand	donations
493 493
 	 */
494
-	public function donations( $args, $assoc_args ) {
494
+	public function donations($args, $assoc_args) {
495 495
 	    global $wp_query;
496
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
496
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
497 497
 
498 498
 		// Cache previous number query var.
499 499
 		$is_set_number = $cache_per_page = false;
500
-		if ( isset( $wp_query->query_vars['number'] ) ) {
500
+		if (isset($wp_query->query_vars['number'])) {
501 501
 			$cache_per_page = $wp_query->query_vars['number'];
502 502
 			$is_set_number = true;
503 503
 		}
@@ -509,45 +509,45 @@  discard block
 block discarded – undo
509 509
 		$donations = $this->api->get_recent_donations();
510 510
 
511 511
 		// Reset number query var.
512
-		if ( $is_set_number ) {
512
+		if ($is_set_number) {
513 513
 			$wp_query->query_vars['number'] = $cache_per_page;
514 514
 		}
515 515
 
516
-		if ( empty( $donations ) ) {
517
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
516
+		if (empty($donations)) {
517
+			WP_CLI::error(__('No donations found.', 'give'));
518 518
 			return;
519 519
 		}
520 520
 
521 521
 		self::$counter = 1;
522 522
 
523
-		foreach ( $donations['donations'] as $key => $donation ) {
524
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
523
+		foreach ($donations['donations'] as $key => $donation) {
524
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
525 525
 			self::$counter++;
526 526
 
527
-			foreach ( $donation as $column => $data ) {
527
+			foreach ($donation as $column => $data) {
528 528
 
529
-				if ( is_array( $data ) ) {
530
-					$this->color_sub_heading( $column );
531
-					foreach ( $data as $subcolumn => $subdata ) {
529
+				if (is_array($data)) {
530
+					$this->color_sub_heading($column);
531
+					foreach ($data as $subcolumn => $subdata) {
532 532
 
533 533
 						// Decode html codes.
534
-						switch ( $subcolumn ) {
534
+						switch ($subcolumn) {
535 535
 							case 'name':
536
-								$subdata = html_entity_decode( $subdata );
536
+								$subdata = html_entity_decode($subdata);
537 537
 								break;
538 538
 						}
539 539
 
540 540
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
541
-						if ( is_array( $subdata ) ) {
541
+						if (is_array($subdata)) {
542 542
 							continue;
543 543
 						}
544 544
 
545
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
545
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
546 546
 					}
547 547
 					continue;
548 548
 				}
549 549
 
550
-				WP_CLI::log( $this->color_message( $column, $data ) );
550
+				WP_CLI::log($this->color_message($column, $data));
551 551
 			}
552 552
 		}
553 553
 	}
@@ -586,27 +586,27 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return		void
588 588
 	 */
589
-	public function report( $args, $assoc_args ) {
589
+	public function report($args, $assoc_args) {
590 590
 		$stats      = new Give_Payment_Stats();
591
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args )      ? $assoc_args['date']      : false;
592
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
593
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args )   ? $assoc_args['end-date']   : false;
594
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args )        ? $assoc_args['id']        : 0;
591
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
592
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
593
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
594
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
595 595
 
596
-		if ( ! empty( $date ) ) {
596
+		if ( ! empty($date)) {
597 597
 			$start_date = $date;
598 598
 			$end_date   = false;
599
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
599
+		} elseif (empty($date) && empty($start_date)) {
600 600
 			$start_date = 'this_month';
601 601
 			$end_date   = false;
602 602
 		}
603 603
 
604 604
 		// Get stats.
605
-		$earnings   = $stats->get_earnings( $form_id, $start_date, $end_date );
606
-		$sales      = $stats->get_sales( $form_id, $start_date, $end_date );
605
+		$earnings   = $stats->get_earnings($form_id, $start_date, $end_date);
606
+		$sales      = $stats->get_sales($form_id, $start_date, $end_date);
607 607
 
608
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
609
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
608
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
609
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
610 610
 	}
611 611
 
612 612
 
@@ -633,26 +633,26 @@  discard block
 block discarded – undo
633 633
 	 *
634 634
 	 * @subcommand cache
635 635
 	 */
636
-	public function cache( $args, $assoc_args ) {
637
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
636
+	public function cache($args, $assoc_args) {
637
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
638 638
 
639 639
 		// Bailout.
640
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
641
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
640
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
641
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
642 642
 			return;
643 643
 		}
644 644
 
645
-		switch ( $action ) {
645
+		switch ($action) {
646 646
 			case 'delete' :
647 647
 				// Reset counter.
648 648
 				self::$counter = 1;
649 649
 
650
-				if ( $this->delete_stats_transients() ) {
650
+				if ($this->delete_stats_transients()) {
651 651
 					// Report .eading.
652
-					WP_CLI::success( 'All form stat transient cache deleted.' );
652
+					WP_CLI::success('All form stat transient cache deleted.');
653 653
 				} else {
654 654
 					// Report .eading.
655
-					WP_CLI::warning( 'We did not find any transient to delete :)' );
655
+					WP_CLI::warning('We did not find any transient to delete :)');
656 656
 				}
657 657
 				break;
658 658
 		}
@@ -678,23 +678,23 @@  discard block
 block discarded – undo
678 678
 			ARRAY_A
679 679
 		);
680 680
 
681
-		if ( ! empty( $stat_option_names ) ) {
681
+		if ( ! empty($stat_option_names)) {
682 682
 
683 683
 			// Convert transient option name to transient name.
684 684
 			$stat_option_names = array_map(
685
-				function( $option ) {
686
-					return str_replace( '_transient_', '', $option['option_name'] );
685
+				function($option) {
686
+					return str_replace('_transient_', '', $option['option_name']);
687 687
 				},
688 688
 				$stat_option_names
689 689
 			);
690 690
 
691
-			foreach ( $stat_option_names as $option_name ) {
692
-				if ( delete_transient( $option_name ) ) {
691
+			foreach ($stat_option_names as $option_name) {
692
+				if (delete_transient($option_name)) {
693 693
 
694
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
694
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
695 695
 					self::$counter++;
696 696
 				} else {
697
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
697
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
698 698
 				}
699 699
 			}
700 700
 
@@ -715,12 +715,12 @@  discard block
 block discarded – undo
715 715
 	 *
716 716
 	 * @return	mixed
717 717
 	 */
718
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
718
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
719 719
 	    // Add colon.
720
-	    if ( $colon ) {
721
-	        $heading = $heading . ': ';
720
+	    if ($colon) {
721
+	        $heading = $heading.': ';
722 722
 		}
723
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
723
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
724 724
 	}
725 725
 
726 726
 
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
 	 *
736 736
 	 * @return	void
737 737
 	 */
738
-	private function color_main_heading( $heading, $color = 'g' ) {
739
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
738
+	private function color_main_heading($heading, $color = 'g') {
739
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
740 740
 	}
741 741
 
742 742
 	/**
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 	 *
750 750
 	 * @return	void
751 751
 	 */
752
-	private function color_sub_heading( $subheading ) {
753
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
752
+	private function color_sub_heading($subheading) {
753
+		WP_CLI::log("\n--->".$subheading.'', '', false);
754 754
 	}
755 755
 
756 756
 
@@ -764,17 +764,17 @@  discard block
 block discarded – undo
764 764
 	 *
765 765
 	 * @return	void
766 766
 	 */
767
-	private function display_table( $data ) {
767
+	private function display_table($data) {
768 768
 		$table = new \cli\Table();
769 769
 
770 770
 		// Set table header.
771
-		$table->setHeaders( $data[0] );
771
+		$table->setHeaders($data[0]);
772 772
 
773 773
 		// Remove table header.
774
-		unset( $data[0] );
774
+		unset($data[0]);
775 775
 
776 776
 		// Set table data.
777
-		$table->setRows( $data );
777
+		$table->setRows($data);
778 778
 
779 779
 		// Display table.
780 780
 		$table->display();
Please login to merge, or discard this patch.
give.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,9 +358,9 @@
 block discarded – undo
358 358
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359 359
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360 360
 
361
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
362
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
-            }
361
+			if( defined( 'WP_CLI' ) && WP_CLI ) {
362
+				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
+			}
364 364
 
365 365
 			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
366 366
 
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.7' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.7');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,116 +300,116 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
304 304
 			$give_options = give_get_settings();
305 305
 
306
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
311
-
312
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
326
-
327
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
329
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
330
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
342
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
343
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
344
-
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
348
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
349
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
350
-
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
354
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
355
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
356
-
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
360
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
361
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
362
-
363
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
364
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
311
+
312
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
326
+
327
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
329
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
330
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
342
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
343
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
344
+
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
348
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
349
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
350
+
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
354
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
355
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
356
+
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
360
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
361
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
362
+
363
+            if (defined('WP_CLI') && WP_CLI) {
364
+                require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
365 365
             }
366 366
 
367
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
368
-
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
379
-
380
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
382
-
383
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
388
-
389
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
396
-
397
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
404
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
405
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
406
-
407
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
408
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
367
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
368
+
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
379
+
380
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
382
+
383
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
388
+
389
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
396
+
397
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
404
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
405
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
406
+
407
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
408
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
409 409
 
410 410
 			}
411 411
 
412
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
412
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
413 413
 
414 414
 		}
415 415
 
@@ -423,26 +423,26 @@  discard block
 block discarded – undo
423 423
 		 */
424 424
 		public function load_textdomain() {
425 425
 			// Set filter for Give's languages directory
426
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
427
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
426
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
427
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
428 428
 
429 429
 			// Traditional WordPress plugin locale filter
430
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
431
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
430
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
431
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
432 432
 
433 433
 			// Setup paths to current locale file
434
-			$mofile_local  = $give_lang_dir . $mofile;
435
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
434
+			$mofile_local  = $give_lang_dir.$mofile;
435
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
436 436
 
437
-			if ( file_exists( $mofile_global ) ) {
437
+			if (file_exists($mofile_global)) {
438 438
 				// Look in global /wp-content/languages/give folder
439
-				load_textdomain( 'give', $mofile_global );
440
-			} elseif ( file_exists( $mofile_local ) ) {
439
+				load_textdomain('give', $mofile_global);
440
+			} elseif (file_exists($mofile_local)) {
441 441
 				// Look in local location from filter `give_languages_directory`
442
-				load_textdomain( 'give', $mofile_local );
442
+				load_textdomain('give', $mofile_local);
443 443
 			} else {
444 444
 				// Load the default language files packaged up w/ Give
445
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
445
+				load_plugin_textdomain('give', false, $give_lang_dir);
446 446
 			}
447 447
 		}
448 448
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-api-requests-logs-list-table.php 1 patch
Spacing   +64 added lines, -64 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
 	/**
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
67
-		$input_id = $input_id . '-search-input';
66
+	public function search_box($text, $input_id) {
67
+		$input_id = $input_id.'-search-input';
68 68
 
69
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
70
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
69
+		if ( ! empty($_REQUEST['orderby'])) {
70
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
71 71
 		}
72
-		if ( ! empty( $_REQUEST['order'] ) ) {
73
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
72
+		if ( ! empty($_REQUEST['order'])) {
73
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
74 74
 		}
75 75
 		?>
76 76
 		<p class="search-box">
77 77
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
78 78
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
79
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
79
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
80 80
 		</p>
81 81
 	<?php
82 82
 	}
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function get_columns() {
92 92
 		$columns = array(
93
-			'ID'      => esc_html__( 'Log ID', 'give' ),
94
-			'details' => esc_html__( 'Request Details', 'give' ),
95
-			'ip'      => esc_html__( 'Request IP', 'give' ),
96
-			'date'    => esc_html__( 'Date', 'give' )
93
+			'ID'      => esc_html__('Log ID', 'give'),
94
+			'details' => esc_html__('Request Details', 'give'),
95
+			'ip'      => esc_html__('Request IP', 'give'),
96
+			'date'    => esc_html__('Date', 'give')
97 97
 		);
98 98
 
99 99
 		return $columns;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string Column Name
112 112
 	 */
113
-	public function column_default( $item, $column_name ) {
114
-		switch ( $column_name ) {
113
+	public function column_default($item, $column_name) {
114
+		switch ($column_name) {
115 115
 			default:
116
-				return $item[ $column_name ];
116
+				return $item[$column_name];
117 117
 		}
118 118
 	}
119 119
 
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return void
129 129
 	 */
130
-	public function column_details( $item ) {
130
+	public function column_details($item) {
131 131
 		?>
132
-		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a>
132
+		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a>
133 133
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
134 134
 			<?php
135 135
 
136
-			$request = get_post_field( 'post_excerpt', $item['ID'] );
137
-			$error   = get_post_field( 'post_content', $item['ID'] );
138
-			echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>';
139
-			echo '<div>' . $request . '</div>';
140
-			if ( ! empty( $error ) ) {
141
-				echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>';
142
-				echo '<div>' . esc_html( $error ) . '</div>';
136
+			$request = get_post_field('post_excerpt', $item['ID']);
137
+			$error   = get_post_field('post_content', $item['ID']);
138
+			echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>';
139
+			echo '<div>'.$request.'</div>';
140
+			if ( ! empty($error)) {
141
+				echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>';
142
+				echo '<div>'.esc_html($error).'</div>';
143 143
 			}
144
-			echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>';
145
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>';
146
-			echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>';
147
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>';
148
-			echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>';
149
-			echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>';
144
+			echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>';
145
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>';
146
+			echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>';
147
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>';
148
+			echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>';
149
+			echo '<div>'.get_post_field('post_date', $item['ID']).'</div>';
150 150
 			?>
151 151
 		</div>
152 152
 	<?php
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed String if search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
163
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
164 164
 	}
165 165
 
166 166
 
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $which
178 178
 	 */
179
-	protected function display_tablenav( $which ) {
180
-		if ( 'top' === $which ) {
181
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
179
+	protected function display_tablenav($which) {
180
+		if ('top' === $which) {
181
+			wp_nonce_field('bulk-'.$this->_args['plural']);
182 182
 		}
183 183
 		?>
184
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
184
+		<div class="tablenav <?php echo esc_attr($which); ?>">
185 185
 
186 186
 			<div class="alignleft actions bulkactions">
187
-				<?php $this->bulk_actions( $which ); ?>
187
+				<?php $this->bulk_actions($which); ?>
188 188
 			</div>
189 189
 			<?php
190
-			$this->extra_tablenav( $which );
191
-			$this->pagination( $which );
190
+			$this->extra_tablenav($which);
191
+			$this->pagination($which);
192 192
 			?>
193 193
 
194 194
 			<br class="clear"/>
@@ -210,31 +210,31 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$search = $this->get_search();
212 212
 
213
-		if ( $search ) {
214
-			if ( filter_var( $search, FILTER_VALIDATE_IP ) ) {
213
+		if ($search) {
214
+			if (filter_var($search, FILTER_VALIDATE_IP)) {
215 215
 				// This is an IP address search
216 216
 				$key = '_give_log_request_ip';
217
-			} else if ( is_email( $search ) ) {
217
+			} else if (is_email($search)) {
218 218
 				// This is an email search
219
-				$userdata = get_user_by( 'email', $search );
219
+				$userdata = get_user_by('email', $search);
220 220
 
221
-				if ( $userdata ) {
221
+				if ($userdata) {
222 222
 					$search = $userdata->ID;
223 223
 				}
224 224
 
225 225
 				$key = '_give_log_user';
226
-			} elseif ( strlen( $search ) == 32 ) {
226
+			} elseif (strlen($search) == 32) {
227 227
 				// Look for an API key
228 228
 				$key = '_give_log_key';
229
-			} elseif ( stristr( $search, 'token:' ) ) {
229
+			} elseif (stristr($search, 'token:')) {
230 230
 				// Look for an API token
231
-				$search = str_ireplace( 'token:', '', $search );
231
+				$search = str_ireplace('token:', '', $search);
232 232
 				$key    = '_give_log_token';
233 233
 			} else {
234 234
 				// This is (probably) a user ID search
235
-				$userdata = get_userdata( $search );
235
+				$userdata = get_userdata($search);
236 236
 
237
-				if ( $userdata ) {
237
+				if ($userdata) {
238 238
 					$search = $userdata->ID;
239 239
 				}
240 240
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @return int Current page number
261 261
 	 */
262 262
 	public function get_paged() {
263
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
263
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
264 264
 	}
265 265
 
266 266
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @since  1.0
271 271
 	 * @return void
272 272
 	 */
273
-	function bulk_actions( $which = '' ) {
273
+	function bulk_actions($which = '') {
274 274
 		give_log_views();
275 275
 	}
276 276
 
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 			'meta_query' => $this->get_meta_query()
294 294
 		);
295 295
 
296
-		$logs = $give_logs->get_connected_logs( $log_query );
296
+		$logs = $give_logs->get_connected_logs($log_query);
297 297
 
298
-		if ( $logs ) {
299
-			foreach ( $logs as $log ) {
298
+		if ($logs) {
299
+			foreach ($logs as $log) {
300 300
 
301 301
 				$logs_data[] = array(
302 302
 					'ID'   => $log->ID,
303
-					'ip'   => get_post_meta( $log->ID, '_give_log_request_ip', true ),
303
+					'ip'   => get_post_meta($log->ID, '_give_log_request_ip', true),
304 304
 					'date' => $log->post_date
305 305
 				);
306 306
 			}
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 		$columns               = $this->get_columns();
329 329
 		$hidden                = array(); // No hidden columns
330 330
 		$sortable              = $this->get_sortable_columns();
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 		$this->items           = $this->get_logs();
333
-		$total_items           = $give_logs->get_log_count( 0, 'api_requests' );
333
+		$total_items           = $give_logs->get_log_count(0, 'api_requests');
334 334
 
335
-		$this->set_pagination_args( array(
335
+		$this->set_pagination_args(array(
336 336
 				'total_items' => $total_items,
337 337
 				'per_page'    => $this->per_page,
338
-				'total_pages' => ceil( $total_items / $this->per_page )
338
+				'total_pages' => ceil($total_items / $this->per_page)
339 339
 			)
340 340
 		);
341 341
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
171
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +18 added lines, -18 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,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a purchase receipt while editing a payment
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 );
36
+add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1);
37 37
 
38 38
 /**
39 39
  * Resend the Email Purchase Receipt. (This can be done from the Payment History page)
@@ -44,29 +44,29 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return void
46 46
  */
47
-function give_resend_donation_receipt( $data ) {
47
+function give_resend_donation_receipt($data) {
48 48
 
49
-	$purchase_id = absint( $data['purchase_id'] );
49
+	$purchase_id = absint($data['purchase_id']);
50 50
 
51
-	if ( empty( $purchase_id ) ) {
51
+	if (empty($purchase_id)) {
52 52
 		return;
53 53
 	}
54 54
 
55
-	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) {
56
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
55
+	if ( ! current_user_can('edit_give_payments', $purchase_id)) {
56
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
57 57
 	}
58 58
 
59
-	give_email_donation_receipt( $purchase_id, false );
59
+	give_email_donation_receipt($purchase_id, false);
60 60
 
61
-	wp_redirect( add_query_arg( array(
61
+	wp_redirect(add_query_arg(array(
62 62
 		'give-message' => 'email_sent',
63 63
 		'give-action'  => false,
64 64
 		'purchase_id'  => false
65
-	) ) );
65
+	)));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_email_links', 'give_resend_donation_receipt' );
69
+add_action('give_email_links', 'give_resend_donation_receipt');
70 70
 
71 71
 /**
72 72
  * Trigger the sending of a Test Email
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
  *
78 78
  * @return void
79 79
  */
80
-function give_send_test_email( $data ) {
81
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) {
80
+function give_send_test_email($data) {
81
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) {
82 82
 		return;
83 83
 	}
84 84
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	give_email_test_donation_receipt();
87 87
 
88 88
 	// Remove the test email query arg
89
-	wp_redirect( remove_query_arg( 'give_action' ) );
89
+	wp_redirect(remove_query_arg('give_action'));
90 90
 	exit;
91 91
 }
92 92
 
93
-add_action( 'give_send_test_email', 'give_send_test_email' );
93
+add_action('give_send_test_email', 'give_send_test_email');
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/class-give-email-access.php 1 patch
Spacing   +62 added lines, -62 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,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	public function __construct() {
99 99
 
100 100
 		// get it started
101
-		add_action( 'init', array( $this, 'init' ) );
101
+		add_action('init', array($this, 'init'));
102 102
 	}
103 103
 
104 104
 	/**
@@ -113,30 +113,30 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function init() {
115 115
 
116
-		$is_enabled = give_get_option( 'email_access' );
116
+		$is_enabled = give_get_option('email_access');
117 117
 
118 118
 		//Non-logged in users only
119
-		if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) {
119
+		if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		//Are db columns setup?
124
-		$is_setup = give_get_option( 'email_access_installed' );
125
-		if ( empty( $is_setup ) ) {
124
+		$is_setup = give_get_option('email_access_installed');
125
+		if (empty($is_setup)) {
126 126
 			$this->create_columns();
127 127
 		}
128 128
 
129 129
 		// Timeouts
130
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
131
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
130
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
131
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
132 132
 
133 133
 		// Setup login
134 134
 		$this->check_for_token();
135 135
 
136
-		if ( $this->token_exists ) {
137
-			add_filter( 'give_can_view_receipt', '__return_true' );
138
-			add_filter( 'give_user_pending_verification', '__return_false' );
139
-			add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) );
136
+		if ($this->token_exists) {
137
+			add_filter('give_can_view_receipt', '__return_true');
138
+			add_filter('give_user_pending_verification', '__return_false');
139
+			add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args'));
140 140
 		}
141 141
 	}
142 142
 
@@ -150,25 +150,25 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return bool
152 152
 	 */
153
-	public function can_send_email( $customer_id ) {
153
+	public function can_send_email($customer_id) {
154 154
 		/* @var WPDB $wpdb */
155 155
 		global $wpdb;
156 156
 
157 157
 		// Prevent multiple emails within X minutes
158
-		$throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle );
158
+		$throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle);
159 159
 
160 160
 		// Does a user row exist?
161 161
 		$exists = (int) $wpdb->get_var(
162
-			$wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id )
162
+			$wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id)
163 163
 		);
164 164
 
165
-		if ( 0 < $exists ) {
165
+		if (0 < $exists) {
166 166
 			$row_id = (int) $wpdb->get_var(
167
-				$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle )
167
+				$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle)
168 168
 			);
169 169
 
170
-			if ( $row_id < 1 ) {
171
-				give_set_error( 'give_email_access_attempts_exhausted', esc_html__( 'Please wait a few minutes before requesting a new email access link.', 'give' ) );
170
+			if ($row_id < 1) {
171
+				give_set_error('give_email_access_attempts_exhausted', esc_html__('Please wait a few minutes before requesting a new email access link.', 'give'));
172 172
 
173 173
 				return false;
174 174
 			}
@@ -188,34 +188,34 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return void
190 190
 	 */
191
-	public function send_email( $customer_id, $email ) {
191
+	public function send_email($customer_id, $email) {
192 192
 
193
-		$verify_key = wp_generate_password( 20, false );
193
+		$verify_key = wp_generate_password(20, false);
194 194
 
195 195
 		// Generate a new verify key
196
-		$this->set_verify_key( $customer_id, $email, $verify_key );
196
+		$this->set_verify_key($customer_id, $email, $verify_key);
197 197
 
198 198
 		// Get the purchase history URL
199
-		$page_id = give_get_option( 'history_page' );
199
+		$page_id = give_get_option('history_page');
200 200
 
201
-		$access_url = add_query_arg( array(
201
+		$access_url = add_query_arg(array(
202 202
 			'give_nl' => $verify_key,
203
-		), get_permalink( $page_id ) );
203
+		), get_permalink($page_id));
204 204
 
205 205
 		//Nice subject and message
206
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );
206
+		$subject = apply_filters('give_email_access_token_subject', sprintf(esc_html__('Your Access Link to %s', 'give'), get_bloginfo('name')));
207 207
 
208
-		$message  = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
209
-		$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details &raquo;', 'give' ) . '</a>' . "\n\n";
208
+		$message  = esc_html__('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n";
209
+		$message .= '<a href="'.esc_url($access_url).'" target="_blank">'.esc_html__('Access My Donation Details &raquo;', 'give').'</a>'."\n\n";
210 210
 		$message .= "\n\n";
211
-		$message .= esc_html__( 'Sincerely,', 'give' ) . "\n";
212
-		$message .= get_bloginfo( 'name' ) . "\n";
211
+		$message .= esc_html__('Sincerely,', 'give')."\n";
212
+		$message .= get_bloginfo('name')."\n";
213 213
 
214
-		$message = apply_filters( 'give_email_access_token_message', $message );
214
+		$message = apply_filters('give_email_access_token_message', $message);
215 215
 
216 216
 		// Send the email
217
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', esc_html__( 'Your Access Link', 'give' ) ) );
218
-		Give()->emails->send( $email, $subject, $message );
217
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', esc_html__('Your Access Link', 'give')));
218
+		Give()->emails->send($email, $subject, $message);
219 219
 
220 220
 	}
221 221
 
@@ -229,24 +229,24 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function check_for_token() {
231 231
 
232
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
232
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
233 233
 
234 234
 		// Check for cookie
235
-		if ( empty( $token ) ) {
236
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
235
+		if (empty($token)) {
236
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
237 237
 		}
238 238
 
239
-		if ( ! empty( $token ) ) {
240
-			if ( ! $this->is_valid_token( $token ) ) {
241
-				if ( ! $this->is_valid_verify_key( $token ) ) {
239
+		if ( ! empty($token)) {
240
+			if ( ! $this->is_valid_token($token)) {
241
+				if ( ! $this->is_valid_verify_key($token)) {
242 242
 					return;
243 243
 				}
244 244
 			}
245 245
 
246 246
 			$this->token_exists = true;
247 247
 			// Set cookie
248
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
249
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
248
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
249
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
250 250
 		}
251 251
 	}
252 252
 
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return bool
262 262
 	 */
263
-	public function is_valid_token( $token ) {
263
+	public function is_valid_token($token) {
264 264
 
265 265
 		global $wpdb;
266 266
 
267 267
 		// Make sure token isn't expired
268
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
268
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
269 269
 
270 270
 		$email = $wpdb->get_var(
271
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
271
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
272 272
 		);
273 273
 
274
-		if ( ! empty( $email ) ) {
274
+		if ( ! empty($email)) {
275 275
 			$this->token_email = $email;
276 276
 			$this->token       = $token;
277 277
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 		}
280 280
 
281 281
 		//Set error only if email access form isn't being submitted
282
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
283
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give' ) );
282
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
283
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give'));
284 284
 		}
285 285
 
286 286
 
@@ -300,25 +300,25 @@  discard block
 block discarded – undo
300 300
 	 *
301 301
 	 * @return void
302 302
 	 */
303
-	public function set_verify_key( $customer_id, $email, $verify_key ) {
303
+	public function set_verify_key($customer_id, $email, $verify_key) {
304 304
 		global $wpdb;
305 305
 
306
-		$now = date( 'Y-m-d H:i:s' );
306
+		$now = date('Y-m-d H:i:s');
307 307
 
308 308
 		// Insert or update?
309 309
 		$row_id = (int) $wpdb->get_var(
310
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
310
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
311 311
 		);
312 312
 
313 313
 		// Update
314
-		if ( ! empty( $row_id ) ) {
314
+		if ( ! empty($row_id)) {
315 315
 			$wpdb->query(
316
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
316
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
317 317
 			);
318 318
 		} // Insert
319 319
 		else {
320 320
 			$wpdb->query(
321
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
321
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
322 322
 			);
323 323
 		}
324 324
 	}
@@ -333,21 +333,21 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return bool
335 335
 	 */
336
-	public function is_valid_verify_key( $token ) {
336
+	public function is_valid_verify_key($token) {
337 337
         /* @var WPDB $wpdb */
338 338
 		global $wpdb;
339 339
 
340 340
 		// See if the verify_key exists
341 341
 		$row = $wpdb->get_row(
342
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
342
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
343 343
 		);
344 344
 
345
-		$now = date( 'Y-m-d H:i:s' );
345
+		$now = date('Y-m-d H:i:s');
346 346
 
347 347
 		// Set token
348
-		if ( ! empty( $row ) ) {
348
+		if ( ! empty($row)) {
349 349
 			$wpdb->query(
350
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
350
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
351 351
 			);
352 352
 
353 353
 			$this->token_email = $row->email;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return mixed
373 373
 	 */
374
-	public function users_purchases_args( $args ) {
374
+	public function users_purchases_args($args) {
375 375
 		$args['user'] = $this->token_email;
376 376
 
377 377
 		return $args;
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 		global $wpdb;
393 393
 
394 394
 		//Create columns in customers table
395
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
395
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
396 396
 
397 397
 		//Columns added properly
398
-		if ( $query ) {
399
-			give_update_option( 'email_access_installed', 1 );
398
+		if ($query) {
399
+			give_update_option('email_access_installed', 1);
400 400
 		}
401 401
 
402 402
 	}
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.