PHP Class Give_Stats, Give

Base class for other stats classes Primarily for setting up dates and ranges
Since: 1.8
Show file Open project: wordimpress/give Class Usage Examples

Public Properties

Property Type Description
$end_date Can be a timestamp, formatted date, date string (such as August 3, 2013), or a predefined date string, such as last_week or this_month Predefined date options are: today, yesterday, this_week, last_week, this_month, last_month this_quarter, last_quarter, this_year, last_year The end date is optional
$start_date Can be a timestamp, formatted date, date string (such as August 3, 2013), or a predefined date string, such as last_week or this_month Predefined date options are: today, yesterday, this_week, last_week, this_month, last_month this_quarter, last_quarter, this_year, last_year
$timestamp Flag to determine if current query is based on timestamps

Public Methods

Method Description
__construct ( ) : void Class Constructor
convert_date ( string $date, boolean $end_date = false ) : array | WP_Error Convert Date
count_where ( string $where = '' ) : string Count Where
get_predefined_dates ( ) : array Get Predefined Dates
payments_where ( string $where = '' ) : string Payment Where
setup_dates ( string $_start_date = 'this_month', boolean $_end_date = false ) : void Setup the dates passed to our constructor.

Method Details

__construct() public method

Set up the Give Stats Class.
Since: 1.0
public __construct ( ) : void
return void

convert_date() public method

Converts a date to a timestamp.
Since: 1.0
public convert_date ( string $date, boolean $end_date = false ) : array | WP_Error
$date string Date.
$end_date boolean End date. Default is false.
return array | WP_Error If the date is invalid, a WP_Error object will be returned.

count_where() public method

Modifies the WHERE flag for payment counts.
Since: 1.0
public count_where ( string $where = '' ) : string
$where string SQL WHERE statment.
return string

get_predefined_dates() public method

Retrieve the predefined date periods permitted.
Since: 1.0
public get_predefined_dates ( ) : array
return array Predefined dates.

payments_where() public method

Modifies the WHERE flag for payment queries.
Since: 1.0
public payments_where ( string $where = '' ) : string
$where string SQL WHERE statment.
return string

setup_dates() public method

This calls the convert_date() member function to ensure the dates are formatted correctly.
Since: 1.0
public setup_dates ( string $_start_date = 'this_month', boolean $_end_date = false ) : void
$_start_date string Start date. Default is 'this_month'.
$_end_date boolean End date. Default is false.
return void

Property Details

$end_date public property

Can be a timestamp, formatted date, date string (such as August 3, 2013), or a predefined date string, such as last_week or this_month Predefined date options are: today, yesterday, this_week, last_week, this_month, last_month this_quarter, last_quarter, this_year, last_year The end date is optional
public $end_date

$start_date public property

Can be a timestamp, formatted date, date string (such as August 3, 2013), or a predefined date string, such as last_week or this_month Predefined date options are: today, yesterday, this_week, last_week, this_month, last_month this_quarter, last_quarter, this_year, last_year
Since: 1.0
public $start_date

$timestamp public property

Flag to determine if current query is based on timestamps
public $timestamp