Test Failed
Pull Request — master (#2823)
by Devin
05:06
created
includes/class-give-donate-form.php 1 patch
Spacing   +121 added lines, -121 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
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  int|bool $_id   Post id. Default is false.
338 338
 	 * @param  array    $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => __( 'New Donation Form', 'give' ),
431
+			'post_title'  => __('New Donation Form', 'give'),
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495 495
 			$this->price = give_maybe_sanitize_amount(
496 496
 				give_get_meta(
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 				)
501 501
 			);
502 502
 
503
-			if ( ! $this->price ) {
503
+			if ( ! $this->price) {
504 504
 				$this->price = 0;
505 505
 			}
506 506
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,17 +527,17 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true);
533 533
 
534
-			if ( ! $this->is_custom_price_mode() ) {
534
+			if ( ! $this->is_custom_price_mode()) {
535 535
 				$this->minimum_price = 0;
536 536
 			}
537 537
 
538 538
 		}
539 539
 
540
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
540
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
541 541
 	}
542 542
 
543 543
 	/**
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public function get_prices() {
552 552
 
553
-		if ( ! isset( $this->prices ) ) {
553
+		if ( ! isset($this->prices)) {
554 554
 
555
-			$this->prices = give_get_meta( $this->ID, '_give_donation_levels', true );
555
+			$this->prices = give_get_meta($this->ID, '_give_donation_levels', true);
556 556
 
557 557
 		}
558 558
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		 * @param array      $prices The array of mulit-level prices.
565 565
 		 * @param int|string $ID     The ID of the form.
566 566
 		 */
567
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
567
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
568 568
 
569 569
 	}
570 570
 
