|
@@ 934-953 (lines=20) @@
|
| 931 |
|
* |
| 932 |
|
* @return int Donation form sale count. |
| 933 |
|
*/ |
| 934 |
|
public function get_sales() { |
| 935 |
|
|
| 936 |
|
if ( ! isset( $this->sales ) ) { |
| 937 |
|
|
| 938 |
|
if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
| 939 |
|
add_post_meta( $this->ID, '_give_form_sales', 0 ); |
| 940 |
|
} // End if |
| 941 |
|
|
| 942 |
|
$this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
| 943 |
|
|
| 944 |
|
if ( $this->sales < 0 ) { |
| 945 |
|
// Never let sales be less than zero. |
| 946 |
|
$this->sales = 0; |
| 947 |
|
} |
| 948 |
|
|
| 949 |
|
} |
| 950 |
|
|
| 951 |
|
return $this->sales; |
| 952 |
|
|
| 953 |
|
} |
| 954 |
|
|
| 955 |
|
/** |
| 956 |
|
* Increment the sale count by one |
|
@@ 1024-1043 (lines=20) @@
|
| 1021 |
|
* |
| 1022 |
|
* @return float Donation form total earnings. |
| 1023 |
|
*/ |
| 1024 |
|
public function get_earnings() { |
| 1025 |
|
|
| 1026 |
|
if ( ! isset( $this->earnings ) ) { |
| 1027 |
|
|
| 1028 |
|
if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
| 1029 |
|
add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
| 1030 |
|
} |
| 1031 |
|
|
| 1032 |
|
$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
| 1033 |
|
|
| 1034 |
|
if ( $this->earnings < 0 ) { |
| 1035 |
|
// Never let earnings be less than zero |
| 1036 |
|
$this->earnings = 0; |
| 1037 |
|
} |
| 1038 |
|
|
| 1039 |
|
} |
| 1040 |
|
|
| 1041 |
|
return $this->earnings; |
| 1042 |
|
|
| 1043 |
|
} |
| 1044 |
|
|
| 1045 |
|
/** |
| 1046 |
|
* Increase the earnings by the given amount |