PHP Class Give_Donate_Form, Give

This class handles donation forms.
Since: 1.0
Show file Open project: wordimpress/give Class Usage Examples

Public Properties

Property Type Description
$ID integer The donation ID
$comment_count integer The comment count
$comment_status string The comment status
$filter string Filtered
$guid string The post GUID
$menu_order integer The menu order
$ping_status string The ping status
$pinged string Pinged
$post_author integer The post author
$post_content string The post content
$post_content_filtered string The post filtered content
$post_date string The post date
$post_date_gmt string The post GTM date
$post_excerpt string The post excerpt
$post_mime_type string The mime type0
$post_modified string The post modified date
$post_modified_gmt string The post modified GTM date
$post_name string The post name
$post_parent integer The post parent
$post_password string The post password
$post_status string The post status
$post_title string The post title
$to_ping string Ping

Public Methods

Method Description
__construct ( boolean $_id = false, array $_args = [] ) : void Class Constructor
__get ( string $key ) : mixed Magic __get function to dispatch a call to retrieve a private property
create ( array $data = [] ) : mixed Creates a donation form
decrease_earnings ( integer $amount ) : float | false Decrease the earnings by the given amount
decrease_sales ( integer $quantity = 1 ) : integer | false Decrement the sale count by one
get_ID ( ) : integer Retrieve the ID
get_earnings ( ) : float Retrieve the total earnings for the form
get_form_classes ( $args ) : string Get form tag classes.
get_form_wrap_classes ( $args ) : string Get form wrap Classes.
get_goal ( ) : float Retrieve the goal
get_minimum_price ( ) : float Retrieve the minimum price.
get_name ( ) : string Retrieve the donation form name
get_price ( ) : float Retrieve the price
get_prices ( ) : array Retrieve the variable prices
get_sales ( ) : integer Retrieve the sale count for the donation form
get_type ( ) : string Retrieve the donation form type, set or multi-level
has_variable_prices ( ) : boolean Has Variable Prices
increase_earnings ( integer $amount ) : float | false Increase the earnings by the given amount
increase_sales ( integer $quantity = 1 ) : integer | false Increment the sale count by one
is_close_donation_form ( ) : boolean Determine if donation form closed or not
is_custom_price_mode ( ) : boolean Determine if custom price mode is enabled or disabled
is_free ( integer $price_id = false ) : boolean Determine if the donation is free or if the given price ID is free
is_multi_type_donation_form ( ) : boolean Get if form type set or not.
is_single_price_mode ( ) : boolean Determine if single price mode is enabled or disabled

Private Methods

Method Description
setup_donation_form ( WP_Post $donation_form ) : boolean Given the donation form data, let's set the variables
update_meta ( string $meta_key = '', string | array | object $meta_value = '' ) : boolean Updates a single meta entry for the donation form

Method Details

__construct() public method

Set up the Give Donate Form Class.
Since: 1.0
public __construct ( boolean $_id = false, array $_args = [] ) : void
$_id boolean Post id. Default is false.
$_args array Arguments passed.
return void

__get() public method

Magic __get function to dispatch a call to retrieve a private property
Since: 1.0
public __get ( string $key ) : mixed
$key string
return mixed

create() public method

Creates a donation form
Since: 1.5
public create ( array $data = [] ) : mixed
$data array Array of attributes for a donation form.
return mixed False if data isn't passed and class not instantiated for creation, or New Form ID.

decrease_earnings() public method

Decrease the earnings by the given amount
Since: 1.0
public decrease_earnings ( integer $amount ) : float | false
$amount integer Amount of donation.
return float | false

decrease_sales() public method

Decrement the sale count by one
Since: 1.0
public decrease_sales ( integer $quantity = 1 ) : integer | false
$quantity integer The quantity to decrease by. Default is 1.
return integer | false New number of total sales.

get_ID() public method

Retrieve the ID
Since: 1.0
public get_ID ( ) : integer
return integer Donation form ID.

get_earnings() public method

Retrieve the total earnings for the form
Since: 1.0
public get_earnings ( ) : float
return float Donation form total earnings.

get_form_classes() public method

Provides the classes for the donation
html tag and filters for customization.
Since: 1.6
public get_form_classes ( $args ) : string
$args
return string

get_form_wrap_classes() public method

Provides the classes for the donation form div wrapper and filters for customization.
public get_form_wrap_classes ( $args ) : string
$args
return string