@@ -578,21 +578,21 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public function get_goal() {
580 580
 
581
-		if ( ! isset( $this->goal ) ) {
581
+		if ( ! isset($this->goal)) {
582 582
 
583
-			if ( 'donation' === give_get_form_goal_format( $this->ID ) ) {
584
-				$this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true );
583
+			if ('donation' === give_get_form_goal_format($this->ID)) {
584
+				$this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true);
585 585
 			} else {
586
-				$this->goal = give_get_meta( $this->ID, '_give_set_goal', true );
586
+				$this->goal = give_get_meta($this->ID, '_give_set_goal', true);
587 587
 			}
588 588
 
589
-			if ( ! $this->goal ) {
589
+			if ( ! $this->goal) {
590 590
 				$this->goal = 0;
591 591
 			}
592 592
 
593 593
 		}
594 594
 
595
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
595
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
596 596
 
597 597
 	}
598 598
 
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public function is_single_price_mode() {
608 608
 
609
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
609
+		$option = give_get_meta($this->ID, '_give_price_option', true);
610 610
 		$ret    = 0;
611 611
 
612
-		if ( empty( $option ) || $option === 'set' ) {
612
+		if (empty($option) || $option === 'set') {
613 613
 			$ret = 1;
614 614
 		}
615 615
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		 * @param bool       $ret Is donation form in single price mode?
622 622
 		 * @param int|string $ID The ID of the donation form.
623 623
 		 */
624
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
624
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
625 625
 
626 626
 	}
627 627
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 */
636 636
 	public function is_custom_price_mode() {
637 637
 
638
-		$option = give_get_meta( $this->ID, '_give_custom_amount', true );
638
+		$option = give_get_meta($this->ID, '_give_custom_amount', true);
639 639
 		$ret    = 0;
640 640
 
641
-		if ( give_is_setting_enabled( $option ) ) {
641
+		if (give_is_setting_enabled($option)) {
642 642
 			$ret = 1;
643 643
 		}
644 644
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 		 * @param bool       $ret Is donation form in custom price mode?
651 651
 		 * @param int|string $ID  The ID of the donation form.
652 652
 		 */
653
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
653
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
654 654
 
655 655
 	}
656 656
 
@@ -664,20 +664,20 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @return bool
666 666
 	 */
667
-	public function is_custom_price( $amount ) {
667
+	public function is_custom_price($amount) {
668 668
 		$result = false;
669
-		$amount = give_maybe_sanitize_amount( $amount );
669
+		$amount = give_maybe_sanitize_amount($amount);
670 670
 
671
-		if ( $this->is_custom_price_mode() ) {
671
+		if ($this->is_custom_price_mode()) {
672 672
 
673
-			if ( 'set' === $this->get_type() ) {
674
-				if ( $amount !== $this->get_price() ) {
673
+			if ('set' === $this->get_type()) {
674
+				if ($amount !== $this->get_price()) {
675 675
 					$result = true;
676 676
 				}
677 677
 
678
-			} elseif ( 'multi' === $this->get_type() ) {
679
-				$level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) );
680
-				$result        = ! in_array( $amount, $level_amounts );
678
+			} elseif ('multi' === $this->get_type()) {
679
+				$level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount'));
680
+				$result        = ! in_array($amount, $level_amounts);
681 681
 			}
682 682
 		}
683 683
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 		 *
691 691
 		 * @since 1.8.18
692 692
 		 */
693
-		return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID );
693
+		return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID);
694 694
 	}
695 695
 
696 696
 	/**
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	public function has_variable_prices() {
707 707
 
708
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
708
+		$option = give_get_meta($this->ID, '_give_price_option', true);
709 709
 		$ret    = 0;
710 710
 
711
-		if ( $option === 'multi' ) {
711
+		if ($option === 'multi') {
712 712
 			$ret = 1;
713 713
 		}
714 714
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		 * @param bool       $ret Does donation form have variable prices?
719 719
 		 * @param int|string $ID  The ID of the donation form.
720 720
 		 */
721
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
721
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
722 722
 
723 723
 	}
724 724
 
@@ -732,17 +732,17 @@  discard block
 block discarded – undo
732 732
 	 */
733 733
 	public function get_type() {
734 734
 
735
-		if ( ! isset( $this->type ) ) {
735
+		if ( ! isset($this->type)) {
736 736
 
737
-			$this->type = give_get_meta( $this->ID, '_give_price_option', true );
737
+			$this->type = give_get_meta($this->ID, '_give_price_option', true);
738 738
 
739
-			if ( empty( $this->type ) ) {
739
+			if (empty($this->type)) {
740 740
 				$this->type = 'set';
741 741
 			}
742 742
 
743 743
 		}
744 744
 
745
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
745
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
746 746
 
747 747
 	}
748 748
 
@@ -758,23 +758,23 @@  discard block
 block discarded – undo
758 758
 	 *
759 759
 	 * @return string
760 760
 	 */
761
-	public function get_form_classes( $args ) {
761
+	public function get_form_classes($args) {
762 762
 
763
-		$float_labels_option = give_is_float_labels_enabled( $args )
763
+		$float_labels_option = give_is_float_labels_enabled($args)
764 764
 			? 'float-labels-enabled'
765 765
 			: '';
766 766
 
767
-		$form_classes_array = apply_filters( 'give_form_classes', array(
767
+		$form_classes_array = apply_filters('give_form_classes', array(
768 768
 			'give-form',
769
-			'give-form-' . $this->ID,
770
-			'give-form-type-' . $this->get_type(),
769
+			'give-form-'.$this->ID,
770
+			'give-form-type-'.$this->get_type(),
771 771
 			$float_labels_option,
772
-		), $this->ID, $args );
772
+		), $this->ID, $args);
773 773
 
774 774
 		// Remove empty class names.
775
-		$form_classes_array = array_filter( $form_classes_array );
775
+		$form_classes_array = array_filter($form_classes_array);
776 776
 
777
-		return implode( ' ', $form_classes_array );
777
+		return implode(' ', $form_classes_array);
778 778
 
779 779
 	}
780 780
 
@@ -789,22 +789,22 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @return string
791 791
 	 */
792
-	public function get_form_wrap_classes( $args ) {
792
+	public function get_form_wrap_classes($args) {
793 793
 		$custom_class = array(
794 794
 			'give-form-wrap',
795 795
 		);
796 796
 
797
-		if ( $this->is_close_donation_form() ) {
797
+		if ($this->is_close_donation_form()) {
798 798
 			$custom_class[] = 'give-form-closed';
799
-		} else{
800
-			$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
799
+		} else {
800
+			$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
801 801
 				? $args['display_style']
802
-				: give_get_meta( $this->ID, '_give_payment_display', true );
802
+				: give_get_meta($this->ID, '_give_payment_display', true);
803 803
 
804 804
 			$custom_class[] = "give-display-{$display_option}";
805 805
 
806 806
 			// If admin want to show only button for form then user inbuilt modal functionality.
807
-			if ( 'button' === $display_option ) {
807
+			if ('button' === $display_option) {
808 808
 				$custom_class[] = 'give-display-button-only';
809 809
 			}
810 810
 		}
@@ -815,10 +815,10 @@  discard block
 block discarded – undo
815 815
 		 *
816 816
 		 * @since 1.0
817 817
 		 */
818
-		$form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args );
818
+		$form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args);
819 819
 
820 820
 
821
-		return implode( ' ', $form_wrap_classes_array );
821
+		return implode(' ', $form_wrap_classes_array);
822 822
 
823 823
 	}
824 824
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	public function is_set_type_donation_form() {
834 834
 		$form_type = $this->get_type();
835 835
 
836
-		return ( 'set' === $form_type ? true : false );
836
+		return ('set' === $form_type ? true : false);
837 837
 	}
838 838
 
839 839
 	/**
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	public function is_multi_type_donation_form() {
848 848
 		$form_type = $this->get_type();
849 849
 
850
-		return ( 'multi' === $form_type ? true : false );
850
+		return ('multi' === $form_type ? true : false);
851 851
 
852 852
 	}
853 853
 
@@ -861,15 +861,15 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	public function get_sales() {
863 863
 
864
-		if ( ! isset( $this->sales ) ) {
864
+		if ( ! isset($this->sales)) {
865 865
 
866
-			if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) {
867
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
866
+			if ('' == give_get_meta($this->ID, '_give_form_sales', true)) {
867
+				add_post_meta($this->ID, '_give_form_sales', 0);
868 868
 			} // End if
869 869
 
870
-			$this->sales = give_get_meta( $this->ID, '_give_form_sales', true );
870
+			$this->sales = give_get_meta($this->ID, '_give_form_sales', true);
871 871
 
872
-			if ( $this->sales < 0 ) {
872
+			if ($this->sales < 0) {
873 873
 				// Never let sales be less than zero.
874 874
 				$this->sales = 0;
875 875
 			}
@@ -890,13 +890,13 @@  discard block
 block discarded – undo
890 890
 	 *
891 891
 	 * @return int|false     New number of total sales.
892 892
 	 */
893
-	public function increase_sales( $quantity = 1 ) {
893
+	public function increase_sales($quantity = 1) {
894 894
 
895
-		$sales       = give_get_form_sales_stats( $this->ID );
896
-		$quantity    = absint( $quantity );
895
+		$sales       = give_get_form_sales_stats($this->ID);
896
+		$quantity    = absint($quantity);
897 897
 		$total_sales = $sales + $quantity;
898 898
 
899
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
899
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
900 900
 
901 901
 			$this->sales = $total_sales;
902 902
 
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 	 *
918 918
 	 * @return int|false     New number of total sales.
919 919
 	 */
920
-	public function decrease_sales( $quantity = 1 ) {
920
+	public function decrease_sales($quantity = 1) {
921 921
 
922
-		$sales = give_get_form_sales_stats( $this->ID );
922
+		$sales = give_get_form_sales_stats($this->ID);
923 923
 
924 924
 		// Only decrease if not already zero
925
-		if ( $sales > 0 ) {
925
+		if ($sales > 0) {
926 926
 
927
-			$quantity    = absint( $quantity );
927
+			$quantity    = absint($quantity);
928 928
 			$total_sales = $sales - $quantity;
929 929
 
930
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
930
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
931 931
 
932 932
 				$this->sales = $sales;
933 933
 
@@ -951,15 +951,15 @@  discard block
 block discarded – undo
951 951
 	 */
952 952
 	public function get_earnings() {
953 953
 
954
-		if ( ! isset( $this->earnings ) ) {
954
+		if ( ! isset($this->earnings)) {
955 955
 
956
-			if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) {
957
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
956
+			if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) {
957
+				add_post_meta($this->ID, '_give_form_earnings', 0);
958 958
 			}
959 959
 
960
-			$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true );
960
+			$this->earnings = give_get_meta($this->ID, '_give_form_earnings', true);
961 961
 
962
-			if ( $this->earnings < 0 ) {
962
+			if ($this->earnings < 0) {
963 963
 				// Never let earnings be less than zero
964 964
 				$this->earnings = 0;
965 965
 			}
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
 	 *
981 981
 	 * @return float|false
982 982
 	 */
983
-	public function increase_earnings( $amount = 0 ) {
983
+	public function increase_earnings($amount = 0) {
984 984
 
985
-		$earnings   = give_get_form_earnings_stats( $this->ID );
985
+		$earnings   = give_get_form_earnings_stats($this->ID);
986 986
 		$new_amount = $earnings + (float) $amount;
987 987
 
988
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
988
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
989 989
 
990 990
 			$this->earnings = $new_amount;
991 991
 
@@ -1007,16 +1007,16 @@  discard block
 block discarded – undo
1007 1007
 	 *
1008 1008
 	 * @return float|false
1009 1009
 	 */
1010
-	public function decrease_earnings( $amount ) {
1010
+	public function decrease_earnings($amount) {
1011 1011
 
1012
-		$earnings = give_get_form_earnings_stats( $this->ID );
1012
+		$earnings = give_get_form_earnings_stats($this->ID);
1013 1013
 
1014
-		if ( $earnings > 0 ) {
1014
+		if ($earnings > 0) {
1015 1015
 			// Only decrease if greater than zero
1016 1016
 			$new_amount = $earnings - (float) $amount;
1017 1017
 
1018 1018
 
1019
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1019
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
1020 1020
 
1021 1021
 				$this->earnings = $new_amount;
1022 1022
 
@@ -1040,22 +1040,22 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool
1042 1042
 	 */
1043
-	public function is_free( $price_id = false ) {
1043
+	public function is_free($price_id = false) {
1044 1044
 
1045 1045
 		$is_free          = false;
1046
-		$variable_pricing = give_has_variable_prices( $this->ID );
1046
+		$variable_pricing = give_has_variable_prices($this->ID);
1047 1047
 
1048
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1049
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1050
-		} elseif ( ! $variable_pricing ) {
1051
-			$price = give_get_meta( $this->ID, '_give_set_price', true );
1048
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1049
+			$price = give_get_price_option_amount($this->ID, $price_id);
1050
+		} elseif ( ! $variable_pricing) {
1051
+			$price = give_get_meta($this->ID, '_give_set_price', true);
1052 1052
 		}
1053 1053
 
1054
-		if ( isset( $price ) && (float) $price == 0 ) {
1054
+		if (isset($price) && (float) $price == 0) {
1055 1055
 			$is_free = true;
1056 1056
 		}
1057 1057
 
1058
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1058
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1059 1059
 
1060 1060
 	}
1061 1061
 
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 */
1075 1075
 	public function is_close_donation_form() {
1076 1076
 
1077
-		$goal_format = give_get_form_goal_format( $this->ID );
1077
+		$goal_format = give_get_form_goal_format($this->ID);
1078 1078
 
1079 1079
 		/**
1080 1080
 		 * Filter the close form result.
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
 		$is_close_form = apply_filters(
1085 1085
 			'give_is_close_donation_form',
1086 1086
 			(
1087
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) &&
1088
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) &&
1089
-				( 'donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings() )
1087
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) &&
1088
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) &&
1089
+				('donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings())
1090 1090
 			),
1091 1091
 			$this->ID
1092 1092
 		);
@@ -1105,17 +1105,17 @@  discard block
 block discarded – undo
1105 1105
 	 *
1106 1106
 	 * @return bool                            The result of the update query.
1107 1107
 	 */
1108
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1108
+	private function update_meta($meta_key = '', $meta_value = '') {
1109 1109
 
1110 1110
 		/* @var WPDB $wpdb */
1111 1111
 		global $wpdb;
1112 1112
 
1113 1113
 		// Bailout.
1114
-		if ( empty( $meta_key ) ) {
1114
+		if (empty($meta_key)) {
1115 1115
 			return false;
1116 1116
 		}
1117 1117
 
1118
-		if ( give_update_meta( $this->ID, $meta_key, $meta_value  ) ) {
1118
+		if (give_update_meta($this->ID, $meta_key, $meta_value)) {
1119 1119
 			return true;
1120 1120
 		}
1121 1121
 
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.0
567 567
  *
568
- * @return int $earnings Earnings
568
+ * @return double $earnings Earnings
569 569
  */
570 570
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @since 1.0
866 866
  *
867
- * @return array $user_info User Info Meta Values.
867
+ * @return string $user_info User Info Meta Values.
868 868
  */
869 869
 function give_get_payment_meta_user_info( $payment_id ) {
870 870
 	$payment = new Give_Payment( $payment_id );
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @since 1.0
883 883
  *
884
- * @return int $form_id Form ID.
884
+ * @return string $form_id Form ID.
885 885
  */
886 886
 function give_get_payment_form_id( $payment_id ) {
887 887
 	$payment = new Give_Payment( $payment_id );
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
  *
1730 1730
  * Retrieves the form title and appends the level name if present.
1731 1731
  *
1732
- * @param int|Give_Payment $donation Donation Data Object.
1732
+ * @param Give_Payment $donation Donation Data Object.
1733 1733
  * @param array            $args     a. only_level = If set to true will only return the level name if multi-level enabled.
1734 1734
  *                                   b. separator  = The separator between the Form Title and the Donation Level.
1735 1735
  *
Please login to merge, or discard this patch.
Spacing   +381 added lines, -383 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,48 +67,48 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
86 86
 			break;
87 87
 
88 88
 		case 'key':
89
-			$payment = give_get_payments( array(
89
+			$payment = give_get_payments(array(
90 90
 				'meta_key'       => '_give_payment_purchase_key',
91 91
 				'meta_value'     => $value,
92 92
 				'posts_per_page' => 1,
93 93
 				'fields'         => 'ids',
94
-			) );
94
+			));
95 95
 
96
-			if ( $payment ) {
97
-				$payment = new Give_Payment( $payment[0] );
96
+			if ($payment) {
97
+				$payment = new Give_Payment($payment[0]);
98 98
 			}
99 99
 
100 100
 			break;
101 101
 
102 102
 		case 'payment_number':
103
-			$payment = give_get_payments( array(
103
+			$payment = give_get_payments(array(
104 104
 				'meta_key'       => '_give_payment_number',
105 105
 				'meta_value'     => $value,
106 106
 				'posts_per_page' => 1,
107 107
 				'fields'         => 'ids',
108
-			) );
108
+			));
109 109
 
110
-			if ( $payment ) {
111
-				$payment = new Give_Payment( $payment[0] );
110
+			if ($payment) {
111
+				$payment = new Give_Payment($payment[0]);
112 112
 			}
113 113
 
114 114
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			return false;
118 118
 	}// End switch().
119 119
 
120
-	if ( $payment ) {
120
+	if ($payment) {
121 121
 		return $payment;
122 122
 	}
123 123
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return int|bool Payment ID if payment is inserted, false otherwise.
135 135
  */
136
-function give_insert_payment( $payment_data = array() ) {
136
+function give_insert_payment($payment_data = array()) {
137 137
 
138
-	if ( empty( $payment_data ) ) {
138
+	if (empty($payment_data)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $payment_data Arguments passed.
148 148
 	 */
149
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
149
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
150 150
 
151 151
 	$payment    = new Give_Payment();
152
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
153
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
154
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
155
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
156
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
152
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
153
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
154
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
155
+	$price_id   = give_get_payment_meta_price_id($payment_data);
156
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
157 157
 
158 158
 	// Set properties.
159 159
 	$payment->total          = $payment_data['price'];
160
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
161
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
160
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
161
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
162 162
 	$payment->user_info      = $payment_data['user_info'];
163 163
 	$payment->gateway        = $gateway;
164 164
 	$payment->form_title     = $form_title;
165 165
 	$payment->form_id        = $form_id;
166 166
 	$payment->price_id       = $price_id;
167
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
167
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
168 168
 	$payment->user_id        = $payment_data['user_info']['id'];
169 169
 	$payment->email          = $payment_data['user_email'];
170 170
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	$payment->email          = $payment_data['user_info']['email'];
173 173
 	$payment->ip             = give_get_ip();
174 174
 	$payment->key            = $payment_data['purchase_key'];
175
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
176
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
175
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
176
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
177 177
 
178 178
 	// Add the donation.
179 179
 	$args = array(
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 		'price_id' => $payment->price_id,
182 182
 	);
183 183
 
184
-	$payment->add_donation( $payment->form_id, $args );
184
+	$payment->add_donation($payment->form_id, $args);
185 185
 
186 186
 
187 187
 	// Set date if present.
188
-	if ( isset( $payment_data['post_date'] ) ) {
188
+	if (isset($payment_data['post_date'])) {
189 189
 		$payment->date = $payment_data['post_date'];
190 190
 	}
191 191
 
192 192
 	// Handle sequential payments.
193
-	if ( give_get_option( 'enable_sequential' ) ) {
193
+	if (give_get_option('enable_sequential')) {
194 194
 		$number          = give_get_next_payment_number();
195
-		$payment->number = give_format_payment_number( $number );
196
-		update_option( 'give_last_payment_number', $number );
195
+		$payment->number = give_format_payment_number($number);
196
+		update_option('give_last_payment_number', $number);
197 197
 	}
198 198
 
199 199
 	// Save payment.
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount   = give_donation_amount( $payment_id );
306
+	$amount   = give_donation_amount($payment_id);
307 307
 	$status   = $payment->post_status;
308
-	$donor_id = give_get_payment_donor_id( $payment_id );
309
-	$donor    = new Give_Donor( $donor_id );
308
+	$donor_id = give_get_payment_donor_id($payment_id);
309
+	$donor    = new Give_Donor($donor_id);
310 310
 
311 311
 	// Only undo donations that aren't these statuses.
312
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
312
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
313 313
 		'pending',
314 314
 		'cancelled',
315
-	) );
315
+	));
316 316
 
317
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
318
-		give_undo_donation( $payment_id );
317
+	if ( ! in_array($status, $dont_undo_statuses)) {
318
+		give_undo_donation($payment_id);
319 319
 	}
320 320
 
321 321
 	// Only undo donations that aren't these statuses.
322
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
322
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
323 323
 
324
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
324
+	if (in_array($status, $status_to_decrease_stats)) {
325 325
 
326 326
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
327
-		give_decrease_total_earnings( $amount );
327
+		give_decrease_total_earnings($amount);
328 328
 
329 329
 		// @todo: Refresh only range related stat cache
330 330
 		give_delete_donation_stats();
331 331
 
332
-		if ( $donor->id && $update_donor ) {
332
+		if ($donor->id && $update_donor) {
333 333
 
334 334
 			// Decrement the stats for the donor.
335 335
 			$donor->decrease_donation_count();
336
-			$donor->decrease_value( $amount );
336
+			$donor->decrease_value($amount);
337 337
 
338 338
 		}
339 339
 	}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @since 1.0
347 347
 	 */
348
-	do_action( 'give_payment_delete', $payment_id );
348
+	do_action('give_payment_delete', $payment_id);
349 349
 
350
-	if ( $donor->id && $update_donor ) {
350
+	if ($donor->id && $update_donor) {
351 351
 		// Remove the payment ID from the donor.
352
-		$donor->remove_payment( $payment_id );
352
+		$donor->remove_payment($payment_id);
353 353
 	}
354 354
 
355 355
 	// Remove the payment.
356
-	wp_delete_post( $payment_id, true );
356
+	wp_delete_post($payment_id, true);
357 357
 
358 358
 	// Remove related sale log entries.
359
-	Give()->logs->delete_logs( $payment_id );
359
+	Give()->logs->delete_logs($payment_id);
360 360
 
361 361
 	/**
362 362
 	 * Fires after payment deleted.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @since 1.0
367 367
 	 */
368
-	do_action( 'give_payment_deleted', $payment_id );
368
+	do_action('give_payment_deleted', $payment_id);
369 369
 }
370 370
 
371 371
 /**
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return void
382 382
  */
383
-function give_undo_donation( $payment_id ) {
383
+function give_undo_donation($payment_id) {
384 384
 
385
-	$payment = new Give_Payment( $payment_id );
385
+	$payment = new Give_Payment($payment_id);
386 386
 
387
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
388
-	if ( true === $maybe_decrease_earnings ) {
387
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
388
+	if (true === $maybe_decrease_earnings) {
389 389
 		// Decrease earnings.
390
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
390
+		give_decrease_form_earnings($payment->form_id, $payment->total);
391 391
 	}
392 392
 
393
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
394
-	if ( true === $maybe_decrease_donations ) {
393
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
394
+	if (true === $maybe_decrease_donations) {
395 395
 		// Decrease donation count.
396
-		give_decrease_donation_count( $payment->form_id );
396
+		give_decrease_donation_count($payment->form_id);
397 397
 	}
398 398
 
399 399
 }
@@ -410,21 +410,21 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return object $stats Contains the number of payments per payment status.
412 412
  */
413
-function give_count_payments( $args = array() ) {
413
+function give_count_payments($args = array()) {
414 414
 	// Backward compatibility.
415
-	if ( ! empty( $args['start-date'] ) ) {
415
+	if ( ! empty($args['start-date'])) {
416 416
 		$args['start_date'] = $args['start-date'];
417
-		unset( $args['start-date'] );
417
+		unset($args['start-date']);
418 418
 	}
419 419
 
420
-	if ( ! empty( $args['end-date'] ) ) {
420
+	if ( ! empty($args['end-date'])) {
421 421
 		$args['end_date'] = $args['end-date'];
422
-		unset( $args['end-date'] );
422
+		unset($args['end-date']);
423 423
 	}
424 424
 
425
-	if ( ! empty( $args['form_id'] ) ) {
425
+	if ( ! empty($args['form_id'])) {
426 426
 		$args['give_forms'] = $args['form_id'];
427
-		unset( $args['form_id'] );
427
+		unset($args['form_id']);
428 428
 	}
429 429
 
430 430
 	// Extract all donations
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$args['group_by']    = 'post_status';
433 433
 	$args['count']       = 'true';
434 434
 
435
-	$donations_obj   = new Give_Payments_Query( $args );
435
+	$donations_obj   = new Give_Payments_Query($args);
436 436
 	$donations_count = $donations_obj->get_payment_by_group();
437 437
 
438 438
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @since 1.0
442 442
 	 */
443
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
443
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
444 444
 }
445 445
 
446 446
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool $exists True if payment exists, false otherwise.
455 455
  */
456
-function give_check_for_existing_payment( $payment_id ) {
456
+function give_check_for_existing_payment($payment_id) {
457 457
 	$exists  = false;
458
-	$payment = new Give_Payment( $payment_id );
458
+	$payment = new Give_Payment($payment_id);
459 459
 
460
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
460
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
461 461
 		$exists = true;
462 462
 	}
463 463
 
@@ -475,41 +475,41 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return bool|mixed True if payment status exists, false otherwise.
477 477
  */
478
-function give_get_payment_status( $payment, $return_label = false ) {
478
+function give_get_payment_status($payment, $return_label = false) {
479 479
 
480
-	if ( is_numeric( $payment ) ) {
480
+	if (is_numeric($payment)) {
481 481
 
482
-		$payment = new Give_Payment( $payment );
482
+		$payment = new Give_Payment($payment);
483 483
 
484
-		if ( ! $payment->ID > 0 ) {
484
+		if ( ! $payment->ID > 0) {
485 485
 			return false;
486 486
 		}
487 487
 
488 488
 	}
489 489
 
490
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
490
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
491 491
 		return false;
492 492
 	}
493 493
 
494 494
 	$statuses = give_get_payment_statuses();
495 495
 
496
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
496
+	if ( ! is_array($statuses) || empty($statuses)) {
497 497
 		return false;
498 498
 	}
499 499
 
500 500
 	// Get payment object if not already given.
501
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
501
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
502 502
 
503
-	if ( array_key_exists( $payment->status, $statuses ) ) {
504
-		if ( true === $return_label ) {
503
+	if (array_key_exists($payment->status, $statuses)) {
504
+		if (true === $return_label) {
505 505
 			// Return translated status label.
506
-			return $statuses[ $payment->status ];
506
+			return $statuses[$payment->status];
507 507
 		} else {
508 508
 			// Account that our 'publish' status is labeled 'Complete'
509 509
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
510 510
 
511 511
 			// Make sure we're matching cases, since they matter
512
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
512
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
513 513
 		}
514 514
 	}
515 515
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function give_get_payment_statuses() {
527 527
 	$payment_statuses = array(
528
-		'pending'     => __( 'Pending', 'give' ),
529
-		'publish'     => __( 'Complete', 'give' ),
530
-		'refunded'    => __( 'Refunded', 'give' ),
531
-		'failed'      => __( 'Failed', 'give' ),
532
-		'cancelled'   => __( 'Cancelled', 'give' ),
533
-		'abandoned'   => __( 'Abandoned', 'give' ),
534
-		'preapproval' => __( 'Pre-Approved', 'give' ),
535
-		'processing'  => __( 'Processing', 'give' ),
536
-		'revoked'     => __( 'Revoked', 'give' ),
528
+		'pending'     => __('Pending', 'give'),
529
+		'publish'     => __('Complete', 'give'),
530
+		'refunded'    => __('Refunded', 'give'),
531
+		'failed'      => __('Failed', 'give'),
532
+		'cancelled'   => __('Cancelled', 'give'),
533
+		'abandoned'   => __('Abandoned', 'give'),
534
+		'preapproval' => __('Pre-Approved', 'give'),
535
+		'processing'  => __('Processing', 'give'),
536
+		'revoked'     => __('Revoked', 'give'),
537 537
 	);
538 538
 
539
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
539
+	return apply_filters('give_payment_statuses', $payment_statuses);
540 540
 }
541 541
 
542 542
 /**
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
  * @return array $payment_status All the available payment statuses.
550 550
  */
551 551
 function give_get_payment_status_keys() {
552
-	$statuses = array_keys( give_get_payment_statuses() );
553
-	asort( $statuses );
552
+	$statuses = array_keys(give_get_payment_statuses());
553
+	asort($statuses);
554 554
 
555
-	return array_values( $statuses );
555
+	return array_values($statuses);
556 556
 }
557 557
 
558 558
 /**
@@ -567,44 +567,44 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return int $earnings Earnings
569 569
  */
570
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
570
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
572 572
 
573 573
 	global $wpdb;
574
-	$meta_table = __give_v20_bc_table_details( 'payment' );
574
+	$meta_table = __give_v20_bc_table_details('payment');
575 575
 
576 576
 	$args = array(
577 577
 		'post_type'              => 'give_payment',
578 578
 		'nopaging'               => true,
579 579
 		'year'                   => $year,
580 580
 		'monthnum'               => $month_num,
581
-		'post_status'            => array( 'publish' ),
581
+		'post_status'            => array('publish'),
582 582
 		'fields'                 => 'ids',
583 583
 		'update_post_term_cache' => false,
584 584
 	);
585
-	if ( ! empty( $day ) ) {
585
+	if ( ! empty($day)) {
586 586
 		$args['day'] = $day;
587 587
 	}
588 588
 
589
-	if ( isset( $hour ) ) {
589
+	if (isset($hour)) {
590 590
 		$args['hour'] = $hour;
591 591
 	}
592 592
 
593
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
594
-	$key  = Give_Cache::get_key( 'give_stats', $args );
593
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
594
+	$key  = Give_Cache::get_key('give_stats', $args);
595 595
 
596
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
596
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
597 597
 		$earnings = false;
598 598
 	} else {
599
-		$earnings = Give_Cache::get( $key );
599
+		$earnings = Give_Cache::get($key);
600 600
 	}
601 601
 
602
-	if ( false === $earnings ) {
603
-		$donations = get_posts( $args );
602
+	if (false === $earnings) {
603
+		$donations = get_posts($args);
604 604
 		$earnings  = 0;
605
-		if ( $donations ) {
606
-			$donations      = implode( ',', $donations );
607
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
605
+		if ($donations) {
606
+			$donations      = implode(',', $donations);
607
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
608 608
 
609 609
 			/**
610 610
 			 * Filter The earnings by dates.
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 			 * @param array $donations      Donations lists.
616 616
 			 * @param array $args           Donation query args.
617 617
 			 */
618
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
618
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
619 619
 		}
620 620
 		// Cache the results for one hour.
621
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
621
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
622 622
 	}
623 623
 
624
-	return round( $earnings, 2 );
624
+	return round($earnings, 2);
625 625
 }
626 626
 
627 627
 /**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return int $count Sales
638 638
  */
639
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
639
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
640 640
 
641 641
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
642 642
 	$args = array(
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		'nopaging'               => true,
645 645
 		'year'                   => $year,
646 646
 		'fields'                 => 'ids',
647
-		'post_status'            => array( 'publish' ),
647
+		'post_status'            => array('publish'),
648 648
 		'update_post_meta_cache' => false,
649 649
 		'update_post_term_cache' => false,
650 650
 	);
651 651
 
652
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
652
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
653 653
 
654
-	if ( false === $show_free ) {
654
+	if (false === $show_free) {
655 655
 		$args['meta_query'] = array(
656 656
 			array(
657 657
 				'key'     => '_give_payment_total',
@@ -662,33 +662,33 @@  discard block
 block discarded – undo
662 662
 		);
663 663
 	}
664 664
 
665
-	if ( ! empty( $month_num ) ) {
665
+	if ( ! empty($month_num)) {
666 666
 		$args['monthnum'] = $month_num;
667 667
 	}
668 668
 
669
-	if ( ! empty( $day ) ) {
669
+	if ( ! empty($day)) {
670 670
 		$args['day'] = $day;
671 671
 	}
672 672
 
673
-	if ( isset( $hour ) ) {
673
+	if (isset($hour)) {
674 674
 		$args['hour'] = $hour;
675 675
 	}
676 676
 
677
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
677
+	$args = apply_filters('give_get_sales_by_date_args', $args);
678 678
 
679
-	$key = Give_Cache::get_key( 'give_stats', $args );
679
+	$key = Give_Cache::get_key('give_stats', $args);
680 680
 
681
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
681
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
682 682
 		$count = false;
683 683
 	} else {
684
-		$count = Give_Cache::get( $key );
684
+		$count = Give_Cache::get($key);
685 685
 	}
686 686
 
687
-	if ( false === $count ) {
688
-		$donations = new WP_Query( $args );
687
+	if (false === $count) {
688
+		$donations = new WP_Query($args);
689 689
 		$count     = (int) $donations->post_count;
690 690
 		// Cache the results for one hour.
691
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
691
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
692 692
 	}
693 693
 
694 694
 	return $count;
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return bool $ret True if complete, false otherwise.
705 705
  */
706
-function give_is_payment_complete( $payment_id ) {
707
-	$payment = new Give_Payment( $payment_id );
706
+function give_is_payment_complete($payment_id) {
707
+	$payment = new Give_Payment($payment_id);
708 708
 
709 709
 	$ret = false;
710 710
 
711
-	if ( $payment->ID > 0 ) {
711
+	if ($payment->ID > 0) {
712 712
 
713
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
713
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
714 714
 			$ret = true;
715 715
 		}
716 716
 	}
717 717
 
718
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
718
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
719 719
 }
720 720
 
721 721
 /**
@@ -741,50 +741,50 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @return float $total Total earnings.
743 743
  */
744
-function give_get_total_earnings( $recalculate = false ) {
744
+function give_get_total_earnings($recalculate = false) {
745 745
 
746
-	$total      = get_option( 'give_earnings_total', 0 );
747
-	$meta_table = __give_v20_bc_table_details( 'payment' );
746
+	$total      = get_option('give_earnings_total', 0);
747
+	$meta_table = __give_v20_bc_table_details('payment');
748 748
 
749 749
 	// Calculate total earnings.
750
-	if ( ! $total || $recalculate ) {
750
+	if ( ! $total || $recalculate) {
751 751
 		global $wpdb;
752 752
 
753 753
 		$total = (float) 0;
754 754
 
755
-		$args = apply_filters( 'give_get_total_earnings_args', array(
755
+		$args = apply_filters('give_get_total_earnings_args', array(
756 756
 			'offset' => 0,
757
-			'number' => - 1,
758
-			'status' => array( 'publish' ),
757
+			'number' => -1,
758
+			'status' => array('publish'),
759 759
 			'fields' => 'ids',
760
-		) );
760
+		));
761 761
 
762
-		$payments = give_get_payments( $args );
763
-		if ( $payments ) {
762
+		$payments = give_get_payments($args);
763
+		if ($payments) {
764 764
 
765 765
 			/**
766 766
 			 * If performing a donation, we need to skip the very last payment in the database,
767 767
 			 * since it calls give_increase_total_earnings() on completion,
768 768
 			 * which results in duplicated earnings for the very first donation.
769 769
 			 */
770
-			if ( did_action( 'give_update_payment_status' ) ) {
771
-				array_pop( $payments );
770
+			if (did_action('give_update_payment_status')) {
771
+				array_pop($payments);
772 772
 			}
773 773
 
774
-			if ( ! empty( $payments ) ) {
775
-				$payments = implode( ',', $payments );
776
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
774
+			if ( ! empty($payments)) {
775
+				$payments = implode(',', $payments);
776
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
777 777
 			}
778 778
 		}
779 779
 
780
-		update_option( 'give_earnings_total', $total, 'no' );
780
+		update_option('give_earnings_total', $total, 'no');
781 781
 	}
782 782
 
783
-	if ( $total < 0 ) {
783
+	if ($total < 0) {
784 784
 		$total = 0; // Don't ever show negative earnings.
785 785
 	}
786 786
 
787
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
787
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
788 788
 }
789 789
 
790 790
 /**
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
  *
797 797
  * @return float $total Total earnings.
798 798
  */
799
-function give_increase_total_earnings( $amount = 0 ) {
799
+function give_increase_total_earnings($amount = 0) {
800 800
 	$total = give_get_total_earnings();
801 801
 	$total += $amount;
802
-	update_option( 'give_earnings_total', $total );
802
+	update_option('give_earnings_total', $total);
803 803
 
804 804
 	return $total;
805 805
 }
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
  *
814 814
  * @return float $total Total earnings.
815 815
  */
816
-function give_decrease_total_earnings( $amount = 0 ) {
816
+function give_decrease_total_earnings($amount = 0) {
817 817
 	$total = give_get_total_earnings();
818 818
 	$total -= $amount;
819
-	if ( $total < 0 ) {
819
+	if ($total < 0) {
820 820
 		$total = 0;
821 821
 	}
822
-	update_option( 'give_earnings_total', $total );
822
+	update_option('give_earnings_total', $total);
823 823
 
824 824
 	return $total;
825 825
 }
@@ -835,10 +835,10 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return mixed $meta Payment Meta.
837 837
  */
838
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
839
-	$payment = new Give_Payment( $payment_id );
838
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
839
+	$payment = new Give_Payment($payment_id);
840 840
 
841
-	return $payment->get_meta( $meta_key, $single );
841
+	return $payment->get_meta($meta_key, $single);
842 842
 }
843 843
 
844 844
 /**
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed Meta ID if successful, false if unsuccessful.
853 853
  */
854
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
855
-	$payment = new Give_Payment( $payment_id );
854
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
855
+	$payment = new Give_Payment($payment_id);
856 856
 
857
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
857
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
858 858
 }
859 859
 
860 860
 /**
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array $user_info User Info Meta Values.
868 868
  */
869
-function give_get_payment_meta_user_info( $payment_id ) {
870
-	$payment = new Give_Payment( $payment_id );
869
+function give_get_payment_meta_user_info($payment_id) {
870
+	$payment = new Give_Payment($payment_id);
871 871
 
872 872
 	return $payment->user_info;
873 873
 }
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return int $form_id Form ID.
885 885
  */
886
-function give_get_payment_form_id( $payment_id ) {
887
-	$payment = new Give_Payment( $payment_id );
886
+function give_get_payment_form_id($payment_id) {
887
+	$payment = new Give_Payment($payment_id);
888 888
 
889 889
 	return $payment->form_id;
890 890
 }
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return string $email User email.
900 900
  */
901
-function give_get_payment_user_email( $payment_id ) {
902
-	$payment = new Give_Payment( $payment_id );
901
+function give_get_payment_user_email($payment_id) {
902
+	$payment = new Give_Payment($payment_id);
903 903
 
904 904
 	return $payment->email;
905 905
 }
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
915 915
  */
916
-function give_is_guest_payment( $payment_id ) {
917
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
918
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
916
+function give_is_guest_payment($payment_id) {
917
+	$payment_user_id  = give_get_payment_user_id($payment_id);
918
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
919 919
 
920
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
920
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
921 921
 }
922 922
 
923 923
 /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return int $user_id User ID.
931 931
  */
932
-function give_get_payment_user_id( $payment_id ) {
933
-	$payment = new Give_Payment( $payment_id );
932
+function give_get_payment_user_id($payment_id) {
933
+	$payment = new Give_Payment($payment_id);
934 934
 
935 935
 	return $payment->user_id;
936 936
 }
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return int $payment->customer_id Donor ID.
946 946
  */
947
-function give_get_payment_donor_id( $payment_id ) {
948
-	$payment = new Give_Payment( $payment_id );
947
+function give_get_payment_donor_id($payment_id) {
948
+	$payment = new Give_Payment($payment_id);
949 949
 
950 950
 	return $payment->customer_id;
951 951
 }
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return string $ip User IP.
961 961
  */
962
-function give_get_payment_user_ip( $payment_id ) {
963
-	$payment = new Give_Payment( $payment_id );
962
+function give_get_payment_user_ip($payment_id) {
963
+	$payment = new Give_Payment($payment_id);
964 964
 
965 965
 	return $payment->ip;
966 966
 }
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
  *
975 975
  * @return string $date The date the payment was completed.
976 976
  */
977
-function give_get_payment_completed_date( $payment_id = 0 ) {
978
-	$payment = new Give_Payment( $payment_id );
977
+function give_get_payment_completed_date($payment_id = 0) {
978
+	$payment = new Give_Payment($payment_id);
979 979
 
980 980
 	return $payment->completed_date;
981 981
 }
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return string $gateway Gateway.
991 991
  */
992
-function give_get_payment_gateway( $payment_id ) {
993
-	$payment = new Give_Payment( $payment_id );
992
+function give_get_payment_gateway($payment_id) {
993
+	$payment = new Give_Payment($payment_id);
994 994
 
995 995
 	return $payment->gateway;
996 996
 }
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  *
1005 1005
  * @return string $currency The currency code.
1006 1006
  */
1007
-function give_get_payment_currency_code( $payment_id = 0 ) {
1008
-	$payment = new Give_Payment( $payment_id );
1007
+function give_get_payment_currency_code($payment_id = 0) {
1008
+	$payment = new Give_Payment($payment_id);
1009 1009
 
1010 1010
 	return $payment->currency;
1011 1011
 }
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
  *
1020 1020
  * @return string $currency The currency name.
1021 1021
  */
1022
-function give_get_payment_currency( $payment_id = 0 ) {
1023
-	$currency = give_get_payment_currency_code( $payment_id );
1022
+function give_get_payment_currency($payment_id = 0) {
1023
+	$currency = give_get_payment_currency_code($payment_id);
1024 1024
 
1025
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1025
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
  *
1035 1035
  * @return string $key Donation key.
1036 1036
  */
1037
-function give_get_payment_key( $payment_id = 0 ) {
1038
-	$payment = new Give_Payment( $payment_id );
1037
+function give_get_payment_key($payment_id = 0) {
1038
+	$payment = new Give_Payment($payment_id);
1039 1039
 
1040 1040
 	return $payment->key;
1041 1041
 }
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return string $number Payment order number.
1053 1053
  */
1054
-function give_get_payment_number( $payment_id = 0 ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_number($payment_id = 0) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->number;
1058 1058
 }
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return string      The formatted payment number.
1068 1068
  */
1069
-function give_format_payment_number( $number ) {
1069
+function give_format_payment_number($number) {
1070 1070
 
1071
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1071
+	if ( ! give_get_option('enable_sequential')) {
1072 1072
 		return $number;
1073 1073
 	}
1074 1074
 
1075
-	if ( ! is_numeric( $number ) ) {
1075
+	if ( ! is_numeric($number)) {
1076 1076
 		return $number;
1077 1077
 	}
1078 1078
 
1079
-	$prefix  = give_get_option( 'sequential_prefix' );
1080
-	$number  = absint( $number );
1081
-	$postfix = give_get_option( 'sequential_postfix' );
1079
+	$prefix  = give_get_option('sequential_prefix');
1080
+	$number  = absint($number);
1081
+	$postfix = give_get_option('sequential_postfix');
1082 1082
 
1083
-	$formatted_number = $prefix . $number . $postfix;
1083
+	$formatted_number = $prefix.$number.$postfix;
1084 1084
 
1085
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1085
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,17 +1096,17 @@  discard block
 block discarded – undo
1096 1096
  */
1097 1097
 function give_get_next_payment_number() {
1098 1098
 
1099
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1099
+	if ( ! give_get_option('enable_sequential')) {
1100 1100
 		return false;
1101 1101
 	}
1102 1102
 
1103
-	$number           = get_option( 'give_last_payment_number' );
1104
-	$start            = give_get_option( 'sequential_start', 1 );
1103
+	$number           = get_option('give_last_payment_number');
1104
+	$start            = give_get_option('sequential_start', 1);
1105 1105
 	$increment_number = true;
1106 1106
 
1107
-	if ( false !== $number ) {
1107
+	if (false !== $number) {
1108 1108
 
1109
-		if ( empty( $number ) ) {
1109
+		if (empty($number)) {
1110 1110
 
1111 1111
 			$number           = $start;
1112 1112
 			$increment_number = false;
@@ -1115,24 +1115,24 @@  discard block
 block discarded – undo
1115 1115
 	} else {
1116 1116
 
1117 1117
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1118
-		$payments     = new Give_Payments_Query( array(
1118
+		$payments = new Give_Payments_Query(array(
1119 1119
 			'number'  => 1,
1120 1120
 			'order'   => 'DESC',
1121 1121
 			'orderby' => 'ID',
1122 1122
 			'output'  => 'posts',
1123 1123
 			'fields'  => 'ids',
1124
-		) );
1124
+		));
1125 1125
 		$last_payment = $payments->get_payments();
1126 1126
 
1127
-		if ( ! empty( $last_payment ) ) {
1127
+		if ( ! empty($last_payment)) {
1128 1128
 
1129
-			$number = give_get_payment_number( $last_payment[0] );
1129
+			$number = give_get_payment_number($last_payment[0]);
1130 1130
 
1131 1131
 		}
1132 1132
 
1133
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1133
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1134 1134
 
1135
-			$number = give_remove_payment_prefix_postfix( $number );
1135
+			$number = give_remove_payment_prefix_postfix($number);
1136 1136
 
1137 1137
 		} else {
1138 1138
 
@@ -1141,13 +1141,13 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 	}// End if().
1143 1143
 
1144
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1144
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1145 1145
 
1146
-	if ( $increment_number ) {
1147
-		$number ++;
1146
+	if ($increment_number) {
1147
+		$number++;
1148 1148
 	}
1149 1149
 
1150
-	return apply_filters( 'give_get_next_payment_number', $number );
1150
+	return apply_filters('give_get_next_payment_number', $number);
1151 1151
 }
1152 1152
 
1153 1153
 /**
@@ -1159,25 +1159,25 @@  discard block
 block discarded – undo
1159 1159
  *
1160 1160
  * @return string The new Payment number without prefix and postfix.
1161 1161
  */
1162
-function give_remove_payment_prefix_postfix( $number ) {
1162
+function give_remove_payment_prefix_postfix($number) {
1163 1163
 
1164
-	$prefix  = give_get_option( 'sequential_prefix' );
1165
-	$postfix = give_get_option( 'sequential_postfix' );
1164
+	$prefix  = give_get_option('sequential_prefix');
1165
+	$postfix = give_get_option('sequential_postfix');
1166 1166
 
1167 1167
 	// Remove prefix.
1168
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1168
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1169 1169
 
1170 1170
 	// Remove the postfix.
1171
-	$length      = strlen( $number );
1172
-	$postfix_pos = strrpos( $number, $postfix );
1173
-	if ( false !== $postfix_pos ) {
1174
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1171
+	$length      = strlen($number);
1172
+	$postfix_pos = strrpos($number, $postfix);
1173
+	if (false !== $postfix_pos) {
1174
+		$number = substr_replace($number, '', $postfix_pos, $length);
1175 1175
 	}
1176 1176
 
1177 1177
 	// Ensure it's a whole number.
1178
-	$number = intval( $number );
1178
+	$number = intval($number);
1179 1179
 
1180
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1180
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1181 1181
 
1182 1182
 }
1183 1183
 
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return string $amount Fully formatted donation amount.
1197 1197
  */
1198
-function give_donation_amount( $donation, $format_args = array() ) {
1198
+function give_donation_amount($donation, $format_args = array()) {
1199 1199
 	/* @var Give_Payment $donation */
1200
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1201
-		$donation = new Give_Payment( absint( $donation ) );
1200
+	if ( ! ($donation instanceof Give_Payment)) {
1201
+		$donation = new Give_Payment(absint($donation));
1202 1202
 	}
1203 1203
 
1204 1204
 	$amount           = $donation->total;
1205 1205
 	$formatted_amount = $amount;
1206 1206
 
1207
-	if ( is_bool( $format_args ) ) {
1207
+	if (is_bool($format_args)) {
1208 1208
 		$format_args = array(
1209 1209
 			'currency' => (bool) $format_args,
1210 1210
 			'amount'   => (bool) $format_args,
@@ -1227,27 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		)
1228 1228
 	);
1229 1229
 
1230
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1230
+	if ($format_args['amount'] || $format_args['currency']) {
1231 1231
 
1232
-		if ( $format_args['amount'] ) {
1232
+		if ($format_args['amount']) {
1233 1233
 
1234 1234
 			$formatted_amount = give_format_amount(
1235 1235
 				$amount,
1236
-				! is_array( $format_args['amount'] ) ?
1236
+				! is_array($format_args['amount']) ?
1237 1237
 					array(
1238 1238
 						'sanitize' => false,
1239 1239
 						'currency' => $donation->currency,
1240
-					) :
1241
-					$format_args['amount']
1240
+					) : $format_args['amount']
1242 1241
 			);
1243 1242
 		}
1244 1243
 
1245
-		if ( $format_args['currency'] ) {
1244
+		if ($format_args['currency']) {
1246 1245
 			$formatted_amount = give_currency_filter(
1247 1246
 				$formatted_amount,
1248
-				! is_array( $format_args['currency'] ) ?
1249
-					array( 'currency_code' => $donation->currency ) :
1250
-					$format_args['currency']
1247
+				! is_array($format_args['currency']) ?
1248
+					array('currency_code' => $donation->currency) : $format_args['currency']
1251 1249
 			);
1252 1250
 		}
1253 1251
 	}
@@ -1262,7 +1260,7 @@  discard block
 block discarded – undo
1262 1260
 	 * @param int    $donation_id      Donation ID.
1263 1261
 	 * @param string $type             Donation amount type.
1264 1262
 	 */
1265
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1263
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1266 1264
 }
1267 1265
 
1268 1266
 /**
@@ -1279,10 +1277,10 @@  discard block
 block discarded – undo
1279 1277
  *
1280 1278
  * @return array Fully formatted payment subtotal.
1281 1279
  */
1282
-function give_payment_subtotal( $payment_id = 0 ) {
1283
-	$subtotal = give_get_payment_subtotal( $payment_id );
1280
+function give_payment_subtotal($payment_id = 0) {
1281
+	$subtotal = give_get_payment_subtotal($payment_id);
1284 1282
 
1285
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1283
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1286 1284
 }
1287 1285
 
1288 1286
 /**
@@ -1296,8 +1294,8 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return float $subtotal Subtotal for payment (non formatted).
1298 1296
  */
1299
-function give_get_payment_subtotal( $payment_id = 0 ) {
1300
-	$payment = new Give_Payment( $payment_id );
1297
+function give_get_payment_subtotal($payment_id = 0) {
1298
+	$payment = new Give_Payment($payment_id);
1301 1299
 
1302 1300
 	return $payment->subtotal;
1303 1301
 }
@@ -1311,8 +1309,8 @@  discard block
 block discarded – undo
1311 1309
  *
1312 1310
  * @return string The donation ID.
1313 1311
  */
1314
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1315
-	$payment = new Give_Payment( $payment_id );
1312
+function give_get_payment_transaction_id($payment_id = 0) {
1313
+	$payment = new Give_Payment($payment_id);
1316 1314
 
1317 1315
 	return $payment->transaction_id;
1318 1316
 }
@@ -1327,15 +1325,15 @@  discard block
 block discarded – undo
1327 1325
  *
1328 1326
  * @return bool|mixed
1329 1327
  */
1330
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1328
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1331 1329
 
1332
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1330
+	if (empty($payment_id) || empty($transaction_id)) {
1333 1331
 		return false;
1334 1332
 	}
1335 1333
 
1336
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1334
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1337 1335
 
1338
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1336
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1339 1337
 }
1340 1338
 
1341 1339
 /**
@@ -1348,10 +1346,10 @@  discard block
 block discarded – undo
1348 1346
  *
1349 1347
  * @return int $purchase Donation ID.
1350 1348
  */
1351
-function give_get_donation_id_by_key( $key ) {
1349
+function give_get_donation_id_by_key($key) {
1352 1350
 	global $wpdb;
1353 1351
 
1354
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1352
+	$meta_table = __give_v20_bc_table_details('payment');
1355 1353
 
1356 1354
 	$purchase = $wpdb->get_var(
1357 1355
 		$wpdb->prepare(
@@ -1367,7 +1365,7 @@  discard block
 block discarded – undo
1367 1365
 		)
1368 1366
 	);
1369 1367
 
1370
-	if ( $purchase != null ) {
1368
+	if ($purchase != null) {
1371 1369
 		return $purchase;
1372 1370
 	}
1373 1371
 
@@ -1385,13 +1383,13 @@  discard block
 block discarded – undo
1385 1383
  *
1386 1384
  * @return int $purchase Donation ID.
1387 1385
  */
1388
-function give_get_purchase_id_by_transaction_id( $key ) {
1386
+function give_get_purchase_id_by_transaction_id($key) {
1389 1387
 	global $wpdb;
1390
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1388
+	$meta_table = __give_v20_bc_table_details('payment');
1391 1389
 
1392
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1390
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1393 1391
 
1394
-	if ( $purchase != null ) {
1392
+	if ($purchase != null) {
1395 1393
 		return $purchase;
1396 1394
 	}
1397 1395
 
@@ -1408,23 +1406,23 @@  discard block
 block discarded – undo
1408 1406
  *
1409 1407
  * @return array $notes Donation Notes
1410 1408
  */
1411
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1409
+function give_get_payment_notes($payment_id = 0, $search = '') {
1412 1410
 
1413
-	if ( empty( $payment_id ) && empty( $search ) ) {
1411
+	if (empty($payment_id) && empty($search)) {
1414 1412
 		return false;
1415 1413
 	}
1416 1414
 
1417
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1418
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1415
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1416
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1419 1417
 
1420
-	$notes = get_comments( array(
1418
+	$notes = get_comments(array(
1421 1419
 		'post_id' => $payment_id,
1422 1420
 		'order'   => 'ASC',
1423 1421
 		'search'  => $search,
1424
-	) );
1422
+	));
1425 1423
 
1426
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1427
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1424
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1425
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1428 1426
 
1429 1427
 	return $notes;
1430 1428
 }
@@ -1440,8 +1438,8 @@  discard block
 block discarded – undo
1440 1438
  *
1441 1439
  * @return int The new note ID
1442 1440
  */
1443
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1444
-	if ( empty( $payment_id ) ) {
1441
+function give_insert_payment_note($payment_id = 0, $note = '') {
1442
+	if (empty($payment_id)) {
1445 1443
 		return false;
1446 1444
 	}
1447 1445
 
@@ -1453,14 +1451,14 @@  discard block
 block discarded – undo
1453 1451
 	 *
1454 1452
 	 * @since 1.0
1455 1453
 	 */
1456
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1454
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1457 1455
 
1458
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1456
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1459 1457
 		'comment_post_ID'      => $payment_id,
1460 1458
 		'comment_content'      => $note,
1461 1459
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1462
-		'comment_date'         => current_time( 'mysql' ),
1463
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1460
+		'comment_date'         => current_time('mysql'),
1461
+		'comment_date_gmt'     => current_time('mysql', 1),
1464 1462
 		'comment_approved'     => 1,
1465 1463
 		'comment_parent'       => 0,
1466 1464
 		'comment_author'       => '',
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 		'comment_author_email' => '',
1470 1468
 		'comment_type'         => 'give_payment_note',
1471 1469
 
1472
-	) ) );
1470
+	)));
1473 1471
 
1474 1472
 	/**
1475 1473
 	 * Fires after payment note inserted.
@@ -1480,7 +1478,7 @@  discard block
 block discarded – undo
1480 1478
 	 *
1481 1479
 	 * @since 1.0
1482 1480
 	 */
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1481
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1482
 
1485 1483
 	return $note_id;
1486 1484
 }
@@ -1495,8 +1493,8 @@  discard block
 block discarded – undo
1495 1493
  *
1496 1494
  * @return bool True on success, false otherwise.
1497 1495
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1496
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1497
+	if (empty($comment_id)) {
1500 1498
 		return false;
1501 1499
 	}
1502 1500
 
@@ -1508,9 +1506,9 @@  discard block
 block discarded – undo
1508 1506
 	 *
1509 1507
 	 * @since 1.0
1510 1508
 	 */
1511
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1509
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1512 1510
 
1513
-	$ret = wp_delete_comment( $comment_id, true );
1511
+	$ret = wp_delete_comment($comment_id, true);
1514 1512
 
1515 1513
 	/**
1516 1514
 	 * Fires after donation note deleted.
@@ -1520,7 +1518,7 @@  discard block
 block discarded – undo
1520 1518
 	 *
1521 1519
 	 * @since 1.0
1522 1520
 	 */
1523
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1521
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1524 1522
 
1525 1523
 	return $ret;
1526 1524
 }
@@ -1535,32 +1533,32 @@  discard block
 block discarded – undo
1535 1533
  *
1536 1534
  * @return string
1537 1535
  */
1538
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1536
+function give_get_payment_note_html($note, $payment_id = 0) {
1539 1537
 
1540
-	if ( is_numeric( $note ) ) {
1541
-		$note = get_comment( $note );
1538
+	if (is_numeric($note)) {
1539
+		$note = get_comment($note);
1542 1540
 	}
1543 1541
 
1544
-	if ( ! empty( $note->user_id ) ) {
1545
-		$user = get_userdata( $note->user_id );
1542
+	if ( ! empty($note->user_id)) {
1543
+		$user = get_userdata($note->user_id);
1546 1544
 		$user = $user->display_name;
1547 1545
 	} else {
1548
-		$user = __( 'System', 'give' );
1546
+		$user = __('System', 'give');
1549 1547
 	}
1550 1548
 
1551
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1549
+	$date_format = give_date_format().', '.get_option('time_format');
1552 1550
 
1553
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1551
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1554 1552
 		'give-action' => 'delete_payment_note',
1555 1553
 		'note_id'     => $note->comment_ID,
1556 1554
 		'payment_id'  => $payment_id,
1557
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1555
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1558 1556
 
1559
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1557
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1560 1558
 	$note_html .= '<p>';
1561
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1559
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1562 1560
 	$note_html .= $note->comment_content;
1563
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1561
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1564 1562
 	$note_html .= '</p>';
1565 1563
 	$note_html .= '</div>';
1566 1564
 
@@ -1578,18 +1576,18 @@  discard block
 block discarded – undo
1578 1576
  *
1579 1577
  * @return void
1580 1578
  */
1581
-function give_hide_payment_notes( $query ) {
1582
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1583
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1584
-		if ( ! is_array( $types ) ) {
1585
-			$types = array( $types );
1579
+function give_hide_payment_notes($query) {
1580
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1581
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1582
+		if ( ! is_array($types)) {
1583
+			$types = array($types);
1586 1584
 		}
1587 1585
 		$types[]                           = 'give_payment_note';
1588 1586
 		$query->query_vars['type__not_in'] = $types;
1589 1587
 	}
1590 1588
 }
1591 1589
 
1592
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1590
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1593 1591
 
1594 1592
 /**
1595 1593
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1601,15 +1599,15 @@  discard block
 block discarded – undo
1601 1599
  *
1602 1600
  * @return array $clauses Updated comment clauses.
1603 1601
  */
1604
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1605
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1602
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1603
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1606 1604
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1607 1605
 	}
1608 1606
 
1609 1607
 	return $clauses;
1610 1608
 }
1611 1609
 
1612
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1610
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1613 1611
 
1614 1612
 
1615 1613
 /**
@@ -1622,15 +1620,15 @@  discard block
 block discarded – undo
1622 1620
  *
1623 1621
  * @return string $where
1624 1622
  */
1625
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1623
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1626 1624
 	global $wpdb;
1627 1625
 
1628
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1626
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1629 1627
 
1630 1628
 	return $where;
1631 1629
 }
1632 1630
 
1633
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1631
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1634 1632
 
1635 1633
 
1636 1634
 /**
@@ -1644,32 +1642,32 @@  discard block
 block discarded – undo
1644 1642
  *
1645 1643
  * @return array|object Array of comment counts.
1646 1644
  */
1647
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1645
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1648 1646
 	global $wpdb, $pagenow;
1649 1647
 
1650
-	if ( 'index.php' != $pagenow ) {
1648
+	if ('index.php' != $pagenow) {
1651 1649
 		return $stats;
1652 1650
 	}
1653 1651
 
1654 1652
 	$post_id = (int) $post_id;
1655 1653
 
1656
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1654
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1657 1655
 		return $stats;
1658 1656
 	}
1659 1657
 
1660
-	$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
1658
+	$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
1661 1659
 
1662
-	if ( ! is_null( $stats ) ) {
1660
+	if ( ! is_null($stats)) {
1663 1661
 		return $stats;
1664 1662
 	}
1665 1663
 
1666 1664
 	$where = 'WHERE comment_type != "give_payment_note"';
1667 1665
 
1668
-	if ( $post_id > 0 ) {
1669
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1666
+	if ($post_id > 0) {
1667
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1670 1668
 	}
1671 1669
 
1672
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1670
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1673 1671
 
1674 1672
 	$total    = 0;
1675 1673
 	$approved = array(
@@ -1679,30 +1677,30 @@  discard block
 block discarded – undo
1679 1677
 		'trash'        => 'trash',
1680 1678
 		'post-trashed' => 'post-trashed',
1681 1679
 	);
1682
-	foreach ( (array) $count as $row ) {
1680
+	foreach ((array) $count as $row) {
1683 1681
 		// Don't count post-trashed toward totals.
1684
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1682
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1685 1683
 			$total += $row['num_comments'];
1686 1684
 		}
1687
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1688
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1685
+		if (isset($approved[$row['comment_approved']])) {
1686
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1689 1687
 		}
1690 1688
 	}
1691 1689
 
1692 1690
 	$stats['total_comments'] = $total;
1693
-	foreach ( $approved as $key ) {
1694
-		if ( empty( $stats[ $key ] ) ) {
1695
-			$stats[ $key ] = 0;
1691
+	foreach ($approved as $key) {
1692
+		if (empty($stats[$key])) {
1693
+			$stats[$key] = 0;
1696 1694
 		}
1697 1695
 	}
1698 1696
 
1699 1697
 	$stats = (object) $stats;
1700
-	Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
1698
+	Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
1701 1699
 
1702 1700
 	return $stats;
1703 1701
 }
1704 1702
 
1705
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1703
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1706 1704
 
1707 1705
 
1708 1706
 /**
@@ -1715,9 +1713,9 @@  discard block
 block discarded – undo
1715 1713
  *
1716 1714
  * @return string $where Modified where clause.
1717 1715
  */
1718
-function give_filter_where_older_than_week( $where = '' ) {
1716
+function give_filter_where_older_than_week($where = '') {
1719 1717
 	// Payments older than one week.
1720
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1718
+	$start = date('Y-m-d', strtotime('-7 days'));
1721 1719
 	$where .= " AND post_date <= '{$start}'";
1722 1720
 
1723 1721
 	return $where;
@@ -1737,13 +1735,13 @@  discard block
 block discarded – undo
1737 1735
  *
1738 1736
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1739 1737
  */
1740
-function give_get_donation_form_title( $donation, $args = array() ) {
1738
+function give_get_donation_form_title($donation, $args = array()) {
1741 1739
 
1742
-	if ( ! $donation instanceof Give_Payment ) {
1743
-		$donation = new Give_Payment( $donation );
1740
+	if ( ! $donation instanceof Give_Payment) {
1741
+		$donation = new Give_Payment($donation);
1744 1742
 	}
1745 1743
 
1746
-	if( ! $donation->ID ) {
1744
+	if ( ! $donation->ID) {
1747 1745
 		return '';
1748 1746
 	}
1749 1747
 
@@ -1752,7 +1750,7 @@  discard block
 block discarded – undo
1752 1750
 		'separator'  => '',
1753 1751
 	);
1754 1752
 
1755
-	$args = wp_parse_args( $args, $defaults );
1753
+	$args = wp_parse_args($args, $defaults);
1756 1754
 
1757 1755
 	$form_id     = $donation->form_id;
1758 1756
 	$price_id    = $donation->price_id;
@@ -1773,39 +1771,39 @@  discard block
 block discarded – undo
1773 1771
 		, false
1774 1772
 	);
1775 1773
 
1776
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1774
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1777 1775
 
1778
-	if ( is_null( $form_title_html ) ) {
1779
-		if ( true === $only_level ) {
1776
+	if (is_null($form_title_html)) {
1777
+		if (true === $only_level) {
1780 1778
 			$form_title = '';
1781 1779
 		}
1782 1780
 
1783 1781
 		$form_title_html = $form_title;
1784 1782
 
1785
-		if ( 'custom' === $price_id ) {
1783
+		if ('custom' === $price_id) {
1786 1784
 
1787
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1788
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1785
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1786
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1789 1787
 
1790 1788
 			// Show custom amount level only in backend otherwise hide it.
1791
-			if( 'set' === give_get_meta( $form_id, '_give_price_option', true ) && ! is_admin()  ) {
1789
+			if ('set' === give_get_meta($form_id, '_give_price_option', true) && ! is_admin()) {
1792 1790
 				$level_label = '';
1793 1791
 			}
1794 1792
 
1795
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1796
-			$level_label = give_get_price_option_name( $form_id, $price_id, $donation->ID, false );
1793
+		} elseif (give_has_variable_prices($form_id)) {
1794
+			$level_label = give_get_price_option_name($form_id, $price_id, $donation->ID, false);
1797 1795
 		}
1798 1796
 
1799 1797
 		// Only add separator if there is a form title.
1800 1798
 		if (
1801
-			! empty( $form_title_html ) &&
1802
-			! empty( $level_label )
1799
+			! empty($form_title_html) &&
1800
+			! empty($level_label)
1803 1801
 		) {
1804 1802
 			$form_title_html .= " {$separator} ";
1805 1803
 		}
1806 1804
 
1807 1805
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1808
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1806
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1809 1807
 	}
1810 1808
 
1811 1809
 	/**
@@ -1813,7 +1811,7 @@  discard block
 block discarded – undo
1813 1811
 	 *
1814 1812
 	 * @since 1.0
1815 1813
 	 */
1816
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation );
1814
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation);
1817 1815
 }
1818 1816
 
1819 1817
 /**
@@ -1826,19 +1824,19 @@  discard block
 block discarded – undo
1826 1824
  *
1827 1825
  * @return string $price_id
1828 1826
  */
1829
-function give_get_price_id( $form_id, $price ) {
1827
+function give_get_price_id($form_id, $price) {
1830 1828
 	$price_id = null;
1831 1829
 
1832
-	if ( give_has_variable_prices( $form_id ) ) {
1830
+	if (give_has_variable_prices($form_id)) {
1833 1831
 
1834
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1832
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1835 1833
 
1836
-		foreach ( $levels as $level ) {
1834
+		foreach ($levels as $level) {
1837 1835
 
1838
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1836
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1839 1837
 
1840 1838
 			// Check that this indeed the recurring price.
1841
-			if ( $level_amount == $price ) {
1839
+			if ($level_amount == $price) {
1842 1840
 
1843 1841
 				$price_id = $level['_give_id']['level_id'];
1844 1842
 				break;
@@ -1846,13 +1844,13 @@  discard block
 block discarded – undo
1846 1844
 			}
1847 1845
 		}
1848 1846
 
1849
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1847
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1850 1848
 			$price_id = 'custom';
1851 1849
 		}
1852 1850
 	}
1853 1851
 
1854 1852
 	// Price ID must be numeric or string.
1855
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1853
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1856 1854
 
1857 1855
 	/**
1858 1856
 	 * Filter the price id
@@ -1862,7 +1860,7 @@  discard block
 block discarded – undo
1862 1860
 	 * @param string $price_id
1863 1861
 	 * @param int    $form_id
1864 1862
 	 */
1865
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1863
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1866 1864
 }
1867 1865
 
1868 1866
 /**
@@ -1878,10 +1876,10 @@  discard block
 block discarded – undo
1878 1876
  *
1879 1877
  * @return string
1880 1878
  */
1881
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1882
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1879
+function give_get_form_dropdown($args = array(), $echo = false) {
1880
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1883 1881
 
1884
-	if ( ! $echo ) {
1882
+	if ( ! $echo) {
1885 1883
 		return $form_dropdown_html;
1886 1884
 	}
1887 1885
 
@@ -1898,17 +1896,17 @@  discard block
 block discarded – undo
1898 1896
  *
1899 1897
  * @return string|bool
1900 1898
  */
1901
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1899
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1902 1900
 
1903 1901
 	// Check for give form id.
1904
-	if ( empty( $args['id'] ) ) {
1902
+	if (empty($args['id'])) {
1905 1903
 		return false;
1906 1904
 	}
1907 1905
 
1908
-	$form = new Give_Donate_Form( $args['id'] );
1906
+	$form = new Give_Donate_Form($args['id']);
1909 1907
 
1910 1908
 	// Check if form has variable prices or not.
1911
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1909
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1912 1910
 		return false;
1913 1911
 	}
1914 1912
 
@@ -1916,24 +1914,24 @@  discard block
 block discarded – undo
1916 1914
 	$variable_price_options = array();
1917 1915
 
1918 1916
 	// Check if multi donation form support custom donation or not.
1919
-	if ( $form->is_custom_price_mode() ) {
1920
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1917
+	if ($form->is_custom_price_mode()) {
1918
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1921 1919
 	}
1922 1920
 
1923 1921
 	// Get variable price and ID from variable price array.
1924
-	foreach ( $variable_prices as $variable_price ) {
1925
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1922
+	foreach ($variable_prices as $variable_price) {
1923
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1926 1924
 	}
1927 1925
 
1928 1926
 	// Update options.
1929
-	$args = array_merge( $args, array(
1927
+	$args = array_merge($args, array(
1930 1928
 		'options' => $variable_price_options,
1931
-	) );
1929
+	));
1932 1930
 
1933 1931
 	// Generate select html.
1934
-	$form_dropdown_html = Give()->html->select( $args );
1932
+	$form_dropdown_html = Give()->html->select($args);
1935 1933
 
1936
-	if ( ! $echo ) {
1934
+	if ( ! $echo) {
1937 1935
 		return $form_dropdown_html;
1938 1936
 	}
1939 1937
 
@@ -1952,14 +1950,14 @@  discard block
 block discarded – undo
1952 1950
  *
1953 1951
  * @return string
1954 1952
  */
1955
-function give_get_payment_meta_price_id( $payment_meta ) {
1953
+function give_get_payment_meta_price_id($payment_meta) {
1956 1954
 
1957
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1955
+	if (isset($payment_meta['give_price_id'])) {
1958 1956
 		$price_id = $payment_meta['give_price_id'];
1959
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1957
+	} elseif (isset($payment_meta['price_id'])) {
1960 1958
 		$price_id = $payment_meta['price_id'];
1961 1959
 	} else {
1962
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1960
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1963 1961
 	}
1964 1962
 
1965 1963
 	/**
@@ -1970,6 +1968,6 @@  discard block
 block discarded – undo
1970 1968
 	 * @param string $price_id
1971 1969
 	 * @param array  $payment_meta
1972 1970
 	 */
1973
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1971
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1974 1972
 
1975 1973
 }
Please login to merge, or discard this patch.
includes/class-give-db-form-meta.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->formmeta    = $this->table_name = $wpdb->prefix . 'give_formmeta';
53
+		$wpdb->formmeta    = $this->table_name = $wpdb->prefix.'give_formmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'logs';
37
-			$this->label = __( 'Logs', 'give' );
37
+			$this->label = __('Logs', 'give');
38 38
 
39 39
 			$this->default_tab = 'sales';
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function get_settings() {
52 52
 			// Get settings.
53
-			$settings = apply_filters( 'give_settings_logs', array(
53
+			$settings = apply_filters('give_settings_logs', array(
54 54
 				array(
55 55
 					'id'         => 'give_tools_logs',
56 56
 					'type'       => 'title',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				),
59 59
 				array(
60 60
 					'id'   => 'logs',
61
-					'name' => __( 'Log', 'give' ),
61
+					'name' => __('Log', 'give'),
62 62
 					'type' => 'logs',
63 63
 
64 64
 				),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					'type'       => 'sectionend',
68 68
 					'table_html' => false,
69 69
 				),
70
-			) );
70
+			));
71 71
 
72 72
 			/**
73 73
 			 * Filter the settings.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @param  array $settings
78 78
 			 */
79
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
79
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
80 80
 
81 81
 			// Output.
82 82
 			return $settings;
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 		 */
91 91
 		public function get_sections() {
92 92
 			$sections = array(
93
-				'sales'          => __( 'Donations', 'give' ),
94
-				'gateway_errors' => __( 'Payment Errors', 'give' ),
95
-				'api_requests'   => __( 'API Requests', 'give' ),
96
-				'updates'   => __( 'Updates', 'give' ),
93
+				'sales'          => __('Donations', 'give'),
94
+				'gateway_errors' => __('Payment Errors', 'give'),
95
+				'api_requests'   => __('API Requests', 'give'),
96
+				'updates'   => __('Updates', 'give'),
97 97
 			);
98 98
 
99
-			$sections = apply_filters( 'give_log_views', $sections );
99
+			$sections = apply_filters('give_log_views', $sections);
100 100
 
101
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
101
+			return apply_filters('give_get_sections_'.$this->id, $sections);
102 102
 		}
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
includes/admin/tools/logs/logs.php 1 patch
Spacing   +26 added lines, -26 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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_get_logs_tab() {
24 24
 
25
-	require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' );
25
+	require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php');
26 26
 
27 27
 	// Get current section.
28 28
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( "give_logs_view_{$current_section}" );
35
+	do_action("give_logs_view_{$current_section}");
36 36
 }
37 37
 
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_logs_view_sales() {
48 48
 
49
-	include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php';
49
+	include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php';
50 50
 
51 51
 	$logs_table = new Give_Sales_Log_Table();
52 52
 	$logs_table->prepare_items();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.8.12
61 61
 		 */
62
-		do_action( 'give_logs_donations_top' );
62
+		do_action('give_logs_donations_top');
63 63
 
64 64
 		$logs_table->display(); ?>
65 65
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.8.12
75 75
 		 */
76
-		do_action( 'give_logs_donations_bottom' );
76
+		do_action('give_logs_donations_bottom');
77 77
 		?>
78 78
 
79 79
 	</div>
80 80
 	<?php
81 81
 }
82 82
 
83
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
83
+add_action('give_logs_view_sales', 'give_logs_view_sales');
84 84
 
85 85
 /**
86 86
  * Update Logs
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_logs_view_updates() {
93
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' );
93
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php');
94 94
 
95 95
 	$logs_table = new Give_Update_Log_Table();
96 96
 	$logs_table->prepare_items();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 2.0.1
105 105
 		 */
106
-		do_action( 'give_logs_update_top' );
106
+		do_action('give_logs_update_top');
107 107
 
108 108
 		$logs_table->display(); ?>
109 109
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @since 2.0.1
119 119
 		 */
120
-		do_action( 'give_logs_update_bottom' );
120
+		do_action('give_logs_update_bottom');
121 121
 		?>
122 122
 
123 123
 	</div>
124 124
 	<?php
125 125
 }
126 126
 
127
-add_action( 'give_logs_view_updates', 'give_logs_view_updates' );
127
+add_action('give_logs_view_updates', 'give_logs_view_updates');
128 128
 
129 129
 /**
130 130
  * Gateway Error Logs
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_logs_view_gateway_errors() {
138
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' );
138
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php');
139 139
 
140 140
 	$logs_table = new Give_Gateway_Error_Log_Table();
141 141
 	$logs_table->prepare_items();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.12
150 150
 		 */
151
-		do_action( 'give_logs_payment_error_top' );
151
+		do_action('give_logs_payment_error_top');
152 152
 
153 153
 		$logs_table->display(); ?>
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.8.12
164 164
 		 */
165
-		do_action( 'give_logs_payment_error_bottom' );
165
+		do_action('give_logs_payment_error_bottom');
166 166
 		?>
167 167
 
168 168
 	</div>
169 169
 	<?php
170 170
 }
171 171
 
172
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
172
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
173 173
 
174 174
 /**
175 175
  * API Request Logs
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @return void
181 181
  */
182 182
 function give_logs_view_api_requests() {
183
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' );
183
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php');
184 184
 
185 185
 	$logs_table = new Give_API_Request_Log_Table();
186 186
 	$logs_table->prepare_items();
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @since 1.0
192 192
 	 */
193
-	do_action( 'give_logs_api_requests_top' );
193
+	do_action('give_logs_api_requests_top');
194 194
 
195
-	$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
195
+	$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
196 196
 	$logs_table->display();
197 197
 	?>
198 198
 	<input type="hidden" name="post_type" value="give_forms"/>
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @since 1.0
208 208
 	 */
209
-	do_action( 'give_logs_api_requests_bottom' );
209
+	do_action('give_logs_api_requests_bottom');
210 210
 }
211
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
211
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
212 212
 
213 213
 /**
214 214
  * Renders the log views drop down.
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	$current_section = give_get_current_setting_section();
221 221
 
222 222
 	// If there are not any event attach to action then do not show form.
223
-	if ( ! has_action( 'give_log_view_actions' ) ) {
223
+	if ( ! has_action('give_log_view_actions')) {
224 224
 		return;
225 225
 	}
226 226
 	?>
227
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
227
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
228 228
 		<?php
229 229
 		/**
230 230
 		 * Fires after displaying the reports page views drop down.
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		 *
234 234
 		 * @since 1.0
235 235
 		 */
236
-		do_action( 'give_log_view_actions' );
236
+		do_action('give_log_view_actions');
237 237
 		?>
238 238
 
239 239
 		<input type="hidden" name="post_type" value="give_forms"/>
240 240
 		<input type="hidden" name="page" value="give-tools"/>
241 241
 		<input type="hidden" name="tab" value="logs"/>
242 242
 
243
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
243
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
244 244
 	</form>
245 245
 	<?php
246 246
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return string
254 254
  */
255
-function give_tools_set_form_method( $method ) {
255
+function give_tools_set_form_method($method) {
256 256
 	return 'get';
257 257
 }
258
-add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 );
258
+add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-update-logs-list-table.php 1 patch
Spacing   +39 added lines, -39 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
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
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
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
66
+	public function search_box($text, $input_id) {
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_columns() {
78 78
 		$columns = array(
79
-			'ID'      => __( 'Log ID', 'give' ),
80
-			'date'    => __( 'Date', 'give' ),
81
-			'details' => __( 'Process Details', 'give' ),
79
+			'ID'      => __('Log ID', 'give'),
80
+			'date'    => __('Date', 'give'),
81
+			'details' => __('Process Details', 'give'),
82 82
 		);
83 83
 
84 84
 		return $columns;
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string Column Name
97 97
 	 */
98
-	public function column_default( $item, $column_name ) {
99
-		switch ( $column_name ) {
98
+	public function column_default($item, $column_name) {
99
+		switch ($column_name) {
100 100
 			case 'ID':
101 101
 				return sprintf(
102 102
 					'<span class="give-item-label give-item-label-gray">%1$s</span> %2$s',
103
-					esc_attr( $item[ $column_name ] ),
104
-					esc_attr( $item['title'] )
103
+					esc_attr($item[$column_name]),
104
+					esc_attr($item['title'])
105 105
 				);
106 106
 
107 107
 			default:
108
-				return esc_attr( $item[ $column_name ] );
108
+				return esc_attr($item[$column_name]);
109 109
 		}
110 110
 	}
111 111
 
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return void
121 121
 	 */
122
-	public function column_details( $item ) {
123
-		echo Give()->tooltips->render_link( array(
124
-			'label'       => __( 'View Update Log', 'give' ),
122
+	public function column_details($item) {
123
+		echo Give()->tooltips->render_link(array(
124
+			'label'       => __('View Update Log', 'give'),
125 125
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
126 126
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
127 127
 			'attributes'  => array(
128 128
 				'class' => 'thickbox give-error-log-details-link button button-small',
129 129
 			),
130
-		) );
130
+		));
131 131
 		?>
132 132
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
133 133
 			<?php
134 134
 
135 135
 			// Print Log Content, if not empty.
136
-			if ( ! empty( $item['log_content'] ) ) {
136
+			if ( ! empty($item['log_content'])) {
137 137
 				echo sprintf(
138 138
 					'<p><pre>%1$s</pre></div>',
139
-					esc_html( $item['log_content'] )
139
+					esc_html($item['log_content'])
140 140
 				);
141 141
 			}
142 142
 			?>
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $which
159 159
 	 */
160
-	protected function display_tablenav( $which ) {
161
-		if ( 'top' === $which ) {
162
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
160
+	protected function display_tablenav($which) {
161
+		if ('top' === $which) {
162
+			wp_nonce_field('bulk-'.$this->_args['plural']);
163 163
 		}
164 164
 		?>
165
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
165
+		<div class="tablenav <?php echo esc_attr($which); ?>">
166 166
 
167 167
 			<div class="alignleft actions bulkactions">
168
-				<?php $this->bulk_actions( $which ); ?>
168
+				<?php $this->bulk_actions($which); ?>
169 169
 			</div>
170 170
 			<?php
171
-			$this->extra_tablenav( $which );
172
-			$this->pagination( $which );
171
+			$this->extra_tablenav($which);
172
+			$this->pagination($which);
173 173
 			?>
174 174
 
175 175
 			<br class="clear"/>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return int Current page number
187 187
 	 */
188 188
 	public function get_paged() {
189
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
189
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
190 190
 	}
191 191
 
192 192
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return void
201 201
 	 */
202
-	function bulk_actions( $which = '' ) {
202
+	function bulk_actions($which = '') {
203 203
 	}
204 204
 
205 205
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 			'posts_per_page' => $this->per_page,
220 220
 		);
221 221
 
222
-		$logs = Give()->logs->get_connected_logs( $log_query );
222
+		$logs = Give()->logs->get_connected_logs($log_query);
223 223
 
224
-		if ( $logs ) {
225
-			foreach ( $logs as $log ) {
224
+		if ($logs) {
225
+			foreach ($logs as $log) {
226 226
 
227 227
 				$logs_data[] = array(
228 228
 					'ID'          => $log->ID,
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		$columns               = $this->get_columns();
255 255
 		$hidden                = array(); // No hidden columns
256 256
 		$sortable              = $this->get_sortable_columns();
257
-		$this->_column_headers = array( $columns, $hidden, $sortable );
257
+		$this->_column_headers = array($columns, $hidden, $sortable);
258 258
 		$this->items           = $this->get_logs();
259
-		$total_items           = Give()->logs->get_log_count( 0, 'update' );
259
+		$total_items           = Give()->logs->get_log_count(0, 'update');
260 260
 
261
-		$this->set_pagination_args( array(
261
+		$this->set_pagination_args(array(
262 262
 				'total_items' => $total_items,
263 263
 				'per_page'    => $this->per_page,
264
-				'total_pages' => ceil( $total_items / $this->per_page ),
264
+				'total_pages' => ceil($total_items / $this->per_page),
265 265
 			)
266 266
 		);
267 267
 	}
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.17
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Core_Settings' ) ) {
18
+if ( ! class_exists('Give_Import_Core_Settings')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Core_Settings.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		 * @return static
69 69
 		 */
70 70
 		public static function get_instance() {
71
-			if ( null === static::$instance ) {
71
+			if (null === static::$instance) {
72 72
 				self::$instance = new static();
73 73
 			}
74 74
 
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 		 * @return void
96 96
 		 */
97 97
 		private function setup_hooks() {
98
-			if ( ! $this->is_donations_import_page() ) {
98
+			if ( ! $this->is_donations_import_page()) {
99 99
 				return;
100 100
 			}
101 101
 
102 102
 			// Do not render main import tools page.
103
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
103
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
104 104
 
105 105
 			// Render donation import page
106
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
106
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
107 107
 
108 108
 			// Print the HTML.
109
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
109
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
110 110
 
111 111
 			// Run when form submit.
112
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
112
+			add_action('give-tools_save_import', array($this, 'save'));
113 113
 
114
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
114
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
115 115
 
116 116
 			// Used to add submit button.
117
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
117
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
118 118
 		}
119 119
 
120 120
 		/**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return mixed
128 128
 		 */
129
-		public function update_notices( $messages ) {
130
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
131
-				unset( $messages['give-setting-updated'] );
129
+		public function update_notices($messages) {
130
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
131
+				unset($messages['give-setting-updated']);
132 132
 			}
133 133
 
134 134
 			return $messages;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @since 1.8.17
141 141
 		 */
142 142
 		public function submit() {
143
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
143
+			wp_nonce_field('give-save-settings', '_give-save-settings');
144 144
 			?>
145 145
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
146 146
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				       id="<?php echo "step-{$step}"; ?>">
164 164
 					<tbody>
165 165
 					<?php
166
-					switch ( $this->get_step() ) {
166
+					switch ($this->get_step()) {
167 167
 						case 1:
168 168
 							$this->render_upload_html();
169 169
 							break;
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 		public function import_success() {
191 191
 			// Imported successfully
192 192
 
193
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
194
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
193
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
194
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
195 195
 			$query_arg_setting = array(
196 196
 				'post_type' => 'give_forms',
197 197
 				'page'      => 'give-settings',
198 198
 			);
199 199
 
200
-			if ( $undo ) {
200
+			if ($undo) {
201 201
 				$success = false;
202 202
 			}
203 203
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
 				'undo'      => 'true',
211 211
 			);
212 212
 
213
-			$title = __( 'Settings Importing Completed!', 'give' );
214
-			if ( $success ) {
213
+			$title = __('Settings Importing Completed!', 'give');
214
+			if ($success) {
215 215
 				$query_arg_success['undo'] = '1';
216 216
 				$query_arg_success['step'] = '3';
217 217
 				$query_arg_success['success'] = '1';
218
-				$text = __( 'Undo Importing', 'give' );
218
+				$text = __('Undo Importing', 'give');
219 219
 			} else {
220
-				if ( $undo ) {
221
-					$host_give_options = get_option( 'give_settings_old', array() );
222
-					update_option( 'give_settings', $host_give_options );
223
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
220
+				if ($undo) {
221
+					$host_give_options = get_option('give_settings_old', array());
222
+					update_option('give_settings', $host_give_options);
223
+					$title = __('Undo of Setting Imported Completed!', 'give');
224 224
 				} else {
225
-					$title = __( 'Failed to import', 'give' );
225
+					$title = __('Failed to import', 'give');
226 226
 				}
227 227
 
228
-				$text = __( 'Importing Again', 'give' );
228
+				$text = __('Importing Again', 'give');
229 229
 			}
230 230
 			?>
231 231
 			<tr valign="top" class="give-import-dropdown">
232 232
 				<th colspan="2">
233 233
 					<h2><?php echo $title; ?></h2>
234 234
 					<p>
235
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
236
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a>
235
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
236
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a>
237 237
 					</p>
238 238
 				</th>
239 239
 			</tr>
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 		 * @since 1.8.17
247 247
 		 */
248 248
 		public function start_import() {
249
-			$type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
250
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
249
+			$type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
250
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
251 251
 
252 252
 			?>
253 253
 			<tr valign="top" class="give-import-dropdown">
254 254
 				<th colspan="2">
255
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
256
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
255
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
256
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
257 257
 				</th>
258 258
 			</tr>
259 259
 
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 			$step = $this->get_step();
287 287
 			?>
288 288
 			<ol class="give-progress-steps">
289
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
290
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
289
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
290
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
291 291
 				</li>
292
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
293
-					<?php esc_html_e( 'Import', 'give' ); ?>
292
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
293
+					<?php esc_html_e('Import', 'give'); ?>
294 294
 				</li>
295
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
296
-					<?php esc_html_e( 'Done!', 'give' ); ?>
295
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
296
+					<?php esc_html_e('Done!', 'give'); ?>
297 297
 				</li>
298 298
 			</ol>
299 299
 			<?php
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 		 * @return int $step on which step doest the import is on.
308 308
 		 */
309 309
 		public function get_step() {
310
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
310
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
311 311
 			$on_step = 1;
312 312
 
313
-			if ( empty( $step ) || 1 === $step ) {
313
+			if (empty($step) || 1 === $step) {
314 314
 				$on_step = 1;
315
-			} elseif ( 2 === $step ) {
315
+			} elseif (2 === $step) {
316 316
 				$on_step = 2;
317
-			} elseif ( 3 === $step ) {
317
+			} elseif (3 === $step) {
318 318
 				$on_step = 3;
319 319
 			}
320 320
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		 * @since 1.8.17
328 328
 		 */
329 329
 		public function render_page() {
330
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
330
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
331 331
 		}
332 332
 
333 333
 		/**
@@ -339,28 +339,28 @@  discard block
 block discarded – undo
339 339
 		 * @return void
340 340
 		 */
341 341
 		public function render_upload_html() {
342
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
343
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
342
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
343
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
344 344
 			$step = $this->get_step();
345 345
 
346 346
 			?>
347 347
 			<tr valign="top">
348 348
 				<th colspan="2">
349
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
350
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p>
349
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
350
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p>
351 351
 				</th>
352 352
 			</tr>
353 353
 
354 354
 			<tr valign="top">
355 355
 				<th scope="row" class="titledesc">
356
-					<label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label>
356
+					<label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label>
357 357
 				</th>
358 358
 				<td class="give-forminp">
359 359
 					<div class="give-field-wrap">
360 360
 						<label for="json">
361 361
 							<input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>"
362 362
 							       accept=".json">
363
-							<p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p>
363
+							<p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p>
364 364
 						</label>
365 365
 					</div>
366 366
 				</td>
@@ -369,20 +369,20 @@  discard block
 block discarded – undo
369 369
 			$settings = array(
370 370
 				array(
371 371
 					'id'          => 'type',
372
-					'name'        => __( 'Merge Type:', 'give' ),
373
-					'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ),
372
+					'name'        => __('Merge Type:', 'give'),
373
+					'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'),
374 374
 					'default'     => $type,
375 375
 					'type'        => 'radio_inline',
376 376
 					'options'     => array(
377
-						'merge'   => __( 'Merge', 'give' ),
378
-						'replace' => __( 'Replace', 'give' ),
377
+						'merge'   => __('Merge', 'give'),
378
+						'replace' => __('Replace', 'give'),
379 379
 					),
380 380
 				),
381 381
 			);
382 382
 
383
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
383
+			$settings = apply_filters('give_import_core_setting_html', $settings);
384 384
 
385
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
385
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
386 386
 			?>
387 387
 			<tr valign="top">
388 388
 				<th></th>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 					<input type="submit"
391 391
 					       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
392 392
 					       id="recount-stats-submit"
393
-					       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
393
+					       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
394 394
 				</th>
395 395
 			</tr>
396 396
 			<?php
@@ -407,20 +407,20 @@  discard block
 block discarded – undo
407 407
 			$step = $this->get_step();
408 408
 
409 409
 			// Validation for first step.
410
-			if ( 1 === $step ) {
411
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
410
+			if (1 === $step) {
411
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
412 412
 				$core_settings = self::upload_widget_settings_file();
413
-				if ( ! empty( $core_settings['error'] ) ) {
414
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
413
+				if ( ! empty($core_settings['error'])) {
414
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
415 415
 				} else {
416
-					$file_path = explode( '/', $core_settings['file'] );
417
-					$count     = ( count( $file_path ) - 1 );
418
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
416
+					$file_path = explode('/', $core_settings['file']);
417
+					$count     = (count($file_path) - 1);
418
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
419 419
 						'step'          => '2',
420 420
 						'importer-type' => $this->importer_type,
421 421
 						'type'          => $type,
422
-						'file_name'     => $file_path[ $count ],
423
-					) ) );
422
+						'file_name'     => $file_path[$count],
423
+					)));
424 424
 
425 425
 					?>
426 426
 					<script type="text/javascript">
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 * @return bool
439 439
 		 */
440 440
 		private function is_donations_import_page() {
441
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
441
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
442 442
 		}
443 443
 
444 444
 		/**
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
 		 */
448 448
 		public static function upload_widget_settings_file() {
449 449
 			$upload = false;
450
-			if ( isset( $_FILES['json'] ) ) {
451
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
450
+			if (isset($_FILES['json'])) {
451
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
452 452
 
453
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
453
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
454 454
 
455
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
455
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
456 456
 			} else {
457
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
457
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
458 458
 			}
459 459
 
460 460
 			return $upload;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		 *
466 466
 		 * @param array $existing_mimes
467 467
 		 */
468
-		public static function json_upload_mimes( $existing_mimes = array() ) {
468
+		public static function json_upload_mimes($existing_mimes = array()) {
469 469
 			$existing_mimes['json'] = 'application/json';
470 470
 
471 471
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
53
+		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/class-give-db-logs-meta.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->logmeta     = $this->table_name = $wpdb->prefix . 'give_logmeta';
53
+		$wpdb->logmeta     = $this->table_name = $wpdb->prefix.'give_logmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return bool
88 88
 	 */
89
-	public function delete_row( $log_id = 0 ) {
89
+	public function delete_row($log_id = 0) {
90 90
 		/* @var WPDB $wpdb */
91 91
 		global $wpdb;
92 92
 
93 93
 		// Row ID must be positive integer
94
-		$log_id = absint( $log_id );
94
+		$log_id = absint($log_id);
95 95
 
96
-		if ( empty( $log_id ) ) {
96
+		if (empty($log_id)) {
97 97
 			return false;
98 98
 		}
99 99
 
100
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) {
100
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE log_id = %d", $log_id))) {
101 101
 			return false;
102 102
 		}
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return bool
116 116
 	 */
117
-	protected function is_valid_post_type( $ID ) {
117
+	protected function is_valid_post_type($ID) {
118 118
 		return $ID && true;
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.