Constants

RENEWAL_DISCOUNT_CODE

RENEWAL_DISCOUNT_CODE ='RENEWAL20'

Properties

$item_id

$item_id :

Type

$license_api

$license_api :

Type

$legacy_db_prefix

$legacy_db_prefix :

Type

$license_option

$license_option :

Type

$license_data

$license_data :

Type

$home_url

$home_url :

Type

Methods

__construct()

__construct(integer  $item_id,\Barn2\PTP_Lib\Plugin\License\License_API  $license_api,string  $legacy_db_prefix = '')

Creates a new plugin license instance.

Parameters

integer $item_id

The item ID for this plugin.

\Barn2\PTP_Lib\Plugin\License\License_API $license_api
string $legacy_db_prefix

Legacy plugins only - the database prefix for the license settings.

register()

register()

get_item_id()

get_item_id()

exists()

exists()

is_valid()

is_valid()

is_active()

is_active()

is_expired()

is_expired()

is_inactive()

is_inactive()

is_disabled()

is_disabled()

get_license_key()

get_license_key()

get_status()

get_status()

get_status_help_text()

get_status_help_text()

activate()

activate(string  $license_key): \Barn2\PTP_Lib\Plugin\License\boolea

Attempt to activate the specified license key.

Parameters

string $license_key

The license key to activate.

Returns

\Barn2\PTP_Lib\Plugin\License\boolea —

true if successfully activated, false otherwise.

deactivate()

deactivate(): boolean

Attempt to deactivate the current license key.

Returns

boolean —

true if successfully deactivated, false otherwise.

refresh()

refresh(): void

Refresh the current license key information from the EDD Licensing server. Ensures the correct license state for this plugin is stored in the database.

override()

override(  $license_key,  $status)

Parameters

$license_key
$status

get_setting_name()

get_setting_name()

get_error_code()

get_error_code()

get_error_message()

get_error_message()

get_active_url()

get_active_url()

has_site_moved()

has_site_moved()

get_renewal_url()

get_renewal_url(  $apply_discount = true)

Parameters

$apply_discount

migrate_legacy_license()

migrate_legacy_license()

get_home_url()

get_home_url()

clean_license_url()

clean_license_url(string  $url): string

Cleans the URL to use for the license.

As in EDD Software Licensing, we ignore www. and http/https in URL to prevent similar URLs causing separate license activations.

Parameters

string $url

The URL to clean.

Returns

string —

Cleaned URL.

is_license_overridden()

is_license_overridden()

get_default_data()

get_default_data()

get_license_data()

get_license_data()

set_license_data()

set_license_data(array  $data)

Parameters

array $data

update_license_data()

update_license_data(array  $data)

Parameters

array $data

sanitize_license_data()

sanitize_license_data(array  $data)

Parameters

array $data

set_missing_license()

set_missing_license()

set_site_inactive()

set_site_inactive()

format_license_info()

format_license_info(  $api_response)

Parameters

$api_response

get_license_info()

get_license_info()

set_status()

set_status(  $status)

Parameters

$status

is_valid_status()

is_valid_status(  $status)

Parameters

$status

to_license_status()

to_license_status(  $api_license_status)

Parameters

$api_license_status

get_license_inactive_message()

get_license_inactive_message()

get_license_expired_message()

get_license_expired_message()

get_license_disabled_message()

get_license_disabled_message()