PHP Class Give_Payment_Stats, Give

This class is for retrieving stats for earnings and sales. Stats can be retrieved for date ranges and pre-defined periods.
Since: 1.0
Inheritance: extends Give_Stats
Show file Open project: wordimpress/give Class Usage Examples

Public Methods

Method Description
get_best_selling ( $number = 10 ) : array Get the best selling forms
get_earnings ( $form_id, $start_date = false, $end_date = false, $gateway_id = false ) : float | integer Retrieve earning stats
get_sales ( $form_id, $start_date = false, $end_date = false, $status = 'publish' ) : float | integer Retrieve sale stats

Method Details

get_best_selling() public method

Get the best selling forms
Since: 1.0
public get_best_selling ( $number = 10 ) : array
$number int The number of results to retrieve with the default set to 10.
return array Best selling forms

get_earnings() public method

Retrieve earning stats
Since: 1.0
public get_earnings ( $form_id, $start_date = false, $end_date = false, $gateway_id = false ) : float | integer
$form_id int The donation form to retrieve stats for. If false, gets stats for all forms
$start_date string|bool The starting date for which we'd like to filter our donation earnings stats. If false, we'll use the default start date of `this_month`
$end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
$gateway_id string|bool The gateway to get earnings for such as 'paypal' or 'stripe'
return float | integer Total amount of donations based on the passed arguments.

get_sales() public method

Retrieve sale stats
Since: 1.0
public get_sales ( $form_id, $start_date = false, $end_date = false, $status = 'publish' ) : float | integer
$form_id int The donation form to retrieve stats for. If false, gets stats for all forms
$start_date string|bool The starting date for which we'd like to filter our sale stats. If false, we'll use the default start date of `this_month`
$end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
$status string|array The sale status(es) to count. Only valid when retrieving global stats
return float | integer Total amount of donations based on the passed arguments.