Property | Type | Description | |
---|---|---|---|
$db_name | Holds the name of our levels database table | ||
$db_version | Holds the version number of our levels database table | ||
$meta_db_name | Holds the name of our level meta database table |
Method | Description | |
---|---|---|
__construct ( ) | Get things started | |
add_meta ( integer $level_id, string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean | Add meta data field to a subscription level. | |
delete_meta ( integer $level_id, string $meta_key = '', mixed $meta_value = '' ) : boolean | Remove metadata matching criteria from a subscription level. | |
get_level ( $level_id ) | Retrieve a specific subscription level from the database | |
get_level_by ( $field = 'name', $value = '' ) | Retrieve a specific subscription level from the database | |
get_level_field ( $level_id, $field = '' ) | Retrieve a field for a subscription level | |
get_levels ( $args = [] ) | Retrieve all subscription levels from the database | |
get_meta ( integer $level_id, string $meta_key = '', boolean $single = false ) : mixed | Retrieve level meta field for a subscription level. | |
insert ( $args = [] ) | Insert a subscription level into the database | |
remove ( $level_id ) | Delete a subscription level | |
remove_all_meta_for_level_id ( integer $level_id ) : integer | false | Removes all metadata for the specified subscription level. | |
update ( $level_id, $args = [] ) | Update an existing subscription level | |
update_meta ( integer $level_id, string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean | Update level meta field based on Subscription level ID. |
Method | Description | |
---|---|---|
valid_amount ( $amount ) : boolean | Validates that the amount is a valid format. |
public add_meta ( integer $level_id, string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean | ||
$level_id | integer | Subscription level ID. |
$meta_key | string | Metadata name. |
$meta_value | mixed | Metadata value. |
$unique | boolean | Optional, default is false. Whether the same key should not be added. |
return | boolean | False for failure. True for success. |
public get_level ( $level_id ) |
public get_level_by ( $field = 'name', $value = '' ) |
public get_level_field ( $level_id, $field = '' ) |
public get_levels ( $args = [] ) |
public get_meta ( integer $level_id, string $meta_key = '', boolean $single = false ) : mixed | ||
$level_id | integer | Subscription level ID. |
$meta_key | string | The meta key to retrieve. |
$single | boolean | Whether to return a single value. |
return | mixed | Will be an array if $single is false. Will be value of meta data field if $single is true. |
public remove_all_meta_for_level_id ( integer $level_id ) : integer | false | ||
$level_id | integer | Subscription level ID. |
return | integer | false | Number of rows affected/selected or false on error. |
public update ( $level_id, $args = [] ) |
public update_meta ( integer $level_id, string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean | ||
$level_id | integer | Subscription level ID. |
$meta_key | string | Metadata key. |
$meta_value | mixed | Metadata value. |
$prev_value | mixed | Optional. Previous value to check before removing. |
return | boolean | False on failure, true if success. |
public $db_version |