@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return Give_Donor_Stats |
| 39 | 39 | */ |
| 40 | 40 | public static function get_instance() { |
| 41 | - if ( null === static::$instance ) { |
|
| 41 | + if (null === static::$instance) { |
|
| 42 | 42 | self::$instance = new static(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | * @return string |
| 58 | 58 | * |
| 59 | 59 | */ |
| 60 | - public static function donated( $args = array() ) { |
|
| 60 | + public static function donated($args = array()) { |
|
| 61 | 61 | global $wpdb; |
| 62 | - $donation_id_col = Give()->payment_meta->get_meta_type() . '_id'; |
|
| 62 | + $donation_id_col = Give()->payment_meta->get_meta_type().'_id'; |
|
| 63 | 63 | |
| 64 | 64 | $donated_amount = 0; |
| 65 | 65 | |
| 66 | - if ( empty( $args['donor'] ) ) { |
|
| 66 | + if (empty($args['donor'])) { |
|
| 67 | 67 | return $donated_amount; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | $args['fields'] = 'ids'; |
| 73 | 73 | $args['number'] = - 1; |
| 74 | 74 | |
| 75 | - $donation_query = new Give_Payments_Query( $args ); |
|
| 75 | + $donation_query = new Give_Payments_Query($args); |
|
| 76 | 76 | $donations = $donation_query->get_payments(); |
| 77 | - $donation_id_str = implode( '\',\'', $donations ); |
|
| 77 | + $donation_id_str = implode('\',\'', $donations); |
|
| 78 | 78 | |
| 79 | 79 | $query = "SELECT {$donation_id_col} as id, meta_value as total |
| 80 | 80 | FROM {$wpdb->donationmeta} |
| 81 | 81 | WHERE meta_key='_give_payment_total' |
| 82 | 82 | AND {$donation_id_col} IN ('{$donation_id_str}')"; |
| 83 | 83 | |
| 84 | - $donated_amounts = $wpdb->get_results( $query, ARRAY_A ); |
|
| 84 | + $donated_amounts = $wpdb->get_results($query, ARRAY_A); |
|
| 85 | 85 | |
| 86 | - if ( ! empty( $donated_amounts ) ) { |
|
| 87 | - foreach ( $donated_amounts as $donation ) { |
|
| 86 | + if ( ! empty($donated_amounts)) { |
|
| 87 | + foreach ($donated_amounts as $donation) { |
|
| 88 | 88 | // Do not include anonymous donation in calculation. |
| 89 | - if( give_is_anonymous_donation( $donation['id']) ){ |
|
| 89 | + if (give_is_anonymous_donation($donation['id'])) { |
|
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $currency_code = give_get_payment_currency_code( $donation['id'] ); |
|
| 93 | + $currency_code = give_get_payment_currency_code($donation['id']); |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Filter the donation amount |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | $formatted_amount = apply_filters( |
| 102 | 102 | 'give_donation_amount', |
| 103 | - give_format_amount( $donation['total'], array( 'currency' => $currency_code ) ), |
|
| 103 | + give_format_amount($donation['total'], array('currency' => $currency_code)), |
|
| 104 | 104 | $donation['total'], |
| 105 | 105 | $donation['id'], |
| 106 | - array( 'type' => 'stats', 'currency' => false, 'amount' => false ) |
|
| 106 | + array('type' => 'stats', 'currency' => false, 'amount' => false) |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $donated_amount += (float) give_maybe_sanitize_amount( $formatted_amount, array( 'currency' => $currency_code ) ); |
|
| 109 | + $donated_amount += (float) give_maybe_sanitize_amount($formatted_amount, array('currency' => $currency_code)); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |