|
@@ 920-939 (lines=20) @@
|
| 917 |
|
* |
| 918 |
|
* @return int Donation form sale count. |
| 919 |
|
*/ |
| 920 |
|
public function get_sales() { |
| 921 |
|
|
| 922 |
|
if ( ! isset( $this->sales ) ) { |
| 923 |
|
|
| 924 |
|
if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
| 925 |
|
add_post_meta( $this->ID, '_give_form_sales', 0 ); |
| 926 |
|
} // End if |
| 927 |
|
|
| 928 |
|
$this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
| 929 |
|
|
| 930 |
|
if ( $this->sales < 0 ) { |
| 931 |
|
// Never let sales be less than zero. |
| 932 |
|
$this->sales = 0; |
| 933 |
|
} |
| 934 |
|
|
| 935 |
|
} |
| 936 |
|
|
| 937 |
|
return $this->sales; |
| 938 |
|
|
| 939 |
|
} |
| 940 |
|
|
| 941 |
|
/** |
| 942 |
|
* Increment the sale count by one |
|
@@ 1010-1029 (lines=20) @@
|
| 1007 |
|
* |
| 1008 |
|
* @return float Donation form total earnings. |
| 1009 |
|
*/ |
| 1010 |
|
public function get_earnings() { |
| 1011 |
|
|
| 1012 |
|
if ( ! isset( $this->earnings ) ) { |
| 1013 |
|
|
| 1014 |
|
if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
| 1015 |
|
add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
| 1016 |
|
} |
| 1017 |
|
|
| 1018 |
|
$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
| 1019 |
|
|
| 1020 |
|
if ( $this->earnings < 0 ) { |
| 1021 |
|
// Never let earnings be less than zero |
| 1022 |
|
$this->earnings = 0; |
| 1023 |
|
} |
| 1024 |
|
|
| 1025 |
|
} |
| 1026 |
|
|
| 1027 |
|
return $this->earnings; |
| 1028 |
|
|
| 1029 |
|
} |
| 1030 |
|
|
| 1031 |
|
/** |
| 1032 |
|
* Increase the earnings by the given amount |