get_goal() public method

Retrieve the goal
Since: 1.0
public get_goal ( ) : float
return float Goal.

get_minimum_price() public method

Retrieve the minimum price.
Since: 1.3.6
public get_minimum_price ( ) : float
return float Minimum price.

get_name() public method

Retrieve the donation form name
Since: 1.5
public get_name ( ) : string
return string Donation form name.

get_price() public method

Retrieve the price
Since: 1.0
public get_price ( ) : float
return float Price.

get_prices() public method

Retrieve the variable prices
Since: 1.0
public get_prices ( ) : array
return array Variable prices.

get_sales() public method

Retrieve the sale count for the donation form
Since: 1.0
public get_sales ( ) : integer
return integer Donation form sale count.

get_type() public method

Retrieve the donation form type, set or multi-level
Since: 1.5
public get_type ( ) : string
return string Type of donation form, either 'set' or 'multi'.

has_variable_prices() public method

Determine if the donation form has variable prices enabled
Since: 1.0
public has_variable_prices ( ) : boolean
return boolean

increase_earnings() public method

Increase the earnings by the given amount
Since: 1.0
public increase_earnings ( integer $amount ) : float | false
$amount integer Amount of donation. Default is 0.
return float | false

increase_sales() public method

Increment the sale count by one
Since: 1.0
public increase_sales ( integer $quantity = 1 ) : integer | false
$quantity integer The quantity to increase the donations by. Default is 1.
return integer | false New number of total sales.

is_close_donation_form() public method

Form will be close if: a. form has fixed goal b. close form when goal achieved cmb2 setting is set to 'Yes' c. goal has been achieved
Since: 1.4.5
public is_close_donation_form ( ) : boolean
return boolean

is_custom_price_mode() public method

Determine if custom price mode is enabled or disabled
Since: 1.6
public is_custom_price_mode ( ) : boolean
return boolean

is_free() public method

Determine if the donation is free or if the given price ID is free
Since: 1.0
public is_free ( integer $price_id = false ) : boolean
$price_id integer Price ID. Default is false.
return boolean

is_multi_type_donation_form() public method

Get if form type set or not.
Since: 1.6
Since: 1.6
public is_multi_type_donation_form ( ) : boolean
return boolean public function is_set_type_donation_form() { $form_type = $this->get_type(); return ( 'set' === $form_type ? true : false ); } Get if form type multi or not.

is_single_price_mode() public method

Determine if single price mode is enabled or disabled
Since: 1.0
public is_single_price_mode ( ) : boolean
return boolean

Property Details

$ID public property

The donation ID
Since: 1.0
public int $ID
return integer

$comment_count public property

The comment count
Since: 1.0
public int $comment_count
return integer

$comment_status public property

The comment status
Since: 1.0
public string $comment_status
return string

$filter public property

Filtered
Since: 1.0
public string $filter
return string

$guid public property

The post GUID
Since: 1.0
public string $guid
return string

$menu_order public property

The menu order
Since: 1.0
public int $menu_order
return integer

$ping_status public property

The ping status
Since: 1.0
public string $ping_status
return string

$pinged public property

Pinged
Since: 1.0
public string $pinged
return string

$post_author public property

The post author
Since: 1.0
public int $post_author
return integer

$post_content public property

The post content
Since: 1.0
public string $post_content
return string

$post_content_filtered public property

The post filtered content
Since: 1.0
public string $post_content_filtered
return string

$post_date public property

The post date
Since: 1.0
public string $post_date
return string

$post_date_gmt public property

The post GTM date
Since: 1.0
public string $post_date_gmt
return string

$post_excerpt public property

The post excerpt
Since: 1.0
public string $post_excerpt
return string

$post_mime_type public property

The mime type0
Since: 1.0
public string $post_mime_type
return string

$post_modified public property

The post modified date
Since: 1.0
public string $post_modified
return string

$post_modified_gmt public property

The post modified GTM date
Since: 1.0
public string $post_modified_gmt
return string

$post_name public property

The post name
Since: 1.0
public string $post_name
return string

$post_parent public property

The post parent
Since: 1.0
public int $post_parent
return integer

$post_password public property

The post password
Since: 1.0
public string $post_password
return string

$post_status public property

The post status
Since: 1.0
public string $post_status
return string

$post_title public property

The post title
Since: 1.0
public string $post_title
return string

$to_ping public property

Ping
Since: 1.0
public string $to_ping
return string