Bitcoin and Altcoin Wallets: Paywall extension 1.0.1

Subscription extends Post_Type
in package

Table of Contents

SUB_DURATION_UNITS  = ['hours', 'days', 'weeks', 'months', 'years']
$duration  : int
Duration.
$duration_units  : string
Duration units.
$name  : string
Subscription name.
$price  : float
Price.
$role  : string
WordPress user role.
$vs_currency  : string
Pricing currency.
__get()  : mixed
__set()  : mixed
__toString()  : string
expires_for_user()  : int|null
Determine when the specified user's sub expires.
load()  : Subscription
Load a Subscription from its custom post entry.
save()  : void
Save a Subscription object to a custom post.

Constants

SUB_DURATION_UNITS

public mixed SUB_DURATION_UNITS = ['hours', 'days', 'weeks', 'months', 'years']

Properties

$duration

Duration.

private int $duration = 0

The duration of this subscription, expressed in units specified below.

$duration_units

Duration units.

private string $duration_units = 'days'

The units in which the duration of this subscription is expressed.

$name

Subscription name.

private string $name = ''

Free text string, stored on the post_title of this subscription in the DB.

$price

Price.

private float $price = 0

The price of this subscription, expressed in units of pricing currency.

$role

WordPress user role.

private string $role = 'days'

The role with this slug will be assigned when this subscription starts and will be revoked when it expires.

$vs_currency

Pricing currency.

private string $vs_currency = 'USD'

One of the vs_currencies. The price of this subscription will be defined in this currency.

Methods

__get()

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

__set()

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed
Return values
mixed

expires_for_user()

Determine when the specified user's sub expires.

public expires_for_user([int $user_id = null ]) : int|null
Parameters
$user_id : int = null

User to check or null for current user

Return values
int|null

Timestamp of expiry if subscribed, or 0 if subscribed indefinitely, or null if not subscribed

load()

Load a Subscription from its custom post entry.

public static load(int $post_id) : Subscription
Parameters
$post_id : int
Tags
inheritdoc
see
Post_Type::load()
throws
InvalidArgumentException

If the post id is not valid.

Return values
Subscription

save()

Save a Subscription object to a custom post.

public save() : void
Tags
inheritdoc
see
Post_Type::load()
throws
Exception

If the post could not be saved to the DB.

Return values
void

Search results