Completed
Push — master ( 82a250...ece35a )
by Devin
38:40 queued 18:41
created
includes/class-give-db-customers.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @since  1.0
159 159
 	 * @access public
160 160
 	 *
161
-	 * @param  bool|string|int $_id_or_email
161
+	 * @param  integer $_id_or_email
162 162
 	 *
163 163
 	 * @return bool|int
164 164
 	 */
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param  int     $user_id       User ID.
314 314
 	 * @param  WP_User $old_user_data User data.
315 315
 	 *
316
-	 * @return bool
316
+	 * @return false|null
317 317
 	 */
318 318
 	public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
319 319
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 * @access public
363 363
 	 *
364 364
 	 * @param  string $field ID or email. Default is 'id'.
365
-	 * @param  mixed  $value The Customer ID or email to search. Default is 0.
365
+	 * @param  integer  $value The Customer ID or email to search. Default is 0.
366 366
 	 *
367 367
 	 * @return mixed         Upon success, an object of the customer. Upon failure, NULL
368 368
 	 */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @since  1.0
429 429
 	 * @access public
430
-     *
431
-     * @param  array $args
432
-     *
433
-     * @return array|object|null Customers array or object. Null if not found.
430
+	 *
431
+	 * @param  array $args
432
+	 *
433
+	 * @return array|object|null Customers array or object. Null if not found.
434 434
 	 */
