@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @param int|bool $payment_id A given payment |
371 | 371 | * |
372 | - * @return mixed void|false |
|
372 | + * @return false|null void|false |
|
373 | 373 | */ |
374 | 374 | public function __construct( $payment_id = false ) { |
375 | 375 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @param string $note The note to add |
1090 | 1090 | * |
1091 | - * @return bool If the note was specified or not |
|
1091 | + * @return false|null If the note was specified or not |
|
1092 | 1092 | */ |
1093 | 1093 | public function add_note( $note = false ) { |
1094 | 1094 | // Bail if no note specified. |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return mixed void|false |
373 | 373 | */ |
374 | - public function __construct( $payment_id = false ) { |
|
374 | + public function __construct($payment_id = false) { |
|
375 | 375 | |
376 | - if ( empty( $payment_id ) ) { |
|
376 | + if (empty($payment_id)) { |
|
377 | 377 | return false; |
378 | 378 | } |
379 | 379 | |
380 | - $this->setup_payment( $payment_id ); |
|
380 | + $this->setup_payment($payment_id); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return mixed The value. |
392 | 392 | */ |
393 | - public function __get( $key ) { |
|
393 | + public function __get($key) { |
|
394 | 394 | |
395 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
395 | + if (method_exists($this, 'get_'.$key)) { |
|
396 | 396 | |
397 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
397 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
398 | 398 | |
399 | 399 | } else { |
400 | 400 | |
@@ -416,18 +416,18 @@ discard block |
||
416 | 416 | * @param string $key The property name |
417 | 417 | * @param mixed $value The value of the property |
418 | 418 | */ |
419 | - public function __set( $key, $value ) { |
|
420 | - $ignore = array( '_ID' ); |
|
419 | + public function __set($key, $value) { |
|
420 | + $ignore = array('_ID'); |
|
421 | 421 | |
422 | - if ( 'status' === $key ) { |
|
422 | + if ('status' === $key) { |
|
423 | 423 | $this->old_status = $this->status; |
424 | 424 | } |
425 | 425 | |
426 | - if ( ! in_array( $key, $ignore ) ) { |
|
427 | - $this->pending[ $key ] = $value; |
|
426 | + if ( ! in_array($key, $ignore)) { |
|
427 | + $this->pending[$key] = $value; |
|
428 | 428 | } |
429 | 429 | |
430 | - if ( '_ID' !== $key ) { |
|
430 | + if ('_ID' !== $key) { |
|
431 | 431 | $this->$key = $value; |
432 | 432 | } |
433 | 433 | } |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @return boolean|null If the item is set or not |
444 | 444 | */ |
445 | - public function __isset( $name ) { |
|
446 | - if ( property_exists( $this, $name ) ) { |
|
447 | - return false === empty( $this->$name ); |
|
445 | + public function __isset($name) { |
|
446 | + if (property_exists($this, $name)) { |
|
447 | + return false === empty($this->$name); |
|
448 | 448 | } else { |
449 | 449 | return null; |
450 | 450 | } |
@@ -460,20 +460,20 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @return bool If the setup was successful or not |
462 | 462 | */ |
463 | - private function setup_payment( $payment_id ) { |
|
463 | + private function setup_payment($payment_id) { |
|
464 | 464 | $this->pending = array(); |
465 | 465 | |
466 | - if ( empty( $payment_id ) ) { |
|
466 | + if (empty($payment_id)) { |
|
467 | 467 | return false; |
468 | 468 | } |
469 | 469 | |
470 | - $payment = get_post( $payment_id ); |
|
470 | + $payment = get_post($payment_id); |
|
471 | 471 | |
472 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
472 | + if ( ! $payment || is_wp_error($payment)) { |
|
473 | 473 | return false; |
474 | 474 | } |
475 | 475 | |
476 | - if ( 'give_payment' !== $payment->post_type ) { |
|
476 | + if ('give_payment' !== $payment->post_type) { |
|
477 | 477 | return false; |
478 | 478 | } |
479 | 479 | |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | * @param Give_Payment $this Payment object. |
488 | 488 | * @param int $payment_id The ID of the payment. |
489 | 489 | */ |
490 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
490 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
491 | 491 | |
492 | 492 | // Primary Identifier. |
493 | - $this->ID = absint( $payment_id ); |
|
493 | + $this->ID = absint($payment_id); |
|
494 | 494 | |
495 | 495 | // Protected ID that can never be changed. |
496 | - $this->_ID = absint( $payment_id ); |
|
496 | + $this->_ID = absint($payment_id); |
|
497 | 497 | |
498 | 498 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
499 | 499 | $this->payment_meta = $this->get_meta(); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $this->parent_payment = $payment->post_parent; |
509 | 509 | |
510 | 510 | $all_payment_statuses = give_get_payment_statuses(); |
511 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
511 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
512 | 512 | |
513 | 513 | // Currency Based. |
514 | 514 | $this->total = $this->setup_total(); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @param Give_Payment $this Payment object. |
547 | 547 | * @param int $payment_id The ID of the payment. |
548 | 548 | */ |
549 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
549 | + do_action('give_setup_payment', $this, $payment_id); |
|
550 | 550 | |
551 | 551 | return true; |
552 | 552 | } |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | * |
565 | 565 | * @return void |
566 | 566 | */ |
567 | - public function update_payment_setup( $payment_id ) { |
|
568 | - $this->setup_payment( $payment_id ); |
|
567 | + public function update_payment_setup($payment_id) { |
|
568 | + $this->setup_payment($payment_id); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
@@ -580,24 +580,24 @@ discard block |
||
580 | 580 | |
581 | 581 | // Construct the payment title. |
582 | 582 | $payment_title = ''; |
583 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
584 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
585 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
583 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
584 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
585 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
586 | 586 | $payment_title = $this->first_name; |
587 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
587 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
588 | 588 | $payment_title = $this->email; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Set Key. |
592 | - if ( empty( $this->key ) ) { |
|
592 | + if (empty($this->key)) { |
|
593 | 593 | |
594 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
595 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
594 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
595 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
596 | 596 | $this->pending['key'] = $this->key; |
597 | 597 | } |
598 | 598 | |
599 | 599 | // Set IP. |
600 | - if ( empty( $this->ip ) ) { |
|
600 | + if (empty($this->ip)) { |
|
601 | 601 | |
602 | 602 | $this->ip = give_get_ip(); |
603 | 603 | $this->pending['ip'] = $this->ip; |
@@ -623,57 +623,57 @@ discard block |
||
623 | 623 | 'status' => $this->status, |
624 | 624 | ); |
625 | 625 | |
626 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
626 | + $args = apply_filters('give_insert_payment_args', array( |
|
627 | 627 | 'post_title' => $payment_title, |
628 | 628 | 'post_status' => $this->status, |
629 | 629 | 'post_type' => 'give_payment', |
630 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
631 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
630 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
631 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
632 | 632 | 'post_parent' => $this->parent_payment, |
633 | - ), $payment_data ); |
|
633 | + ), $payment_data); |
|
634 | 634 | |
635 | 635 | // Create a blank payment |
636 | - $payment_id = wp_insert_post( $args ); |
|
636 | + $payment_id = wp_insert_post($args); |
|
637 | 637 | |
638 | - if ( ! empty( $payment_id ) ) { |
|
638 | + if ( ! empty($payment_id)) { |
|
639 | 639 | |
640 | 640 | $this->ID = $payment_id; |
641 | 641 | $this->_ID = $payment_id; |
642 | 642 | |
643 | 643 | $donor = new stdClass; |
644 | 644 | |
645 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
646 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
645 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
646 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
647 | 647 | |
648 | 648 | // Donor is logged in but used a different email to purchase with so assign to their donor record. |
649 | - if ( ! empty( $donor->id ) && $this->email !== $donor->email ) { |
|
650 | - $donor->add_email( $this->email ); |
|
649 | + if ( ! empty($donor->id) && $this->email !== $donor->email) { |
|
650 | + $donor->add_email($this->email); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | |
654 | - if ( empty( $donor->id ) ) { |
|
655 | - $donor = new Give_Donor( $this->email ); |
|
654 | + if (empty($donor->id)) { |
|
655 | + $donor = new Give_Donor($this->email); |
|
656 | 656 | } |
657 | 657 | |
658 | - if ( empty( $donor->id ) ) { |
|
658 | + if (empty($donor->id)) { |
|
659 | 659 | |
660 | 660 | $donor_data = array( |
661 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
661 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
662 | 662 | 'email' => $this->email, |
663 | 663 | 'user_id' => $this->user_id, |
664 | 664 | ); |
665 | 665 | |
666 | - $donor->create( $donor_data ); |
|
666 | + $donor->create($donor_data); |
|
667 | 667 | |
668 | 668 | } |
669 | 669 | |
670 | 670 | $this->customer_id = $donor->id; |
671 | 671 | $this->pending['customer_id'] = $this->customer_id; |
672 | - $donor->attach_payment( $this->ID, false ); |
|
672 | + $donor->attach_payment($this->ID, false); |
|
673 | 673 | |
674 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
674 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
675 | 675 | |
676 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
676 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
677 | 677 | $this->new = true; |
678 | 678 | }// End if(). |
679 | 679 | |
@@ -695,11 +695,11 @@ discard block |
||
695 | 695 | $saved = false; |
696 | 696 | |
697 | 697 | // Must have an ID. |
698 | - if ( empty( $this->ID ) ) { |
|
698 | + if (empty($this->ID)) { |
|
699 | 699 | |
700 | 700 | $payment_id = $this->insert_payment(); |
701 | 701 | |
702 | - if ( false === $payment_id ) { |
|
702 | + if (false === $payment_id) { |
|
703 | 703 | $saved = false; |
704 | 704 | } else { |
705 | 705 | $this->ID = $payment_id; |
@@ -707,48 +707,48 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | // Set ID if not matching. |
710 | - if ( $this->ID !== $this->_ID ) { |
|
710 | + if ($this->ID !== $this->_ID) { |
|
711 | 711 | $this->ID = $this->_ID; |
712 | 712 | } |
713 | 713 | |
714 | 714 | // If we have something pending, let's save it. |
715 | - if ( ! empty( $this->pending ) ) { |
|
715 | + if ( ! empty($this->pending)) { |
|
716 | 716 | |
717 | 717 | $total_increase = 0; |
718 | 718 | $total_decrease = 0; |
719 | 719 | |
720 | - foreach ( $this->pending as $key => $value ) { |
|
720 | + foreach ($this->pending as $key => $value) { |
|
721 | 721 | |
722 | - switch ( $key ) { |
|
722 | + switch ($key) { |
|
723 | 723 | |
724 | 724 | case 'donations': |
725 | 725 | // Update totals for pending donations. |
726 | - foreach ( $this->pending[ $key ] as $item ) { |
|
726 | + foreach ($this->pending[$key] as $item) { |
|
727 | 727 | |
728 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
729 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
728 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
729 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
730 | 730 | |
731 | - switch ( $item['action'] ) { |
|
731 | + switch ($item['action']) { |
|
732 | 732 | |
733 | 733 | case 'add': |
734 | 734 | |
735 | 735 | $price = $item['price']; |
736 | 736 | |
737 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
737 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
738 | 738 | |
739 | 739 | // Add sales logs. |
740 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
740 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
741 | 741 | |
742 | 742 | $y = 0; |
743 | - while ( $y < $quantity ) { |
|
743 | + while ($y < $quantity) { |
|
744 | 744 | |
745 | - give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
746 | - $y ++; |
|
745 | + give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
746 | + $y++; |
|
747 | 747 | } |
748 | 748 | |
749 | - $form = new Give_Donate_Form( $item['id'] ); |
|
750 | - $form->increase_sales( $quantity ); |
|
751 | - $form->increase_earnings( $price ); |
|
749 | + $form = new Give_Donate_Form($item['id']); |
|
750 | + $form->increase_sales($quantity); |
|
751 | + $form->increase_earnings($price); |
|
752 | 752 | |
753 | 753 | $total_increase += $price; |
754 | 754 | } |
@@ -773,15 +773,15 @@ discard block |
||
773 | 773 | ), |
774 | 774 | ); |
775 | 775 | |
776 | - $found_logs = get_posts( $log_args ); |
|
777 | - foreach ( $found_logs as $log ) { |
|
778 | - wp_delete_post( $log->ID, true ); |
|
776 | + $found_logs = get_posts($log_args); |
|
777 | + foreach ($found_logs as $log) { |
|
778 | + wp_delete_post($log->ID, true); |
|
779 | 779 | } |
780 | 780 | |
781 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
782 | - $form = new Give_Donate_Form( $item['id'] ); |
|
783 | - $form->decrease_sales( $quantity ); |
|
784 | - $form->decrease_earnings( $item['amount'] ); |
|
781 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
782 | + $form = new Give_Donate_Form($item['id']); |
|
783 | + $form->decrease_sales($quantity); |
|
784 | + $form->decrease_earnings($item['amount']); |
|
785 | 785 | |
786 | 786 | $total_decrease += $item['amount']; |
787 | 787 | } |
@@ -792,43 +792,43 @@ discard block |
||
792 | 792 | break; |
793 | 793 | |
794 | 794 | case 'status': |
795 | - $this->update_status( $this->status ); |
|
795 | + $this->update_status($this->status); |
|
796 | 796 | break; |
797 | 797 | |
798 | 798 | case 'gateway': |
799 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
799 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
800 | 800 | break; |
801 | 801 | |
802 | 802 | case 'mode': |
803 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
803 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
804 | 804 | break; |
805 | 805 | |
806 | 806 | case 'transaction_id': |
807 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
807 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
808 | 808 | break; |
809 | 809 | |
810 | 810 | case 'ip': |
811 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
811 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
812 | 812 | break; |
813 | 813 | |
814 | 814 | case 'customer_id': |
815 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
815 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
816 | 816 | break; |
817 | 817 | |
818 | 818 | case 'user_id': |
819 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
819 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
820 | 820 | break; |
821 | 821 | |
822 | 822 | case 'form_title': |
823 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
823 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
824 | 824 | break; |
825 | 825 | |
826 | 826 | case 'form_id': |
827 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
827 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
828 | 828 | break; |
829 | 829 | |
830 | 830 | case 'price_id': |
831 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
831 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
832 | 832 | break; |
833 | 833 | |
834 | 834 | case 'first_name': |
@@ -844,15 +844,15 @@ discard block |
||
844 | 844 | break; |
845 | 845 | |
846 | 846 | case 'email': |
847 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
847 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
848 | 848 | break; |
849 | 849 | |
850 | 850 | case 'key': |
851 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
851 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
852 | 852 | break; |
853 | 853 | |
854 | 854 | case 'number': |
855 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
855 | + $this->update_meta('_give_payment_number', $this->number); |
|
856 | 856 | break; |
857 | 857 | |
858 | 858 | case 'date': |
@@ -862,11 +862,11 @@ discard block |
||
862 | 862 | 'edit_date' => true, |
863 | 863 | ); |
864 | 864 | |
865 | - wp_update_post( $args ); |
|
865 | + wp_update_post($args); |
|
866 | 866 | break; |
867 | 867 | |
868 | 868 | case 'completed_date': |
869 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
869 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
870 | 870 | break; |
871 | 871 | |
872 | 872 | case 'parent_payment': |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | 'post_parent' => $this->parent_payment, |
876 | 876 | ); |
877 | 877 | |
878 | - wp_update_post( $args ); |
|
878 | + wp_update_post($args); |
|
879 | 879 | break; |
880 | 880 | |
881 | 881 | default: |
@@ -886,33 +886,33 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @param Give_Payment $this Payment object. |
888 | 888 | */ |
889 | - do_action( 'give_payment_save', $this, $key ); |
|
889 | + do_action('give_payment_save', $this, $key); |
|
890 | 890 | break; |
891 | 891 | }// End switch(). |
892 | 892 | }// End foreach(). |
893 | 893 | |
894 | - if ( 'pending' !== $this->status ) { |
|
894 | + if ('pending' !== $this->status) { |
|
895 | 895 | |
896 | - $donor = new Give_Donor( $this->customer_id ); |
|
896 | + $donor = new Give_Donor($this->customer_id); |
|
897 | 897 | |
898 | 898 | $total_change = $total_increase - $total_decrease; |
899 | - if ( $total_change < 0 ) { |
|
899 | + if ($total_change < 0) { |
|
900 | 900 | |
901 | - $total_change = - ( $total_change ); |
|
901 | + $total_change = - ($total_change); |
|
902 | 902 | // Decrease the donor's donation stats. |
903 | - $donor->decrease_value( $total_change ); |
|
904 | - give_decrease_total_earnings( $total_change ); |
|
903 | + $donor->decrease_value($total_change); |
|
904 | + give_decrease_total_earnings($total_change); |
|
905 | 905 | |
906 | - } elseif ( $total_change > 0 ) { |
|
906 | + } elseif ($total_change > 0) { |
|
907 | 907 | |
908 | 908 | // Increase the donor's donation stats. |
909 | - $donor->increase_value( $total_change ); |
|
910 | - give_increase_total_earnings( $total_change ); |
|
909 | + $donor->increase_value($total_change); |
|
910 | + give_increase_total_earnings($total_change); |
|
911 | 911 | |
912 | 912 | } |
913 | 913 | } |
914 | 914 | |
915 | - $this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) ); |
|
915 | + $this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total)); |
|
916 | 916 | |
917 | 917 | $new_meta = array( |
918 | 918 | 'form_title' => $this->form_title, |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | ); |
924 | 924 | |
925 | 925 | $meta = $this->get_meta(); |
926 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
926 | + $merged_meta = array_merge($meta, $new_meta); |
|
927 | 927 | |
928 | 928 | // Only save the payment meta if it's changed. |
929 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
930 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
931 | - if ( false !== $updated ) { |
|
929 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
930 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
931 | + if (false !== $updated) { |
|
932 | 932 | $saved = true; |
933 | 933 | } |
934 | 934 | } |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | $saved = true; |
938 | 938 | }// End if(). |
939 | 939 | |
940 | - if ( true === $saved ) { |
|
941 | - $this->setup_payment( $this->ID ); |
|
940 | + if (true === $saved) { |
|
941 | + $this->setup_payment($this->ID); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | return $saved; |
@@ -956,12 +956,12 @@ discard block |
||
956 | 956 | * |
957 | 957 | * @return bool True when successful, false otherwise |
958 | 958 | */ |
959 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
959 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
960 | 960 | |
961 | - $donation = new Give_Donate_Form( $form_id ); |
|
961 | + $donation = new Give_Donate_Form($form_id); |
|
962 | 962 | |
963 | 963 | // Bail if this post isn't a give donation form. |
964 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
964 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
965 | 965 | return false; |
966 | 966 | } |
967 | 967 | |
@@ -971,59 +971,59 @@ discard block |
||
971 | 971 | 'price_id' => false, |
972 | 972 | ); |
973 | 973 | |
974 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
974 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
975 | 975 | |
976 | 976 | // Allow overriding the price. |
977 | - if ( false !== $args['price'] ) { |
|
977 | + if (false !== $args['price']) { |
|
978 | 978 | $item_price = $args['price']; |
979 | 979 | } else { |
980 | 980 | |
981 | 981 | // Deal with variable pricing. |
982 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
983 | - $prices = maybe_unserialize( give_get_meta( $form_id, '_give_donation_levels', true ) ); |
|
982 | + if (give_has_variable_prices($donation->ID)) { |
|
983 | + $prices = maybe_unserialize(give_get_meta($form_id, '_give_donation_levels', true)); |
|
984 | 984 | $item_price = ''; |
985 | 985 | // Loop through prices. |
986 | - foreach ( $prices as $price ) { |
|
986 | + foreach ($prices as $price) { |
|
987 | 987 | // Find a match between price_id and level_id. |
988 | 988 | // First verify array keys exists THEN make the match. |
989 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
989 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
990 | 990 | && $args['price_id'] == $price['_give_id']['level_id'] |
991 | 991 | ) { |
992 | 992 | $item_price = $price['_give_amount']; |
993 | 993 | } |
994 | 994 | } |
995 | 995 | // Fallback to the lowest price point. |
996 | - if ( $item_price == '' ) { |
|
997 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
998 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
996 | + if ($item_price == '') { |
|
997 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
998 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
999 | 999 | } |
1000 | 1000 | } else { |
1001 | 1001 | // Simple form price. |
1002 | - $item_price = give_get_form_price( $donation->ID ); |
|
1002 | + $item_price = give_get_form_price($donation->ID); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // Sanitizing the price here so we don't have a dozen calls later. |
1007 | - $item_price = give_maybe_sanitize_amount( $item_price ); |
|
1008 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
1007 | + $item_price = give_maybe_sanitize_amount($item_price); |
|
1008 | + $total = round($item_price, give_currency_decimal_filter()); |
|
1009 | 1009 | |
1010 | 1010 | // Add Options. |
1011 | 1011 | $default_options = array(); |
1012 | - if ( false !== $args['price_id'] ) { |
|
1012 | + if (false !== $args['price_id']) { |
|
1013 | 1013 | $default_options['price_id'] = (int) $args['price_id']; |
1014 | 1014 | } |
1015 | - $options = wp_parse_args( $options, $default_options ); |
|
1015 | + $options = wp_parse_args($options, $default_options); |
|
1016 | 1016 | |
1017 | 1017 | // Do not allow totals to go negative. |
1018 | - if ( $total < 0 ) { |
|
1018 | + if ($total < 0) { |
|
1019 | 1019 | $total = 0; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | $donation = array( |
1023 | 1023 | 'name' => $donation->post_title, |
1024 | 1024 | 'id' => $donation->ID, |
1025 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
1026 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
1025 | + 'price' => round($total, give_currency_decimal_filter()), |
|
1026 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
1027 | 1027 | 'price_id' => $args['price_id'], |
1028 | 1028 | 'action' => 'add', |
1029 | 1029 | 'options' => $options, |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | $this->pending['donations'][] = $donation; |
1033 | 1033 | |
1034 | - $this->increase_subtotal( $total ); |
|
1034 | + $this->increase_subtotal($total); |
|
1035 | 1035 | |
1036 | 1036 | return true; |
1037 | 1037 | |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | * |
1049 | 1049 | * @return bool If the item was removed or not |
1050 | 1050 | */ |
1051 | - public function remove_donation( $form_id, $args = array() ) { |
|
1051 | + public function remove_donation($form_id, $args = array()) { |
|
1052 | 1052 | |
1053 | 1053 | // Set some defaults. |
1054 | 1054 | $defaults = array( |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | 'price' => false, |
1057 | 1057 | 'price_id' => false, |
1058 | 1058 | ); |
1059 | - $args = wp_parse_args( $args, $defaults ); |
|
1059 | + $args = wp_parse_args($args, $defaults); |
|
1060 | 1060 | |
1061 | - $form = new Give_Donate_Form( $form_id ); |
|
1061 | + $form = new Give_Donate_Form($form_id); |
|
1062 | 1062 | |
1063 | 1063 | // Bail if this post isn't a valid give donation form. |
1064 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
1064 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
1065 | 1065 | return false; |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->pending['donations'][] = $pending_args; |
1076 | 1076 | |
1077 | - $this->decrease_subtotal( $this->total ); |
|
1077 | + $this->decrease_subtotal($this->total); |
|
1078 | 1078 | |
1079 | 1079 | return true; |
1080 | 1080 | } |
@@ -1090,13 +1090,13 @@ discard block |
||
1090 | 1090 | * |
1091 | 1091 | * @return bool If the note was specified or not |
1092 | 1092 | */ |
1093 | - public function add_note( $note = false ) { |
|
1093 | + public function add_note($note = false) { |
|
1094 | 1094 | // Bail if no note specified. |
1095 | - if ( ! $note ) { |
|
1095 | + if ( ! $note) { |
|
1096 | 1096 | return false; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - give_insert_payment_note( $this->ID, $note ); |
|
1099 | + give_insert_payment_note($this->ID, $note); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | * |
1110 | 1110 | * @return void |
1111 | 1111 | */ |
1112 | - private function increase_subtotal( $amount = 0.00 ) { |
|
1113 | - $amount = (float) $amount; |
|
1112 | + private function increase_subtotal($amount = 0.00) { |
|
1113 | + $amount = (float) $amount; |
|
1114 | 1114 | $this->subtotal += $amount; |
1115 | 1115 | |
1116 | 1116 | $this->recalculate_total(); |
@@ -1126,11 +1126,11 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return void |
1128 | 1128 | */ |
1129 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
1130 | - $amount = (float) $amount; |
|
1129 | + private function decrease_subtotal($amount = 0.00) { |
|
1130 | + $amount = (float) $amount; |
|
1131 | 1131 | $this->subtotal -= $amount; |
1132 | 1132 | |
1133 | - if ( $this->subtotal < 0 ) { |
|
1133 | + if ($this->subtotal < 0) { |
|
1134 | 1134 | $this->subtotal = 0; |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1159,24 +1159,24 @@ discard block |
||
1159 | 1159 | * |
1160 | 1160 | * @return bool $updated Returns if the status was successfully updated. |
1161 | 1161 | */ |
1162 | - public function update_status( $status = false ) { |
|
1162 | + public function update_status($status = false) { |
|
1163 | 1163 | |
1164 | 1164 | // standardize the 'complete(d)' status. |
1165 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
1165 | + if ($status == 'completed' || $status == 'complete') { |
|
1166 | 1166 | $status = 'publish'; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
1169 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
1170 | 1170 | |
1171 | - if ( $old_status === $status ) { |
|
1171 | + if ($old_status === $status) { |
|
1172 | 1172 | return false; // Don't permit status changes that aren't changes. |
1173 | 1173 | } |
1174 | 1174 | |
1175 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
1175 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
1176 | 1176 | |
1177 | 1177 | $updated = false; |
1178 | 1178 | |
1179 | - if ( $do_change ) { |
|
1179 | + if ($do_change) { |
|
1180 | 1180 | |
1181 | 1181 | /** |
1182 | 1182 | * Fires before changing payment status. |
@@ -1187,21 +1187,21 @@ discard block |
||
1187 | 1187 | * @param string $status The new status. |
1188 | 1188 | * @param string $old_status The old status. |
1189 | 1189 | */ |
1190 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
1190 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
1191 | 1191 | |
1192 | 1192 | $update_fields = array( |
1193 | 1193 | 'ID' => $this->ID, |
1194 | 1194 | 'post_status' => $status, |
1195 | - 'edit_date' => current_time( 'mysql' ), |
|
1195 | + 'edit_date' => current_time('mysql'), |
|
1196 | 1196 | ); |
1197 | 1197 | |
1198 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
1198 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
1199 | 1199 | |
1200 | 1200 | $all_payment_statuses = give_get_payment_statuses(); |
1201 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
1201 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
1202 | 1202 | |
1203 | 1203 | // Process any specific status functions. |
1204 | - switch ( $status ) { |
|
1204 | + switch ($status) { |
|
1205 | 1205 | case 'refunded': |
1206 | 1206 | $this->process_refund(); |
1207 | 1207 | break; |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | * @param string $status The new status. |
1229 | 1229 | * @param string $old_status The old status. |
1230 | 1230 | */ |
1231 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
1231 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
1232 | 1232 | |
1233 | 1233 | }// End if(). |
1234 | 1234 | |
@@ -1263,33 +1263,33 @@ discard block |
||
1263 | 1263 | * |
1264 | 1264 | * @return mixed The value from the post meta |
1265 | 1265 | */ |
1266 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
1266 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
1267 | 1267 | |
1268 | - $meta = give_get_meta( $this->ID, $meta_key, $single ); |
|
1268 | + $meta = give_get_meta($this->ID, $meta_key, $single); |
|
1269 | 1269 | |
1270 | - if ( $meta_key === '_give_payment_meta' ) { |
|
1270 | + if ($meta_key === '_give_payment_meta') { |
|
1271 | 1271 | $meta = (array) $meta; |
1272 | 1272 | |
1273 | - if ( empty( $meta['key'] ) ) { |
|
1273 | + if (empty($meta['key'])) { |
|
1274 | 1274 | $meta['key'] = $this->setup_payment_key(); |
1275 | 1275 | } |
1276 | 1276 | |
1277 | - if ( empty( $meta['form_title'] ) ) { |
|
1277 | + if (empty($meta['form_title'])) { |
|
1278 | 1278 | $meta['form_title'] = $this->setup_form_title(); |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - if ( empty( $meta['email'] ) ) { |
|
1281 | + if (empty($meta['email'])) { |
|
1282 | 1282 | $meta['email'] = $this->setup_email(); |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - if ( empty( $meta['date'] ) ) { |
|
1286 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
1285 | + if (empty($meta['date'])) { |
|
1286 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
1290 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
1290 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
1291 | 1291 | |
1292 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
1292 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | /** |
@@ -1304,23 +1304,23 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
1306 | 1306 | */ |
1307 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
1308 | - if ( empty( $meta_key ) ) { |
|
1307 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
1308 | + if (empty($meta_key)) { |
|
1309 | 1309 | return false; |
1310 | 1310 | } |
1311 | 1311 | |
1312 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
1312 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
1313 | 1313 | |
1314 | 1314 | $current_meta = $this->get_meta(); |
1315 | - $current_meta[ $meta_key ] = $meta_value; |
|
1315 | + $current_meta[$meta_key] = $meta_value; |
|
1316 | 1316 | |
1317 | 1317 | $meta_key = '_give_payment_meta'; |
1318 | 1318 | $meta_value = $current_meta; |
1319 | 1319 | |
1320 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
1320 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
1321 | 1321 | |
1322 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1323 | - give_update_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
1322 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1323 | + give_update_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
1324 | 1324 | |
1325 | 1325 | $current_meta = $this->get_meta(); |
1326 | 1326 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1330,9 +1330,9 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1333 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1334 | 1334 | |
1335 | - return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
1335 | + return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | /** |
@@ -1347,14 +1347,14 @@ discard block |
||
1347 | 1347 | $process_refund = true; |
1348 | 1348 | |
1349 | 1349 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1350 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
1350 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
1351 | 1351 | $process_refund = false; |
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1355 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
1355 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
1356 | 1356 | |
1357 | - if ( false === $process_refund ) { |
|
1357 | + if (false === $process_refund) { |
|
1358 | 1358 | return; |
1359 | 1359 | } |
1360 | 1360 | |
@@ -1365,13 +1365,13 @@ discard block |
||
1365 | 1365 | * |
1366 | 1366 | * @param Give_Payment $this Payment object. |
1367 | 1367 | */ |
1368 | - do_action( 'give_pre_refund_payment', $this ); |
|
1368 | + do_action('give_pre_refund_payment', $this); |
|
1369 | 1369 | |
1370 | - $decrease_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
1371 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
1372 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
1370 | + $decrease_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
1371 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
1372 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
1373 | 1373 | |
1374 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1374 | + $this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1375 | 1375 | $this->delete_sales_logs(); |
1376 | 1376 | |
1377 | 1377 | // @todo: Refresh only range related stat cache |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | * |
1385 | 1385 | * @param Give_Payment $this Payment object. |
1386 | 1386 | */ |
1387 | - do_action( 'give_post_refund_payment', $this ); |
|
1387 | + do_action('give_post_refund_payment', $this); |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | /** |
@@ -1411,26 +1411,26 @@ discard block |
||
1411 | 1411 | $process_pending = true; |
1412 | 1412 | |
1413 | 1413 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1414 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
1414 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
1415 | 1415 | $process_pending = false; |
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1419 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
1419 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
1420 | 1420 | |
1421 | - if ( false === $process_pending ) { |
|
1421 | + if (false === $process_pending) { |
|
1422 | 1422 | return; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_pending', true, $this ); |
|
1426 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_pending', true, $this ); |
|
1427 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this ); |
|
1425 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_pending', true, $this); |
|
1426 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_pending', true, $this); |
|
1427 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this); |
|
1428 | 1428 | |
1429 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1429 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1430 | 1430 | $this->delete_sales_logs(); |
1431 | 1431 | |
1432 | 1432 | $this->completed_date = false; |
1433 | - $this->update_meta( '_give_completed_date', '' ); |
|
1433 | + $this->update_meta('_give_completed_date', ''); |
|
1434 | 1434 | |
1435 | 1435 | // @todo: Refresh only range related stat cache |
1436 | 1436 | give_delete_donation_stats(); |
@@ -1448,26 +1448,26 @@ discard block |
||
1448 | 1448 | $process_cancelled = true; |
1449 | 1449 | |
1450 | 1450 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1451 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
1451 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
1452 | 1452 | $process_cancelled = false; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1456 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
1456 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
1457 | 1457 | |
1458 | - if ( false === $process_cancelled ) { |
|
1458 | + if (false === $process_cancelled) { |
|
1459 | 1459 | return; |
1460 | 1460 | } |
1461 | 1461 | |
1462 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this ); |
|
1463 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this ); |
|
1464 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this ); |
|
1462 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_cancelled', true, $this); |
|
1463 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_cancelled', true, $this); |
|
1464 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this); |
|
1465 | 1465 | |
1466 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1466 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1467 | 1467 | $this->delete_sales_logs(); |
1468 | 1468 | |
1469 | 1469 | $this->completed_date = false; |
1470 | - $this->update_meta( '_give_completed_date', '' ); |
|
1470 | + $this->update_meta('_give_completed_date', ''); |
|
1471 | 1471 | |
1472 | 1472 | // @todo: Refresh only range related stat cache |
1473 | 1473 | give_delete_donation_stats(); |
@@ -1483,26 +1483,26 @@ discard block |
||
1483 | 1483 | $process_revoked = true; |
1484 | 1484 | |
1485 | 1485 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
1486 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
1486 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
1487 | 1487 | $process_revoked = false; |
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1491 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
1491 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
1492 | 1492 | |
1493 | - if ( false === $process_revoked ) { |
|
1493 | + if (false === $process_revoked) { |
|
1494 | 1494 | return; |
1495 | 1495 | } |
1496 | 1496 | |
1497 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_revoked', true, $this ); |
|
1498 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this ); |
|
1499 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this ); |
|
1497 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_revoked', true, $this); |
|
1498 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_revoked', true, $this); |
|
1499 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this); |
|
1500 | 1500 | |
1501 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1501 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1502 | 1502 | $this->delete_sales_logs(); |
1503 | 1503 | |
1504 | 1504 | $this->completed_date = false; |
1505 | - $this->update_meta( '_give_completed_date', '' ); |
|
1505 | + $this->update_meta('_give_completed_date', ''); |
|
1506 | 1506 | |
1507 | 1507 | // @todo: Refresh only range related stat cache |
1508 | 1508 | give_delete_donation_stats(); |
@@ -1520,25 +1520,25 @@ discard block |
||
1520 | 1520 | * |
1521 | 1521 | * @return void |
1522 | 1522 | */ |
1523 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
1523 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
1524 | 1524 | |
1525 | - give_undo_donation( $this->ID ); |
|
1525 | + give_undo_donation($this->ID); |
|
1526 | 1526 | |
1527 | 1527 | // Decrease store earnings. |
1528 | - if ( true === $alter_store_earnings ) { |
|
1529 | - give_decrease_total_earnings( $this->total ); |
|
1528 | + if (true === $alter_store_earnings) { |
|
1529 | + give_decrease_total_earnings($this->total); |
|
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | // Decrement the stats for the donor. |
1533 | - if ( ! empty( $this->customer_id ) ) { |
|
1533 | + if ( ! empty($this->customer_id)) { |
|
1534 | 1534 | |
1535 | - $donor = new Give_Donor( $this->customer_id ); |
|
1535 | + $donor = new Give_Donor($this->customer_id); |
|
1536 | 1536 | |
1537 | - if ( true === $alter_customer_value ) { |
|
1538 | - $donor->decrease_value( $this->total ); |
|
1537 | + if (true === $alter_customer_value) { |
|
1538 | + $donor->decrease_value($this->total); |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | - if ( true === $alter_customer_purchase_count ) { |
|
1541 | + if (true === $alter_customer_purchase_count) { |
|
1542 | 1542 | $donor->decrease_donation_count(); |
1543 | 1543 | } |
1544 | 1544 | } |
@@ -1587,13 +1587,13 @@ discard block |
||
1587 | 1587 | * @return string The date the payment was completed |
1588 | 1588 | */ |
1589 | 1589 | private function setup_completed_date() { |
1590 | - $payment = get_post( $this->ID ); |
|
1590 | + $payment = get_post($this->ID); |
|
1591 | 1591 | |
1592 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
1592 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
1593 | 1593 | return false; // This payment was never completed. |
1594 | 1594 | } |
1595 | 1595 | |
1596 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
1596 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
1597 | 1597 | |
1598 | 1598 | return $date; |
1599 | 1599 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | * @return string The payment mode |
1608 | 1608 | */ |
1609 | 1609 | private function setup_mode() { |
1610 | - return $this->get_meta( '_give_payment_mode' ); |
|
1610 | + return $this->get_meta('_give_payment_mode'); |
|
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | /** |
@@ -1619,18 +1619,18 @@ discard block |
||
1619 | 1619 | * @return float The payment total |
1620 | 1620 | */ |
1621 | 1621 | private function setup_total() { |
1622 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
1622 | + $amount = $this->get_meta('_give_payment_total', true); |
|
1623 | 1623 | |
1624 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
1625 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
1626 | - $meta = maybe_unserialize( $meta ); |
|
1624 | + if (empty($amount) && '0.00' != $amount) { |
|
1625 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
1626 | + $meta = maybe_unserialize($meta); |
|
1627 | 1627 | |
1628 | - if ( isset( $meta['amount'] ) ) { |
|
1628 | + if (isset($meta['amount'])) { |
|
1629 | 1629 | $amount = $meta['amount']; |
1630 | 1630 | } |
1631 | 1631 | } |
1632 | 1632 | |
1633 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
1633 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | * @return string The currency for the payment |
1657 | 1657 | */ |
1658 | 1658 | private function setup_currency() { |
1659 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
1659 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
1660 | 1660 | |
1661 | 1661 | return $currency; |
1662 | 1662 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
1670 | 1670 | * @return string The gateway |
1671 | 1671 | */ |
1672 | 1672 | private function setup_gateway() { |
1673 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
1673 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
1674 | 1674 | |
1675 | 1675 | return $gateway; |
1676 | 1676 | } |
@@ -1684,11 +1684,11 @@ discard block |
||
1684 | 1684 | * @return string The donation ID |
1685 | 1685 | */ |
1686 | 1686 | private function setup_transaction_id() { |
1687 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
1687 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
1688 | 1688 | |
1689 | - if ( empty( $transaction_id ) ) { |
|
1689 | + if (empty($transaction_id)) { |
|
1690 | 1690 | $gateway = $this->gateway; |
1691 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
1691 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | return $transaction_id; |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | * @return string The IP address for the payment |
1704 | 1704 | */ |
1705 | 1705 | private function setup_ip() { |
1706 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
1706 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
1707 | 1707 | |
1708 | 1708 | return $ip; |
1709 | 1709 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
1717 | 1717 | * @return int The Donor ID. |
1718 | 1718 | */ |
1719 | 1719 | private function setup_donor_id() { |
1720 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
1720 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
1721 | 1721 | |
1722 | 1722 | return $customer_id; |
1723 | 1723 | } |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | * @return int The User ID |
1732 | 1732 | */ |
1733 | 1733 | private function setup_user_id() { |
1734 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
1734 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
1735 | 1735 | |
1736 | 1736 | return $user_id; |
1737 | 1737 | } |
@@ -1745,10 +1745,10 @@ discard block |
||
1745 | 1745 | * @return string The email address for the payment. |
1746 | 1746 | */ |
1747 | 1747 | private function setup_email() { |
1748 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
1748 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
1749 | 1749 | |
1750 | - if ( empty( $email ) && $this->customer_id ) { |
|
1751 | - $email = Give()->donors->get_column( 'email', $this->customer_id ); |
|
1750 | + if (empty($email) && $this->customer_id) { |
|
1751 | + $email = Give()->donors->get_column('email', $this->customer_id); |
|
1752 | 1752 | } |
1753 | 1753 | |
1754 | 1754 | return $email; |
@@ -1768,15 +1768,15 @@ discard block |
||
1768 | 1768 | 'last_name' => $this->last_name, |
1769 | 1769 | ); |
1770 | 1770 | |
1771 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
1772 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
1771 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
1772 | + $user_info = wp_parse_args($user_info, $defaults); |
|
1773 | 1773 | |
1774 | - if ( empty( $user_info ) ) { |
|
1774 | + if (empty($user_info)) { |
|
1775 | 1775 | // Get the donor, but only if it's been created. |
1776 | - $donor = new Give_Donor( $this->customer_id ); |
|
1776 | + $donor = new Give_Donor($this->customer_id); |
|
1777 | 1777 | |
1778 | - if ( $donor->id > 0 ) { |
|
1779 | - $name = explode( ' ', $donor->name, 2 ); |
|
1778 | + if ($donor->id > 0) { |
|
1779 | + $name = explode(' ', $donor->name, 2); |
|
1780 | 1780 | $user_info = array( |
1781 | 1781 | 'first_name' => $name[0], |
1782 | 1782 | 'last_name' => $name[1], |
@@ -1786,29 +1786,29 @@ discard block |
||
1786 | 1786 | } |
1787 | 1787 | } else { |
1788 | 1788 | // Get the donor, but only if it's been created. |
1789 | - $donor = new Give_Donor( $this->customer_id ); |
|
1790 | - if ( $donor->id > 0 ) { |
|
1791 | - foreach ( $user_info as $key => $value ) { |
|
1792 | - if ( ! empty( $value ) ) { |
|
1789 | + $donor = new Give_Donor($this->customer_id); |
|
1790 | + if ($donor->id > 0) { |
|
1791 | + foreach ($user_info as $key => $value) { |
|
1792 | + if ( ! empty($value)) { |
|
1793 | 1793 | continue; |
1794 | 1794 | } |
1795 | 1795 | |
1796 | - switch ( $key ) { |
|
1796 | + switch ($key) { |
|
1797 | 1797 | case 'first_name': |
1798 | - $name = explode( ' ', $donor->name, 2 ); |
|
1798 | + $name = explode(' ', $donor->name, 2); |
|
1799 | 1799 | |
1800 | - $user_info[ $key ] = $name[0]; |
|
1800 | + $user_info[$key] = $name[0]; |
|
1801 | 1801 | break; |
1802 | 1802 | |
1803 | 1803 | case 'last_name': |
1804 | - $name = explode( ' ', $donor->name, 2 ); |
|
1805 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
1804 | + $name = explode(' ', $donor->name, 2); |
|
1805 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
1806 | 1806 | |
1807 | - $user_info[ $key ] = $last_name; |
|
1807 | + $user_info[$key] = $last_name; |
|
1808 | 1808 | break; |
1809 | 1809 | |
1810 | 1810 | case 'email': |
1811 | - $user_info[ $key ] = $donor->email; |
|
1811 | + $user_info[$key] = $donor->email; |
|
1812 | 1812 | break; |
1813 | 1813 | } |
1814 | 1814 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | */ |
1830 | 1830 | private function setup_address() { |
1831 | 1831 | |
1832 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
1832 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
1833 | 1833 | 'line1' => '', |
1834 | 1834 | 'line2' => '', |
1835 | 1835 | 'city' => '', |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | */ |
1852 | 1852 | private function setup_form_title() { |
1853 | 1853 | |
1854 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
1854 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
1855 | 1855 | |
1856 | 1856 | return $form_id; |
1857 | 1857 | } |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | */ |
1867 | 1867 | private function setup_form_id() { |
1868 | 1868 | |
1869 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
1869 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
1870 | 1870 | |
1871 | 1871 | return $form_id; |
1872 | 1872 | } |
@@ -1880,7 +1880,7 @@ discard block |
||
1880 | 1880 | * @return int The Form Price ID. |
1881 | 1881 | */ |
1882 | 1882 | private function setup_price_id() { |
1883 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
1883 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
1884 | 1884 | |
1885 | 1885 | return $price_id; |
1886 | 1886 | } |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | * @return string The Payment Key. |
1895 | 1895 | */ |
1896 | 1896 | private function setup_payment_key() { |
1897 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
1897 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
1898 | 1898 | |
1899 | 1899 | return $key; |
1900 | 1900 | } |
@@ -1910,11 +1910,11 @@ discard block |
||
1910 | 1910 | private function setup_payment_number() { |
1911 | 1911 | $number = $this->ID; |
1912 | 1912 | |
1913 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
1913 | + if (give_get_option('enable_sequential')) { |
|
1914 | 1914 | |
1915 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
1915 | + $number = $this->get_meta('_give_payment_number', true); |
|
1916 | 1916 | |
1917 | - if ( ! $number ) { |
|
1917 | + if ( ! $number) { |
|
1918 | 1918 | |
1919 | 1919 | $number = $this->ID; |
1920 | 1920 | |
@@ -1932,7 +1932,7 @@ discard block |
||
1932 | 1932 | * @return array The payment object as an array. |
1933 | 1933 | */ |
1934 | 1934 | public function array_convert() { |
1935 | - return get_object_vars( $this ); |
|
1935 | + return get_object_vars($this); |
|
1936 | 1936 | } |
1937 | 1937 | |
1938 | 1938 | |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | * @return bool |
1946 | 1946 | */ |
1947 | 1947 | public function is_completed() { |
1948 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
1948 | + return ('publish' === $this->status && $this->completed_date); |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | /** |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | * @return string Date payment was completed. |
1958 | 1958 | */ |
1959 | 1959 | private function get_completed_date() { |
1960 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
1960 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | /** |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | * @return float Payment subtotal. |
1970 | 1970 | */ |
1971 | 1971 | private function get_subtotal() { |
1972 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
1972 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | * @return string Payment currency code. |
1982 | 1982 | */ |
1983 | 1983 | private function get_currency() { |
1984 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
1984 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
1985 | 1985 | } |
1986 | 1986 | |
1987 | 1987 | /** |
@@ -1993,7 +1993,7 @@ discard block |
||
1993 | 1993 | * @return string Gateway used. |
1994 | 1994 | */ |
1995 | 1995 | private function get_gateway() { |
1996 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
1996 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
1997 | 1997 | } |
1998 | 1998 | |
1999 | 1999 | /** |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | * @return string Donation ID from merchant processor. |
2006 | 2006 | */ |
2007 | 2007 | private function get_transaction_id() { |
2008 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
2008 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | /** |
@@ -2017,7 +2017,7 @@ discard block |
||
2017 | 2017 | * @return string Payment IP address |
2018 | 2018 | */ |
2019 | 2019 | private function get_ip() { |
2020 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
2020 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | /** |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | * @return int Payment donor ID. |
2030 | 2030 | */ |
2031 | 2031 | private function get_donor_id() { |
2032 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
2032 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
2033 | 2033 | } |
2034 | 2034 | |
2035 | 2035 | /** |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | * @return int Payment user ID. |
2042 | 2042 | */ |
2043 | 2043 | private function get_user_id() { |
2044 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
2044 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | /** |
@@ -2053,7 +2053,7 @@ discard block |
||
2053 | 2053 | * @return string Payment donor email. |
2054 | 2054 | */ |
2055 | 2055 | private function get_email() { |
2056 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
2056 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
2057 | 2057 | } |
2058 | 2058 | |
2059 | 2059 | /** |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | * @return array Payment user info. |
2066 | 2066 | */ |
2067 | 2067 | private function get_user_info() { |
2068 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
2068 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | /** |
@@ -2077,7 +2077,7 @@ discard block |
||
2077 | 2077 | * @return array Payment billing address. |
2078 | 2078 | */ |
2079 | 2079 | private function get_address() { |
2080 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
2080 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
2081 | 2081 | } |
2082 | 2082 | |
2083 | 2083 | /** |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | * @return string Payment key. |
2090 | 2090 | */ |
2091 | 2091 | private function get_key() { |
2092 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
2092 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
2093 | 2093 | } |
2094 | 2094 | |
2095 | 2095 | /** |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | * @return string Payment form id |
2102 | 2102 | */ |
2103 | 2103 | private function get_form_id() { |
2104 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
2104 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | /** |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | * @return int|string Payment number |
2114 | 2114 | */ |
2115 | 2115 | private function get_number() { |
2116 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
2116 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
2117 | 2117 | } |
2118 | 2118 | |
2119 | 2119 | } |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Add give command. |
15 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
15 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @subcommand logo |
70 | 70 | */ |
71 | - public function ascii( $args, $assoc_args ) { |
|
72 | - WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) ); |
|
71 | + public function ascii($args, $assoc_args) { |
|
72 | + WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -94,54 +94,54 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @subcommand details |
96 | 96 | */ |
97 | - public function details( $args, $assoc_args ) { |
|
97 | + public function details($args, $assoc_args) { |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Plugin Information |
101 | 101 | */ |
102 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
102 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * General Information. |
106 | 106 | */ |
107 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
107 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
108 | 108 | |
109 | - $success_page = give_get_option( 'success_page' ); |
|
110 | - $failure_page = give_get_option( 'failure_page' ); |
|
111 | - $history_page = give_get_option( 'history_page' ); |
|
109 | + $success_page = give_get_option('success_page'); |
|
110 | + $failure_page = give_get_option('failure_page'); |
|
111 | + $history_page = give_get_option('history_page'); |
|
112 | 112 | |
113 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
114 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
115 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
116 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
113 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
114 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
115 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
116 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Currency Information. |
120 | 120 | */ |
121 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
121 | + $default_gateway = give_get_option('default_gateway'); |
|
122 | 122 | |
123 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
123 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
124 | 124 | |
125 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
126 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
127 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
128 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
129 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
130 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
131 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
125 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
126 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
127 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
128 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
129 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
130 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
131 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
132 | 132 | |
133 | 133 | // Payment gateways Information. |
134 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
135 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
134 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
135 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
136 | 136 | |
137 | - if ( ! empty( $gateways ) ) { |
|
137 | + if ( ! empty($gateways)) { |
|
138 | 138 | self::$counter = 1; |
139 | - foreach ( $gateways as $gateway ) { |
|
140 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
141 | - self::$counter ++; |
|
139 | + foreach ($gateways as $gateway) { |
|
140 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
141 | + self::$counter++; |
|
142 | 142 | } |
143 | 143 | } else { |
144 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
144 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @subcommand forms |
175 | 175 | */ |
176 | - public function forms( $args, $assoc_args ) { |
|
176 | + public function forms($args, $assoc_args) { |
|
177 | 177 | global $wp_query; |
178 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
179 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
178 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
179 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
180 | 180 | $start = time(); |
181 | 181 | |
182 | 182 | // Cache previous number query var. |
183 | 183 | $is_set_number = $cache_per_page = false; |
184 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
184 | + if (isset($wp_query->query_vars['number'])) { |
|
185 | 185 | $cache_per_page = $wp_query->query_vars['number']; |
186 | 186 | $is_set_number = true; |
187 | 187 | } |
@@ -190,22 +190,22 @@ discard block |
||
190 | 190 | $wp_query->query_vars['number'] = $number; |
191 | 191 | |
192 | 192 | // Get forms. |
193 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
193 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
194 | 194 | |
195 | 195 | // Reset number query var. |
196 | - if ( $is_set_number ) { |
|
196 | + if ($is_set_number) { |
|
197 | 197 | $wp_query->query_vars['number'] = $cache_per_page; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // Bailout. |
201 | - if ( array_key_exists( 'error', $forms ) ) { |
|
201 | + if (array_key_exists('error', $forms)) { |
|
202 | 202 | |
203 | - WP_CLI::warning( $forms['error'] ); |
|
203 | + WP_CLI::warning($forms['error']); |
|
204 | 204 | |
205 | 205 | return; |
206 | - } elseif ( empty( $forms['forms'] ) ) { |
|
206 | + } elseif (empty($forms['forms'])) { |
|
207 | 207 | |
208 | - WP_CLI::error( __( 'No forms found.', 'give' ) ); |
|
208 | + WP_CLI::error(__('No forms found.', 'give')); |
|
209 | 209 | |
210 | 210 | return; |
211 | 211 | } |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | // Param to check if form typeis already showed or not. |
214 | 214 | $is_show_form_type = false; |
215 | 215 | |
216 | - if ( 1 === count( $forms ) && $form_id ) { |
|
216 | + if (1 === count($forms) && $form_id) { |
|
217 | 217 | // Show single form. |
218 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
219 | - switch ( $key ) { |
|
218 | + foreach ($forms['forms'][0] as $key => $info) { |
|
219 | + switch ($key) { |
|
220 | 220 | case 'stats': |
221 | - $this->color_main_heading( ucfirst( $key ) ); |
|
221 | + $this->color_main_heading(ucfirst($key)); |
|
222 | 222 | |
223 | - foreach ( $info as $heading => $data ) { |
|
224 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
225 | - switch ( $heading ) { |
|
223 | + foreach ($info as $heading => $data) { |
|
224 | + $this->color_sub_heading(ucfirst($heading)); |
|
225 | + switch ($heading) { |
|
226 | 226 | default: |
227 | - foreach ( $data as $subheading => $subdata ) { |
|
227 | + foreach ($data as $subheading => $subdata) { |
|
228 | 228 | |
229 | - switch ( $subheading ) { |
|
229 | + switch ($subheading) { |
|
230 | 230 | case 'earnings': |
231 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
231 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
232 | 232 | break; |
233 | 233 | default: |
234 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
234 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -241,26 +241,26 @@ discard block |
||
241 | 241 | case 'pricing': |
242 | 242 | case 'info': |
243 | 243 | default: |
244 | - $this->color_main_heading( ucfirst( $key ) ); |
|
244 | + $this->color_main_heading(ucfirst($key)); |
|
245 | 245 | |
246 | 246 | // Show form type. |
247 | - if ( ! $is_show_form_type ) { |
|
248 | - $form = new Give_Donate_Form( $form_id ); |
|
247 | + if ( ! $is_show_form_type) { |
|
248 | + $form = new Give_Donate_Form($form_id); |
|
249 | 249 | $is_show_form_type = true; |
250 | 250 | |
251 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
251 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
252 | 252 | } |
253 | 253 | |
254 | - foreach ( $info as $heading => $data ) { |
|
254 | + foreach ($info as $heading => $data) { |
|
255 | 255 | |
256 | - switch ( $heading ) { |
|
256 | + switch ($heading) { |
|
257 | 257 | case 'id': |
258 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
258 | + WP_CLI::log($this->color_message($heading, $data)); |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | default: |
262 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
263 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
262 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
263 | + WP_CLI::log($this->color_message($heading, $data)); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | }// End switch(). |
@@ -271,37 +271,37 @@ discard block |
||
271 | 271 | $is_table_first_row_set = false; |
272 | 272 | $table_column_count = 0; |
273 | 273 | |
274 | - WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
274 | + WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
275 | 275 | |
276 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
276 | + foreach ($forms['forms'] as $index => $form_data) { |
|
277 | 277 | |
278 | 278 | // Default table data. |
279 | 279 | $table_first_row = array(); |
280 | 280 | $table_row = array(); |
281 | 281 | |
282 | - foreach ( $form_data['info'] as $key => $form ) { |
|
282 | + foreach ($form_data['info'] as $key => $form) { |
|
283 | 283 | |
284 | 284 | // Do not show thumbnail, content and link in table. |
285 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
285 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 | |
289 | - if ( ! $is_table_first_row_set ) { |
|
289 | + if ( ! $is_table_first_row_set) { |
|
290 | 290 | $table_first_row[] = $key; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $table_row[] = $form; |
294 | 294 | |
295 | - if ( 'status' === $key ) { |
|
295 | + if ('status' === $key) { |
|
296 | 296 | // First array item will be an form id in our case. |
297 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
297 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
298 | 298 | |
299 | 299 | $table_row[] = $form->get_type(); |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Set table first row. |
304 | - if ( ! $is_table_first_row_set ) { |
|
304 | + if ( ! $is_table_first_row_set) { |
|
305 | 305 | |
306 | 306 | // Add extra column to table. |
307 | 307 | $table_first_row[] = 'type'; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $table_data[] = $table_row; |
315 | 315 | }// End foreach(). |
316 | 316 | |
317 | - $this->display_table( $table_data ); |
|
317 | + $this->display_table($table_data); |
|
318 | 318 | }// End if(). |
319 | 319 | } |
320 | 320 | |
@@ -367,37 +367,37 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @subcommand donors |
369 | 369 | */ |
370 | - public function donors( $args, $assoc_args ) { |
|
370 | + public function donors($args, $assoc_args) { |
|
371 | 371 | global $wp_query; |
372 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
373 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
374 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
375 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
376 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
377 | - $form_id = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0; |
|
378 | - $format = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table'; |
|
372 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
373 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
374 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
375 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
376 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
377 | + $form_id = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0; |
|
378 | + $format = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table'; |
|
379 | 379 | $start = time(); |
380 | 380 | |
381 | - if ( $create ) { |
|
381 | + if ($create) { |
|
382 | 382 | $number = 1; |
383 | 383 | |
384 | - if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) { |
|
385 | - WP_CLI::warning( 'Wrong email address provided.', 'give' ); |
|
384 | + if (isset($assoc_args['email']) && ! is_email($email)) { |
|
385 | + WP_CLI::warning('Wrong email address provided.', 'give'); |
|
386 | 386 | |
387 | 387 | return; |
388 | 388 | } |
389 | 389 | |
390 | 390 | // Create one or more donors. |
391 | - if ( ! $email ) { |
|
391 | + if ( ! $email) { |
|
392 | 392 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
393 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
393 | + $number = is_numeric($create) ? absint($create) : 1; |
|
394 | 394 | } |
395 | 395 | |
396 | - for ( $i = 0; $i < $number; $i ++ ) { |
|
397 | - if ( ! $email ) { |
|
396 | + for ($i = 0; $i < $number; $i++) { |
|
397 | + if ( ! $email) { |
|
398 | 398 | |
399 | 399 | // Generate fake email. |
400 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
400 | + $email = 'customer-'.uniqid().'@test.com'; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $args = array( |
@@ -405,19 +405,19 @@ discard block |
||
405 | 405 | 'name' => $name, |
406 | 406 | ); |
407 | 407 | |
408 | - $donor_id = Give()->donors->add( $args ); |
|
408 | + $donor_id = Give()->donors->add($args); |
|
409 | 409 | |
410 | - if ( $donor_id ) { |
|
411 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) ); |
|
410 | + if ($donor_id) { |
|
411 | + WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id))); |
|
412 | 412 | } else { |
413 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
413 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | // Reset email to false so it is generated on the next loop (if creating donors). |
417 | 417 | $email = false; |
418 | 418 | } |
419 | 419 | |
420 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
420 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | // Counter. |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | */ |
432 | 432 | // Cache previous number query var. |
433 | 433 | $is_set_number = $cache_per_page = false; |
434 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
434 | + if (isset($wp_query->query_vars['number'])) { |
|
435 | 435 | $cache_per_page = $wp_query->query_vars['number']; |
436 | 436 | $is_set_number = true; |
437 | 437 | } |
@@ -440,24 +440,24 @@ discard block |
||
440 | 440 | $wp_query->query_vars['number'] = $number; |
441 | 441 | |
442 | 442 | // Get donors. |
443 | - if ( $form_id ) { |
|
443 | + if ($form_id) { |
|
444 | 444 | // @TODO: Allow user to get a list of donors by donation status. |
445 | - $donors = $this->get_donors_by_form_id( $form_id ); |
|
445 | + $donors = $this->get_donors_by_form_id($form_id); |
|
446 | 446 | } else { |
447 | - $donors = $this->api->get_donors( $search ); |
|
447 | + $donors = $this->api->get_donors($search); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | // Reset number query var. |
451 | - if ( $is_set_number ) { |
|
451 | + if ($is_set_number) { |
|
452 | 452 | $wp_query->query_vars['number'] = $cache_per_page; |
453 | 453 | } |
454 | 454 | |
455 | - if ( isset( $donors['error'] ) ) { |
|
456 | - WP_CLI::error( $donors['error'] ); |
|
455 | + if (isset($donors['error'])) { |
|
456 | + WP_CLI::error($donors['error']); |
|
457 | 457 | } |
458 | 458 | |
459 | - if ( empty( $donors ) ) { |
|
460 | - WP_CLI::error( __( 'No donors found.', 'give' ) ); |
|
459 | + if (empty($donors)) { |
|
460 | + WP_CLI::error(__('No donors found.', 'give')); |
|
461 | 461 | |
462 | 462 | return; |
463 | 463 | } |
@@ -465,24 +465,24 @@ discard block |
||
465 | 465 | $table_data = array(); |
466 | 466 | $is_table_first_row_set = false; |
467 | 467 | |
468 | - foreach ( $donors['donors'] as $donor_data ) { |
|
468 | + foreach ($donors['donors'] as $donor_data) { |
|
469 | 469 | // Set default table row data. |
470 | - $table_first_row = array( __( 's_no', 'give' ) ); |
|
471 | - $table_row = array( self::$counter ); |
|
470 | + $table_first_row = array(__('s_no', 'give')); |
|
471 | + $table_row = array(self::$counter); |
|
472 | 472 | |
473 | - foreach ( $donor_data as $key => $donor ) { |
|
474 | - switch ( $key ) { |
|
473 | + foreach ($donor_data as $key => $donor) { |
|
474 | + switch ($key) { |
|
475 | 475 | case 'stats': |
476 | - foreach ( $donor as $heading => $data ) { |
|
476 | + foreach ($donor as $heading => $data) { |
|
477 | 477 | |
478 | 478 | // Get first row. |
479 | - if ( ! $is_table_first_row_set ) { |
|
479 | + if ( ! $is_table_first_row_set) { |
|
480 | 480 | $table_first_row[] = $heading; |
481 | 481 | } |
482 | 482 | |
483 | - switch ( $heading ) { |
|
483 | + switch ($heading) { |
|
484 | 484 | case 'total_spent': |
485 | - $table_row[] = give_currency_filter( $data ); |
|
485 | + $table_row[] = give_currency_filter($data); |
|
486 | 486 | break; |
487 | 487 | |
488 | 488 | default: |
@@ -493,10 +493,10 @@ discard block |
||
493 | 493 | |
494 | 494 | case 'info': |
495 | 495 | default: |
496 | - foreach ( $donor as $heading => $data ) { |
|
496 | + foreach ($donor as $heading => $data) { |
|
497 | 497 | |
498 | 498 | // Get first row. |
499 | - if ( ! $is_table_first_row_set ) { |
|
499 | + if ( ! $is_table_first_row_set) { |
|
500 | 500 | $table_first_row[] = $heading; |
501 | 501 | } |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | } |
507 | 507 | |
508 | 508 | // Add first row data to table data. |
509 | - if ( ! $is_table_first_row_set ) { |
|
509 | + if ( ! $is_table_first_row_set) { |
|
510 | 510 | $table_data[] = $table_first_row; |
511 | 511 | $is_table_first_row_set = true; |
512 | 512 | } |
@@ -515,44 +515,44 @@ discard block |
||
515 | 515 | $table_data[] = $table_row; |
516 | 516 | |
517 | 517 | // Increase counter. |
518 | - self::$counter ++; |
|
518 | + self::$counter++; |
|
519 | 519 | }// End foreach(). |
520 | 520 | |
521 | - switch ( $format ) { |
|
521 | + switch ($format) { |
|
522 | 522 | case 'json': |
523 | 523 | $table_column_name = $table_data[0]; |
524 | - unset( $table_data[0] ); |
|
524 | + unset($table_data[0]); |
|
525 | 525 | |
526 | 526 | $new_table_data = array(); |
527 | - foreach ( $table_data as $index => $data ) { |
|
528 | - foreach ( $data as $key => $value ) { |
|
529 | - $new_table_data[ $index ][ $table_column_name[ $key ] ] = $value; |
|
527 | + foreach ($table_data as $index => $data) { |
|
528 | + foreach ($data as $key => $value) { |
|
529 | + $new_table_data[$index][$table_column_name[$key]] = $value; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | - WP_CLI::log( json_encode( $new_table_data ) ); |
|
533 | + WP_CLI::log(json_encode($new_table_data)); |
|
534 | 534 | break; |
535 | 535 | |
536 | 536 | case 'csv': |
537 | - $file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv'; |
|
538 | - $fp = fopen( $file_path, 'w' ); |
|
537 | + $file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv'; |
|
538 | + $fp = fopen($file_path, 'w'); |
|
539 | 539 | |
540 | - if ( is_writable( $file_path ) ) { |
|
541 | - foreach ( $table_data as $fields ) { |
|
542 | - fputcsv( $fp, $fields ); |
|
540 | + if (is_writable($file_path)) { |
|
541 | + foreach ($table_data as $fields) { |
|
542 | + fputcsv($fp, $fields); |
|
543 | 543 | } |
544 | 544 | |
545 | - fclose( $fp ); |
|
545 | + fclose($fp); |
|
546 | 546 | |
547 | - WP_CLI::success( "Donors list csv created successfully: {$file_path}" ); |
|
547 | + WP_CLI::success("Donors list csv created successfully: {$file_path}"); |
|
548 | 548 | } else { |
549 | - WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" ); |
|
549 | + WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)"); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | break; |
553 | 553 | |
554 | 554 | default: |
555 | - $this->display_table( $table_data ); |
|
555 | + $this->display_table($table_data); |
|
556 | 556 | }// End switch(). |
557 | 557 | }// End if(). |
558 | 558 | } |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @subcommand donations |
584 | 584 | */ |
585 | - public function donations( $args, $assoc_args ) { |
|
585 | + public function donations($args, $assoc_args) { |
|
586 | 586 | global $wp_query; |
587 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
587 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
588 | 588 | |
589 | 589 | // Cache previous number query var. |
590 | 590 | $is_set_number = $cache_per_page = false; |
591 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
591 | + if (isset($wp_query->query_vars['number'])) { |
|
592 | 592 | $cache_per_page = $wp_query->query_vars['number']; |
593 | 593 | $is_set_number = true; |
594 | 594 | } |
@@ -600,46 +600,46 @@ discard block |
||
600 | 600 | $donations = $this->api->get_recent_donations(); |
601 | 601 | |
602 | 602 | // Reset number query var. |
603 | - if ( $is_set_number ) { |
|
603 | + if ($is_set_number) { |
|
604 | 604 | $wp_query->query_vars['number'] = $cache_per_page; |
605 | 605 | } |
606 | 606 | |
607 | - if ( empty( $donations ) ) { |
|
608 | - WP_CLI::error( __( 'No donations found.', 'give' ) ); |
|
607 | + if (empty($donations)) { |
|
608 | + WP_CLI::error(__('No donations found.', 'give')); |
|
609 | 609 | |
610 | 610 | return; |
611 | 611 | } |
612 | 612 | |
613 | 613 | self::$counter = 1; |
614 | 614 | |
615 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
616 | - $this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
617 | - self::$counter ++; |
|
615 | + foreach ($donations['donations'] as $key => $donation) { |
|
616 | + $this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
617 | + self::$counter++; |
|
618 | 618 | |
619 | - foreach ( $donation as $column => $data ) { |
|
619 | + foreach ($donation as $column => $data) { |
|
620 | 620 | |
621 | - if ( is_array( $data ) ) { |
|
622 | - $this->color_sub_heading( $column ); |
|
623 | - foreach ( $data as $subcolumn => $subdata ) { |
|
621 | + if (is_array($data)) { |
|
622 | + $this->color_sub_heading($column); |
|
623 | + foreach ($data as $subcolumn => $subdata) { |
|
624 | 624 | |
625 | 625 | // Decode html codes. |
626 | - switch ( $subcolumn ) { |
|
626 | + switch ($subcolumn) { |
|
627 | 627 | case 'name': |
628 | - $subdata = html_entity_decode( $subdata ); |
|
628 | + $subdata = html_entity_decode($subdata); |
|
629 | 629 | break; |
630 | 630 | } |
631 | 631 | |
632 | 632 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
633 | - if ( is_array( $subdata ) ) { |
|
633 | + if (is_array($subdata)) { |
|
634 | 634 | continue; |
635 | 635 | } |
636 | 636 | |
637 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
637 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
638 | 638 | } |
639 | 639 | continue; |
640 | 640 | } |
641 | 641 | |
642 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
642 | + WP_CLI::log($this->color_message($column, $data)); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -679,27 +679,27 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @return void |
681 | 681 | */ |
682 | - public function report( $args, $assoc_args ) { |
|
682 | + public function report($args, $assoc_args) { |
|
683 | 683 | $stats = new Give_Payment_Stats(); |
684 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
685 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
686 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
687 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
684 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
685 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
686 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
687 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
688 | 688 | |
689 | - if ( ! empty( $date ) ) { |
|
689 | + if ( ! empty($date)) { |
|
690 | 690 | $start_date = $date; |
691 | 691 | $end_date = false; |
692 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
692 | + } elseif (empty($date) && empty($start_date)) { |
|
693 | 693 | $start_date = 'this_month'; |
694 | 694 | $end_date = false; |
695 | 695 | } |
696 | 696 | |
697 | 697 | // Get stats. |
698 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
699 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
698 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
699 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
700 | 700 | |
701 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
702 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
701 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
702 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | |
@@ -726,27 +726,27 @@ discard block |
||
726 | 726 | * |
727 | 727 | * @subcommand cache |
728 | 728 | */ |
729 | - public function cache( $args, $assoc_args ) { |
|
730 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
729 | + public function cache($args, $assoc_args) { |
|
730 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
731 | 731 | |
732 | 732 | // Bailout. |
733 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
734 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
733 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
734 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
735 | 735 | |
736 | 736 | return; |
737 | 737 | } |
738 | 738 | |
739 | - switch ( $action ) { |
|
739 | + switch ($action) { |
|
740 | 740 | case 'delete' : |
741 | 741 | // Reset counter. |
742 | 742 | self::$counter = 1; |
743 | 743 | |
744 | - if ( $this->delete_stats_transients() ) { |
|
744 | + if ($this->delete_stats_transients()) { |
|
745 | 745 | // Report .eading. |
746 | - WP_CLI::success( 'Give cache deleted.' ); |
|
746 | + WP_CLI::success('Give cache deleted.'); |
|
747 | 747 | } else { |
748 | 748 | // Report .eading. |
749 | - WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' ); |
|
749 | + WP_CLI::warning('We did not find any Give plugin cache to delete :)'); |
|
750 | 750 | } |
751 | 751 | break; |
752 | 752 | } |
@@ -775,27 +775,27 @@ discard block |
||
775 | 775 | ARRAY_A |
776 | 776 | ); |
777 | 777 | |
778 | - if ( ! empty( $stat_option_names ) ) { |
|
778 | + if ( ! empty($stat_option_names)) { |
|
779 | 779 | |
780 | - foreach ( $stat_option_names as $option_name ) { |
|
780 | + foreach ($stat_option_names as $option_name) { |
|
781 | 781 | $error = false; |
782 | 782 | $option_name = $option_name['option_name']; |
783 | 783 | |
784 | - switch ( true ) { |
|
785 | - case ( false !== strpos( $option_name, 'transient' ) ): |
|
786 | - $option_name = str_replace( '_transient_', '', $option_name ); |
|
787 | - $error = delete_transient( $option_name ); |
|
784 | + switch (true) { |
|
785 | + case (false !== strpos($option_name, 'transient')): |
|
786 | + $option_name = str_replace('_transient_', '', $option_name); |
|
787 | + $error = delete_transient($option_name); |
|
788 | 788 | break; |
789 | 789 | |
790 | 790 | default: |
791 | - $error = delete_option( $option_name ); |
|
791 | + $error = delete_option($option_name); |
|
792 | 792 | } |
793 | 793 | |
794 | - if ( $error ) { |
|
795 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
796 | - self::$counter ++; |
|
794 | + if ($error) { |
|
795 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
796 | + self::$counter++; |
|
797 | 797 | } else { |
798 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
798 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return string |
818 | 818 | */ |
819 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
819 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
820 | 820 | // Add colon. |
821 | - if ( $colon ) { |
|
822 | - $heading = $heading . ': '; |
|
821 | + if ($colon) { |
|
822 | + $heading = $heading.': '; |
|
823 | 823 | } |
824 | 824 | |
825 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
825 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @return void |
839 | 839 | */ |
840 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
841 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
840 | + private function color_main_heading($heading, $color = 'g') { |
|
841 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return void |
853 | 853 | */ |
854 | - private function color_sub_heading( $subheading ) { |
|
855 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
854 | + private function color_sub_heading($subheading) { |
|
855 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -866,17 +866,17 @@ discard block |
||
866 | 866 | * |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function display_table( $data ) { |
|
869 | + private function display_table($data) { |
|
870 | 870 | $table = new \cli\Table(); |
871 | 871 | |
872 | 872 | // Set table header. |
873 | - $table->setHeaders( $data[0] ); |
|
873 | + $table->setHeaders($data[0]); |
|
874 | 874 | |
875 | 875 | // Remove table header. |
876 | - unset( $data[0] ); |
|
876 | + unset($data[0]); |
|
877 | 877 | |
878 | 878 | // Set table data. |
879 | - $table->setRows( $data ); |
|
879 | + $table->setRows($data); |
|
880 | 880 | |
881 | 881 | // Display table. |
882 | 882 | $table->display(); |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | * @return array |
894 | 894 | */ |
895 | 895 | |
896 | - private function get_donors_by_form_id( $form_id ) { |
|
896 | + private function get_donors_by_form_id($form_id) { |
|
897 | 897 | $donors = array(); |
898 | 898 | |
899 | 899 | $donations = new Give_Payments_Query( |
900 | 900 | array( |
901 | - 'give_forms' => array( $form_id ), |
|
902 | - 'number' => - 1, |
|
903 | - 'status' => array( 'publish' ), |
|
901 | + 'give_forms' => array($form_id), |
|
902 | + 'number' => -1, |
|
903 | + 'status' => array('publish'), |
|
904 | 904 | ) |
905 | 905 | ); |
906 | 906 | |
@@ -908,16 +908,16 @@ discard block |
||
908 | 908 | $skip_donors = array(); |
909 | 909 | |
910 | 910 | /* @var Give_Payment|object $donation Payment object. */ |
911 | - foreach ( $donations as $donation ) { |
|
911 | + foreach ($donations as $donation) { |
|
912 | 912 | |
913 | - if ( in_array( $donation->customer_id, $skip_donors ,true ) ) { |
|
913 | + if (in_array($donation->customer_id, $skip_donors, true)) { |
|
914 | 914 | continue; |
915 | 915 | } |
916 | 916 | |
917 | - if ( ! empty( $donors ) ) { |
|
918 | - $donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) ); |
|
917 | + if ( ! empty($donors)) { |
|
918 | + $donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id))); |
|
919 | 919 | } else { |
920 | - $donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) ); |
|
920 | + $donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id)); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | $skip_donors[] = $donation->customer_id; |