| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | /** |
| 12 | 12 | * @return array |
| 13 | 13 | */ |
| 14 | 14 | public function get_defaults() { |
| 15 | - $values = array( | |
| 15 | + return array( | |
| 16 | 16 | 'receipt_id' => array( |
| 17 | 17 | 'sanitize' => 'sanitize_text_field', |
| 18 | 18 | 'default' => '', |
| 19 | 19 | ), |
| @@ -65,9 +65,8 @@ | ||
| 65 | 65 | 'sanitize' => 'sanitize_text_field', |
| 66 | 66 | 'default' => null, |
| 67 | 67 | ), |
| 68 | 68 | ); |
| 69 | - return $values; | |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | 71 | /** |
| 73 | 72 | * Gets payments statistic data. |
| @@ -73,10 +72,10 @@ | ||
| 73 | 72 | * Gets payments statistic data. |
| 74 | 73 | * |
| 75 | 74 | * @since 6.7 |
| 76 | 75 | * |
| 77 | - * @param string $from_date From date. | |
| 78 | - * @param string $to_date To date. | |
| 76 | + * @param string|null $from_date From date. | |
| 77 | + * @param string|null $to_date To date. | |
| 79 | 78 | * |
| 80 | 79 | * @return array Contains `count` and `total`. |
| 81 | 80 | */ |
| 82 | 81 | public function get_payments_stats( $from_date = null, $to_date = null ) { |
| @@ -98,15 +97,17 @@ | ||
| 98 | 97 | if ( null !== $to_date ) { |
| 99 | 98 | $where['created_at <'] = $to_date . ' 23:59:59'; |
| 100 | 99 | } |
| 101 | 100 | |
| 101 | + $db_version = get_option( $this->db_opt_name ); | |
| 102 | + | |
| 102 | 103 | // Do not collect test payment, this is a new feature of Stripe lite. |
| 103 | - if ( 6 <= get_option( $this->db_opt_name ) ) { | |
| 104 | + if ( 6 <= $db_version ) { | |
| 104 | 105 | $where['test'] = array( null, 0 ); |
| 105 | 106 | } |
| 106 | 107 | |
| 107 | 108 | // If only Paypal is used, and the DB isn't migrated (to version 4), use `completed` column instead of `status`. |
| 108 | - if ( 4 > get_option( $this->db_opt_name ) && FrmDb::db_column_exists( $this->table_name, 'completed' ) ) { | |
| 109 | + if ( 4 > $db_version && FrmDb::db_column_exists( $this->table_name, 'completed' ) ) { | |
| 109 | 110 | $where['completed'] = 1; |
| 110 | 111 | } else { |
| 111 | 112 | $where['status'] = 'complete'; |
| 112 | 113 | } |