435 435
 	public function get_customers( $args = array() ) {
436
-        /* @var WPDB $wpdb */
436
+		/* @var WPDB $wpdb */
437 437
 		global $wpdb;
438 438
 
439 439
 		$defaults = array(
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @since  1.0
560 560
 	 * @access public
561
-     *
562
-     * @param  array $args
563
-     *
564
-     * @return int         Total number of customers.
561
+	 *
562
+	 * @param  array $args
563
+	 *
564
+	 * @return int         Total number of customers.
565 565
 	 */
566 566
 	public function count( $args = array() ) {
567
-        /* @var WPDB $wpdb */
567
+		/* @var WPDB $wpdb */
568 568
 		global $wpdb;
569 569
 
570 570
 		$where = ' WHERE 1=1 ';
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param  bool  $_id   Post id. Default is false.
330 330
 	 * @param  array $_args Arguments passed.
331 331
 	 *
332
-	 * @return void
332
+	 * @return boolean
333 333
 	 */
334 334
 	public function __construct( $_id = false, $_args = array() ) {
335 335
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @param  array $data Array of attributes for a donation form.
414 414
 	 *
415
-	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
415
+	 * @return boolean       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417 417
 	public function create( $data = array() ) {
418 418
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 
771 771
 	}
772 772
 
773
-    /**
774
-     * Get if form type set or not.
775
-     *
776
-     * @since  1.6
773
+	/**
774
+	 * Get if form type set or not.
775
+	 *
776
+	 * @since  1.6
777 777
 	 * @access public
778
-     *
778
+	 *
779 779
 	 * @return bool
780 780
 	 *
781 781
 	public function is_set_type_donation_form() {
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1029
-		       );
1026
+				   'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
+			   && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
+			   && ( $this->get_goal() <= $this->get_earnings()
1029
+			   );
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return void
333 333
 	 */
334
-	public function __construct( $_id = false, $_args = array() ) {
334
+	public function __construct($_id = false, $_args = array()) {
335 335
 
336
-		$donation_form = WP_Post::get_instance( $_id );
336
+		$donation_form = WP_Post::get_instance($_id);
337 337
 
338
-		return $this->setup_donation_form( $donation_form );
338
+		return $this->setup_donation_form($donation_form);
339 339
 	}
340 340
 
341 341
 	/**
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return bool                   If the setup was successful or not.
350 350
 	 */
351
-	private function setup_donation_form( $donation_form ) {
351
+	private function setup_donation_form($donation_form) {
352 352
 
353
-		if ( ! is_object( $donation_form ) ) {
353
+		if ( ! is_object($donation_form)) {
354 354
 			return false;
355 355
 		}
356 356
 
357
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
357
+		if ( ! is_a($donation_form, 'WP_Post')) {
358 358
 			return false;
359 359
 		}
360 360
 
361
-		if ( 'give_forms' !== $donation_form->post_type ) {
361
+		if ('give_forms' !== $donation_form->post_type) {
362 362
 			return false;
363 363
 		}
364 364
 
365
-		foreach ( $donation_form as $key => $value ) {
365
+		foreach ($donation_form as $key => $value) {
366 366
 
367
-			switch ( $key ) {
367
+			switch ($key) {
368 368
 
369 369
 				default:
370 370
 					$this->$key = $value;
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 * @return mixed
390 390
 	 * @throws Exception
391 391
 	 */
392
-	public function __get( $key ) {
392
+	public function __get($key) {
393 393
 
394
-		if ( method_exists( $this, 'get_' . $key ) ) {
394
+		if (method_exists($this, 'get_'.$key)) {
395 395
 
396
-			return call_user_func( array( $this, 'get_' . $key ) );
396
+			return call_user_func(array($this, 'get_'.$key));
397 397
 
398 398
 		} else {
399 399
 
400 400
 			/* translators: %s: property key */
401
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
401
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
402 402
 
403 403
 		}
404 404
 
@@ -414,30 +414,30 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417
-	public function create( $data = array() ) {
417
+	public function create($data = array()) {
418 418
 
419
-		if ( $this->id != 0 ) {
419
+		if ($this->id != 0) {
420 420
 			return false;
421 421
 		}
422 422
 
423 423
 		$defaults = array(
424 424
 			'post_type'   => 'give_forms',
425 425
 			'post_status' => 'draft',
426
-			'post_title'  => esc_html__( 'New Donation Form', 'give' )
426
+			'post_title'  => esc_html__('New Donation Form', 'give')
427 427
 		);
428 428
 
429
-		$args = wp_parse_args( $data, $defaults );
429
+		$args = wp_parse_args($data, $defaults);
430 430
 
431 431
 		/**
432 432
 		 * Fired before a donation form is created
433 433
 		 *
434 434
 		 * @param array $args The post object arguments used for creation.
435 435
 		 */
436
-		do_action( 'give_form_pre_create', $args );
436
+		do_action('give_form_pre_create', $args);
437 437
 
438
-		$id = wp_insert_post( $args, true );
438
+		$id = wp_insert_post($args, true);
439 439
 
440
-		$donation_form = WP_Post::get_instance( $id );
440
+		$donation_form = WP_Post::get_instance($id);
441 441
 
442 442
 		/**
443 443
 		 * Fired after a donation form is created
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 		 * @param int   $id   The post ID of the created item.
446 446
 		 * @param array $args The post object arguments used for creation.
447 447
 		 */
448
-		do_action( 'give_form_post_create', $id, $args );
448
+		do_action('give_form_post_create', $id, $args);
449 449
 
450
-		return $this->setup_donation_form( $donation_form );
450
+		return $this->setup_donation_form($donation_form);
451 451
 
452 452
 	}
453 453
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @return string Donation form name.
473 473
 	 */
474 474
 	public function get_name() {
475
-		return get_the_title( $this->ID );
475
+		return get_the_title($this->ID);
476 476
 	}
477 477
 
478 478
 	/**
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function get_price() {
487 487
 
488
-		if ( ! isset( $this->price ) ) {
488
+		if ( ! isset($this->price)) {
489 489
 
490
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
490
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
491 491
 
492
-			if ( $this->price ) {
492
+			if ($this->price) {
493 493
 
494
-				$this->price = give_sanitize_amount( $this->price );
494
+				$this->price = give_sanitize_amount($this->price);
495 495
 
496 496
 			} else {
497 497
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		 * @param string     $price The donation form price.
510 510
 		 * @param string|int $id    The form ID.
511 511
 		 */
512
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
512
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
513 513
 	}
514 514
 
515 515
 	/**
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function get_minimum_price() {
524 524
 
525
-		if ( ! isset( $this->minimum_price ) ) {
525
+		if ( ! isset($this->minimum_price)) {
526 526
 
527
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
528
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
527
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
528
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
529 529
 
530
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
530
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
531 531
 
532
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
532
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
533 533
 
534 534
 			} else {
535 535
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		}
541 541
 
542
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
542
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
543 543
 	}
544 544
 
545 545
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	public function get_prices() {
554 554
 
555
-		if ( ! isset( $this->prices ) ) {
555
+		if ( ! isset($this->prices)) {
556 556
 
557
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
557
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
558 558
 
559 559
 		}
560 560
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @param array $prices The array of mulit-level prices.
567 567
 		 * @param int|string The ID of the form.
568 568
 		 */
569
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
569
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
570 570
 
571 571
 	}
572 572
 
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	public function get_goal() {
582 582
 
583
-		if ( ! isset( $this->goal ) ) {
583
+		if ( ! isset($this->goal)) {
584 584
 
585
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
585
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
586 586
 
587
-			if ( $this->goal ) {
587
+			if ($this->goal) {
588 588
 
589
-				$this->goal = give_sanitize_amount( $this->goal );
589
+				$this->goal = give_sanitize_amount($this->goal);
590 590
 
591 591
 			} else {
592 592
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		}
598 598
 
599
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
599
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
600 600
 
601 601
 	}
602 602
 
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function is_single_price_mode() {
612 612
 
613
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
613
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
614 614
 		$ret    = 0;
615 615
 
616
-		if ( empty( $option ) || $option === 'set' ) {
616
+		if (empty($option) || $option === 'set') {
617 617
 			$ret = 1;
618 618
 		}
619 619
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		 * @param bool $ret Is donation form in single price mode?
626 626
 		 * @param int|string The ID of the donation form.
627 627
 		 */
628
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
628
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
629 629
 
630 630
 	}
631 631
 
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function is_custom_price_mode() {
641 641
 
642
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
642
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
643 643
 		$ret    = 0;
644 644
 
645
-		if ( $option === 'yes' ) {
645
+		if ($option === 'yes') {
646 646
 			$ret = 1;
647 647
 		}
648 648
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		 * @param bool $ret Is donation form in custom price mode?
655 655
 		 * @param int|string The ID of the donation form.
656 656
 		 */
657
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
657
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
658 658
 
659 659
 	}
660 660
 
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 	 */
671 671
 	public function has_variable_prices() {
672 672
 
673
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
673
+		$option = get_post_meta($this->ID, '_give_price_option', true);
674 674
 		$ret    = 0;
675 675
 
676
-		if ( $option === 'multi' ) {
676
+		if ($option === 'multi') {
677 677
 			$ret = 1;
678 678
 		}
679 679
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 		 * @param bool $ret Does donation form have variable prices?
684 684
 		 * @param int|string The ID of the donation form.
685 685
 		 */
686
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
686
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
687 687
 
688 688
 	}
689 689
 
@@ -697,17 +697,17 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function get_type() {
699 699
 
700
-		if ( ! isset( $this->type ) ) {
700
+		if ( ! isset($this->type)) {
701 701
 
702
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
702
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
703 703
 
704
-			if ( empty( $this->type ) ) {
704
+			if (empty($this->type)) {
705 705
 				$this->type = 'set';
706 706
 			}
707 707
 
708 708
 		}
709 709
 
710
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
710
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
711 711
 
712 712
 	}
713 713
 
@@ -723,23 +723,23 @@  discard block
 block discarded – undo
723 723
 	 *
724 724
 	 * @return string
725 725
 	 */
726
-	public function get_form_classes( $args ) {
726
+	public function get_form_classes($args) {
727 727
 
728
-		$float_labels_option = give_is_float_labels_enabled( $args )
728
+		$float_labels_option = give_is_float_labels_enabled($args)
729 729
 			? 'float-labels-enabled'
730 730
 			: '';
731 731
 
732
-		$form_classes_array = apply_filters( 'give_form_classes', array(
732
+		$form_classes_array = apply_filters('give_form_classes', array(
733 733
 			'give-form',
734
-			'give-form-' . $this->ID,
735
-			'give-form-type-' . $this->get_type(),
734
+			'give-form-'.$this->ID,
735
+			'give-form-type-'.$this->get_type(),
736 736
 			$float_labels_option
737
-		), $this->ID, $args );
737
+		), $this->ID, $args);
738 738
 
739 739
 		// Remove empty class names.
740
-		$form_classes_array = array_filter( $form_classes_array );
740
+		$form_classes_array = array_filter($form_classes_array);
741 741
 
742
-		return implode( ' ', $form_classes_array );
742
+		return implode(' ', $form_classes_array);
743 743
 
744 744
 	}
745 745
 
@@ -754,19 +754,19 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return string
756 756
 	 */
757
-	public function get_form_wrap_classes( $args ) {
757
+	public function get_form_wrap_classes($args) {
758 758
 
759
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
759
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
760 760
 			? $args['display_style']
761
-			: get_post_meta( $this->ID, '_give_payment_display', true );
761
+			: get_post_meta($this->ID, '_give_payment_display', true);
762 762
 
763
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
763
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
764 764
 			'give-form-wrap',
765
-			'give-display-' . $display_option
766
-		), $this->ID, $args );
765
+			'give-display-'.$display_option
766
+		), $this->ID, $args);
767 767
 
768 768
 
769
-		return implode( ' ', $form_wrap_classes_array );
769
+		return implode(' ', $form_wrap_classes_array);
770 770
 
771 771
 	}
772 772
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	public function is_multi_type_donation_form() {
797 797
 		$form_type = $this->get_type();
798 798
 
799
-		return ( 'multi' === $form_type ? true : false );
799
+		return ('multi' === $form_type ? true : false);
800 800
 
801 801
 	}
802 802
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 */
811 811
 	public function get_sales() {
812 812
 
813
-		if ( ! isset( $this->sales ) ) {
813
+		if ( ! isset($this->sales)) {
814 814
 
815
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
816
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
815
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
816
+				add_post_meta($this->ID, '_give_form_sales', 0);
817 817
 			} // End if
818 818
 
819
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
819
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
820 820
 
821
-			if ( $this->sales < 0 ) {
821
+			if ($this->sales < 0) {
822 822
 				// Never let sales be less than zero
823 823
 				$this->sales = 0;
824 824
 			}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @return int|false     New number of total sales.
841 841
 	 */
842
-	public function increase_sales( $quantity = 1 ) {
842
+	public function increase_sales($quantity = 1) {
843 843
 
844
-		$sales       = give_get_form_sales_stats( $this->ID );
845
-		$quantity    = absint( $quantity );
844
+		$sales       = give_get_form_sales_stats($this->ID);
845
+		$quantity    = absint($quantity);
846 846
 		$total_sales = $sales + $quantity;
847 847
 
848
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
848
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
849 849
 
850 850
 			$this->sales = $total_sales;
851 851
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return int|false     New number of total sales.
868 868
 	 */
869
-	public function decrease_sales( $quantity = 1 ) {
869
+	public function decrease_sales($quantity = 1) {
870 870
 
871
-		$sales = give_get_form_sales_stats( $this->ID );
871
+		$sales = give_get_form_sales_stats($this->ID);
872 872
 
873 873
 		// Only decrease if not already zero
874
-		if ( $sales > 0 ) {
874
+		if ($sales > 0) {
875 875
 
876
-			$quantity    = absint( $quantity );
876
+			$quantity    = absint($quantity);
877 877
 			$total_sales = $sales - $quantity;
878 878
 
879
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
879
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
880 880
 
881 881
 				$this->sales = $sales;
882 882
 
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	 */
901 901
 	public function get_earnings() {
902 902
 
903
-		if ( ! isset( $this->earnings ) ) {
903
+		if ( ! isset($this->earnings)) {
904 904
 
905
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
906
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
905
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
906
+				add_post_meta($this->ID, '_give_form_earnings', 0);
907 907
 			}
908 908
 
909
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
909
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
910 910
 
911
-			if ( $this->earnings < 0 ) {
911
+			if ($this->earnings < 0) {
912 912
 				// Never let earnings be less than zero
913 913
 				$this->earnings = 0;
914 914
 			}
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 	 *
930 930
 	 * @return float|false
931 931
 	 */
932
-	public function increase_earnings( $amount = 0 ) {
932
+	public function increase_earnings($amount = 0) {
933 933
 
934
-		$earnings   = give_get_form_earnings_stats( $this->ID );
934
+		$earnings   = give_get_form_earnings_stats($this->ID);
935 935
 		$new_amount = $earnings + (float) $amount;
936 936
 
937
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
937
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
938 938
 
939 939
 			$this->earnings = $new_amount;
940 940
 
@@ -956,16 +956,16 @@  discard block
 block discarded – undo
956 956
 	 * 
957 957
 	 * @return float|false
958 958
 	 */
959
-	public function decrease_earnings( $amount ) {
959
+	public function decrease_earnings($amount) {
960 960
 
961
-		$earnings = give_get_form_earnings_stats( $this->ID );
961
+		$earnings = give_get_form_earnings_stats($this->ID);
962 962
 
963
-		if ( $earnings > 0 ) {
963
+		if ($earnings > 0) {
964 964
 			// Only decrease if greater than zero
965 965
 			$new_amount = $earnings - (float) $amount;
966 966
 
967 967
 
968
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
968
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
969 969
 
970 970
 				$this->earnings = $new_amount;
971 971
 
@@ -989,22 +989,22 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @return bool
991 991
 	 */
992
-	public function is_free( $price_id = false ) {
992
+	public function is_free($price_id = false) {
993 993
 
994 994
 		$is_free          = false;
995
-		$variable_pricing = give_has_variable_prices( $this->ID );
995
+		$variable_pricing = give_has_variable_prices($this->ID);
996 996
 
997
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
998
-			$price = give_get_price_option_amount( $this->ID, $price_id );
999
-		} elseif ( ! $variable_pricing ) {
1000
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
997
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
998
+			$price = give_get_price_option_amount($this->ID, $price_id);
999
+		} elseif ( ! $variable_pricing) {
1000
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1001 1001
 		}
1002 1002
 
1003
-		if ( isset( $price ) && (float) $price == 0 ) {
1003
+		if (isset($price) && (float) $price == 0) {
1004 1004
 			$is_free = true;
1005 1005
 		}
1006 1006
 
1007
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1007
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1008 1008
 
1009 1009
 	}
1010 1010
 
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1026
+			       'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
1027
+		       && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1028
+		       && ($this->get_goal() <= $this->get_earnings()
1029 1029
 		       );
1030 1030
 	}
1031 1031
 
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool                            The result of the update query.
1042 1042
 	 */
1043
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1043
+	private function update_meta($meta_key = '', $meta_value = '') {
1044 1044
 
1045 1045
 		/* @var WPDB $wpdb */
1046 1046
 		global $wpdb;
1047 1047
 
1048
-		if ( empty( $meta_key ) ) {
1048
+		if (empty($meta_key)) {
1049 1049
 			return false;
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make sure if it needs to be serialized, we do
1053
-		$meta_value = maybe_serialize( $meta_value );
1053
+		$meta_value = maybe_serialize($meta_value);
1054 1054
 
1055
-		if ( is_numeric( $meta_value ) ) {
1056
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1055
+		if (is_numeric($meta_value)) {
1056
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1057 1057
 		} else {
1058 1058
 			$value_type = "'%s'";
1059 1059
 		}
1060 1060
 
1061
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1061
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1062 1062
 
1063
-		if ( $wpdb->query( $sql ) ) {
1063
+		if ($wpdb->query($sql)) {
1064 1064
 
1065
-			clean_post_cache( $this->ID );
1065
+			clean_post_cache($this->ID);
1066 1066
 
1067 1067
 			return true;
1068 1068
 
Please login to merge, or discard this patch.
includes/class-give-logging.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @param  array $log_data Log entry data.
224 224
 	 * @param  array $log_meta Log entry meta.
225 225
 	 *
226
-	 * @return bool            True if successful, false otherwise.
226
+	 * @return boolean|null            True if successful, false otherwise.
227 227
 	 */
228 228
 	public function update_log( $log_data = array(), $log_meta = array() ) {
229 229
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  * @param  int    $parent  Parent log. Default is 0.
407 407
  * @param  string $type    Log type. Default is null.
408 408
  *
409
- * @return mixed           ID of the new log entry.
409
+ * @return integer           ID of the new log entry.
410 410
  */
411 411
 function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
412 412
 	/* @var Give_Logging $give_logs */
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 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
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	public function __construct() {
37 37
 
38 38
 		// Create the log post type
39
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
39
+		add_action('init', array($this, 'register_post_type'), 1);
40 40
 
41 41
 		// Create types taxonomy and default types
42
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
42
+		add_action('init', array($this, 'register_taxonomy'), 1);
43 43
 
44 44
 	}
45 45
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	public function register_post_type() {
57 57
 		/* Logs post type */
58 58
 		$log_args = array(
59
-			'labels'              => array( 'name' => esc_html__( 'Logs', 'give' ) ),
59
+			'labels'              => array('name' => esc_html__('Logs', 'give')),
60 60
 			'public'              => false,
61 61
 			'exclude_from_search' => true,
62 62
 			'publicly_queryable'  => false,
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 			'query_var'           => false,
65 65
 			'rewrite'             => false,
66 66
 			'capability_type'     => 'post',
67
-			'supports'            => array( 'title', 'editor' ),
67
+			'supports'            => array('title', 'editor'),
68 68
 			'can_export'          => true
69 69
 		);
70 70
 
71
-		register_post_type( 'give_log', $log_args );
71
+		register_post_type('give_log', $log_args);
72 72
 	}
73 73
 
74 74
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	public function register_taxonomy() {
85
-		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
85
+		register_taxonomy('give_log_type', 'give_log', array('public' => false));
86 86
 	}
87 87
 
88 88
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'api_request'
103 103
 		);
104 104
 
105
-		return apply_filters( 'give_log_types', $terms );
105
+		return apply_filters('give_log_types', $terms);
106 106
 	}
107 107
 
108 108
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return bool         Whether log type is valid.
119 119
 	 */
120
-	public function valid_type( $type ) {
121
-		return in_array( $type, $this->log_types() );
120
+	public function valid_type($type) {
121
+		return in_array($type, $this->log_types());
122 122
 	}
123 123
 
124 124
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return int             Log ID.
139 139
 	 */
140
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
140
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
141 141
 		$log_data = array(
142 142
 			'post_title'   => $title,
143 143
 			'post_content' => $message,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'log_type'     => $type
146 146
 		);
147 147
 
148
-		return $this->insert_log( $log_data );
148
+		return $this->insert_log($log_data);
149 149
 	}
150 150
 
151 151
 	/**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return array             An array of the connected logs.
164 164
 	 */
165
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
166
-		return $this->get_connected_logs( array(
165
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
166
+		return $this->get_connected_logs(array(
167 167
 			'post_parent' => $object_id,
168 168
 			'paged'       => $paged,
169 169
 			'log_type'    => $type
170
-		) );
170
+		));
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return int             The ID of the newly created log item.
183 183
 	 */
184
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
184
+	public function insert_log($log_data = array(), $log_meta = array()) {
185 185
 		$defaults = array(
186 186
 			'post_type'    => 'give_log',
187 187
 			'post_status'  => 'publish',
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 			'log_type'     => false
191 191
 		);
192 192
 
193
-		$args = wp_parse_args( $log_data, $defaults );
193
+		$args = wp_parse_args($log_data, $defaults);
194 194
 
195
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
195
+		do_action('give_pre_insert_log', $log_data, $log_meta);
196 196
 
197 197
 		// Store the log entry
198
-		$log_id = wp_insert_post( $args );
198
+		$log_id = wp_insert_post($args);
199 199
 
200 200
 		// Set the log type, if any
201
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
202
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
201
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
202
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
203 203
 		}
204 204
 
205 205
 		// Set log meta, if any
206
-		if ( $log_id && ! empty( $log_meta ) ) {
207
-			foreach ( (array) $log_meta as $key => $meta ) {
208
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
206
+		if ($log_id && ! empty($log_meta)) {
207
+			foreach ((array) $log_meta as $key => $meta) {
208
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
209 209
 			}
210 210
 		}
211 211
 
212
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
212
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
213 213
 
214 214
 		return $log_id;
215 215
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return bool            True if successful, false otherwise.
227 227
 	 */
228
-	public function update_log( $log_data = array(), $log_meta = array() ) {
228
+	public function update_log($log_data = array(), $log_meta = array()) {
229 229
 
230
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
230
+		do_action('give_pre_update_log', $log_data, $log_meta);
231 231
 
232 232
 		$defaults = array(
233 233
 			'post_type'   => 'give_log',
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
 			'post_parent' => 0
236 236
 		);
237 237
 
238
-		$args = wp_parse_args( $log_data, $defaults );
238
+		$args = wp_parse_args($log_data, $defaults);
239 239
 
240 240
 		// Store the log entry
241
-		$log_id = wp_update_post( $args );
241
+		$log_id = wp_update_post($args);
242 242
 
243
-		if ( $log_id && ! empty( $log_meta ) ) {
244
-			foreach ( (array) $log_meta as $key => $meta ) {
245
-				if ( ! empty( $meta ) ) {
246
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
243
+		if ($log_id && ! empty($log_meta)) {
244
+			foreach ((array) $log_meta as $key => $meta) {
245
+				if ( ! empty($meta)) {
246
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
247 247
 				}
248 248
 			}
249 249
 		}
250 250
 
251
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
251
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
252 252
 	}
253 253
 
254 254
 	/**
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return array|false Array if logs were found, false otherwise.
265 265
 	 */
266
-	public function get_connected_logs( $args = array() ) {
266
+	public function get_connected_logs($args = array()) {
267 267
 
268 268
 		$defaults = array(
269 269
 			'post_type'      => 'give_log',
270 270
 			'posts_per_page' => 20,
271 271
 			'post_status'    => 'publish',
272
-			'paged'          => get_query_var( 'paged' ),
272
+			'paged'          => get_query_var('paged'),
273 273
 			'log_type'       => false
274 274
 		);
275 275
 
276
-		$query_args = wp_parse_args( $args, $defaults );
276
+		$query_args = wp_parse_args($args, $defaults);
277 277
 
278
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
278
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
279 279
 			$query_args['tax_query'] = array(
280 280
 				array(
281 281
 					'taxonomy' => 'give_log_type',
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			);
286 286
 		}
287 287
 		
288
-		$logs = get_posts( $query_args );
288
+		$logs = get_posts($query_args);
289 289
 	
290
-		if ( $logs ) {
290
+		if ($logs) {
291 291
 			return $logs;
292 292
 		}
293 293
 
@@ -310,17 +310,17 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @return int                Log count.
312 312
 	 */
313
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
313
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
314 314
 
315 315
 		$query_args = array(
316 316
 			'post_parent'    => $object_id,
317 317
 			'post_type'      => 'give_log',
318
-			'posts_per_page' => - 1,
318
+			'posts_per_page' => -1,
319 319
 			'post_status'    => 'publish',
320 320
 			'fields'         => 'ids',
321 321
 		);
322 322
 
323
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
323
+		if ( ! empty($type) && $this->valid_type($type)) {
324 324
 			$query_args['tax_query'] = array(
325 325
 				array(
326 326
 					'taxonomy' => 'give_log_type',
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 			);
331 331
 		}
332 332
 
333
-		if ( ! empty( $meta_query ) ) {
333
+		if ( ! empty($meta_query)) {
334 334
 			$query_args['meta_query'] = $meta_query;
335 335
 		}
336 336
 
337
-		if ( ! empty( $date_query ) ) {
337
+		if ( ! empty($date_query)) {
338 338
 			$query_args['date_query'] = $date_query;
339 339
 		}
340 340
 
341
-		$logs = new WP_Query( $query_args );
341
+		$logs = new WP_Query($query_args);
342 342
 
343 343
 		return (int) $logs->post_count;
344 344
 	}
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 	 *
358 358
 	 * @return void
359 359
 	 */
360
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) {
360
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
361 361
 		$query_args = array(
362 362
 			'post_parent'    => $object_id,
363 363
 			'post_type'      => 'give_log',
364
-			'posts_per_page' => - 1,
364
+			'posts_per_page' => -1,
365 365
 			'post_status'    => 'publish',
366 366
 			'fields'         => 'ids'
367 367
 		);
368 368
 
369
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
369
+		if ( ! empty($type) && $this->valid_type($type)) {
370 370
 			$query_args['tax_query'] = array(
371 371
 				array(
372 372
 					'taxonomy' => 'give_log_type',
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 			);
377 377
 		}
378 378
 
379
-		if ( ! empty( $meta_query ) ) {
379
+		if ( ! empty($meta_query)) {
380 380
 			$query_args['meta_query'] = $meta_query;
381 381
 		}
382 382
 
383
-		$logs = get_posts( $query_args );
383
+		$logs = get_posts($query_args);
384 384
 
385
-		if ( $logs ) {
386
-			foreach ( $logs as $log ) {
387
-				wp_delete_post( $log, true );
385
+		if ($logs) {
386
+			foreach ($logs as $log) {
387
+				wp_delete_post($log, true);
388 388
 			}
389 389
 		}
390 390
 	}
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
  *
409 409
  * @return mixed           ID of the new log entry.
410 410
  */
411
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
411
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
412 412
 	/* @var Give_Logging $give_logs */
413 413
 	global $give_logs;
414
-	$log = $give_logs->add( $title, $message, $parent, $type );
414
+	$log = $give_logs->add($title, $message, $parent, $type);
415 415
 
416 416
 	return $log;
417 417
 }
Please login to merge, or discard this patch.
includes/class-give-session.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@
 block discarded – undo
192 192
 	 * @param  string $key   Session key.
193 193
 	 * @param  string $value Session variable.
194 194
 	 *
195
-	 * @return mixed         Session variable.
195
+	 * @return string         Session variable.
196 196
 	 */
197 197
 	public function set( $key, $value ) {
198 198
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 	}
183 183
 
184 184
 	/**
185
-     * Set Session
186
-     *
185
+	 * Set Session
186
+	 *
187 187
 	 * Create a new session.
188
-     *
188
+	 *
189 189
 	 * @since  1.0
190 190
 	 * @access public
191 191
 	 *
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * Determines if we should start sessions.
316 316
 	 *
317 317
 	 * @since  1.4
318
-     * @access public
318
+	 * @access public
319 319
 	 *
320 320
 	 * @return bool
321 321
 	 */
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 
353 353
 	/**
354 354
 	 * Maybe Start Session
355
-     *
355
+	 *
356 356
 	 * Starts a new session if one hasn't started yet.
357
-     *
358
-     * @access public
359
-     *
357
+	 *
358
+	 * @access public
359
+	 *
360 360
 	 * @see    http://php.net/manual/en/function.session-set-cookie-params.php
361 361
 	 *
362 362
 	 * @return void
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 
376 376
 	/**
377 377
 	 * Get Session Expiration
378
-     *
378
+	 *
379 379
 	 * Looks at the session cookies and returns the expiration date for this session if applicable
380
-     *
381
-     * @access public
382
-     *
383
-     * @return string Formatted expiration date string.
380
+	 *
381
+	 * @access public
382
+	 *
383
+	 * @return string Formatted expiration date string.
384 384
 	 */
385 385
 	public function get_session_expiration() {
386 386
 
Please login to merge, or discard this patch.
includes/payments/functions.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
  * @param  int $year      Year number. Default is null.
631 631
  * @param  int $hour      Hour number. Default is null.
632 632
  *
633
- * @return int $earnings  Earnings
633
+ * @return double $earnings  Earnings
634 634
  */
635 635
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
636 636
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
  *
933 933
  * @param int $payment_id Payment ID
934 934
  *
935
- * @return array $user_info User Info Meta Values
935
+ * @return string $user_info User Info Meta Values
936 936
  */
937 937
 function give_get_payment_meta_user_info( $payment_id ) {
938 938
 	$payment = new Give_Payment( $payment_id );
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
  *
949 949
  * @param int $payment_id Payment ID
950 950
  *
951
- * @return int $form_id
951
+ * @return string $form_id
952 952
  */
953 953
 function give_get_payment_form_id( $payment_id ) {
954 954
 	$payment = new Give_Payment( $payment_id );
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
  *
995 995
  * @param int $payment_id Payment ID
996 996
  *
997
- * @return string $user_id User ID
997
+ * @return integer $user_id User ID
998 998
  */
999 999
 function give_get_payment_user_id( $payment_id ) {
1000 1000
 	$payment = new Give_Payment( $payment_id );
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @param int $payment_id Payment ID
1011 1011
  *
1012
- * @return string $customer_id Customer ID
1012
+ * @return integer $customer_id Customer ID
1013 1013
  */
1014 1014
 function give_get_payment_customer_id( $payment_id ) {
1015 1015
 	$payment = new Give_Payment( $payment_id );
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
  * @param array $where
1607 1607
  * @param object $wp_comment_query WordPress Comment Query Object
1608 1608
  *
1609
- * @return array $where
1609
+ * @return string $where
1610 1610
  */
1611 1611
 function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1612 1612
 	global $wpdb;
Please login to merge, or discard this patch.
Indentation   +33 added lines, -34 removed lines patch added patch discarded remove patch
@@ -228,7 +228,6 @@  discard block
 block discarded – undo
228 228
  * Deletes a Donation
229 229
  *
230 230
  * @since  1.0
231
-
232 231
  * @global $give_logs
233 232
  *
234 233
  * @param  int  $payment_id      Payment ID (default: 0)
@@ -610,7 +609,7 @@  discard block
 block discarded – undo
610 609
  * Retrieves keys for all available statuses for payments
611 610
  *
612 611
  * @since  1.0
613
-  *
612
+ *
614 613
  * @return array $payment_status All the available payment statuses.
615 614
  */
616 615
 function give_get_payment_status_keys() {
@@ -1807,13 +1806,13 @@  discard block
 block discarded – undo
1807 1806
  * @return string/void
1808 1807
  */
1809 1808
 function give_get_form_dropdown( $args = array(), $echo = false ){
1810
-    $form_dropdown_html = Give()->html->forms_dropdown( $args );
1809
+	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1811 1810
 
1812
-    if( ! $echo ) {
1813
-        return $form_dropdown_html;
1814
-    }
1811
+	if( ! $echo ) {
1812
+		return $form_dropdown_html;
1813
+	}
1815 1814
 
1816
-    echo $form_dropdown_html;
1815
+	echo $form_dropdown_html;
1817 1816
 }
1818 1817
 
1819 1818
 /**
@@ -1828,39 +1827,39 @@  discard block
 block discarded – undo
1828 1827
  */
1829 1828
 function give_get_form_variable_price_dropdown( $args = array(), $echo = false ){
1830 1829
     
1831
-    // Check for give form id.
1832
-    if( empty( $args['id'] ) ) {
1833
-        return false;
1834
-    }
1835
-
1836
-    // Check if form has variable prices or not.
1837
-    if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1838
-        return false;
1839
-    }
1830
+	// Check for give form id.
1831
+	if( empty( $args['id'] ) ) {
1832
+		return false;
1833
+	}
1834
+
1835
+	// Check if form has variable prices or not.
1836
+	if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1837
+		return false;
1838
+	}
1840 1839
     
1841
-    $variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1842
-    $variable_price_options = array();
1840
+	$variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1841
+	$variable_price_options = array();
1843 1842
 
1844
-    // Check if multi donation form support custom donation or not.
1845
-    if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1846
-        $variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1847
-    }
1843
+	// Check if multi donation form support custom donation or not.
1844
+	if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1845
+		$variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1846
+	}
1848 1847
 
1849
-    // Get variable price and ID from variable price array.
1850
-    foreach ( $variable_prices as $variable_price ) {
1851
-        $variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1852
-    }
1848
+	// Get variable price and ID from variable price array.
1849
+	foreach ( $variable_prices as $variable_price ) {
1850
+		$variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1851
+	}
1853 1852
 
1854 1853
 
1855
-    // Update options.
1856
-    $args = array_merge( $args, array( 'options' => $variable_price_options ) );
1854
+	// Update options.
1855
+	$args = array_merge( $args, array( 'options' => $variable_price_options ) );
1857 1856
 
1858
-    // Generate select html.
1859
-    $form_dropdown_html = Give()->html->select( $args );
1857
+	// Generate select html.
1858
+	$form_dropdown_html = Give()->html->select( $args );
1860 1859
 
1861
-    if( ! $echo ) {
1862
-        return $form_dropdown_html;
1863
-    }
1860
+	if( ! $echo ) {
1861
+		return $form_dropdown_html;
1862
+	}
1864 1863
 
1865
-    echo $form_dropdown_html;
1864
+	echo $form_dropdown_html;
1866 1865
 }
1867 1866
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +394 added lines, -394 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return object $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	//Set properties
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
@@ -162,40 +162,40 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	//Add the donation
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array()
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array()
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	//Set date if present
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	//Handle sequential payments
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's purchased cache
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	//Save payment
192 192
 	$payment->save();
193 193
 
194 194
 	//Hook it
195
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
195
+	do_action('give_insert_payment', $payment->ID, $payment_data);
196 196
 
197 197
 	//Return payment ID upon success
198
-	if ( ! empty( $payment->ID ) ) {
198
+	if ( ! empty($payment->ID)) {
199 199
 		return $payment->ID;
200 200
 	}
201 201
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @return bool
216 216
  */
217
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
217
+function give_update_payment_status($payment_id, $new_status = 'publish') {
218 218
 
219
-	$payment         = new Give_Payment( $payment_id );
219
+	$payment         = new Give_Payment($payment_id);
220 220
 	$payment->status = $new_status;
221 221
 	$updated         = $payment->save();
222 222
 
@@ -236,52 +236,52 @@  discard block
 block discarded – undo
236 236
  *
237 237
  * @return void
238 238
  */
239
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
239
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
240 240
 	global $give_logs;
241 241
 
242
-	$payment     = new Give_Payment( $payment_id );
243
-	$amount      = give_get_payment_amount( $payment_id );
242
+	$payment     = new Give_Payment($payment_id);
243
+	$amount      = give_get_payment_amount($payment_id);
244 244
 	$status      = $payment->post_status;
245
-	$customer_id = give_get_payment_customer_id( $payment_id );
246
-	$customer    = new Give_Customer( $customer_id );
245
+	$customer_id = give_get_payment_customer_id($payment_id);
246
+	$customer    = new Give_Customer($customer_id);
247 247
 
248 248
 	//Only undo purchases that aren't these statuses
249
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
249
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
250 250
 		'pending',
251 251
 		'cancelled'
252
-	) );
252
+	));
253 253
 
254
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
255
-		give_undo_purchase( false, $payment_id );
254
+	if ( ! in_array($status, $dont_undo_statuses)) {
255
+		give_undo_purchase(false, $payment_id);
256 256
 	}
257 257
 
258
-	if ( $status == 'publish' ) {
258
+	if ($status == 'publish') {
259 259
 
260 260
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment)
261
-		give_decrease_total_earnings( $amount );
261
+		give_decrease_total_earnings($amount);
262 262
 		// Clear the This Month earnings (this_monththis_month is NOT a typo)
263
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
263
+		delete_transient(md5('give_earnings_this_monththis_month'));
264 264
 
265
-		if ( $customer->id && $update_customer ) {
265
+		if ($customer->id && $update_customer) {
266 266
 
267 267
 			// Decrement the stats for the customer
268 268
 			$customer->decrease_purchase_count();
269
-			$customer->decrease_value( $amount );
269
+			$customer->decrease_value($amount);
270 270
 
271 271
 		}
272 272
 	}
273 273
 
274
-	do_action( 'give_payment_delete', $payment_id );
274
+	do_action('give_payment_delete', $payment_id);
275 275
 
276
-	if ( $customer->id && $update_customer ) {
276
+	if ($customer->id && $update_customer) {
277 277
 
278 278
 		// Remove the payment ID from the customer
279
-		$customer->remove_payment( $payment_id );
279
+		$customer->remove_payment($payment_id);
280 280
 
281 281
 	}
282 282
 
283 283
 	// Remove the payment
284
-	wp_delete_post( $payment_id, true );
284
+	wp_delete_post($payment_id, true);
285 285
 
286 286
 	// Remove related sale log entries
287 287
 	$give_logs->delete_logs(
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		)
296 296
 	);
297 297
 
298
-	do_action( 'give_payment_deleted', $payment_id );
298
+	do_action('give_payment_deleted', $payment_id);
299 299
 }
300 300
 
301 301
 /**
@@ -311,25 +311,25 @@  discard block
 block discarded – undo
311 311
  *
312 312
  * @return void
313 313
  */
314
-function give_undo_purchase( $form_id = false, $payment_id ) {
314
+function give_undo_purchase($form_id = false, $payment_id) {
315 315
 
316
-	if ( ! empty( $form_id ) ) {
316
+	if ( ! empty($form_id)) {
317 317
 		$form_id = false;
318
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
318
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
319 319
 	}
320 320
 
321
-	$payment = new Give_Payment( $payment_id );
321
+	$payment = new Give_Payment($payment_id);
322 322
 
323
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
324
-	if ( true === $maybe_decrease_earnings ) {
323
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
324
+	if (true === $maybe_decrease_earnings) {
325 325
 		// decrease earnings
326
-		give_decrease_earnings( $payment->form_id, $payment->total );
326
+		give_decrease_earnings($payment->form_id, $payment->total);
327 327
 	}
328 328
 
329
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
330
-	if ( true === $maybe_decrease_sales ) {
329
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
330
+	if (true === $maybe_decrease_sales) {
331 331
 		// decrease purchase count
332
-		give_decrease_purchase_count( $payment->form_id );
332
+		give_decrease_purchase_count($payment->form_id);
333 333
 	}
334 334
 
335 335
 }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return array $count Number of payments sorted by payment status
348 348
  */
349
-function give_count_payments( $args = array() ) {
349
+function give_count_payments($args = array()) {
350 350
 
351 351
 	global $wpdb;
352 352
 
@@ -358,18 +358,18 @@  discard block
 block discarded – undo
358 358
 		'form_id'    => null,
359 359
 	);
360 360
 
361
-	$args = wp_parse_args( $args, $defaults );
361
+	$args = wp_parse_args($args, $defaults);
362 362
 
363 363
 	$select = "SELECT p.post_status,count( * ) AS num_posts";
364 364
 	$join   = '';
365 365
 	$where  = "WHERE p.post_type = 'give_payment'";
366 366
 
367 367
 	// Count payments for a specific user
368
-	if ( ! empty( $args['user'] ) ) {
368
+	if ( ! empty($args['user'])) {
369 369
 
370
-		if ( is_email( $args['user'] ) ) {
370
+		if (is_email($args['user'])) {
371 371
 			$field = 'email';
372
-		} elseif ( is_numeric( $args['user'] ) ) {
372
+		} elseif (is_numeric($args['user'])) {
373 373
 			$field = 'id';
374 374
 		} else {
375 375
 			$field = '';
@@ -377,108 +377,108 @@  discard block
 block discarded – undo
377 377
 
378 378
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
379 379
 
380
-		if ( ! empty( $field ) ) {
380
+		if ( ! empty($field)) {
381 381
 			$where .= "
382 382
 				AND m.meta_key = '_give_payment_user_{$field}'
383 383
 				AND m.meta_value = '{$args['user']}'";
384 384
 		}
385 385
 
386 386
 		// Count payments for a search
387
-	} elseif ( ! empty( $args['s'] ) ) {
387
+	} elseif ( ! empty($args['s'])) {
388 388
 
389
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
389
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
390 390
 
391
-			if ( is_email( $args['s'] ) ) {
391
+			if (is_email($args['s'])) {
392 392
 				$field = '_give_payment_user_email';
393 393
 			} else {
394 394
 				$field = '_give_payment_purchase_key';
395 395
 			}
396 396
 
397 397
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
398
-			$where .= $wpdb->prepare( "
398
+			$where .= $wpdb->prepare("
399 399
 				AND m.meta_key = %s
400 400
 				AND m.meta_value = %s",
401 401
 				$field,
402 402
 				$args['s']
403 403
 			);
404 404
 
405
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
405
+		} elseif ('#' == substr($args['s'], 0, 1)) {
406 406
 
407
-			$search = str_replace( '#:', '', $args['s'] );
408
-			$search = str_replace( '#', '', $search );
407
+			$search = str_replace('#:', '', $args['s']);
408
+			$search = str_replace('#', '', $search);
409 409
 
410 410
 			$select = "SELECT p2.post_status,count( * ) AS num_posts ";
411 411
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
412 412
 			$join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
413 413
 			$where = "WHERE p.post_type = 'give_log' ";
414
-			$where .= $wpdb->prepare( "AND p.post_parent = %d} ", $search );
414
+			$where .= $wpdb->prepare("AND p.post_parent = %d} ", $search);
415 415
 
416
-		} elseif ( is_numeric( $args['s'] ) ) {
416
+		} elseif (is_numeric($args['s'])) {
417 417
 
418 418
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
419
-			$where .= $wpdb->prepare( "
419
+			$where .= $wpdb->prepare("
420 420
 				AND m.meta_key = '_give_payment_user_id'
421 421
 				AND m.meta_value = %d",
422 422
 				$args['s']
423 423
 			);
424 424
 
425 425
 		} else {
426
-			$search = $wpdb->esc_like( $args['s'] );
427
-			$search = '%' . $search . '%';
426
+			$search = $wpdb->esc_like($args['s']);
427
+			$search = '%'.$search.'%';
428 428
 
429
-			$where .= $wpdb->prepare( "AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search );
429
+			$where .= $wpdb->prepare("AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search);
430 430
 		}
431 431
 
432 432
 	}
433 433
 
434
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
434
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
435 435
 
436
-		$where .= $wpdb->prepare( " AND p.post_parent = %d", $args['form_id'] );
436
+		$where .= $wpdb->prepare(" AND p.post_parent = %d", $args['form_id']);
437 437
 
438 438
 	}
439 439
 	// Limit payments count by date
440
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
440
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
441 441
 
442
-		$date_parts = explode( '/', $args['start-date'] );
443
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
444
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
445
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
442
+		$date_parts = explode('/', $args['start-date']);
443
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
444
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
445
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
446 446
 
447
-		$is_date = checkdate( $month, $day, $year );
448
-		if ( false !== $is_date ) {
447
+		$is_date = checkdate($month, $day, $year);
448
+		if (false !== $is_date) {
449 449
 
450
-			$date = new DateTime( $args['start-date'] );
451
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
450
+			$date = new DateTime($args['start-date']);
451
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
452 452
 
453 453
 		}
454 454
 
455 455
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class)
456
-		if ( empty( $args['end-date'] ) ) {
456
+		if (empty($args['end-date'])) {
457 457
 			$args['end-date'] = $args['start-date'];
458 458
 		}
459 459
 
460 460
 	}
461 461
 
462
-	if ( ! empty ( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
462
+	if ( ! empty ($args['end-date']) && false !== strpos($args['end-date'], '/')) {
463 463
 
464
-		$date_parts = explode( '/', $args['end-date'] );
464
+		$date_parts = explode('/', $args['end-date']);
465 465
 
466
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
467
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
468
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
466
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
467
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
468
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
469 469
 
470
-		$is_date = checkdate( $month, $day, $year );
471
-		if ( false !== $is_date ) {
470
+		$is_date = checkdate($month, $day, $year);
471
+		if (false !== $is_date) {
472 472
 
473
-			$date = new DateTime( $args['end-date'] );
474
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
473
+			$date = new DateTime($args['end-date']);
474
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
475 475
 
476 476
 		}
477 477
 
478 478
 	}
479 479
 
480
-	$where = apply_filters( 'give_count_payments_where', $where );
481
-	$join  = apply_filters( 'give_count_payments_join', $join );
480
+	$where = apply_filters('give_count_payments_where', $where);
481
+	$join  = apply_filters('give_count_payments_join', $join);
482 482
 
483 483
 	$query = "$select
484 484
 		FROM $wpdb->posts p
@@ -487,36 +487,36 @@  discard block
 block discarded – undo
487 487
 		GROUP BY p.post_status
488 488
 	";
489 489
 
490
-	$cache_key = md5( $query );
490
+	$cache_key = md5($query);
491 491
 
492
-	$count = wp_cache_get( $cache_key, 'counts' );
493
-	if ( false !== $count ) {
492
+	$count = wp_cache_get($cache_key, 'counts');
493
+	if (false !== $count) {
494 494
 		return $count;
495 495
 	}
496 496
 
497
-	$count = $wpdb->get_results( $query, ARRAY_A );
497
+	$count = $wpdb->get_results($query, ARRAY_A);
498 498
 
499 499
 	$stats    = array();
500 500
 	$statuses = get_post_stati();
501
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
502
-		unset( $statuses['private'] );
501
+	if (isset($statuses['private']) && empty($args['s'])) {
502
+		unset($statuses['private']);
503 503
 	}
504 504
 
505
-	foreach ( $statuses as $state ) {
506
-		$stats[ $state ] = 0;
505
+	foreach ($statuses as $state) {
506
+		$stats[$state] = 0;
507 507
 	}
508 508
 
509
-	foreach ( (array) $count as $row ) {
509
+	foreach ((array) $count as $row) {
510 510
 
511
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
511
+		if ('private' == $row['post_status'] && empty($args['s'])) {
512 512
 			continue;
513 513
 		}
514 514
 
515
-		$stats[ $row['post_status'] ] = $row['num_posts'];
515
+		$stats[$row['post_status']] = $row['num_posts'];
516 516
 	}
517 517
 
518 518
 	$stats = (object) $stats;
519
-	wp_cache_set( $cache_key, $stats, 'counts' );
519
+	wp_cache_set($cache_key, $stats, 'counts');
520 520
 
521 521
 	return $stats;
522 522
 }
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
  *
532 532
  * @return bool             True if payment exists, false otherwise
533 533
  */
534
-function give_check_for_existing_payment( $payment_id ) {
534
+function give_check_for_existing_payment($payment_id) {
535 535
 	$exists  = false;
536
-	$payment = new Give_Payment( $payment_id );
536
+	$payment = new Give_Payment($payment_id);
537 537
 
538 538
 
539
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
539
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
540 540
 		$exists = true;
541 541
 	}
542 542
 
@@ -553,29 +553,29 @@  discard block
 block discarded – undo
553 553
  *
554 554
  * @return bool|mixed           True if payment status exists, false otherwise
555 555
  */
556
-function give_get_payment_status( $payment, $return_label = false ) {
556
+function give_get_payment_status($payment, $return_label = false) {
557 557
 
558
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
558
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
559 559
 		return false;
560 560
 	}
561 561
 
562 562
 	$statuses = give_get_payment_statuses();
563 563
 
564
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
564
+	if ( ! is_array($statuses) || empty($statuses)) {
565 565
 		return false;
566 566
 	}
567 567
 
568
-	$payment = new Give_Payment( $payment->ID );
568
+	$payment = new Give_Payment($payment->ID);
569 569
 
570
-	if ( array_key_exists( $payment->status, $statuses ) ) {
571
-		if ( true === $return_label ) {
572
-			return $statuses[ $payment->status ];
570
+	if (array_key_exists($payment->status, $statuses)) {
571
+		if (true === $return_label) {
572
+			return $statuses[$payment->status];
573 573
 		} else {
574 574
 			// Account that our 'publish' status is labeled 'Complete'
575 575
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
576 576
 
577 577
 			// Make sure we're matching cases, since they matter
578
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
578
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
579 579
 		}
580 580
 	}
581 581
 
@@ -591,17 +591,17 @@  discard block
 block discarded – undo
591 591
  */
592 592
 function give_get_payment_statuses() {
593 593
 	$payment_statuses = array(
594
-		'pending'     => esc_html__( 'Pending', 'give' ),
595
-		'publish'     => esc_html__( 'Complete', 'give' ),
596
-		'refunded'    => esc_html__( 'Refunded', 'give' ),
597
-		'failed'      => esc_html__( 'Failed', 'give' ),
598
-		'cancelled'   => esc_html__( 'Cancelled', 'give' ),
599
-		'abandoned'   => esc_html__( 'Abandoned', 'give' ),
600
-		'preapproval' => esc_html__( 'Pre-Approved', 'give' ),
601
-		'revoked'     => esc_html__( 'Revoked', 'give' )
594
+		'pending'     => esc_html__('Pending', 'give'),
595
+		'publish'     => esc_html__('Complete', 'give'),
596
+		'refunded'    => esc_html__('Refunded', 'give'),
597
+		'failed'      => esc_html__('Failed', 'give'),
598
+		'cancelled'   => esc_html__('Cancelled', 'give'),
599
+		'abandoned'   => esc_html__('Abandoned', 'give'),
600
+		'preapproval' => esc_html__('Pre-Approved', 'give'),
601
+		'revoked'     => esc_html__('Revoked', 'give')
602 602
 	);
603 603
 
604
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
604
+	return apply_filters('give_payment_statuses', $payment_statuses);
605 605
 }
606 606
 
607 607
 /**
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
  * @return array $payment_status All the available payment statuses.
615 615
  */
616 616
 function give_get_payment_status_keys() {
617
-	$statuses = array_keys( give_get_payment_statuses() );
618
-	asort( $statuses );
617
+	$statuses = array_keys(give_get_payment_statuses());
618
+	asort($statuses);
619 619
 
620
-	return array_values( $statuses );
620
+	return array_values($statuses);
621 621
 }
622 622
 
623 623
 /**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
  *
633 633
  * @return int $earnings  Earnings
634 634
  */
635
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
635
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
636 636
 
637 637
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead
638 638
 
@@ -643,41 +643,41 @@  discard block
 block discarded – undo
643 643
 		'nopaging'               => true,
644 644
 		'year'                   => $year,
645 645
 		'monthnum'               => $month_num,
646
-		'post_status'            => array( 'publish' ),
646
+		'post_status'            => array('publish'),
647 647
 		'fields'                 => 'ids',
648 648
 		'update_post_term_cache' => false
649 649
 	);
650
-	if ( ! empty( $day ) ) {
650
+	if ( ! empty($day)) {
651 651
 		$args['day'] = $day;
652 652
 	}
653 653
 
654
-	if ( ! empty( $hour ) ) {
654
+	if ( ! empty($hour)) {
655 655
 		$args['hour'] = $hour;
656 656
 	}
657 657
 
658
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
659
-	$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
658
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
659
+	$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
660 660
 
661
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
661
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
662 662
 		$earnings = false;
663 663
 	} else {
664
-		$earnings = get_transient( $key );
664
+		$earnings = get_transient($key);
665 665
 	}
666 666
 
667
-	if ( false === $earnings ) {
668
-		$sales    = get_posts( $args );
667
+	if (false === $earnings) {
668
+		$sales    = get_posts($args);
669 669
 		$earnings = 0;
670
-		if ( $sales ) {
671
-			$sales = implode( ',', $sales );
670
+		if ($sales) {
671
+			$sales = implode(',', $sales);
672 672
 
673
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
673
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
674 674
 
675 675
 		}
676 676
 		// Cache the results for one hour
677
-		set_transient( $key, $earnings, HOUR_IN_SECONDS );
677
+		set_transient($key, $earnings, HOUR_IN_SECONDS);
678 678
 	}
679 679
 
680
-	return round( $earnings, 2 );
680
+	return round($earnings, 2);
681 681
 }
682 682
 
683 683
 /**
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
  *
693 693
  * @return int $count     Sales
694 694
  */
695
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
695
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
696 696
 
697 697
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead
698 698
 	$args = array(
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 		'nopaging'               => true,
701 701
 		'year'                   => $year,
702 702
 		'fields'                 => 'ids',
703
-		'post_status'            => array( 'publish' ),
703
+		'post_status'            => array('publish'),
704 704
 		'update_post_meta_cache' => false,
705 705
 		'update_post_term_cache' => false
706 706
 	);
707 707
 
708
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
708
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
709 709
 
710
-	if ( false === $show_free ) {
710
+	if (false === $show_free) {
711 711
 		$args['meta_query'] = array(
712 712
 			array(
713 713
 				'key'     => '_give_payment_total',
@@ -718,33 +718,33 @@  discard block
 block discarded – undo
718 718
 		);
719 719
 	}
720 720
 
721
-	if ( ! empty( $month_num ) ) {
721
+	if ( ! empty($month_num)) {
722 722
 		$args['monthnum'] = $month_num;
723 723
 	}
724 724
 
725
-	if ( ! empty( $day ) ) {
725
+	if ( ! empty($day)) {
726 726
 		$args['day'] = $day;
727 727
 	}
728 728
 
729
-	if ( ! empty( $hour ) ) {
729
+	if ( ! empty($hour)) {
730 730
 		$args['hour'] = $hour;
731 731
 	}
732 732
 
733
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
733
+	$args = apply_filters('give_get_sales_by_date_args', $args);
734 734
 
735
-	$key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
735
+	$key = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
736 736
 
737
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
737
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
738 738
 		$count = false;
739 739
 	} else {
740
-		$count = get_transient( $key );
740
+		$count = get_transient($key);
741 741
 	}
742 742
 
743
-	if ( false === $count ) {
744
-		$sales = new WP_Query( $args );
743
+	if (false === $count) {
744
+		$sales = new WP_Query($args);
745 745
 		$count = (int) $sales->post_count;
746 746
 		// Cache the results for one hour
747
-		set_transient( $key, $count, HOUR_IN_SECONDS );
747
+		set_transient($key, $count, HOUR_IN_SECONDS);
748 748
 	}
749 749
 
750 750
 	return $count;
@@ -759,20 +759,20 @@  discard block
 block discarded – undo
759 759
  *
760 760
  * @return bool            True if complete, false otherwise.
761 761
  */
762
-function give_is_payment_complete( $payment_id ) {
763
-	$payment = new Give_Payment( $payment_id );
762
+function give_is_payment_complete($payment_id) {
763
+	$payment = new Give_Payment($payment_id);
764 764
 
765 765
 	$ret = false;
766 766
 
767
-	if ( $payment->ID > 0 ) {
767
+	if ($payment->ID > 0) {
768 768
 
769
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
769
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
770 770
 			$ret = true;
771 771
 		}
772 772
 
773 773
 	}
774 774
 
775
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
775
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
776 776
 }
777 777
 
778 778
 /**
@@ -798,29 +798,29 @@  discard block
 block discarded – undo
798 798
  */
799 799
 function give_get_total_earnings() {
800 800
 
801
-	$total = get_option( 'give_earnings_total', false );
801
+	$total = get_option('give_earnings_total', false);
802 802
 
803 803
 	// If no total stored in DB, use old method of calculating total earnings
804
-	if ( false === $total ) {
804
+	if (false === $total) {
805 805
 
806 806
 		global $wpdb;
807 807
 
808
-		$total = get_transient( 'give_earnings_total' );
808
+		$total = get_transient('give_earnings_total');
809 809
 
810
-		if ( false === $total ) {
810
+		if (false === $total) {
811 811
 
812 812
 			$total = (float) 0;
813 813
 
814
-			$args = apply_filters( 'give_get_total_earnings_args', array(
814
+			$args = apply_filters('give_get_total_earnings_args', array(
815 815
 				'offset' => 0,
816
-				'number' => - 1,
817
-				'status' => array( 'publish' ),
816
+				'number' => -1,
817
+				'status' => array('publish'),
818 818
 				'fields' => 'ids'
819
-			) );
819
+			));
820 820
 
821 821
 
822
-			$payments = give_get_payments( $args );
823
-			if ( $payments ) {
822
+			$payments = give_get_payments($args);
823
+			if ($payments) {
824 824
 
825 825
 				/*
826 826
 				 * If performing a purchase, we need to skip the very last payment in the database, since it calls
@@ -828,30 +828,30 @@  discard block
 block discarded – undo
828 828
 				 * first purchase
829 829
 				 */
830 830
 
831
-				if ( did_action( 'give_update_payment_status' ) ) {
832
-					array_pop( $payments );
831
+				if (did_action('give_update_payment_status')) {
832
+					array_pop($payments);
833 833
 				}
834 834
 
835
-				if ( ! empty( $payments ) ) {
836
-					$payments = implode( ',', $payments );
837
-					$total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
835
+				if ( ! empty($payments)) {
836
+					$payments = implode(',', $payments);
837
+					$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
838 838
 				}
839 839
 
840 840
 			}
841 841
 
842 842
 			// Cache results for 1 day. This cache is cleared automatically when a payment is made
843
-			set_transient( 'give_earnings_total', $total, 86400 );
843
+			set_transient('give_earnings_total', $total, 86400);
844 844
 
845 845
 			// Store the total for the first time
846
-			update_option( 'give_earnings_total', $total );
846
+			update_option('give_earnings_total', $total);
847 847
 		}
848 848
 	}
849 849
 
850
-	if ( $total < 0 ) {
850
+	if ($total < 0) {
851 851
 		$total = 0; // Don't ever show negative earnings
852 852
 	}
853 853
 
854
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
854
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
855 855
 }
856 856
 
857 857
 /**
@@ -864,10 +864,10 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return float $total  Total earnings.
866 866
  */
867
-function give_increase_total_earnings( $amount = 0 ) {
867
+function give_increase_total_earnings($amount = 0) {
868 868
 	$total = give_get_total_earnings();
869 869
 	$total += $amount;
870
-	update_option( 'give_earnings_total', $total );
870
+	update_option('give_earnings_total', $total);
871 871
 
872 872
 	return $total;
873 873
 }
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @return float $total Total earnings
883 883
  */
884
-function give_decrease_total_earnings( $amount = 0 ) {
884
+function give_decrease_total_earnings($amount = 0) {
885 885
 	$total = give_get_total_earnings();
886 886
 	$total -= $amount;
887
-	if ( $total < 0 ) {
887
+	if ($total < 0) {
888 888
 		$total = 0;
889 889
 	}
890
-	update_option( 'give_earnings_total', $total );
890
+	update_option('give_earnings_total', $total);
891 891
 
892 892
 	return $total;
893 893
 }
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
  *
904 904
  * @return mixed $meta Payment Meta
905 905
  */
906
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
907
-	$payment = new Give_Payment( $payment_id );
906
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
907
+	$payment = new Give_Payment($payment_id);
908 908
 
909
-	return $payment->get_meta( $meta_key, $single );
909
+	return $payment->get_meta($meta_key, $single);
910 910
 }
911 911
 
912 912
 /**
@@ -919,10 +919,10 @@  discard block
 block discarded – undo
919 919
  *
920 920
  * @return mixed               Meta ID if successful, false if unsuccessful
921 921
  */
922
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
923
-	$payment = new Give_Payment( $payment_id );
922
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
923
+	$payment = new Give_Payment($payment_id);
924 924
 
925
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
925
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
926 926
 }
927 927
 
928 928
 /**
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return array $user_info User Info Meta Values
936 936
  */
937
-function give_get_payment_meta_user_info( $payment_id ) {
938
-	$payment = new Give_Payment( $payment_id );
937
+function give_get_payment_meta_user_info($payment_id) {
938
+	$payment = new Give_Payment($payment_id);
939 939
 
940 940
 	return $payment->user_info;
941 941
 }
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
  *
951 951
  * @return int $form_id
952 952
  */
953
-function give_get_payment_form_id( $payment_id ) {
954
-	$payment = new Give_Payment( $payment_id );
953
+function give_get_payment_form_id($payment_id) {
954
+	$payment = new Give_Payment($payment_id);
955 955
 
956 956
 	return $payment->form_id;
957 957
 }
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
  *
966 966
  * @return string $email User Email
967 967
  */
968
-function give_get_payment_user_email( $payment_id ) {
969
-	$payment = new Give_Payment( $payment_id );
968
+function give_get_payment_user_email($payment_id) {
969
+	$payment = new Give_Payment($payment_id);
970 970
 
971 971
 	return $payment->email;
972 972
 }
@@ -980,11 +980,11 @@  discard block
 block discarded – undo
980 980
  *
981 981
  * @return bool            If the payment is associated with a user (false) or not (true)
982 982
  */
983
-function give_is_guest_payment( $payment_id ) {
984
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
985
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
983
+function give_is_guest_payment($payment_id) {
984
+	$payment_user_id  = give_get_payment_user_id($payment_id);
985
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
986 986
 
987
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
987
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
988 988
 }
989 989
 
990 990
 /**
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
  *
997 997
  * @return string $user_id User ID
998 998
  */
999
-function give_get_payment_user_id( $payment_id ) {
1000
-	$payment = new Give_Payment( $payment_id );
999
+function give_get_payment_user_id($payment_id) {
1000
+	$payment = new Give_Payment($payment_id);
1001 1001
 
1002 1002
 	return $payment->user_id;
1003 1003
 }
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
  *
1012 1012
  * @return string $customer_id Customer ID
1013 1013
  */
1014
-function give_get_payment_customer_id( $payment_id ) {
1015
-	$payment = new Give_Payment( $payment_id );
1014
+function give_get_payment_customer_id($payment_id) {
1015
+	$payment = new Give_Payment($payment_id);
1016 1016
 
1017 1017
 	return $payment->customer_id;
1018 1018
 }
@@ -1026,8 +1026,8 @@  discard block
 block discarded – undo
1026 1026
  *
1027 1027
  * @return string $ip User IP
1028 1028
  */
1029
-function give_get_payment_user_ip( $payment_id ) {
1030
-	$payment = new Give_Payment( $payment_id );
1029
+function give_get_payment_user_ip($payment_id) {
1030
+	$payment = new Give_Payment($payment_id);
1031 1031
 
1032 1032
 	return $payment->ip;
1033 1033
 }
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @return string $date The date the payment was completed
1043 1043
  */
1044
-function give_get_payment_completed_date( $payment_id = 0 ) {
1045
-	$payment = new Give_Payment( $payment_id );
1044
+function give_get_payment_completed_date($payment_id = 0) {
1045
+	$payment = new Give_Payment($payment_id);
1046 1046
 
1047 1047
 	return $payment->completed_date;
1048 1048
 }
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
  *
1057 1057
  * @return string $gateway Gateway
1058 1058
  */
1059
-function give_get_payment_gateway( $payment_id ) {
1060
-	$payment = new Give_Payment( $payment_id );
1059
+function give_get_payment_gateway($payment_id) {
1060
+	$payment = new Give_Payment($payment_id);
1061 1061
 
1062 1062
 	return $payment->gateway;
1063 1063
 }
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
  *
1072 1072
  * @return string $currency The currency code
1073 1073
  */
1074
-function give_get_payment_currency_code( $payment_id = 0 ) {
1075
-	$payment = new Give_Payment( $payment_id );
1074
+function give_get_payment_currency_code($payment_id = 0) {
1075
+	$payment = new Give_Payment($payment_id);
1076 1076
 
1077 1077
 	return $payment->currency;
1078 1078
 }
@@ -1086,10 +1086,10 @@  discard block
 block discarded – undo
1086 1086
  *
1087 1087
  * @return string $currency The currency name
1088 1088
  */
1089
-function give_get_payment_currency( $payment_id = 0 ) {
1090
-	$currency = give_get_payment_currency_code( $payment_id );
1089
+function give_get_payment_currency($payment_id = 0) {
1090
+	$currency = give_get_payment_currency_code($payment_id);
1091 1091
 
1092
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1092
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1093 1093
 }
1094 1094
 
1095 1095
 /**
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return string $key Purchase key
1103 1103
  */
1104
-function give_get_payment_key( $payment_id = 0 ) {
1105
-	$payment = new Give_Payment( $payment_id );
1104
+function give_get_payment_key($payment_id = 0) {
1105
+	$payment = new Give_Payment($payment_id);
1106 1106
 
1107 1107
 	return $payment->key;
1108 1108
 }
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
  *
1119 1119
  * @return string $number Payment order number
1120 1120
  */
1121
-function give_get_payment_number( $payment_id = 0 ) {
1122
-	$payment = new Give_Payment( $payment_id );
1121
+function give_get_payment_number($payment_id = 0) {
1122
+	$payment = new Give_Payment($payment_id);
1123 1123
 
1124 1124
 	return $payment->number;
1125 1125
 }
@@ -1133,23 +1133,23 @@  discard block
 block discarded – undo
1133 1133
  *
1134 1134
  * @return string      The formatted payment number
1135 1135
  */
1136
-function give_format_payment_number( $number ) {
1136
+function give_format_payment_number($number) {
1137 1137
 
1138
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1138
+	if ( ! give_get_option('enable_sequential')) {
1139 1139
 		return $number;
1140 1140
 	}
1141 1141
 
1142
-	if ( ! is_numeric( $number ) ) {
1142
+	if ( ! is_numeric($number)) {
1143 1143
 		return $number;
1144 1144
 	}
1145 1145
 
1146
-	$prefix  = give_get_option( 'sequential_prefix' );
1147
-	$number  = absint( $number );
1148
-	$postfix = give_get_option( 'sequential_postfix' );
1146
+	$prefix  = give_get_option('sequential_prefix');
1147
+	$number  = absint($number);
1148
+	$postfix = give_get_option('sequential_postfix');
1149 1149
 
1150
-	$formatted_number = $prefix . $number . $postfix;
1150
+	$formatted_number = $prefix.$number.$postfix;
1151 1151
 
1152
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1152
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1153 1153
 }
1154 1154
 
1155 1155
 /**
@@ -1162,17 +1162,17 @@  discard block
 block discarded – undo
1162 1162
  */
1163 1163
 function give_get_next_payment_number() {
1164 1164
 
1165
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1165
+	if ( ! give_get_option('enable_sequential')) {
1166 1166
 		return false;
1167 1167
 	}
1168 1168
 
1169
-	$number           = get_option( 'give_last_payment_number' );
1170
-	$start            = give_get_option( 'sequential_start', 1 );
1169
+	$number           = get_option('give_last_payment_number');
1170
+	$start            = give_get_option('sequential_start', 1);
1171 1171
 	$increment_number = true;
1172 1172
 
1173
-	if ( false !== $number ) {
1173
+	if (false !== $number) {
1174 1174
 
1175
-		if ( empty( $number ) ) {
1175
+		if (empty($number)) {
1176 1176
 
1177 1177
 			$number           = $start;
1178 1178
 			$increment_number = false;
@@ -1182,24 +1182,24 @@  discard block
 block discarded – undo
1182 1182
 	} else {
1183 1183
 
1184 1184
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason
1185
-		$payments     = new Give_Payments_Query( array(
1185
+		$payments = new Give_Payments_Query(array(
1186 1186
 			'number'  => 1,
1187 1187
 			'order'   => 'DESC',
1188 1188
 			'orderby' => 'ID',
1189 1189
 			'output'  => 'posts',
1190 1190
 			'fields'  => 'ids'
1191
-		) );
1191
+		));
1192 1192
 		$last_payment = $payments->get_payments();
1193 1193
 
1194
-		if ( ! empty( $last_payment ) ) {
1194
+		if ( ! empty($last_payment)) {
1195 1195
 
1196
-			$number = give_get_payment_number( $last_payment[0] );
1196
+			$number = give_get_payment_number($last_payment[0]);
1197 1197
 
1198 1198
 		}
1199 1199
 
1200
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1200
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1201 1201
 
1202
-			$number = give_remove_payment_prefix_postfix( $number );
1202
+			$number = give_remove_payment_prefix_postfix($number);
1203 1203
 
1204 1204
 		} else {
1205 1205
 
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	}
1211 1211
 
1212
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1212
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1213 1213
 
1214
-	if ( $increment_number ) {
1215
-		$number ++;
1214
+	if ($increment_number) {
1215
+		$number++;
1216 1216
 	}
1217 1217
 
1218
-	return apply_filters( 'give_get_next_payment_number', $number );
1218
+	return apply_filters('give_get_next_payment_number', $number);
1219 1219
 }
1220 1220
 
1221 1221
 /**
@@ -1227,25 +1227,25 @@  discard block
 block discarded – undo
1227 1227
  *
1228 1228
  * @return string          The new Payment number without prefix and postfix
1229 1229
  */
1230
-function give_remove_payment_prefix_postfix( $number ) {
1230
+function give_remove_payment_prefix_postfix($number) {
1231 1231
 
1232
-	$prefix  = give_get_option( 'sequential_prefix' );
1233
-	$postfix = give_get_option( 'sequential_postfix' );
1232
+	$prefix  = give_get_option('sequential_prefix');
1233
+	$postfix = give_get_option('sequential_postfix');
1234 1234
 
1235 1235
 	// Remove prefix
1236
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1236
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1237 1237
 
1238 1238
 	// Remove the postfix
1239
-	$length      = strlen( $number );
1240
-	$postfix_pos = strrpos( $number, $postfix );
1241
-	if ( false !== $postfix_pos ) {
1242
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1239
+	$length      = strlen($number);
1240
+	$postfix_pos = strrpos($number, $postfix);
1241
+	if (false !== $postfix_pos) {
1242
+		$number = substr_replace($number, '', $postfix_pos, $length);
1243 1243
 	}
1244 1244
 
1245 1245
 	// Ensure it's a whole number
1246
-	$number = intval( $number );
1246
+	$number = intval($number);
1247 1247
 
1248
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1248
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1249 1249
 
1250 1250
 }
1251 1251
 
@@ -1261,10 +1261,10 @@  discard block
 block discarded – undo
1261 1261
  *
1262 1262
  * @return string $amount Fully formatted payment amount
1263 1263
  */
1264
-function give_payment_amount( $payment_id = 0 ) {
1265
-	$amount = give_get_payment_amount( $payment_id );
1264
+function give_payment_amount($payment_id = 0) {
1265
+	$amount = give_get_payment_amount($payment_id);
1266 1266
 
1267
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1267
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1268 1268
 }
1269 1269
 
1270 1270
 /**
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
  *
1278 1278
  * @return mixed|void
1279 1279
  */
1280
-function give_get_payment_amount( $payment_id ) {
1280
+function give_get_payment_amount($payment_id) {
1281 1281
 
1282
-	$payment = new Give_Payment( $payment_id );
1282
+	$payment = new Give_Payment($payment_id);
1283 1283
 
1284
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1284
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1285 1285
 }
1286 1286
 
1287 1287
 /**
@@ -1297,10 +1297,10 @@  discard block
 block discarded – undo
1297 1297
  *
1298 1298
  * @return array Fully formatted payment subtotal
1299 1299
  */
1300
-function give_payment_subtotal( $payment_id = 0 ) {
1301
-	$subtotal = give_get_payment_subtotal( $payment_id );
1300
+function give_payment_subtotal($payment_id = 0) {
1301
+	$subtotal = give_get_payment_subtotal($payment_id);
1302 1302
 
1303
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1303
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
  *
1315 1315
  * @return float $subtotal Subtotal for payment (non formatted)
1316 1316
  */
1317
-function give_get_payment_subtotal( $payment_id = 0 ) {
1318
-	$payment = new G_Payment( $payment_id );
1317
+function give_get_payment_subtotal($payment_id = 0) {
1318
+	$payment = new G_Payment($payment_id);
1319 1319
 
1320 1320
 	return $payment->subtotal;
1321 1321
 }
@@ -1330,10 +1330,10 @@  discard block
 block discarded – undo
1330 1330
  *
1331 1331
  * @return mixed array if payment fees found, false otherwise
1332 1332
  */
1333
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1334
-	$payment = new Give_Payment( $payment_id );
1333
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1334
+	$payment = new Give_Payment($payment_id);
1335 1335
 
1336
-	return $payment->get_fees( $type );
1336
+	return $payment->get_fees($type);
1337 1337
 }
1338 1338
 
1339 1339
 /**
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
  *
1346 1346
  * @return string The Transaction ID
1347 1347
  */
1348
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1349
-	$payment = new Give_Payment( $payment_id );
1348
+function give_get_payment_transaction_id($payment_id = 0) {
1349
+	$payment = new Give_Payment($payment_id);
1350 1350
 
1351 1351
 	return $payment->transaction_id;
1352 1352
 }
@@ -1361,15 +1361,15 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @return bool|mixed
1363 1363
  */
1364
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1364
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1365 1365
 
1366
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1366
+	if (empty($payment_id) || empty($transaction_id)) {
1367 1367
 		return false;
1368 1368
 	}
1369 1369
 
1370
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1370
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1371 1371
 
1372
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1372
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1383,12 +1383,12 @@  discard block
 block discarded – undo
1383 1383
  *
1384 1384
  * @return int $purchase Purchase ID
1385 1385
  */
1386
-function give_get_purchase_id_by_key( $key ) {
1386
+function give_get_purchase_id_by_key($key) {
1387 1387
 	global $wpdb;
1388 1388
 
1389
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1389
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1390 1390
 
1391
-	if ( $purchase != null ) {
1391
+	if ($purchase != null) {
1392 1392
 		return $purchase;
1393 1393
 	}
1394 1394
 
@@ -1407,12 +1407,12 @@  discard block
 block discarded – undo
1407 1407
  *
1408 1408
  * @return int $purchase Purchase ID
1409 1409
  */
1410
-function give_get_purchase_id_by_transaction_id( $key ) {
1410
+function give_get_purchase_id_by_transaction_id($key) {
1411 1411
 	global $wpdb;
1412 1412
 
1413
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1413
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1414 1414
 
1415
-	if ( $purchase != null ) {
1415
+	if ($purchase != null) {
1416 1416
 		return $purchase;
1417 1417
 	}
1418 1418
 
@@ -1429,19 +1429,19 @@  discard block
 block discarded – undo
1429 1429
  *
1430 1430
  * @return array $notes Payment Notes
1431 1431
  */
1432
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1432
+function give_get_payment_notes($payment_id = 0, $search = '') {
1433 1433
 
1434
-	if ( empty( $payment_id ) && empty( $search ) ) {
1434
+	if (empty($payment_id) && empty($search)) {
1435 1435
 		return false;
1436 1436
 	}
1437 1437
 
1438
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1439
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1438
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1439
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1440 1440
 
1441
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1441
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1442 1442
 
1443
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1444
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1443
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1444
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1445 1445
 
1446 1446
 	return $notes;
1447 1447
 }
@@ -1457,19 +1457,19 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return int The new note ID
1459 1459
  */
1460
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1461
-	if ( empty( $payment_id ) ) {
1460
+function give_insert_payment_note($payment_id = 0, $note = '') {
1461
+	if (empty($payment_id)) {
1462 1462
 		return false;
1463 1463
 	}
1464 1464
 
1465
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1465
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1466 1466
 
1467
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1467
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1468 1468
 		'comment_post_ID'      => $payment_id,
1469 1469
 		'comment_content'      => $note,
1470 1470
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1471
-		'comment_date'         => current_time( 'mysql' ),
1472
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1471
+		'comment_date'         => current_time('mysql'),
1472
+		'comment_date_gmt'     => current_time('mysql', 1),
1473 1473
 		'comment_approved'     => 1,
1474 1474
 		'comment_parent'       => 0,
1475 1475
 		'comment_author'       => '',
@@ -1478,9 +1478,9 @@  discard block
 block discarded – undo
1478 1478
 		'comment_author_email' => '',
1479 1479
 		'comment_type'         => 'give_payment_note'
1480 1480
 
1481
-	) ) );
1481
+	)));
1482 1482
 
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1483
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1484
 
1485 1485
 	return $note_id;
1486 1486
 }
@@ -1495,14 +1495,14 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return bool True on success, false otherwise
1497 1497
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1498
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1499
+	if (empty($comment_id)) {
1500 1500
 		return false;
1501 1501
 	}
1502 1502
 
1503
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1504
-	$ret = wp_delete_comment( $comment_id, true );
1505
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1503
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1504
+	$ret = wp_delete_comment($comment_id, true);
1505
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1506 1506
 
1507 1507
 	return $ret;
1508 1508
 }
@@ -1517,32 +1517,32 @@  discard block
 block discarded – undo
1517 1517
  *
1518 1518
  * @return string
1519 1519
  */
1520
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1520
+function give_get_payment_note_html($note, $payment_id = 0) {
1521 1521
 
1522
-	if ( is_numeric( $note ) ) {
1523
-		$note = get_comment( $note );
1522
+	if (is_numeric($note)) {
1523
+		$note = get_comment($note);
1524 1524
 	}
1525 1525
 
1526
-	if ( ! empty( $note->user_id ) ) {
1527
-		$user = get_userdata( $note->user_id );
1526
+	if ( ! empty($note->user_id)) {
1527
+		$user = get_userdata($note->user_id);
1528 1528
 		$user = $user->display_name;
1529 1529
 	} else {
1530
-		$user = esc_html__( 'System', 'give' );
1530
+		$user = esc_html__('System', 'give');
1531 1531
 	}
1532 1532
 
1533
-	$date_format = get_option( 'date_format' ) . ', ' . get_option( 'time_format' );
1533
+	$date_format = get_option('date_format').', '.get_option('time_format');
1534 1534
 
1535
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1535
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1536 1536
 		'give-action' => 'delete_payment_note',
1537 1537
 		'note_id'     => $note->comment_ID,
1538 1538
 		'payment_id'  => $payment_id
1539
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1539
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1540 1540
 
1541
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1541
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1542 1542
 	$note_html .= '<p>';
1543
-	$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/>';
1543
+	$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/>';
1544 1544
 	$note_html .= $note->comment_content;
1545
-	$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 ) . '" title="' . esc_attr__( 'Delete this payment note', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1545
+	$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).'" title="'.esc_attr__('Delete this payment note', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1546 1546
 	$note_html .= '</p>';
1547 1547
 	$note_html .= '</div>';
1548 1548
 
@@ -1560,20 +1560,20 @@  discard block
 block discarded – undo
1560 1560
  *
1561 1561
  * @return void
1562 1562
  */
1563
-function give_hide_payment_notes( $query ) {
1563
+function give_hide_payment_notes($query) {
1564 1564
 	global $wp_version;
1565 1565
 
1566
-	if ( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) {
1567
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1568
-		if ( ! is_array( $types ) ) {
1569
-			$types = array( $types );
1566
+	if (version_compare(floatval($wp_version), '4.1', '>=')) {
1567
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1568
+		if ( ! is_array($types)) {
1569
+			$types = array($types);
1570 1570
 		}
1571 1571
 		$types[]                           = 'give_payment_note';
1572 1572
 		$query->query_vars['type__not_in'] = $types;
1573 1573
 	}
1574 1574
 }
1575 1575
 
1576
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1576
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1577 1577
 
1578 1578
 /**
1579 1579
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1585,17 +1585,17 @@  discard block
 block discarded – undo
1585 1585
  *
1586 1586
  * @return array $clauses Updated comment clauses
1587 1587
  */
1588
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1588
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1589 1589
 	global $wpdb, $wp_version;
1590 1590
 
1591
-	if ( version_compare( floatval( $wp_version ), '4.1', '<' ) ) {
1591
+	if (version_compare(floatval($wp_version), '4.1', '<')) {
1592 1592
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1593 1593
 	}
1594 1594
 
1595 1595
 	return $clauses;
1596 1596
 }
1597 1597
 
1598
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1598
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1599 1599
 
1600 1600
 
1601 1601
 /**
@@ -1608,15 +1608,15 @@  discard block
 block discarded – undo
1608 1608
  *
1609 1609
  * @return array $where
1610 1610
  */
1611
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1611
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1612 1612
 	global $wpdb;
1613 1613
 
1614
-	$where .= $wpdb->prepare( " AND comment_type != %s", 'give_payment_note' );
1614
+	$where .= $wpdb->prepare(" AND comment_type != %s", 'give_payment_note');
1615 1615
 
1616 1616
 	return $where;
1617 1617
 }
1618 1618
 
1619
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1619
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1620 1620
 
1621 1621
 
1622 1622
 /**
@@ -1630,32 +1630,32 @@  discard block
 block discarded – undo
1630 1630
  *
1631 1631
  * @return array Array of comment counts
1632 1632
  */
1633
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1633
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1634 1634
 	global $wpdb, $pagenow;
1635 1635
 
1636
-	if ( 'index.php' != $pagenow ) {
1636
+	if ('index.php' != $pagenow) {
1637 1637
 		return $stats;
1638 1638
 	}
1639 1639
 
1640 1640
 	$post_id = (int) $post_id;
1641 1641
 
1642
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1642
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1643 1643
 		return $stats;
1644 1644
 	}
1645 1645
 
1646
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1646
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1647 1647
 
1648
-	if ( false !== $stats ) {
1648
+	if (false !== $stats) {
1649 1649
 		return $stats;
1650 1650
 	}
1651 1651
 
1652 1652
 	$where = 'WHERE comment_type != "give_payment_note"';
1653 1653
 
1654
-	if ( $post_id > 0 ) {
1655
-		$where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id );
1654
+	if ($post_id > 0) {
1655
+		$where .= $wpdb->prepare(" AND comment_post_ID = %d", $post_id);
1656 1656
 	}
1657 1657
 
1658
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1658
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1659 1659
 
1660 1660
 	$total    = 0;
1661 1661
 	$approved = array(
@@ -1665,30 +1665,30 @@  discard block
 block discarded – undo
1665 1665
 		'trash'        => 'trash',
1666 1666
 		'post-trashed' => 'post-trashed'
1667 1667
 	);
1668
-	foreach ( (array) $count as $row ) {
1668
+	foreach ((array) $count as $row) {
1669 1669
 		// Don't count post-trashed toward totals
1670
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1670
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1671 1671
 			$total += $row['num_comments'];
1672 1672
 		}
1673
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1674
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1673
+		if (isset($approved[$row['comment_approved']])) {
1674
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1675 1675
 		}
1676 1676
 	}
1677 1677
 
1678 1678
 	$stats['total_comments'] = $total;
1679
-	foreach ( $approved as $key ) {
1680
-		if ( empty( $stats[ $key ] ) ) {
1681
-			$stats[ $key ] = 0;
1679
+	foreach ($approved as $key) {
1680
+		if (empty($stats[$key])) {
1681
+			$stats[$key] = 0;
1682 1682
 		}
1683 1683
 	}
1684 1684
 
1685 1685
 	$stats = (object) $stats;
1686
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1686
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1687 1687
 
1688 1688
 	return $stats;
1689 1689
 }
1690 1690
 
1691
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1691
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1692 1692
 
1693 1693
 
1694 1694
 /**
@@ -1701,9 +1701,9 @@  discard block
 block discarded – undo
1701 1701
  *
1702 1702
  * @return string $where Modified where clause
1703 1703
  */
1704
-function give_filter_where_older_than_week( $where = '' ) {
1704
+function give_filter_where_older_than_week($where = '') {
1705 1705
 	// Payments older than one week
1706
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1706
+	$start = date('Y-m-d', strtotime('-7 days'));
1707 1707
 	$where .= " AND post_date <= '{$start}'";
1708 1708
 
1709 1709
 	return $where;
@@ -1722,37 +1722,37 @@  discard block
 block discarded – undo
1722 1722
  *
1723 1723
  * @return string $form_title Returns the full title if $level_title false, otherwise returns the levels title
1724 1724
  */
1725
-function give_get_payment_form_title( $payment_meta, $level_title = false, $separator = '' ) {
1725
+function give_get_payment_form_title($payment_meta, $level_title = false, $separator = '') {
1726 1726
 
1727
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1728
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1729
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1727
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1728
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1729
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1730 1730
 
1731
-	if ( $level_title == true ) {
1731
+	if ($level_title == true) {
1732 1732
 		$form_title = '';
1733 1733
 	}
1734 1734
 
1735
-	if ( give_has_variable_prices( $form_id ) ) {
1735
+	if (give_has_variable_prices($form_id)) {
1736 1736
 
1737
-		if ( ! empty( $separator ) ) {
1738
-			$form_title .= ' ' . $separator;
1737
+		if ( ! empty($separator)) {
1738
+			$form_title .= ' '.$separator;
1739 1739
 		}
1740 1740
 		$form_title .= ' <span class="donation-level-text-wrap">';
1741 1741
 
1742
-		if ( $price_id == 'custom' ) {
1742
+		if ($price_id == 'custom') {
1743 1743
 
1744
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1745
-			$form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' );
1744
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1745
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give');
1746 1746
 
1747 1747
 		} else {
1748
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1748
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1749 1749
 		}
1750 1750
 
1751 1751
 		$form_title .= '</span>';
1752 1752
 
1753 1753
 	}
1754 1754
 
1755
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1755
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1756 1756
 
1757 1757
 }
1758 1758
 
@@ -1766,20 +1766,20 @@  discard block
 block discarded – undo
1766 1766
  *
1767 1767
  * @return string $price_id
1768 1768
  */
1769
-function give_get_price_id( $form_id, $price ) {
1769
+function give_get_price_id($form_id, $price) {
1770 1770
 
1771 1771
 	$price_id = 0;
1772 1772
 
1773
-	if ( give_has_variable_prices( $form_id ) ) {
1773
+	if (give_has_variable_prices($form_id)) {
1774 1774
 
1775
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1775
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1776 1776
 
1777
-		foreach ( $levels as $level ) {
1777
+		foreach ($levels as $level) {
1778 1778
 
1779
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1779
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1780 1780
 
1781 1781
 			//check that this indeed the recurring price
1782
-			if ( $level_amount == $price ) {
1782
+			if ($level_amount == $price) {
1783 1783
 
1784 1784
 				$price_id = $level['_give_id']['level_id'];
1785 1785
 
@@ -1806,10 +1806,10 @@  discard block
 block discarded – undo
1806 1806
  * 
1807 1807
  * @return string/void
1808 1808
  */
1809
-function give_get_form_dropdown( $args = array(), $echo = false ){
1810
-    $form_dropdown_html = Give()->html->forms_dropdown( $args );
1809
+function give_get_form_dropdown($args = array(), $echo = false) {
1810
+    $form_dropdown_html = Give()->html->forms_dropdown($args);
1811 1811
 
1812
-    if( ! $echo ) {
1812
+    if ( ! $echo) {
1813 1813
         return $form_dropdown_html;
1814 1814
     }
1815 1815
 
@@ -1826,39 +1826,39 @@  discard block
 block discarded – undo
1826 1826
  *
1827 1827
  * @return string/void
1828 1828
  */
1829
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ){
1829
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1830 1830
     
1831 1831
     // Check for give form id.
1832
-    if( empty( $args['id'] ) ) {
1832
+    if (empty($args['id'])) {
1833 1833
         return false;
1834 1834
     }
1835 1835
 
1836 1836
     // Check if form has variable prices or not.
1837
-    if( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) {
1837
+    if ( ! ($variable_prices = give_has_variable_prices($args['id']))) {
1838 1838
         return false;
1839 1839
     }
1840 1840
     
1841
-    $variable_prices = give_get_variable_prices( absint( $args['id'] ) );
1841
+    $variable_prices = give_get_variable_prices(absint($args['id']));
1842 1842
     $variable_price_options = array();
1843 1843
 
1844 1844
     // Check if multi donation form support custom donation or not.
1845
-    if( give_is_custom_price_mode( absint( $args['id'] ) ) ) {
1846
-        $variable_price_options['custom']  = _x( 'Custom', 'custom donation dropdown item', 'give' );
1845
+    if (give_is_custom_price_mode(absint($args['id']))) {
1846
+        $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1847 1847
     }
1848 1848
 
1849 1849
     // Get variable price and ID from variable price array.
1850
-    foreach ( $variable_prices as $variable_price ) {
1851
-        $variable_price_options[ $variable_price['_give_id']['level_id'] ] =  $variable_price['_give_text'];
1850
+    foreach ($variable_prices as $variable_price) {
1851
+        $variable_price_options[$variable_price['_give_id']['level_id']] = $variable_price['_give_text'];
1852 1852
     }
1853 1853
 
1854 1854
 
1855 1855
     // Update options.
1856
-    $args = array_merge( $args, array( 'options' => $variable_price_options ) );
1856
+    $args = array_merge($args, array('options' => $variable_price_options));
1857 1857
 
1858 1858
     // Generate select html.
1859
-    $form_dropdown_html = Give()->html->select( $args );
1859
+    $form_dropdown_html = Give()->html->select($args);
1860 1860
 
1861
-    if( ! $echo ) {
1861
+    if ( ! $echo) {
1862 1862
         return $form_dropdown_html;
1863 1863
     }
1864 1864
 
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 		return true;
514 514
 	}
515 515
 
516
-    /**
517
-     * Payment class object is storing various meta value in object parameter.
518
-     * So if user is updating payment meta but not updating payment object, then payment meta values will not reflect/changes on payment meta automatically
519
-     * and you can still access payment meta old value in any old payment object ( previously created ) which can cause to show or save wrong payment data.
520
-     * To prevent that user can use this function after updating any payment meta value ( in bulk or single update ).
521
-     *  
522
-     * @since  1.6
523
-     * @access public
524
-     * 
525
-     * @param  int $payment_id Payment ID.
526
-     * 
527
-     * @return void
528
-     */
529
-    public function update_payment_setup( $payment_id ){
530
-        $this->setup_payment( $payment_id );
531
-    }
516
+	/**
517
+	 * Payment class object is storing various meta value in object parameter.
518
+	 * So if user is updating payment meta but not updating payment object, then payment meta values will not reflect/changes on payment meta automatically
519
+	 * and you can still access payment meta old value in any old payment object ( previously created ) which can cause to show or save wrong payment data.
520
+	 * To prevent that user can use this function after updating any payment meta value ( in bulk or single update ).
521
+	 *  
522
+	 * @since  1.6
523
+	 * @access public
524
+	 * 
525
+	 * @param  int $payment_id Payment ID.
526
+	 * 
527
+	 * @return void
528
+	 */
529
+	public function update_payment_setup( $payment_id ){
530
+		$this->setup_payment( $payment_id );
531
+	}
532 532
 
533 533
 	/**
534 534
 	 * Create the base of a payment.
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 *
651 651
 	 * Once items have been set, an update is needed to save them to the database.
652 652
 	 *
653
-     * @access public
653
+	 * @access public
654 654
 	 *
655 655
 	 * @return bool  True of the save occurred, false if it failed or wasn't needed
656 656
 	 */
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 	 * Add a donation to a given payment
938 938
 	 *
939 939
 	 * @since  1.5
940
-     * @access public
940
+	 * @access public
941 941
 	 *
942 942
 	 * @param  int   $form_id The donation form to add
943 943
 	 * @param  array $args    Other arguments to pass to the function
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 					//Find a match between price_id and level_id
978 978
 					//First verify array keys exists THEN make the match
979 979
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
980
-					     && $args['price_id'] == $price['_give_id']['level_id']
980
+						 && $args['price_id'] == $price['_give_id']['level_id']
981 981
 					) {
982 982
 						$item_price = $price['_give_amount'];
983 983
 					}
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 	 * Remove a donation from the payment
1034 1034
 	 *
1035 1035
 	 * @since  1.5
1036
-     * @access public
1036
+	 * @access public
1037 1037
 	 *
1038 1038
 	 * @param  int   $form_id The form ID to remove
1039 1039
 	 * @param  array $args    Arguments to pass to identify (quantity, amount, price_id)
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 	 * Add a fee to a given payment
1076 1076
 	 *
1077 1077
 	 * @since  1.5
1078
-     * @access public
1078
+	 * @access public
1079 1079
 	 *
1080 1080
 	 * @param  array $args   Array of arguments for the fee to add
1081 1081
 	 * @param  bool  $global
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 * Remove a fee from the payment
1111 1111
 	 *
1112 1112
 	 * @since  1.5
1113
-     * @access public
1113
+	 * @access public
1114 1114
 	 *
1115 1115
 	 * @param  int $key The array key index to remove
1116 1116
 	 *
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	 * Remove a fee by the defined attributed
1131 1131
 	 *
1132 1132
 	 * @since  1.5
1133
-     * @access public
1133
+	 * @access public
1134 1134
 	 *
1135 1135
 	 * @param  string     $key    The key to remove by
1136 1136
 	 * @param  int|string $value  The value to search for
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 	 * Get the fees, filterable by type
1201 1201
 	 *
1202 1202
 	 * @since  1.5
1203
-     * @access public
1203
+	 * @access public
1204 1204
 	 *
1205 1205
 	 * @param  string $type All, item, fee
1206 1206
 	 *
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 	 * Add a note to a payment
1231 1231
 	 *
1232 1232
 	 * @since  1.0
1233
-     * @access public
1233
+	 * @access public
1234 1234
 	 *
1235 1235
 	 * @param  string $note The note to add
1236 1236
 	 *
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 	 * Increase the payment's subtotal
1250 1250
 	 *
1251 1251
 	 * @since  1.5
1252
-     * @access private
1252
+	 * @access private
1253 1253
 	 *
1254 1254
 	 * @param  float $amount The amount to increase the payment subtotal by
1255 1255
 	 *
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 	 * Decrease the payment's subtotal
1267 1267
 	 *
1268 1268
 	 * @since  1.5
1269
-     * @access private
1269
+	 * @access private
1270 1270
 	 *
1271 1271
 	 * @param  float $amount The amount to decrease the payment subtotal by
1272 1272
 	 *
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 	 * Increase the payment's subtotal
1288 1288
 	 *
1289 1289
 	 * @since  1.5
1290
-     * @access private
1290
+	 * @access private
1291 1291
 	 *
1292 1292
 	 * @param  float $amount The amount to increase the payment subtotal by
1293 1293
 	 *
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 	 * Decrease the payment's subtotal
1305 1305
 	 *
1306 1306
 	 * @since  1.5
1307
-     * @access private
1307
+	 * @access private
1308 1308
 	 *
1309 1309
 	 * @param  float $amount The amount to decrease the payment subtotal by
1310 1310
 	 *
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 	 * Set or update the total for a payment
1326 1326
 	 *
1327 1327
 	 * @since  1.0
1328
-     * @access private
1328
+	 * @access private
1329 1329
 	 *
1330 1330
 	 * @return void
1331 1331
 	 */
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 	 * Set the payment status and run any status specific changes necessary
1338 1338
 	 *
1339 1339
 	 * @since  1.0
1340
-     * @access public
1340
+	 * @access public
1341 1341
 	 *
1342 1342
 	 * @param  string $status  The status to set the payment to
1343 1343
 	 *
@@ -1387,12 +1387,12 @@  discard block
 block discarded – undo
1387 1387
 				case 'pending':
1388 1388
 					$this->process_pending();
1389 1389
 					break;
1390
-                case 'cancelled':
1391
-                    $this->process_cancelled();
1392
-                    break;
1393
-                case 'revoked':
1394
-                    $this->process_revoked();
1395
-                    break;
1390
+				case 'cancelled':
1391
+					$this->process_cancelled();
1392
+					break;
1393
+				case 'revoked':
1394
+					$this->process_revoked();
1395
+					break;
1396 1396
 			}
1397 1397
 
1398 1398
 			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 	 * Change the status of the payment to refunded, and run the necessary changes
1408 1408
 	 *
1409 1409
 	 * @since  1.5
1410
-     * @access public
1410
+	 * @access public
1411 1411
 	 *
1412 1412
 	 * @return void
1413 1413
 	 */
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 	 * Get a post meta item for the payment
1424 1424
 	 *
1425 1425
 	 * @since  1.5
1426
-     * @access public
1426
+	 * @access public
1427 1427
 	 *
1428 1428
 	 * @param  string  $meta_key The Meta Key
1429 1429
 	 * @param  boolean $single   Return single item or array
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 	 * Update the post meta
1463 1463
 	 *
1464 1464
 	 * @since  1.5
1465
-     * @access public
1465
+	 * @access public
1466 1466
 	 *
1467 1467
 	 * @param  string $meta_key   The meta key to update
1468 1468
 	 * @param  string $meta_value The meta value
@@ -1588,77 +1588,77 @@  discard block
 block discarded – undo
1588 1588
 		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1589 1589
 	}
1590 1590
 
1591
-    /**
1592
-     * Process when a payment moves to cancelled
1593
-     *
1594
-     * @since  1.5
1591
+	/**
1592
+	 * Process when a payment moves to cancelled
1593
+	 *
1594
+	 * @since  1.5
1595 1595
 	 * @access private
1596 1596
 	 *
1597
-     * @return void
1598
-     */
1599
-    private function process_cancelled() {
1600
-        $process_cancelled = true;
1597
+	 * @return void
1598
+	 */
1599
+	private function process_cancelled() {
1600
+		$process_cancelled = true;
1601 1601
 
1602
-        // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented
1603
-        if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1604
-            $process_cancelled = false;
1605
-        }
1602
+		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented
1603
+		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1604
+			$process_cancelled = false;
1605
+		}
1606 1606
 
1607
-        // Allow extensions to filter for their own payment types, Example: Recurring Payments
1608
-        $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1607
+		// Allow extensions to filter for their own payment types, Example: Recurring Payments
1608
+		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1609 1609
 
1610
-        if ( false === $process_cancelled ) {
1611
-            return;
1612
-        }
1610
+		if ( false === $process_cancelled ) {
1611
+			return;
1612
+		}
1613 1613
 
1614
-        $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this );
1615
-        $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this );
1616
-        $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this );
1614
+		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this );
1615
+		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this );
1616
+		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this );
1617 1617
 
1618
-        $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1619
-        $this->delete_sales_logs();
1618
+		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1619
+		$this->delete_sales_logs();
1620 1620
 
1621
-        $this->completed_date = false;
1622
-        $this->update_meta( '_give_completed_date', '' );
1621
+		$this->completed_date = false;
1622
+		$this->update_meta( '_give_completed_date', '' );
1623 1623
 
1624
-        // Clear the This Month earnings (this_monththis_month is NOT a typo)
1625
-        delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1626
-    }
1624
+		// Clear the This Month earnings (this_monththis_month is NOT a typo)
1625
+		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1626
+	}
1627 1627
 
1628
-    /**
1629
-     * Process when a payment moves to revoked
1630
-     *
1631
-     * @since  1.5
1632
-     * @return void
1633
-     */
1634
-    private function process_revoked() {
1635
-        $process_revoked = true;
1628
+	/**
1629
+	 * Process when a payment moves to revoked
1630
+	 *
1631
+	 * @since  1.5
1632
+	 * @return void
1633
+	 */
1634
+	private function process_revoked() {
1635
+		$process_revoked = true;
1636 1636
 
1637
-        // If the payment was not in publish, don't decrement stats as they were never incremented
1638
-        if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1639
-            $process_revoked = false;
1640
-        }
1637
+		// If the payment was not in publish, don't decrement stats as they were never incremented
1638
+		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1639
+			$process_revoked = false;
1640
+		}
1641 1641
 
1642
-        // Allow extensions to filter for their own payment types, Example: Recurring Payments
1643
-        $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1642
+		// Allow extensions to filter for their own payment types, Example: Recurring Payments
1643
+		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1644 1644
 
1645
-        if ( false === $process_revoked ) {
1646
-            return;
1647
-        }
1645
+		if ( false === $process_revoked ) {
1646
+			return;
1647
+		}
1648 1648
 
1649
-        $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this );
1650
-        $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this );
1651
-        $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this );
1649
+		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this );
1650
+		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this );
1651
+		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this );
1652 1652
 
1653
-        $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1654
-        $this->delete_sales_logs();
1653
+		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1654
+		$this->delete_sales_logs();
1655 1655
 
1656
-        $this->completed_date = false;
1657
-        $this->update_meta( '_give_completed_date', '' );
1656
+		$this->completed_date = false;
1657
+		$this->update_meta( '_give_completed_date', '' );
1658 1658
 
1659
-        // Clear the This Month earnings (this_monththis_month is NOT a typo)
1660
-        delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1661
-    }
1659
+		// Clear the This Month earnings (this_monththis_month is NOT a typo)
1660
+		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1661
+	}
1662 1662
 
1663 1663
 	/**
1664 1664
 	 * Used during the process of moving to refunded or pending, to decrement stats
Please login to merge, or discard this patch.
Spacing   +322 added lines, -322 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
 
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @return mixed void|false
349 349
 	 */
350
-	public function __construct( $payment_id = false ) {
350
+	public function __construct($payment_id = false) {
351 351
 
352
-		if ( empty( $payment_id ) ) {
352
+		if (empty($payment_id)) {
353 353
 			return false;
354 354
 		}
355 355
 
356
-		$this->setup_payment( $payment_id );
356
+		$this->setup_payment($payment_id);
357 357
 	}
358 358
 
359 359
 	/**
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @return mixed        The value
368 368
 	 */
369
-	public function __get( $key ) {
369
+	public function __get($key) {
370 370
 
371
-		if ( method_exists( $this, 'get_' . $key ) ) {
371
+		if (method_exists($this, 'get_'.$key)) {
372 372
 
373
-			$value = call_user_func( array( $this, 'get_' . $key ) );
373
+			$value = call_user_func(array($this, 'get_'.$key));
374 374
 
375 375
 		} else {
376 376
 
@@ -392,18 +392,18 @@  discard block
 block discarded – undo
392 392
 	 * @param  string $key The property name
393 393
 	 * @param  mixed $value The value of the property
394 394
 	 */
395
-	public function __set( $key, $value ) {
396
-		$ignore = array( '_ID' );
395
+	public function __set($key, $value) {
396
+		$ignore = array('_ID');
397 397
 
398
-		if ( $key === 'status' ) {
398
+		if ($key === 'status') {
399 399
 			$this->old_status = $this->status;
400 400
 		}
401 401
 
402
-		if ( ! in_array( $key, $ignore ) ) {
403
-			$this->pending[ $key ] = $value;
402
+		if ( ! in_array($key, $ignore)) {
403
+			$this->pending[$key] = $value;
404 404
 		}
405 405
 
406
-		if ( '_ID' !== $key ) {
406
+		if ('_ID' !== $key) {
407 407
 			$this->$key = $value;
408 408
 		}
409 409
 	}
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @return boolean       If the item is set or not
420 420
 	 */
421
-	public function __isset( $name ) {
422
-		if ( property_exists( $this, $name ) ) {
423
-			return false === empty( $this->$name );
421
+	public function __isset($name) {
422
+		if (property_exists($this, $name)) {
423
+			return false === empty($this->$name);
424 424
 		} else {
425 425
 			return null;
426 426
 		}
@@ -436,31 +436,31 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @return bool            If the setup was successful or not
438 438
 	 */
439
-	private function setup_payment( $payment_id ) {
439
+	private function setup_payment($payment_id) {
440 440
 		$this->pending = array();
441 441
 
442
-		if ( empty( $payment_id ) ) {
442
+		if (empty($payment_id)) {
443 443
 			return false;
444 444
 		}
445 445
 
446
-		$payment = get_post( $payment_id );
446
+		$payment = get_post($payment_id);
447 447
 
448
-		if ( ! $payment || is_wp_error( $payment ) ) {
448
+		if ( ! $payment || is_wp_error($payment)) {
449 449
 			return false;
450 450
 		}
451 451
 
452
-		if ( 'give_payment' !== $payment->post_type ) {
452
+		if ('give_payment' !== $payment->post_type) {
453 453
 			return false;
454 454
 		}
455 455
 
456 456
 		// Allow extensions to perform actions before the payment is loaded
457
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
457
+		do_action('give_pre_setup_payment', $this, $payment_id);
458 458
 
459 459
 		// Primary Identifier
460
-		$this->ID = absint( $payment_id );
460
+		$this->ID = absint($payment_id);
461 461
 
462 462
 		// Protected ID that can never be changed
463
-		$this->_ID = absint( $payment_id );
463
+		$this->_ID = absint($payment_id);
464 464
 
465 465
 		// We have a payment, get the generic payment_meta item to reduce calls to it
466 466
 		$this->payment_meta = $this->get_meta();
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		$this->parent_payment = $payment->post_parent;
476 476
 
477 477
 		$all_payment_statuses  = give_get_payment_statuses();
478
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
478
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
479 479
 
480 480
 		// Items
481 481
 		$this->fees = $this->setup_fees();
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$this->number     = $this->setup_payment_number();
509 509
 
510 510
 		// Allow extensions to add items to this object via hook
511
-		do_action( 'give_setup_payment', $this, $payment_id );
511
+		do_action('give_setup_payment', $this, $payment_id);
512 512
 
513 513
 		return true;
514 514
 	}
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
      * 
527 527
      * @return void
528 528
      */
529
-    public function update_payment_setup( $payment_id ){
530
-        $this->setup_payment( $payment_id );
529
+    public function update_payment_setup($payment_id) {
530
+        $this->setup_payment($payment_id);
531 531
     }
532 532
 
533 533
 	/**
@@ -542,24 +542,24 @@  discard block
 block discarded – undo
542 542
 
543 543
 		// Construct the payment title
544 544
 		$payment_title = '';
545
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
546
-			$payment_title = $this->first_name . ' ' . $this->last_name;
547
-		} else if ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
545
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
546
+			$payment_title = $this->first_name.' '.$this->last_name;
547
+		} else if ( ! empty($this->first_name) && empty($this->last_name)) {
548 548
 			$payment_title = $this->first_name;
549
-		} else if ( ! empty( $this->email ) && is_email( $this->email ) ) {
549
+		} else if ( ! empty($this->email) && is_email($this->email)) {
550 550
 			$payment_title = $this->email;
551 551
 		}
552 552
 
553 553
 		//Set Key
554
-		if ( empty( $this->key ) ) {
554
+		if (empty($this->key)) {
555 555
 
556
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
557
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
556
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
557
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
558 558
 			$this->pending['key'] = $this->key;
559 559
 		}
560 560
 
561 561
 		//Set IP
562
-		if ( empty( $this->ip ) ) {
562
+		if (empty($this->ip)) {
563 563
 
564 564
 			$this->ip            = give_get_ip();
565 565
 			$this->pending['ip'] = $this->ip;
@@ -586,58 +586,58 @@  discard block
 block discarded – undo
586 586
 			'fees'         => $this->fees,
587 587
 		);
588 588
 
589
-		$args = apply_filters( 'give_insert_payment_args', array(
589
+		$args = apply_filters('give_insert_payment_args', array(
590 590
 			'post_title'    => $payment_title,
591 591
 			'post_status'   => $this->status,
592 592
 			'post_type'     => 'give_payment',
593
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
594
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
593
+			'post_date'     => ! empty($this->date) ? $this->date : null,
594
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
595 595
 			'post_parent'   => $this->parent_payment,
596
-		), $payment_data );
596
+		), $payment_data);
597 597
 
598 598
 		// Create a blank payment
599
-		$payment_id = wp_insert_post( $args );
599
+		$payment_id = wp_insert_post($args);
600 600
 
601
-		if ( ! empty( $payment_id ) ) {
601
+		if ( ! empty($payment_id)) {
602 602
 
603 603
 			$this->ID  = $payment_id;
604 604
 			$this->_ID = $payment_id;
605 605
 
606 606
 			$customer = new stdClass;
607 607
 
608
-			if ( did_action( 'give_pre_process_purchase' ) && is_user_logged_in() ) {
609
-				$customer = new Give_Customer( get_current_user_id(), true );
608
+			if (did_action('give_pre_process_purchase') && is_user_logged_in()) {
609
+				$customer = new Give_Customer(get_current_user_id(), true);
610 610
 			}
611 611
 
612
-			if ( empty( $customer->id ) ) {
613
-				$customer = new Give_Customer( $this->email );
612
+			if (empty($customer->id)) {
613
+				$customer = new Give_Customer($this->email);
614 614
 			}
615 615
 
616
-			if ( empty( $customer->id ) ) {
616
+			if (empty($customer->id)) {
617 617
 
618 618
 				$customer_data = array(
619
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
619
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
620 620
 					'email'   => $this->email,
621 621
 					'user_id' => $this->user_id,
622 622
 				);
623 623
 
624
-				$customer->create( $customer_data );
624
+				$customer->create($customer_data);
625 625
 
626 626
 			}
627 627
 
628 628
 			$this->customer_id            = $customer->id;
629 629
 			$this->pending['customer_id'] = $this->customer_id;
630
-			$customer->attach_payment( $this->ID, false );
630
+			$customer->attach_payment($this->ID, false);
631 631
 
632
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
633
-			if ( ! empty( $this->payment_meta['fees'] ) ) {
634
-				$this->fees = array_merge( $this->fees, $this->payment_meta['fees'] );
635
-				foreach ( $this->fees as $fee ) {
636
-					$this->increase_fees( $fee['amount'] );
632
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
633
+			if ( ! empty($this->payment_meta['fees'])) {
634
+				$this->fees = array_merge($this->fees, $this->payment_meta['fees']);
635
+				foreach ($this->fees as $fee) {
636
+					$this->increase_fees($fee['amount']);
637 637
 				}
638 638
 			}
639 639
 
640
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
640
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
641 641
 			$this->new = true;
642 642
 		}
643 643
 
@@ -659,11 +659,11 @@  discard block
 block discarded – undo
659 659
 		$saved = false;
660 660
 
661 661
 		//Must have an ID 
662
-		if ( empty( $this->ID ) ) {
662
+		if (empty($this->ID)) {
663 663
 
664 664
 			$payment_id = $this->insert_payment();
665 665
 
666
-			if ( false === $payment_id ) {
666
+			if (false === $payment_id) {
667 667
 				$saved = false;
668 668
 			} else {
669 669
 				$this->ID = $payment_id;
@@ -672,48 +672,48 @@  discard block
 block discarded – undo
672 672
 		}
673 673
 
674 674
 		//Set ID if not matching
675
-		if ( $this->ID !== $this->_ID ) {
675
+		if ($this->ID !== $this->_ID) {
676 676
 			$this->ID = $this->_ID;
677 677
 		}
678 678
 
679 679
 		// If we have something pending, let's save it
680
-		if ( ! empty( $this->pending ) ) {
680
+		if ( ! empty($this->pending)) {
681 681
 
682 682
 			$total_increase = 0;
683 683
 			$total_decrease = 0;
684 684
 
685
-			foreach ( $this->pending as $key => $value ) {
685
+			foreach ($this->pending as $key => $value) {
686 686
 
687
-				switch ( $key ) {
687
+				switch ($key) {
688 688
 
689 689
 					case 'donations':
690 690
 						// Update totals for pending donations
691
-						foreach ( $this->pending[ $key ] as $item ) {
691
+						foreach ($this->pending[$key] as $item) {
692 692
 
693
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
694
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
693
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
694
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
695 695
 
696
-							switch ( $item['action'] ) {
696
+							switch ($item['action']) {
697 697
 
698 698
 								case 'add':
699 699
 
700 700
 									$price = $item['price'];
701 701
 
702
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
702
+									if ('publish' === $this->status || 'complete' === $this->status) {
703 703
 
704 704
 										// Add sales logs
705
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
705
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
706 706
 
707 707
 										$y = 0;
708
-										while ( $y < $quantity ) {
708
+										while ($y < $quantity) {
709 709
 
710
-											give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date );
711
-											$y ++;
710
+											give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date);
711
+											$y++;
712 712
 										}
713 713
 
714
-										$form = new Give_Donate_Form( $item['id'] );
715
-										$form->increase_sales( $quantity );
716
-										$form->increase_earnings( $price );
714
+										$form = new Give_Donate_Form($item['id']);
715
+										$form->increase_sales($quantity);
716
+										$form->increase_earnings($price);
717 717
 
718 718
 										$total_increase += $price;
719 719
 									}
@@ -738,15 +738,15 @@  discard block
 block discarded – undo
738 738
 										)
739 739
 									);
740 740
 
741
-									$found_logs = get_posts( $log_args );
742
-									foreach ( $found_logs as $log ) {
743
-										wp_delete_post( $log->ID, true );
741
+									$found_logs = get_posts($log_args);
742
+									foreach ($found_logs as $log) {
743
+										wp_delete_post($log->ID, true);
744 744
 									}
745 745
 
746
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
747
-										$form = new Give_Donate_Form( $item['id'] );
748
-										$form->decrease_sales( $quantity );
749
-										$form->decrease_earnings( $item['amount'] );
746
+									if ('publish' === $this->status || 'complete' === $this->status) {
747
+										$form = new Give_Donate_Form($item['id']);
748
+										$form->decrease_sales($quantity);
749
+										$form->decrease_earnings($item['amount']);
750 750
 
751 751
 										$total_decrease += $item['amount'];
752 752
 									}
@@ -759,17 +759,17 @@  discard block
 block discarded – undo
759 759
 
760 760
 					case 'fees':
761 761
 
762
-						if ( 'publish' !== $this->status && 'complete' !== $this->status ) {
762
+						if ('publish' !== $this->status && 'complete' !== $this->status) {
763 763
 							break;
764 764
 						}
765 765
 
766
-						if ( empty( $this->pending[ $key ] ) ) {
766
+						if (empty($this->pending[$key])) {
767 767
 							break;
768 768
 						}
769 769
 
770
-						foreach ( $this->pending[ $key ] as $fee ) {
770
+						foreach ($this->pending[$key] as $fee) {
771 771
 
772
-							switch ( $fee['action'] ) {
772
+							switch ($fee['action']) {
773 773
 
774 774
 								case 'add':
775 775
 									$total_increase += $fee['amount'];
@@ -786,43 +786,43 @@  discard block
 block discarded – undo
786 786
 						break;
787 787
 
788 788
 					case 'status':
789
-						$this->update_status( $this->status );
789
+						$this->update_status($this->status);
790 790
 						break;
791 791
 
792 792
 					case 'gateway':
793
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
793
+						$this->update_meta('_give_payment_gateway', $this->gateway);
794 794
 						break;
795 795
 
796 796
 					case 'mode':
797
-						$this->update_meta( '_give_payment_mode', $this->mode );
797
+						$this->update_meta('_give_payment_mode', $this->mode);
798 798
 						break;
799 799
 
800 800
 					case 'transaction_id':
801
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
801
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
802 802
 						break;
803 803
 
804 804
 					case 'ip':
805
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
805
+						$this->update_meta('_give_payment_user_ip', $this->ip);
806 806
 						break;
807 807
 
808 808
 					case 'customer_id':
809
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
809
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
810 810
 						break;
811 811
 
812 812
 					case 'user_id':
813
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
813
+						$this->update_meta('_give_payment_user_id', $this->user_id);
814 814
 						break;
815 815
 
816 816
 					case 'form_title':
817
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
817
+						$this->update_meta('_give_payment_form_title', $this->form_title);
818 818
 						break;
819 819
 
820 820
 					case 'form_id':
821
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
821
+						$this->update_meta('_give_payment_form_id', $this->form_id);
822 822
 						break;
823 823
 
824 824
 					case 'price_id':
825
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
825
+						$this->update_meta('_give_payment_price_id', $this->price_id);
826 826
 						break;
827 827
 
828 828
 					case 'first_name':
@@ -838,15 +838,15 @@  discard block
 block discarded – undo
838 838
 						break;
839 839
 
840 840
 					case 'email':
841
-						$this->update_meta( '_give_payment_user_email', $this->email );
841
+						$this->update_meta('_give_payment_user_email', $this->email);
842 842
 						break;
843 843
 
844 844
 					case 'key':
845
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
845
+						$this->update_meta('_give_payment_purchase_key', $this->key);
846 846
 						break;
847 847
 
848 848
 					case 'number':
849
-						$this->update_meta( '_give_payment_number', $this->number );
849
+						$this->update_meta('_give_payment_number', $this->number);
850 850
 						break;
851 851
 
852 852
 					case 'date':
@@ -856,11 +856,11 @@  discard block
 block discarded – undo
856 856
 							'edit_date' => true,
857 857
 						);
858 858
 
859
-						wp_update_post( $args );
859
+						wp_update_post($args);
860 860
 						break;
861 861
 
862 862
 					case 'completed_date':
863
-						$this->update_meta( '_give_completed_date', $this->completed_date );
863
+						$this->update_meta('_give_completed_date', $this->completed_date);
864 864
 						break;
865 865
 
866 866
 					case 'parent_payment':
@@ -869,38 +869,38 @@  discard block
 block discarded – undo
869 869
 							'post_parent' => $this->parent_payment,
870 870
 						);
871 871
 
872
-						wp_update_post( $args );
872
+						wp_update_post($args);
873 873
 						break;
874 874
 
875 875
 					default:
876
-						do_action( 'give_payment_save', $this, $key );
876
+						do_action('give_payment_save', $this, $key);
877 877
 						break;
878 878
 				}
879 879
 			}
880 880
 
881
-			if ( 'pending' !== $this->status ) {
881
+			if ('pending' !== $this->status) {
882 882
 
883
-				$customer = new Give_Customer( $this->customer_id );
883
+				$customer = new Give_Customer($this->customer_id);
884 884
 
885 885
 				$total_change = $total_increase - $total_decrease;
886
-				if ( $total_change < 0 ) {
886
+				if ($total_change < 0) {
887 887
 
888
-					$total_change = - ( $total_change );
888
+					$total_change = - ($total_change);
889 889
 					// Decrease the customer's purchase stats
890
-					$customer->decrease_value( $total_change );
891
-					give_decrease_total_earnings( $total_change );
890
+					$customer->decrease_value($total_change);
891
+					give_decrease_total_earnings($total_change);
892 892
 
893
-				} else if ( $total_change > 0 ) {
893
+				} else if ($total_change > 0) {
894 894
 
895 895
 					// Increase the customer's purchase stats
896
-					$customer->increase_value( $total_change );
897
-					give_increase_total_earnings( $total_change );
896
+					$customer->increase_value($total_change);
897
+					give_increase_total_earnings($total_change);
898 898
 
899 899
 				}
900 900
 
901 901
 			}
902 902
 
903
-			$this->update_meta( '_give_payment_total', $this->total );
903
+			$this->update_meta('_give_payment_total', $this->total);
904 904
 
905 905
 			$new_meta = array(
906 906
 				'form_title' => $this->form_title,
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
 			);
913 913
 
914 914
 			$meta        = $this->get_meta();
915
-			$merged_meta = array_merge( $meta, $new_meta );
915
+			$merged_meta = array_merge($meta, $new_meta);
916 916
 
917 917
 			// Only save the payment meta if it's changed
918
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
919
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
920
-				if ( false !== $updated ) {
918
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
919
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
920
+				if (false !== $updated) {
921 921
 					$saved = true;
922 922
 				}
923 923
 			}
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 			$saved         = true;
927 927
 		}
928 928
 
929
-		if ( true === $saved ) {
930
-			$this->setup_payment( $this->ID );
929
+		if (true === $saved) {
930
+			$this->setup_payment($this->ID);
931 931
 		}
932 932
 
933 933
 		return $saved;
@@ -945,12 +945,12 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return bool           True when successful, false otherwise
947 947
 	 */
948
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
948
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
949 949
 
950
-		$donation = new Give_Donate_Form( $form_id );
950
+		$donation = new Give_Donate_Form($form_id);
951 951
 
952 952
 		// Bail if this post isn't a give donation form
953
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
953
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
954 954
 			return false;
955 955
 		}
956 956
 
@@ -961,60 +961,60 @@  discard block
 block discarded – undo
961 961
 			'fees'     => array(),
962 962
 		);
963 963
 
964
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
964
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
965 965
 
966 966
 		// Allow overriding the price
967
-		if ( false !== $args['price'] ) {
967
+		if (false !== $args['price']) {
968 968
 			$item_price = $args['price'];
969 969
 		} else {
970 970
 
971 971
 			// Deal with variable pricing
972
-			if ( give_has_variable_prices( $donation->ID ) ) {
973
-				$prices     = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
972
+			if (give_has_variable_prices($donation->ID)) {
973
+				$prices     = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
974 974
 				$item_price = '';
975 975
 				//Loop through prices
976
-				foreach ( $prices as $price ) {
976
+				foreach ($prices as $price) {
977 977
 					//Find a match between price_id and level_id
978 978
 					//First verify array keys exists THEN make the match
979
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
979
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
980 980
 					     && $args['price_id'] == $price['_give_id']['level_id']
981 981
 					) {
982 982
 						$item_price = $price['_give_amount'];
983 983
 					}
984 984
 				}
985 985
 				//Fallback to the lowest price point
986
-				if ( $item_price == '' ) {
987
-					$item_price       = give_get_lowest_price_option( $donation->ID );
988
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
986
+				if ($item_price == '') {
987
+					$item_price       = give_get_lowest_price_option($donation->ID);
988
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
989 989
 				}
990 990
 			} else {
991 991
 				//Simple form price
992
-				$item_price = give_get_form_price( $donation->ID );
992
+				$item_price = give_get_form_price($donation->ID);
993 993
 			}
994 994
 
995 995
 		}
996 996
 
997 997
 		// Sanitizing the price here so we don't have a dozen calls later
998
-		$item_price = give_sanitize_amount( $item_price );
999
-		$total      = round( $item_price, give_currency_decimal_filter() );
998
+		$item_price = give_sanitize_amount($item_price);
999
+		$total      = round($item_price, give_currency_decimal_filter());
1000 1000
 
1001 1001
 		//Add Options
1002 1002
 		$default_options = array();
1003
-		if ( false !== $args['price_id'] ) {
1003
+		if (false !== $args['price_id']) {
1004 1004
 			$default_options['price_id'] = (int) $args['price_id'];
1005 1005
 		}
1006
-		$options = wp_parse_args( $options, $default_options );
1006
+		$options = wp_parse_args($options, $default_options);
1007 1007
 
1008 1008
 		// Do not allow totals to go negative
1009
-		if ( $total < 0 ) {
1009
+		if ($total < 0) {
1010 1010
 			$total = 0;
1011 1011
 		}
1012 1012
 
1013 1013
 		$donation = array(
1014 1014
 			'name'     => $donation->post_title,
1015 1015
 			'id'       => $donation->ID,
1016
-			'price'    => round( $total, give_currency_decimal_filter() ),
1017
-			'subtotal' => round( $total, give_currency_decimal_filter() ),
1016
+			'price'    => round($total, give_currency_decimal_filter()),
1017
+			'subtotal' => round($total, give_currency_decimal_filter()),
1018 1018
 			'fees'     => $args['fees'],
1019 1019
 			'price_id' => $args['price_id'],
1020 1020
 			'action'   => 'add',
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
 		$this->pending['donations'][] = $donation;
1025 1025
 
1026
-		$this->increase_subtotal( $total );
1026
+		$this->increase_subtotal($total);
1027 1027
 
1028 1028
 		return true;
1029 1029
 
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool           If the item was removed or not
1042 1042
 	 */
1043
-	public function remove_donation( $form_id, $args = array() ) {
1043
+	public function remove_donation($form_id, $args = array()) {
1044 1044
 
1045 1045
 		// Set some defaults
1046 1046
 		$defaults = array(
@@ -1048,12 +1048,12 @@  discard block
 block discarded – undo
1048 1048
 			'price'    => false,
1049 1049
 			'price_id' => false,
1050 1050
 		);
1051
-		$args     = wp_parse_args( $args, $defaults );
1051
+		$args = wp_parse_args($args, $defaults);
1052 1052
 
1053
-		$form = new Give_Donate_Form( $form_id );
1053
+		$form = new Give_Donate_Form($form_id);
1054 1054
 
1055 1055
 		// Bail if this post isn't a valid give donation form
1056
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1056
+		if ( ! $form || $form->post_type !== 'give_forms') {
1057 1057
 			return false;
1058 1058
 		}
1059 1059
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 		$this->pending['donations'][] = $pending_args;
1068 1068
 
1069
-		$this->decrease_subtotal( $this->total );
1069
+		$this->decrease_subtotal($this->total);
1070 1070
 
1071 1071
 		return true;
1072 1072
 	}
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 	 *
1083 1083
 	 * @return bool          If the fee was added
1084 1084
 	 */
1085
-	public function add_fee( $args, $global = true ) {
1085
+	public function add_fee($args, $global = true) {
1086 1086
 
1087 1087
 		$default_args = array(
1088 1088
 			'label'    => '',
@@ -1092,16 +1092,16 @@  discard block
 block discarded – undo
1092 1092
 			'price_id' => 0,
1093 1093
 		);
1094 1094
 
1095
-		$fee          = wp_parse_args( $args, $default_args );
1095
+		$fee          = wp_parse_args($args, $default_args);
1096 1096
 		$this->fees[] = $fee;
1097 1097
 
1098 1098
 
1099 1099
 		$added_fee               = $fee;
1100 1100
 		$added_fee['action']     = 'add';
1101 1101
 		$this->pending['fees'][] = $added_fee;
1102
-		reset( $this->fees );
1102
+		reset($this->fees);
1103 1103
 
1104
-		$this->increase_fees( $fee['amount'] );
1104
+		$this->increase_fees($fee['amount']);
1105 1105
 
1106 1106
 		return true;
1107 1107
 	}
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
 	 *
1117 1117
 	 * @return bool     If the fee was removed successfully
1118 1118
 	 */
1119
-	public function remove_fee( $key ) {
1119
+	public function remove_fee($key) {
1120 1120
 		$removed = false;
1121 1121
 
1122
-		if ( is_numeric( $key ) ) {
1123
-			$removed = $this->remove_fee_by( 'index', $key );
1122
+		if (is_numeric($key)) {
1123
+			$removed = $this->remove_fee_by('index', $key);
1124 1124
 		}
1125 1125
 
1126 1126
 		return $removed;
@@ -1139,47 +1139,47 @@  discard block
 block discarded – undo
1139 1139
 	 *
1140 1140
 	 * @return boolean            If the item is removed
1141 1141
 	 */
1142
-	public function remove_fee_by( $key, $value, $global = false ) {
1142
+	public function remove_fee_by($key, $value, $global = false) {
1143 1143
 
1144
-		$allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array(
1144
+		$allowed_fee_keys = apply_filters('give_payment_fee_keys', array(
1145 1145
 			'index',
1146 1146
 			'label',
1147 1147
 			'amount',
1148 1148
 			'type',
1149
-		) );
1149
+		));
1150 1150
 
1151
-		if ( ! in_array( $key, $allowed_fee_keys ) ) {
1151
+		if ( ! in_array($key, $allowed_fee_keys)) {
1152 1152
 			return false;
1153 1153
 		}
1154 1154
 
1155 1155
 		$removed = false;
1156
-		if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) {
1156
+		if ('index' === $key && array_key_exists($value, $this->fees)) {
1157 1157
 
1158
-			$removed_fee             = $this->fees[ $value ];
1158
+			$removed_fee             = $this->fees[$value];
1159 1159
 			$removed_fee['action']   = 'remove';
1160 1160
 			$this->pending['fees'][] = $removed_fee;
1161 1161
 
1162
-			$this->decrease_fees( $removed_fee['amount'] );
1162
+			$this->decrease_fees($removed_fee['amount']);
1163 1163
 
1164
-			unset( $this->fees[ $value ] );
1164
+			unset($this->fees[$value]);
1165 1165
 			$removed = true;
1166 1166
 
1167
-		} else if ( 'index' !== $key ) {
1167
+		} else if ('index' !== $key) {
1168 1168
 
1169
-			foreach ( $this->fees as $index => $fee ) {
1169
+			foreach ($this->fees as $index => $fee) {
1170 1170
 
1171
-				if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) {
1171
+				if (isset($fee[$key]) && $fee[$key] == $value) {
1172 1172
 
1173 1173
 					$removed_fee             = $fee;
1174 1174
 					$removed_fee['action']   = 'remove';
1175 1175
 					$this->pending['fees'][] = $removed_fee;
1176 1176
 
1177
-					$this->decrease_fees( $removed_fee['amount'] );
1177
+					$this->decrease_fees($removed_fee['amount']);
1178 1178
 
1179
-					unset( $this->fees[ $index ] );
1179
+					unset($this->fees[$index]);
1180 1180
 					$removed = true;
1181 1181
 
1182
-					if ( false === $global ) {
1182
+					if (false === $global) {
1183 1183
 						break;
1184 1184
 					}
1185 1185
 
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 		}
1191 1191
 
1192
-		if ( true === $removed ) {
1193
-			$this->fees = array_values( $this->fees );
1192
+		if (true === $removed) {
1193
+			$this->fees = array_values($this->fees);
1194 1194
 		}
1195 1195
 
1196 1196
 		return $removed;
@@ -1206,14 +1206,14 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @return array        The Fees for the type specified
1208 1208
 	 */
1209
-	public function get_fees( $type = 'all' ) {
1209
+	public function get_fees($type = 'all') {
1210 1210
 		$fees = array();
1211 1211
 
1212
-		if ( ! empty( $this->fees ) && is_array( $this->fees ) ) {
1212
+		if ( ! empty($this->fees) && is_array($this->fees)) {
1213 1213
 
1214
-			foreach ( $this->fees as $fee_id => $fee ) {
1214
+			foreach ($this->fees as $fee_id => $fee) {
1215 1215
 
1216
-				if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) {
1216
+				if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) {
1217 1217
 					continue;
1218 1218
 				}
1219 1219
 
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 			}
1224 1224
 		}
1225 1225
 
1226
-		return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this );
1226
+		return apply_filters('give_get_payment_fees', $fees, $this->ID, $this);
1227 1227
 	}
1228 1228
 
1229 1229
 	/**
@@ -1236,13 +1236,13 @@  discard block
 block discarded – undo
1236 1236
 	 *
1237 1237
 	 * @return void
1238 1238
 	 */
1239
-	public function add_note( $note = false ) {
1239
+	public function add_note($note = false) {
1240 1240
 		// Bail if no note specified
1241
-		if ( ! $note ) {
1241
+		if ( ! $note) {
1242 1242
 			return false;
1243 1243
 		}
1244 1244
 
1245
-		give_insert_payment_note( $this->ID, $note );
1245
+		give_insert_payment_note($this->ID, $note);
1246 1246
 	}
1247 1247
 
1248 1248
 	/**
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 	 *
1256 1256
 	 * @return void
1257 1257
 	 */
1258
-	private function increase_subtotal( $amount = 0.00 ) {
1258
+	private function increase_subtotal($amount = 0.00) {
1259 1259
 		$amount = (float) $amount;
1260 1260
 		$this->subtotal += $amount;
1261 1261
 
@@ -1272,11 +1272,11 @@  discard block
 block discarded – undo
1272 1272
 	 *
1273 1273
 	 * @return void
1274 1274
 	 */
1275
-	private function decrease_subtotal( $amount = 0.00 ) {
1275
+	private function decrease_subtotal($amount = 0.00) {
1276 1276
 		$amount = (float) $amount;
1277 1277
 		$this->subtotal -= $amount;
1278 1278
 
1279
-		if ( $this->subtotal < 0 ) {
1279
+		if ($this->subtotal < 0) {
1280 1280
 			$this->subtotal = 0;
1281 1281
 		}
1282 1282
 
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 	 *
1294 1294
 	 * @return void
1295 1295
 	 */
1296
-	private function increase_fees( $amount = 0.00 ) {
1296
+	private function increase_fees($amount = 0.00) {
1297 1297
 		$amount = (float) $amount;
1298 1298
 		$this->fees_total += $amount;
1299 1299
 
@@ -1310,11 +1310,11 @@  discard block
 block discarded – undo
1310 1310
 	 *
1311 1311
 	 * @return void
1312 1312
 	 */
1313
-	private function decrease_fees( $amount = 0.00 ) {
1313
+	private function decrease_fees($amount = 0.00) {
1314 1314
 		$amount = (float) $amount;
1315 1315
 		$this->fees_total -= $amount;
1316 1316
 
1317
-		if ( $this->fees_total < 0 ) {
1317
+		if ($this->fees_total < 0) {
1318 1318
 			$this->fees_total = 0;
1319 1319
 		}
1320 1320
 
@@ -1343,41 +1343,41 @@  discard block
 block discarded – undo
1343 1343
 	 *
1344 1344
 	 * @return bool   $updated Returns if the status was successfully updated
1345 1345
 	 */
1346
-	public function update_status( $status = false ) {
1346
+	public function update_status($status = false) {
1347 1347
 
1348 1348
 		//standardize the 'complete(d)' status
1349
-		if ( $status == 'completed' || $status == 'complete' ) {
1349
+		if ($status == 'completed' || $status == 'complete') {
1350 1350
 			$status = 'publish';
1351 1351
 		}
1352 1352
 
1353
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1353
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1354 1354
 
1355
-		if ( $old_status === $status ) {
1355
+		if ($old_status === $status) {
1356 1356
 			return false; // Don't permit status changes that aren't changes
1357 1357
 		}
1358 1358
 
1359
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1359
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1360 1360
 
1361 1361
 		$updated = false;
1362 1362
 
1363 1363
 
1364
-		if ( $do_change ) {
1364
+		if ($do_change) {
1365 1365
 
1366
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1366
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1367 1367
 
1368 1368
 			$update_fields = array(
1369 1369
 				'ID'          => $this->ID,
1370 1370
 				'post_status' => $status,
1371
-				'edit_date'   => current_time( 'mysql' )
1371
+				'edit_date'   => current_time('mysql')
1372 1372
 			);
1373 1373
 
1374
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1374
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1375 1375
 
1376 1376
 			$all_payment_statuses  = give_get_payment_statuses();
1377
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1377
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1378 1378
 
1379 1379
 			// Process any specific status functions
1380
-			switch ( $status ) {
1380
+			switch ($status) {
1381 1381
 				case 'refunded':
1382 1382
 					$this->process_refund();
1383 1383
 					break;
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
                     break;
1396 1396
 			}
1397 1397
 
1398
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1398
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1399 1399
 
1400 1400
 		}
1401 1401
 
@@ -1430,32 +1430,32 @@  discard block
 block discarded – undo
1430 1430
 	 *
1431 1431
 	 * @return mixed             The value from the post meta
1432 1432
 	 */
1433
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1433
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1434 1434
 
1435
-		$meta = get_post_meta( $this->ID, $meta_key, $single );
1435
+		$meta = get_post_meta($this->ID, $meta_key, $single);
1436 1436
 
1437
-		if ( $meta_key === '_give_payment_meta' ) {
1437
+		if ($meta_key === '_give_payment_meta') {
1438 1438
 
1439
-			if ( empty( $meta['key'] ) ) {
1439
+			if (empty($meta['key'])) {
1440 1440
 				$meta['key'] = $this->setup_payment_key();
1441 1441
 			}
1442 1442
 
1443
-			if ( empty( $meta['form_title'] ) ) {
1443
+			if (empty($meta['form_title'])) {
1444 1444
 				$meta['form_title'] = $this->setup_form_title();
1445 1445
 			}
1446 1446
 
1447
-			if ( empty( $meta['email'] ) ) {
1447
+			if (empty($meta['email'])) {
1448 1448
 				$meta['email'] = $this->setup_email();
1449 1449
 			}
1450 1450
 
1451
-			if ( empty( $meta['date'] ) ) {
1452
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1451
+			if (empty($meta['date'])) {
1452
+				$meta['date'] = get_post_field('post_date', $this->ID);
1453 1453
 			}
1454 1454
 		}
1455 1455
 
1456
-		$meta = apply_filters( 'give_get_payment_meta_' . $meta_key, $meta, $this->ID );
1456
+		$meta = apply_filters('give_get_payment_meta_'.$meta_key, $meta, $this->ID);
1457 1457
 
1458
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1458
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1459 1459
 	}
1460 1460
 
1461 1461
 	/**
@@ -1470,23 +1470,23 @@  discard block
 block discarded – undo
1470 1470
 	 *
1471 1471
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1472 1472
 	 */
1473
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1474
-		if ( empty( $meta_key ) ) {
1473
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1474
+		if (empty($meta_key)) {
1475 1475
 			return false;
1476 1476
 		}
1477 1477
 
1478
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1478
+		if ($meta_key == 'key' || $meta_key == 'date') {
1479 1479
 
1480 1480
 			$current_meta              = $this->get_meta();
1481
-			$current_meta[ $meta_key ] = $meta_value;
1481
+			$current_meta[$meta_key] = $meta_value;
1482 1482
 
1483 1483
 			$meta_key   = '_give_payment_meta';
1484 1484
 			$meta_value = $current_meta;
1485 1485
 
1486
-		} else if ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1486
+		} else if ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1487 1487
 
1488
-			$meta_value = apply_filters( 'give_give_update_payment_meta_' . $meta_key, $meta_value, $this->ID );
1489
-			update_post_meta( $this->ID, '_give_payment_user_email', $meta_value );
1488
+			$meta_value = apply_filters('give_give_update_payment_meta_'.$meta_key, $meta_value, $this->ID);
1489
+			update_post_meta($this->ID, '_give_payment_user_email', $meta_value);
1490 1490
 
1491 1491
 			$current_meta                       = $this->get_meta();
1492 1492
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1496,9 +1496,9 @@  discard block
 block discarded – undo
1496 1496
 
1497 1497
 		}
1498 1498
 
1499
-		$meta_value = apply_filters( 'give_update_payment_meta_' . $meta_key, $meta_value, $this->ID );
1499
+		$meta_value = apply_filters('give_update_payment_meta_'.$meta_key, $meta_value, $this->ID);
1500 1500
 
1501
-		return update_post_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1501
+		return update_post_meta($this->ID, $meta_key, $meta_value, $prev_value);
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1513,30 +1513,30 @@  discard block
 block discarded – undo
1513 1513
 		$process_refund = true;
1514 1514
 
1515 1515
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented
1516
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1516
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1517 1517
 			$process_refund = false;
1518 1518
 		}
1519 1519
 
1520 1520
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments
1521
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1521
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1522 1522
 
1523
-		if ( false === $process_refund ) {
1523
+		if (false === $process_refund) {
1524 1524
 			return;
1525 1525
 		}
1526 1526
 
1527
-		do_action( 'give_pre_refund_payment', $this );
1527
+		do_action('give_pre_refund_payment', $this);
1528 1528
 
1529
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1530
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1531
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1529
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1530
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1531
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1532 1532
 
1533
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1533
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1534 1534
 		$this->delete_sales_logs();
1535 1535
 
1536 1536
 		// Clear the This Month earnings (this_monththis_month is NOT a typo)
1537
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1537
+		delete_transient(md5('give_earnings_this_monththis_month'));
1538 1538
 
1539
-		do_action( 'give_post_refund_payment', $this );
1539
+		do_action('give_post_refund_payment', $this);
1540 1540
 	}
1541 1541
 
1542 1542
 	/**
@@ -1563,29 +1563,29 @@  discard block
 block discarded – undo
1563 1563
 		$process_pending = true;
1564 1564
 
1565 1565
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented
1566
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1566
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1567 1567
 			$process_pending = false;
1568 1568
 		}
1569 1569
 
1570 1570
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments
1571
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1571
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1572 1572
 
1573
-		if ( false === $process_pending ) {
1573
+		if (false === $process_pending) {
1574 1574
 			return;
1575 1575
 		}
1576 1576
 
1577
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_pending', true, $this );
1578
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_pending', true, $this );
1579
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_pending', true, $this );
1577
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_pending', true, $this);
1578
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_pending', true, $this);
1579
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_pending', true, $this);
1580 1580
 
1581
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1581
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1582 1582
 		$this->delete_sales_logs();
1583 1583
 
1584 1584
 		$this->completed_date = false;
1585
-		$this->update_meta( '_give_completed_date', '' );
1585
+		$this->update_meta('_give_completed_date', '');
1586 1586
 
1587 1587
 		// Clear the This Month earnings (this_monththis_month is NOT a typo)
1588
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1588
+		delete_transient(md5('give_earnings_this_monththis_month'));
1589 1589
 	}
1590 1590
 
1591 1591
     /**
@@ -1600,29 +1600,29 @@  discard block
 block discarded – undo
1600 1600
         $process_cancelled = true;
1601 1601
 
1602 1602
         // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented
1603
-        if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1603
+        if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1604 1604
             $process_cancelled = false;
1605 1605
         }
1606 1606
 
1607 1607
         // Allow extensions to filter for their own payment types, Example: Recurring Payments
1608
-        $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1608
+        $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1609 1609
 
1610
-        if ( false === $process_cancelled ) {
1610
+        if (false === $process_cancelled) {
1611 1611
             return;
1612 1612
         }
1613 1613
 
1614
-        $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this );
1615
-        $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this );
1616
-        $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this );
1614
+        $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_cancelled', true, $this);
1615
+        $decrease_customer_value = apply_filters('give_decrease_customer_value_on_cancelled', true, $this);
1616
+        $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_cancelled', true, $this);
1617 1617
 
1618
-        $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1618
+        $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1619 1619
         $this->delete_sales_logs();
1620 1620
 
1621 1621
         $this->completed_date = false;
1622
-        $this->update_meta( '_give_completed_date', '' );
1622
+        $this->update_meta('_give_completed_date', '');
1623 1623
 
1624 1624
         // Clear the This Month earnings (this_monththis_month is NOT a typo)
1625
-        delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1625
+        delete_transient(md5('give_earnings_this_monththis_month'));
1626 1626
     }
1627 1627
 
1628 1628
     /**
@@ -1635,29 +1635,29 @@  discard block
 block discarded – undo
1635 1635
         $process_revoked = true;
1636 1636
 
1637 1637
         // If the payment was not in publish, don't decrement stats as they were never incremented
1638
-        if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1638
+        if ('publish' != $this->old_status || 'revoked' != $this->status) {
1639 1639
             $process_revoked = false;
1640 1640
         }
1641 1641
 
1642 1642
         // Allow extensions to filter for their own payment types, Example: Recurring Payments
1643
-        $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1643
+        $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1644 1644
 
1645
-        if ( false === $process_revoked ) {
1645
+        if (false === $process_revoked) {
1646 1646
             return;
1647 1647
         }
1648 1648
 
1649
-        $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this );
1650
-        $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this );
1651
-        $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this );
1649
+        $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_revoked', true, $this);
1650
+        $decrease_customer_value = apply_filters('give_decrease_customer_value_on_revoked', true, $this);
1651
+        $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_revoked', true, $this);
1652 1652
 
1653
-        $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1653
+        $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1654 1654
         $this->delete_sales_logs();
1655 1655
 
1656 1656
         $this->completed_date = false;
1657
-        $this->update_meta( '_give_completed_date', '' );
1657
+        $this->update_meta('_give_completed_date', '');
1658 1658
 
1659 1659
         // Clear the This Month earnings (this_monththis_month is NOT a typo)
1660
-        delete_transient( md5( 'give_earnings_this_monththis_month' ) );
1660
+        delete_transient(md5('give_earnings_this_monththis_month'));
1661 1661
     }
1662 1662
 
1663 1663
 	/**
@@ -1672,25 +1672,25 @@  discard block
 block discarded – undo
1672 1672
 	 *
1673 1673
 	 * @return void
1674 1674
 	 */
1675
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1675
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1676 1676
 
1677
-		give_undo_purchase( false, $this->ID );
1677
+		give_undo_purchase(false, $this->ID);
1678 1678
 
1679 1679
 		// Decrease store earnings
1680
-		if ( true === $alter_store_earnings ) {
1681
-			give_decrease_total_earnings( $this->total );
1680
+		if (true === $alter_store_earnings) {
1681
+			give_decrease_total_earnings($this->total);
1682 1682
 		}
1683 1683
 
1684 1684
 		// Decrement the stats for the customer
1685
-		if ( ! empty( $this->customer_id ) ) {
1685
+		if ( ! empty($this->customer_id)) {
1686 1686
 
1687
-			$customer = new Give_Customer( $this->customer_id );
1687
+			$customer = new Give_Customer($this->customer_id);
1688 1688
 
1689
-			if ( true === $alter_customer_value ) {
1690
-				$customer->decrease_value( $this->total );
1689
+			if (true === $alter_customer_value) {
1690
+				$customer->decrease_value($this->total);
1691 1691
 			}
1692 1692
 
1693
-			if ( true === $alter_customer_purchase_count ) {
1693
+			if (true === $alter_customer_purchase_count) {
1694 1694
 				$customer->decrease_purchase_count();
1695 1695
 			}
1696 1696
 
@@ -1740,13 +1740,13 @@  discard block
 block discarded – undo
1740 1740
 	 * @return string The date the payment was completed
1741 1741
 	 */
1742 1742
 	private function setup_completed_date() {
1743
-		$payment = get_post( $this->ID );
1743
+		$payment = get_post($this->ID);
1744 1744
 
1745
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1745
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1746 1746
 			return false; // This payment was never completed
1747 1747
 		}
1748 1748
 
1749
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1749
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1750 1750
 
1751 1751
 		return $date;
1752 1752
 	}
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 	 * @return string The payment mode
1761 1761
 	 */
1762 1762
 	private function setup_mode() {
1763
-		return $this->get_meta( '_give_payment_mode' );
1763
+		return $this->get_meta('_give_payment_mode');
1764 1764
 	}
1765 1765
 
1766 1766
 	/**
@@ -1772,13 +1772,13 @@  discard block
 block discarded – undo
1772 1772
 	 * @return float The payment total
1773 1773
 	 */
1774 1774
 	private function setup_total() {
1775
-		$amount = $this->get_meta( '_give_payment_total', true );
1775
+		$amount = $this->get_meta('_give_payment_total', true);
1776 1776
 
1777
-		if ( empty( $amount ) && '0.00' != $amount ) {
1778
-			$meta = $this->get_meta( '_give_payment_meta', true );
1779
-			$meta = maybe_unserialize( $meta );
1777
+		if (empty($amount) && '0.00' != $amount) {
1778
+			$meta = $this->get_meta('_give_payment_meta', true);
1779
+			$meta = maybe_unserialize($meta);
1780 1780
 
1781
-			if ( isset( $meta['amount'] ) ) {
1781
+			if (isset($meta['amount'])) {
1782 1782
 				$amount = $meta['amount'];
1783 1783
 			}
1784 1784
 		}
@@ -1811,9 +1811,9 @@  discard block
 block discarded – undo
1811 1811
 	private function setup_fees_total() {
1812 1812
 		$fees_total = (float) 0.00;
1813 1813
 
1814
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1815
-		if ( ! empty( $payment_fees ) ) {
1816
-			foreach ( $payment_fees as $fee ) {
1814
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1815
+		if ( ! empty($payment_fees)) {
1816
+			foreach ($payment_fees as $fee) {
1817 1817
 				$fees_total += (float) $fee['amount'];
1818 1818
 			}
1819 1819
 		}
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
 	 * @return string The currency for the payment
1832 1832
 	 */
1833 1833
 	private function setup_currency() {
1834
-		$currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this );
1834
+		$currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this);
1835 1835
 
1836 1836
 		return $currency;
1837 1837
 	}
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 	 * @return array The Fees
1846 1846
 	 */
1847 1847
 	private function setup_fees() {
1848
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1848
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1849 1849
 
1850 1850
 		return $payment_fees;
1851 1851
 	}
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 	 * @return string The gateway
1860 1860
 	 */
1861 1861
 	private function setup_gateway() {
1862
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1862
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1863 1863
 
1864 1864
 		return $gateway;
1865 1865
 	}
@@ -1873,12 +1873,12 @@  discard block
 block discarded – undo
1873 1873
 	 * @return string The transaction ID for the payment
1874 1874
 	 */
1875 1875
 	private function setup_transaction_id() {
1876
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1876
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1877 1877
 
1878
-		if ( empty( $transaction_id ) || (int) $transaction_id === (int) $this->ID ) {
1878
+		if (empty($transaction_id) || (int) $transaction_id === (int) $this->ID) {
1879 1879
 
1880 1880
 			$gateway        = $this->gateway;
1881
-			$transaction_id = apply_filters( 'give_get_payment_transaction_id-' . $gateway, $this->ID );
1881
+			$transaction_id = apply_filters('give_get_payment_transaction_id-'.$gateway, $this->ID);
1882 1882
 
1883 1883
 		}
1884 1884
 
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 	 * @return string The IP address for the payment
1895 1895
 	 */
1896 1896
 	private function setup_ip() {
1897
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1897
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1898 1898
 
1899 1899
 		return $ip;
1900 1900
 	}
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 	 * @return int The Customer ID
1909 1909
 	 */
1910 1910
 	private function setup_customer_id() {
1911
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
1911
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
1912 1912
 
1913 1913
 		return $customer_id;
1914 1914
 	}
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
 	 * @return int The User ID
1923 1923
 	 */
1924 1924
 	private function setup_user_id() {
1925
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
1925
+		$user_id = $this->get_meta('_give_payment_user_id', true);
1926 1926
 
1927 1927
 		return $user_id;
1928 1928
 	}
@@ -1936,10 +1936,10 @@  discard block
 block discarded – undo
1936 1936
 	 * @return string The email address for the payment
1937 1937
 	 */
1938 1938
 	private function setup_email() {
1939
-		$email = $this->get_meta( '_give_payment_user_email', true );
1939
+		$email = $this->get_meta('_give_payment_user_email', true);
1940 1940
 
1941
-		if ( empty( $email ) ) {
1942
-			$email = Give()->customers->get_column( 'email', $this->customer_id );
1941
+		if (empty($email)) {
1942
+			$email = Give()->customers->get_column('email', $this->customer_id);
1943 1943
 		}
1944 1944
 
1945 1945
 		return $email;
@@ -1959,15 +1959,15 @@  discard block
 block discarded – undo
1959 1959
 			'last_name'  => $this->last_name,
1960 1960
 		);
1961 1961
 
1962
-		$user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array();
1963
-		$user_info = wp_parse_args( $user_info, $defaults );
1962
+		$user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array();
1963
+		$user_info = wp_parse_args($user_info, $defaults);
1964 1964
 
1965
-		if ( empty( $user_info ) ) {
1965
+		if (empty($user_info)) {
1966 1966
 			// Get the customer, but only if it's been created
1967
-			$customer = new Give_Customer( $this->customer_id );
1967
+			$customer = new Give_Customer($this->customer_id);
1968 1968
 
1969
-			if ( $customer->id > 0 ) {
1970
-				$name      = explode( ' ', $customer->name, 2 );
1969
+			if ($customer->id > 0) {
1970
+				$name      = explode(' ', $customer->name, 2);
1971 1971
 				$user_info = array(
1972 1972
 					'first_name' => $name[0],
1973 1973
 					'last_name'  => $name[1],
@@ -1977,29 +1977,29 @@  discard block
 block discarded – undo
1977 1977
 			}
1978 1978
 		} else {
1979 1979
 			// Get the customer, but only if it's been created
1980
-			$customer = new Give_Customer( $this->customer_id );
1981
-			if ( $customer->id > 0 ) {
1982
-				foreach ( $user_info as $key => $value ) {
1983
-					if ( ! empty( $value ) ) {
1980
+			$customer = new Give_Customer($this->customer_id);
1981
+			if ($customer->id > 0) {
1982
+				foreach ($user_info as $key => $value) {
1983
+					if ( ! empty($value)) {
1984 1984
 						continue;
1985 1985
 					}
1986 1986
 
1987
-					switch ( $key ) {
1987
+					switch ($key) {
1988 1988
 						case 'first_name':
1989
-							$name = explode( ' ', $customer->name, 2 );
1989
+							$name = explode(' ', $customer->name, 2);
1990 1990
 
1991
-							$user_info[ $key ] = $name[0];
1991
+							$user_info[$key] = $name[0];
1992 1992
 							break;
1993 1993
 
1994 1994
 						case 'last_name':
1995
-							$name      = explode( ' ', $customer->name, 2 );
1996
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
1995
+							$name      = explode(' ', $customer->name, 2);
1996
+							$last_name = ! empty($name[1]) ? $name[1] : '';
1997 1997
 
1998
-							$user_info[ $key ] = $last_name;
1998
+							$user_info[$key] = $last_name;
1999 1999
 							break;
2000 2000
 
2001 2001
 						case 'email':
2002
-							$user_info[ $key ] = $customer->email;
2002
+							$user_info[$key] = $customer->email;
2003 2003
 							break;
2004 2004
 					}
2005 2005
 				}
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 */
2022 2022
 	private function setup_address() {
2023 2023
 
2024
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
2024
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
2025 2025
 			'line1'   => '',
2026 2026
 			'line2'   => '',
2027 2027
 			'city'    => '',
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 	 */
2044 2044
 	private function setup_form_title() {
2045 2045
 
2046
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
2046
+		$form_id = $this->get_meta('_give_payment_form_title', true);
2047 2047
 
2048 2048
 		return $form_id;
2049 2049
 	}
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 	 */
2059 2059
 	private function setup_form_id() {
2060 2060
 
2061
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
2061
+		$form_id = $this->get_meta('_give_payment_form_id', true);
2062 2062
 
2063 2063
 		return $form_id;
2064 2064
 	}
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 	 * @return int The Form Price ID
2073 2073
 	 */
2074 2074
 	private function setup_price_id() {
2075
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
2075
+		$price_id = $this->get_meta('_give_payment_price_id', true);
2076 2076
 
2077 2077
 		return $price_id;
2078 2078
 	}
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 	 * @return string The Payment Key
2087 2087
 	 */
2088 2088
 	private function setup_payment_key() {
2089
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
2089
+		$key = $this->get_meta('_give_payment_purchase_key', true);
2090 2090
 
2091 2091
 		return $key;
2092 2092
 	}
@@ -2102,11 +2102,11 @@  discard block
 block discarded – undo
2102 2102
 	private function setup_payment_number() {
2103 2103
 		$number = $this->ID;
2104 2104
 
2105
-		if ( give_get_option( 'enable_sequential' ) ) {
2105
+		if (give_get_option('enable_sequential')) {
2106 2106
 
2107
-			$number = $this->get_meta( '_give_payment_number', true );
2107
+			$number = $this->get_meta('_give_payment_number', true);
2108 2108
 
2109
-			if ( ! $number ) {
2109
+			if ( ! $number) {
2110 2110
 
2111 2111
 				$number = $this->ID;
2112 2112
 
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
 	 * @return array The payment object as an array
2126 2126
 	 */
2127 2127
 	public function array_convert() {
2128
-		return get_object_vars( $this );
2128
+		return get_object_vars($this);
2129 2129
 	}
2130 2130
 
2131 2131
 	/**
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 	 * @return string Date payment was completed
2138 2138
 	 */
2139 2139
 	private function get_completed_date() {
2140
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2140
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2141 2141
 	}
2142 2142
 
2143 2143
 	/**
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 	 * @return float Payment subtotal
2150 2150
 	 */
2151 2151
 	private function get_subtotal() {
2152
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2152
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2153 2153
 	}
2154 2154
 
2155 2155
 	/**
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 	 * @return string Payment currency code
2162 2162
 	 */
2163 2163
 	private function get_currency() {
2164
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2164
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2165 2165
 	}
2166 2166
 
2167 2167
 	/**
@@ -2173,7 +2173,7 @@  discard block
 block discarded – undo
2173 2173
 	 * @return string Gateway used
2174 2174
 	 */
2175 2175
 	private function get_gateway() {
2176
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2176
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2177 2177
 	}
2178 2178
 
2179 2179
 	/**
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
 	 * @return string Transaction ID from merchant processor
2186 2186
 	 */
2187 2187
 	private function get_transaction_id() {
2188
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2188
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2189 2189
 	}
2190 2190
 
2191 2191
 	/**
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
 	 * @return string Payment IP address
2198 2198
 	 */
2199 2199
 	private function get_ip() {
2200
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2200
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2201 2201
 	}
2202 2202
 
2203 2203
 	/**
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 	 * @return int Payment customer ID
2210 2210
 	 */
2211 2211
 	private function get_customer_id() {
2212
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2212
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2213 2213
 	}
2214 2214
 
2215 2215
 	/**
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 	 * @return int Payment user ID
2222 2222
 	 */
2223 2223
 	private function get_user_id() {
2224
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2224
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2225 2225
 	}
2226 2226
 
2227 2227
 	/**
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 	 * @return string Payment customer email
2234 2234
 	 */
2235 2235
 	private function get_email() {
2236
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2236
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2237 2237
 	}
2238 2238
 
2239 2239
 	/**
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
 	 * @return array Payment user info
2246 2246
 	 */
2247 2247
 	private function get_user_info() {
2248
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2248
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2249 2249
 	}
2250 2250
 
2251 2251
 	/**
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 	 * @return array Payment billing address
2258 2258
 	 */
2259 2259
 	private function get_address() {
2260
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2260
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2261 2261
 	}
2262 2262
 
2263 2263
 	/**
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 	 * @return string Payment key
2270 2270
 	 */
2271 2271
 	private function get_key() {
2272
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2272
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2273 2273
 	}
2274 2274
 
2275 2275
 	/**
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 	 * @return string Payment form id
2282 2282
 	 */
2283 2283
 	private function get_form_id() {
2284
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2284
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2285 2285
 	}
2286 2286
 
2287 2287
 	/**
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 	 * @return int|string Payment number
2294 2294
 	 */
2295 2295
 	private function get_number() {
2296
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2296
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2297 2297
 	}
2298 2298
 
2299 2299
 }
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -64,50 +64,50 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool If the gravatar exists or not
66 66
 	 */
67
-	public function validate_gravatar( $id_or_email ) {
67
+	public function validate_gravatar($id_or_email) {
68 68
 		//id or email code borrowed from wp-includes/pluggable.php
69 69
 		$email = '';
70
-		if ( is_numeric( $id_or_email ) ) {
70
+		if (is_numeric($id_or_email)) {
71 71
 			$id   = (int) $id_or_email;
72
-			$user = get_userdata( $id );
73
-			if ( $user ) {
72
+			$user = get_userdata($id);
73
+			if ($user) {
74 74
 				$email = $user->user_email;
75 75
 			}
76
-		} elseif ( is_object( $id_or_email ) ) {
76
+		} elseif (is_object($id_or_email)) {
77 77
 			// No avatar for pingbacks or trackbacks
78
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
79
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
78
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
79
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
80 80
 				return false;
81 81
 			}
82 82
 
83
-			if ( ! empty( $id_or_email->user_id ) ) {
83
+			if ( ! empty($id_or_email->user_id)) {
84 84
 				$id   = (int) $id_or_email->user_id;
85
-				$user = get_userdata( $id );
86
-				if ( $user ) {
85
+				$user = get_userdata($id);
86
+				if ($user) {
87 87
 					$email = $user->user_email;
88 88
 				}
89
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
89
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
90 90
 				$email = $id_or_email->comment_author_email;
91 91
 			}
92 92
 		} else {
93 93
 			$email = $id_or_email;
94 94
 		}
95 95
 
96
-		$hashkey = md5( strtolower( trim( $email ) ) );
97
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
96
+		$hashkey = md5(strtolower(trim($email)));
97
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
98 98
 
99
-		$data = wp_cache_get( $hashkey );
100
-		if ( false === $data ) {
101
-			$response = wp_remote_head( $uri );
102
-			if ( is_wp_error( $response ) ) {
99
+		$data = wp_cache_get($hashkey);
100
+		if (false === $data) {
101
+			$response = wp_remote_head($uri);
102
+			if (is_wp_error($response)) {
103 103
 				$data = 'not200';
104 104
 			} else {
105 105
 				$data = $response['response']['code'];
106 106
 			}
107
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
107
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
108 108
 
109 109
 		}
110
-		if ( $data == '200' ) {
110
+		if ($data == '200') {
111 111
 			return true;
112 112
 		} else {
113 113
 			return false;
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return array        IDs if logs, false otherwise
126 126
 	 */
127
-	public function get_log_ids( $form_id = '' ) {
127
+	public function get_log_ids($form_id = '') {
128 128
 
129 129
 		// get Give_Logging class
130 130
 		global $give_logs;
131 131
 
132 132
 		// get log for this form
133
-		$logs = $give_logs->get_logs( $form_id );
133
+		$logs = $give_logs->get_logs($form_id);
134 134
 
135
-		if ( $logs ) {
135
+		if ($logs) {
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,49 +155,49 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		global $give_options;
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have purchased more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
178
+				$email = get_post_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			// strip duplicate emails
191
-			$unique_emails = array_unique( $unique_emails );
191
+			$unique_emails = array_unique($unique_emails);
192 192
 
193 193
 			// convert the unique IDs back into simple array
194
-			foreach ( $unique_emails as $id => $email ) {
194
+			foreach ($unique_emails as $id => $email) {
195 195
 				$unique_ids[] = $id;
196 196
 			}
197 197
 
198 198
 			// randomize the payment IDs if enabled
199
-			if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) {
200
-				shuffle( $unique_ids );
199
+			if (isset($give_options['give_donators_gravatars_random_gravatars'])) {
200
+				shuffle($unique_ids);
201 201
 			}
202 202
 
203 203
 			// return our unique IDs
@@ -218,22 +218,22 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return string
220 220
 	 */
221
-	public function gravatars( $form_id = false, $title = '' ) {
221
+	public function gravatars($form_id = false, $title = '') {
222 222
 
223 223
 		// unique $payment_ids 
224
-		$payment_ids = $this->get_payment_ids( $form_id );
224
+		$payment_ids = $this->get_payment_ids($form_id);
225 225
 
226 226
 		global $give_options;
227 227
 
228 228
 		// return if no ID
229
-		if ( ! $form_id ) {
229
+		if ( ! $form_id) {
230 230
 			return;
231 231
 		}
232 232
 
233 233
 		// minimum amount of purchases before showing gravatars
234 234
 		// if the number of items in array is not greater or equal to the number specified, then exit
235
-		if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) {
236
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) {
235
+		if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) {
236
+			if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) {
237 237
 				return;
238 238
 			}
239 239
 		}
@@ -244,51 +244,51 @@  discard block
 block discarded – undo
244 244
 		echo '<div id="give-purchase-gravatars">';
245 245
 
246 246
 
247
-		if ( isset ( $title ) ) {
247
+		if (isset ($title)) {
248 248
 
249
-			if ( $title ) {
250
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
251
-			} elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) {
252
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' );
249
+			if ($title) {
250
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
251
+			} elseif (isset($give_options['give_donators_gravatars_heading'])) {
252
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>');
253 253
 			}
254 254
 
255 255
 		}
256 256
 		echo '<ul class="give-purchase-gravatars-list">';
257 257
 		$i = 0;
258 258
 
259
-		if ( $payment_ids ) {
260
-			foreach ( $payment_ids as $id ) {
259
+		if ($payment_ids) {
260
+			foreach ($payment_ids as $id) {
261 261
 
262 262
 				// Give saves a blank option even when the control is turned off, hence the extra check
263
-				if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) {
263
+				if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) {
264 264
 					continue;
265 265
 				}
266 266
 
267 267
 				// get the payment meta
268
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
268
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
269 269
 
270 270
 				// unserialize the payment meta
271
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
271
+				$user_info = maybe_unserialize($payment_meta['user_info']);
272 272
 
273 273
 				// get donor's first name
274 274
 				$name = $user_info['first_name'];
275 275
 
276 276
 				// get donor's email
277
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
277
+				$email = get_post_meta($id, '_give_payment_user_email', true);
278 278
 
279 279
 				// set gravatar size and provide filter
280
-				$size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : '';
280
+				$size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : '';
281 281
 
282 282
 				// default image
283
-				$default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false );
283
+				$default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false);
284 284
 
285 285
 				// assemble output
286 286
 				$output .= '<li>';
287 287
 
288
-				$output .= get_avatar( $email, $size, $default_image, $name );
288
+				$output .= get_avatar($email, $size, $default_image, $name);
289 289
 				$output .= '</li>';
290 290
 
291
-				$i ++;
291
+				$i++;
292 292
 
293 293
 			} // end foreach
294 294
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		echo '</ul>';
298 298
 		echo '</div>';
299 299
 
300
-		return apply_filters( 'give_donators_gravatars', ob_get_clean() );
300
+		return apply_filters('give_donators_gravatars', ob_get_clean());
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return void
310 310
 	 */
311 311
 	public function register_widget() {
312
-		register_widget( 'Give_Donators_Gravatars_Widget' );
312
+		register_widget('Give_Donators_Gravatars_Widget');
313 313
 	}
314 314
 
315 315
 	/**
@@ -325,19 +325,19 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @todo   Set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
327 327
 	 */
328
-	public function shortcode( $atts, $content = null ) {
328
+	public function shortcode($atts, $content = null) {
329 329
 
330
-		$atts = shortcode_atts( array(
330
+		$atts = shortcode_atts(array(
331 331
 			'id'    => '',
332 332
 			'title' => ''
333
-		), $atts, 'give_donators_gravatars' );
333
+		), $atts, 'give_donators_gravatars');
334 334
 
335 335
 		// if no ID is passed on single give_forms pages, get the correct ID
336
-		if ( is_singular( 'give_forms' ) ) {
336
+		if (is_singular('give_forms')) {
337 337
 			$id = get_the_ID();
338 338
 		}
339 339
 
340
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
340
+		$content = $this->gravatars($atts['id'], $atts['title']);
341 341
 
342 342
 		return $content;
343 343
 
@@ -353,57 +353,57 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return array           Gravatar settings.
355 355
 	 */
356
-	public function settings( $settings ) {
356
+	public function settings($settings) {
357 357
 
358 358
 		$give_gravatar_settings = array(
359 359
 			array(
360
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
360
+				'name' => esc_html__('Donator Gravatars', 'give'),
361 361
 				'desc' => '<hr>',
362 362
 				'id'   => 'give_title',
363 363
 				'type' => 'give_title'
364 364
 			),
365 365
 			array(
366
-				'name' => esc_html__( 'Heading', 'give' ),
367
-				'desc' => esc_html__( 'The heading to display above the Gravatars', 'give' ),
366
+				'name' => esc_html__('Heading', 'give'),
367
+				'desc' => esc_html__('The heading to display above the Gravatars', 'give'),
368 368
 				'type' => 'text',
369 369
 				'id'   => 'give_donators_gravatars_heading'
370 370
 			),
371 371
 			array(
372
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
373
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum)', 'give' ),
372
+				'name'    => esc_html__('Gravatar Size', 'give'),
373
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum)', 'give'),
374 374
 				'type'    => 'text_small',
375 375
 				'id'      => 'give_donators_gravatars_gravatar_size',
376 376
 				'default' => '64'
377 377
 			),
378 378
 			array(
379
-				'name' => esc_html__( 'Minimum Unique Purchases Required', 'give' ),
379
+				'name' => esc_html__('Minimum Unique Purchases Required', 'give'),
380 380
 				/* translators: %s: form singular label */
381
-				'desc' => sprintf( esc_html__( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
381
+				'desc' => sprintf(esc_html__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
382 382
 				'type' => 'text_small',
383 383
 				'id'   => 'give_donators_gravatars_min_purchases_required',
384 384
 			),
385 385
 			array(
386
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
387
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
386
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
387
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
388 388
 				'type'    => 'text',
389 389
 				'id'      => 'give_donators_gravatars_maximum_number',
390 390
 				'default' => '20',
391 391
 			),
392 392
 			array(
393
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
394
-				'desc' => esc_html__( 'Only show donators with a Gravatar account', 'give' ),
393
+				'name' => esc_html__('Gravatar Visibility', 'give'),
394
+				'desc' => esc_html__('Only show donators with a Gravatar account', 'give'),
395 395
 				'id'   => 'give_donators_gravatars_has_gravatar_account',
396 396
 				'type' => 'checkbox',
397 397
 			),
398 398
 			array(
399
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
400
-				'desc' => esc_html__( 'Randomize the Gravatars', 'give' ),
399
+				'name' => esc_html__('Randomize Gravatars', 'give'),
400
+				'desc' => esc_html__('Randomize the Gravatars', 'give'),
401 401
 				'id'   => 'give_donators_gravatars_random_gravatars',
402 402
 				'type' => 'checkbox',
403 403
 			),
404 404
 		);
405 405
 
406
-		return array_merge( $settings, $give_gravatar_settings );
406
+		return array_merge($settings, $give_gravatar_settings);
407 407
 	}
408 408
 
409 409
 }
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function __construct() {
430 430
 
431
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
431
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
432 432
 
433 433
 		// widget settings
434 434
 		$widget_ops = array(
435 435
 			'classname'   => 'give-donators-gravatars',
436 436
 			/* translators: 1: form singular label 2: form singular label */
437
-			'description' => sprintf( esc_html__( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular )
437
+			'description' => sprintf(esc_html__('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular)
438 438
 		);
439 439
 
440 440
 		// widget control settings
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		// create the widget
448 448
 		parent::__construct(
449 449
 			'give_donators_gravatars_widget',
450
-			esc_html__( 'Give Donators Gravatars', 'give' ),
450
+			esc_html__('Give Donators Gravatars', 'give'),
451 451
 			$widget_ops,
452 452
 			$control_ops
453 453
 		);
@@ -467,30 +467,30 @@  discard block
 block discarded – undo
467 467
 	 *
468 468
 	 * @return void
469 469
 	 */
470
-	public function widget( $args, $instance ) {
470
+	public function widget($args, $instance) {
471 471
 		global $give_options;
472 472
 
473 473
 		//@TODO: Don't extract it!!!
474
-		extract( $args );
474
+		extract($args);
475 475
 
476
-		if ( ! is_singular( 'give_forms' ) ) {
476
+		if ( ! is_singular('give_forms')) {
477 477
 			return;
478 478
 		}
479 479
 
480 480
 		// Variables from widget settings
481
-		$title = apply_filters( 'widget_title', $instance['title'] );
481
+		$title = apply_filters('widget_title', $instance['title']);
482 482
 
483 483
 		// Used by themes. Opens the widget
484 484
 		echo $before_widget;
485 485
 
486 486
 		// Display the widget title
487
-		if ( $title ) {
488
-			echo $before_title . $title . $after_title;
487
+		if ($title) {
488
+			echo $before_title.$title.$after_title;
489 489
 		}
490 490
 
491 491
 		$gravatars = new Give_Donators_Gravatars();
492 492
 
493
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
493
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
494 494
 
495 495
 		// Used by themes. Closes the widget
496 496
 		echo $after_widget;
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 *
511 511
 	 * @return array Updated settings to save.
512 512
 	 */
513
-	public function update( $new_instance, $old_instance ) {
513
+	public function update($new_instance, $old_instance) {
514 514
 
515 515
 		$instance = $old_instance;
516 516
 
517
-		$instance['title'] = strip_tags( $new_instance['title'] );
517
+		$instance['title'] = strip_tags($new_instance['title']);
518 518
 
519 519
 		return $instance;
520 520
 
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return void
534 534
 	 */
535
-	public function form( $instance ) {
535
+	public function form($instance) {
536 536
 
537 537
 		// Set up some default widget settings.
538 538
 		$defaults = array(
539 539
 			'title' => '',
540 540
 		);
541 541
 
542
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
542
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
543 543
 
544 544
 		<!-- Title -->
545 545
 		<p>
546
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
547
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
546
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
547
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
548 548
 		</p>
549 549
 
550 550
 		<?php
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return void
38 38
 	 */
39 39
 	public function __construct() {
40
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
40
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return void
52 52
 	 */
53 53
 	public function add_roles() {
54
-		add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array(
54
+		add_role('give_manager', esc_html__('Give Manager', 'give'), array(
55 55
 			'read'                   => true,
56 56
 			'edit_posts'             => true,
57 57
 			'delete_posts'           => true,
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 			'publish_posts'          => true,
81 81
 			'read_private_pages'     => true,
82 82
 			'read_private_posts'     => true
83
-		) );
83
+		));
84 84
 
85
-		add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array(
85
+		add_role('give_accountant', esc_html__('Give Accountant', 'give'), array(
86 86
 		    'read'                   => true,
87 87
 		    'edit_posts'             => false,
88 88
 		    'delete_posts'           => false
89
-		) );
89
+		));
90 90
 
91
-		add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array(
91
+		add_role('give_worker', esc_html__('Give Worker', 'give'), array(
92 92
 			'read'                   => true,
93 93
 			'edit_posts'             => false,
94 94
 			'upload_files'           => true,
95 95
 			'delete_posts'           => false
96
-		) );
96
+		));
97 97
 
98 98
 	}
99 99
 
@@ -112,38 +112,38 @@  discard block
 block discarded – undo
112 112
 	public function add_caps() {
113 113
 		global $wp_roles;
114 114
 
115
-		if ( class_exists('WP_Roles') ) {
116
-			if ( ! isset( $wp_roles ) ) {
115
+		if (class_exists('WP_Roles')) {
116
+			if ( ! isset($wp_roles)) {
117 117
 				$wp_roles = new WP_Roles();
118 118
 			}
119 119
 		}
120 120
 
121
-		if ( is_object( $wp_roles ) ) {
122
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
123
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
124
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
125
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
121
+		if (is_object($wp_roles)) {
122
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
123
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
124
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
125
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
126 126
 
127
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
128
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
129
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
130
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
127
+			$wp_roles->add_cap('administrator', 'view_give_reports');
128
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
129
+			$wp_roles->add_cap('administrator', 'export_give_reports');
130
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
131 131
 
132 132
 			// Add the main post type capabilities
133 133
 			$capabilities = $this->get_core_caps();
134
-			foreach ( $capabilities as $cap_group ) {
135
-				foreach ( $cap_group as $cap ) {
136
-					$wp_roles->add_cap( 'administrator', $cap );
137
-					$wp_roles->add_cap( 'give_manager', $cap );
138
-					$wp_roles->add_cap( 'give_worker', $cap );
134
+			foreach ($capabilities as $cap_group) {
135
+				foreach ($cap_group as $cap) {
136
+					$wp_roles->add_cap('administrator', $cap);
137
+					$wp_roles->add_cap('give_manager', $cap);
138
+					$wp_roles->add_cap('give_worker', $cap);
139 139
 				}
140 140
 			}
141 141
 
142
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
143
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
144
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
145
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
146
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
142
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
143
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
144
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
145
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
146
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
147 147
 
148 148
 		}
149 149
 	}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	public function get_core_caps() {
162 162
 		$capabilities = array();
163 163
 
164
-		$capability_types = array( 'give_form', 'give_payment' );
164
+		$capability_types = array('give_form', 'give_payment');
165 165
 
166
-		foreach ( $capability_types as $capability_type ) {
167
-			$capabilities[ $capability_type ] = array(
166
+		foreach ($capability_types as $capability_type) {
167
+			$capabilities[$capability_type] = array(
168 168
 				// Post type
169 169
 				"edit_{$capability_type}",
170 170
 				"read_{$capability_type}",
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array $caps Meta capabilities.
206 206
 	 */
207
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
207
+	public function meta_caps($caps, $cap, $user_id, $args) {
208 208
 
209
-		switch( $cap ) {
209
+		switch ($cap) {
210 210
 
211 211
 			case 'view_give_forms_stats' :
212 212
 				
213
-				if( empty( $args[0] ) ) {
213
+				if (empty($args[0])) {
214 214
 					break;
215 215
 				}
216 216
 				
217
-				$form = get_post( $args[0] );
218
-				if ( empty( $form ) ) {
217
+				$form = get_post($args[0]);
218
+				if (empty($form)) {
219 219
 					break;
220 220
 				}
221 221
 
222
-				if( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
222
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
223 223
 					$caps = array();
224 224
 				}
225 225
 
@@ -244,41 +244,41 @@  discard block
 block discarded – undo
244 244
 		
245 245
 		global $wp_roles;
246 246
 
247
-		if ( class_exists( 'WP_Roles' ) ) {
248
-			if ( ! isset( $wp_roles ) ) {
247
+		if (class_exists('WP_Roles')) {
248
+			if ( ! isset($wp_roles)) {
249 249
 				$wp_roles = new WP_Roles();
250 250
 			}
251 251
 		}
252 252
 
253
-		if ( is_object( $wp_roles ) ) {
253
+		if (is_object($wp_roles)) {
254 254
 			/** Give Manager Capabilities */
255
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
256
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
257
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
258
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
255
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
256
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
257
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
258
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
259 259
 
260 260
 			/** Site Administrator Capabilities */
261
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
262
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
263
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
264
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
261
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
262
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
263
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
264
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
265 265
 
266 266
 			/** Remove the Main Post Type Capabilities */
267 267
 			$capabilities = $this->get_core_caps();
268 268
 
269
-			foreach ( $capabilities as $cap_group ) {
270
-				foreach ( $cap_group as $cap ) {
271
-					$wp_roles->remove_cap( 'give_manager', $cap );
272
-					$wp_roles->remove_cap( 'administrator', $cap );
273
-					$wp_roles->remove_cap( 'give_worker', $cap );
269
+			foreach ($capabilities as $cap_group) {
270
+				foreach ($cap_group as $cap) {
271
+					$wp_roles->remove_cap('give_manager', $cap);
272
+					$wp_roles->remove_cap('administrator', $cap);
273
+					$wp_roles->remove_cap('give_worker', $cap);
274 274
 				}
275 275
 			}
276 276
 
277 277
 			/** Give Accountant Capabilities */
278
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
279
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
280
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
281
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
278
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
279
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
280
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
281
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
282 282
 
283 283
 		}
284 284
 	}
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => esc_html__( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => esc_html__('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => esc_html__( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => esc_html__( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => esc_html__( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => esc_html__( 'New %1$s', 'give' ),
48
-		'all_items'          => esc_html__( 'All %2$s', 'give' ),
49
-		'view_item'          => esc_html__( 'View %1$s', 'give' ),
50
-		'search_items'       => esc_html__( 'Search %2$s', 'give' ),
51
-		'not_found'          => esc_html__( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => esc_html__( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => esc_html__('Add %1$s', 'give'),
45
+		'add_new_item'       => esc_html__('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => esc_html__('Edit Donation %1$s', 'give'),
47
+		'new_item'           => esc_html__('New %1$s', 'give'),
48
+		'all_items'          => esc_html__('All %2$s', 'give'),
49
+		'view_item'          => esc_html__('View %1$s', 'give'),
50
+		'search_items'       => esc_html__('Search %2$s', 'give'),
51
+		'not_found'          => esc_html__('No %2$s found', 'give'),
52
+		'not_found_in_trash' => esc_html__('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Payment Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => esc_html__( 'Add New', 'give' ),
104
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
105
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
106
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
107
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
108
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
109
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
110
-		'not_found'          => esc_html__( 'No Donations found', 'give' ),
111
-		'not_found_in_trash' => esc_html__( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => esc_html__('Add New', 'give'),
104
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
105
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
106
+		'new_item'           => esc_html__('New Donation', 'give'),
107
+		'all_items'          => esc_html__('All Donations', 'give'),
108
+		'view_item'          => esc_html__('View Donation', 'give'),
109
+		'search_items'       => esc_html__('Search Donations', 'give'),
110
+		'not_found'          => esc_html__('No Donations found', 'give'),
111
+		'not_found_in_trash' => esc_html__('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => esc_html__( 'Transactions', 'give' )
113
+		'menu_name'          => esc_html__('Transactions', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147 147
 		/* translators: %s: form singular label */
148
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
149
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
150
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
151
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
152
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
153
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
154
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
155
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
148
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
149
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
150
+		'search_items'      => esc_html__('Search Categories', 'give'),
151
+		'all_items'         => esc_html__('All Categories', 'give'),
152
+		'parent_item'       => esc_html__('Parent Category', 'give'),
153
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
154
+		'edit_item'         => esc_html__('Edit Category', 'give'),
155
+		'update_item'       => esc_html__('Update Category', 'give'),
156 156
 		/* translators: %s: form singular label */
157
-		'add_new_item'      => sprintf( esc_html__( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
158
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
159
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
157
+		'add_new_item'      => sprintf(esc_html__('Add New %s Category', 'give'), give_get_forms_label_singular()),
158
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
159
+		'menu_name'         => esc_html__('Categories', 'give'),
160 160
 	);
161 161
 
162
-	$category_args = apply_filters( 'give_forms_category_args', array(
162
+	$category_args = apply_filters('give_forms_category_args', array(
163 163
 			'hierarchical' => true,
164
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
164
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
165 165
 			'show_ui'      => true,
166 166
 			'query_var'    => 'give_forms_category',
167 167
 			'rewrite'      => array(
168
-				'slug'         => $slug . '/category',
168
+				'slug'         => $slug.'/category',
169 169
 				'with_front'   => false,
170 170
 				'hierarchical' => true
171 171
 			),
@@ -179,36 +179,36 @@  discard block
 block discarded – undo
179 179
 	);
180 180
 
181 181
 	//Does the user want categories?
182
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
183
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
184
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
182
+	if (give_get_option('enable_categories') == 'on') {
183
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
184
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
185 185
 	}
186 186
 
187 187
 
188 188
 	/** Tags */
189 189
 	$tag_labels = array(
190 190
 		/* translators: %s: form singular label */
191
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
192
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
193
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
194
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
195
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
196
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
197
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
198
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
199
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
200
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
201
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
191
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
192
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
193
+		'search_items'          => esc_html__('Search Tags', 'give'),
194
+		'all_items'             => esc_html__('All Tags', 'give'),
195
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
196
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
197
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
198
+		'update_item'           => esc_html__('Update Tag', 'give'),
199
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
200
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
201
+		'menu_name'             => esc_html__('Tags', 'give'),
202 202
 		/* translators: %s: form singular label */
203
-		'choose_from_most_used' => sprintf( esc_html__( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ),
203
+		'choose_from_most_used' => sprintf(esc_html__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()),
204 204
 	);
205 205
 
206
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
206
+	$tag_args = apply_filters('give_forms_tag_args', array(
207 207
 			'hierarchical' => false,
208
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
208
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
209 209
 			'show_ui'      => true,
210 210
 			'query_var'    => 'give_forms_tag',
211
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
211
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
212 212
 			'capabilities' => array(
213 213
 				'manage_terms' => 'manage_give_form_terms',
214 214
 				'edit_terms'   => 'edit_give_form_terms',
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		)
219 219
 	);
220 220
 
221
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
222
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
223
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
221
+	if (give_get_option('enable_tags') == 'on') {
222
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
223
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
224 224
 	}
225 225
 
226 226
 
227 227
 }
228 228
 
229
-add_action( 'init', 'give_setup_taxonomies', 0 );
229
+add_action('init', 'give_setup_taxonomies', 0);
230 230
 
231 231
 
232 232
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function give_get_default_form_labels() {
239 239
 	$defaults = array(
240
-		'singular' => esc_html__( 'Form', 'give' ),
241
-		'plural'   => esc_html__( 'Forms', 'give' )
240
+		'singular' => esc_html__('Form', 'give'),
241
+		'plural'   => esc_html__('Forms', 'give')
242 242
 	);
243 243
 
244
-	return apply_filters( 'give_default_form_name', $defaults );
244
+	return apply_filters('give_default_form_name', $defaults);
245 245
 }
246 246
 
247 247
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string $defaults['singular'] Singular label
255 255
  */
256
-function give_get_forms_label_singular( $lowercase = false ) {
256
+function give_get_forms_label_singular($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
259
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
260 260
 }
261 261
 
262 262
 /**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
  * @since 1.0
266 266
  * @return string $defaults['plural'] Plural label
267 267
  */
268
-function give_get_forms_label_plural( $lowercase = false ) {
268
+function give_get_forms_label_plural($lowercase = false) {
269 269
 	$defaults = give_get_default_form_labels();
270 270
 
271
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
271
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
272 272
 }
273 273
 
274 274
 /**
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return string $title New placeholder text
282 282
  */
283
-function give_change_default_title( $title ) {
283
+function give_change_default_title($title) {
284 284
 	// If a frontend plugin uses this filter (check extensions before changing this function)
285
-	if ( ! is_admin() ) {
285
+	if ( ! is_admin()) {
286 286
 		$title = sprintf(
287 287
 			/* translators: %s: form singular label */
288
-			esc_html__( 'Enter %s title here', 'give' ),
288
+			esc_html__('Enter %s title here', 'give'),
289 289
 			give_get_forms_label_singular()
290 290
 		);
291 291
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 
295 295
 	$screen = get_current_screen();
296 296
 
297
-	if ( 'give_forms' == $screen->post_type ) {
297
+	if ('give_forms' == $screen->post_type) {
298 298
 		$title = sprintf(
299 299
 			/* translators: %s: form singular label */
300
-			esc_html__( 'Enter %s title here', 'give' ),
300
+			esc_html__('Enter %s title here', 'give'),
301 301
 			give_get_forms_label_singular()
302 302
 		);
303 303
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	return $title;
306 306
 }
307 307
 
308
-add_filter( 'enter_title_here', 'give_change_default_title' );
308
+add_filter('enter_title_here', 'give_change_default_title');
309 309
 
310 310
 /**
311 311
  * Registers Custom Post Statuses which are used by the Payments
@@ -315,50 +315,50 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function give_register_post_type_statuses() {
317 317
 	// Payment Statuses
318
-	register_post_status( 'refunded', array(
319
-		'label'                     => _x( 'Refunded', 'payment status', 'give' ),
318
+	register_post_status('refunded', array(
319
+		'label'                     => _x('Refunded', 'payment status', 'give'),
320 320
 		'public'                    => true,
321 321
 		'exclude_from_search'       => false,
322 322
 		'show_in_admin_all_list'    => true,
323 323
 		'show_in_admin_status_list' => true,
324
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
325
-	) );
326
-	register_post_status( 'failed', array(
327
-		'label'                     => _x( 'Failed', 'payment status', 'give' ),
324
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
325
+	));
326
+	register_post_status('failed', array(
327
+		'label'                     => _x('Failed', 'payment status', 'give'),
328 328
 		'public'                    => true,
329 329
 		'exclude_from_search'       => false,
330 330
 		'show_in_admin_all_list'    => true,
331 331
 		'show_in_admin_status_list' => true,
332
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
333
-	) );
334
-	register_post_status( 'revoked', array(
335
-		'label'                     => _x( 'Revoked', 'payment status', 'give' ),
332
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
333
+	));
334
+	register_post_status('revoked', array(
335
+		'label'                     => _x('Revoked', 'payment status', 'give'),
336 336
 		'public'                    => true,
337 337
 		'exclude_from_search'       => false,
338 338
 		'show_in_admin_all_list'    => true,
339 339
 		'show_in_admin_status_list' => true,
340
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
341
-	) );
342
-	register_post_status( 'cancelled', array(
343
-		'label'                     => _x( 'Cancelled', 'payment status', 'give' ),
340
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
341
+	));
342
+	register_post_status('cancelled', array(
343
+		'label'                     => _x('Cancelled', 'payment status', 'give'),
344 344
 		'public'                    => true,
345 345
 		'exclude_from_search'       => false,
346 346
 		'show_in_admin_all_list'    => true,
347 347
 		'show_in_admin_status_list' => true,
348
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
349
-	) );
350
-	register_post_status( 'abandoned', array(
351
-		'label'                     => _x( 'Abandoned', 'payment status', 'give' ),
348
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
349
+	));
350
+	register_post_status('abandoned', array(
351
+		'label'                     => _x('Abandoned', 'payment status', 'give'),
352 352
 		'public'                    => true,
353 353
 		'exclude_from_search'       => false,
354 354
 		'show_in_admin_all_list'    => true,
355 355
 		'show_in_admin_status_list' => true,
356
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
357
-	) );
356
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
357
+	));
358 358
 
359 359
 }
360 360
 
361
-add_action( 'init', 'give_register_post_type_statuses' );
361
+add_action('init', 'give_register_post_type_statuses');
362 362
 
363 363
 /**
364 364
  * Updated Messages
@@ -371,43 +371,43 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return array $messages New post updated messages
373 373
  */
374
-function give_updated_messages( $messages ) {
374
+function give_updated_messages($messages) {
375 375
 	global $post, $post_ID;
376 376
 
377
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
377
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
378 378
 	$url2 = give_get_forms_label_singular();
379 379
 	$url3 = '</a>';
380 380
 
381 381
 	$messages['give_forms'] = array(
382
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
383
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
384
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
385
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
386
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
382
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
383
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
384
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
385
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
386
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
387 387
 	);
388 388
 
389 389
 	return $messages;
390 390
 }
391 391
 
392
-add_filter( 'post_updated_messages', 'give_updated_messages' );
392
+add_filter('post_updated_messages', 'give_updated_messages');
393 393
 
394 394
 
395 395
 /**
396 396
  * Setup Post Type Images
397 397
  */
398
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
398
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
399 399
 
400 400
 /**
401 401
  * Ensure post thumbnail support is turned on
402 402
  */
403 403
 function give_add_thumbnail_support() {
404
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
404
+	if (give_get_option('disable_form_featured_img') === 'on') {
405 405
 		return;
406 406
 	}
407
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
408
-		add_theme_support( 'post-thumbnails' );
407
+	if ( ! current_theme_supports('post-thumbnails')) {
408
+		add_theme_support('post-thumbnails');
409 409
 	}
410
-	add_post_type_support( 'give_forms', 'thumbnail' );
410
+	add_post_type_support('give_forms', 'thumbnail');
411 411
 }
412 412
 
413 413
 /**
@@ -419,19 +419,19 @@  discard block
 block discarded – undo
419 419
 function give_widgets_init() {
420 420
 
421 421
 	//Single Give Forms (disabled if single turned off in settings)
422
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
422
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
423 423
 
424
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
425
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
424
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
425
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
426 426
 			'id'            => 'give-forms-sidebar',
427
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
427
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
428 428
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
429 429
 			'after_widget'  => '</div>',
430 430
 			'before_title'  => '<h3 class="widgettitle widget-title">',
431 431
 			'after_title'   => '</h3>',
432
-		) ) );
432
+		)));
433 433
 
434 434
 	}
435 435
 }
436 436
 
437
-add_action( 'widgets_init', 'give_widgets_init', 999 );
437
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.