Constants

ERROR_CODE_ALREADY_ACTIVATED

ERROR_CODE_ALREADY_ACTIVATED ='rpm_wpc_already_exists'

Properties

$license

$license :\DevOwl\RealProductManagerWpClient\license\License

License instance.

Type

\DevOwl\RealProductManagerWpClient\license\License

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this package so we can utils package natively.

Returns

string

setupConstants()

setupConstants()

Make sure the RPM_WP_CLIENT constants are available.

__construct()

__construct(\DevOwl\RealProductManagerWpClient\license\License  $license)

C'tor.

Parameters

\DevOwl\RealProductManagerWpClient\license\License $license

skip()

skip(boolean  $noUsage = false)

Mark the license as "ever seen form once", see also `#hasInteractedWithFormOnce`.

You should use the REST API endpoint plugin-update/:slug/skip for this.

$noUsage = true:

Mark the license as "no usage". That means, the license code is not needed and not considered for "fully licensed" or "partial licensed".

Use case: User has installed the plugin network wide, but want to use the premium plugin only on one sub site.

Parameters

boolean $noUsage

activate()

activate(string  $code,string  $installationType,boolean  $telemetry,boolean  $newsletterOptIn,string  $firstName,string  $email)

Activate this license with a given code. It returns a `WP_Error` if a code is already active.

Parameters

string $code
string $installationType
boolean $telemetry
boolean $newsletterOptIn
string $firstName
string $email

deactivate()

deactivate(boolean  $remote = false,string  $validateStatus = null,string  $help = ''): \WP_Error|true

Deactivate the license for this blog and plugin.

Parameters

boolean $remote

If true, the license is also deactivate remotely

string $validateStatus
string $help

Returns

\WP_Error|true

applyTimeOfLicenseActivationToTimestamp()

applyTimeOfLicenseActivationToTimestamp(integer  $timestamp)

Pass any timestamp and this method returns the day of the timestamp with the time of the license activation. This allows us to defer API calls.

Parameters

integer $timestamp

executeDeferredAction()

executeDeferredAction(string  $actionName,callable|integer  $actionOrExpire,integer  $periodInDays = 1,string  $minimumWpHook = 'init')

Schedules an action (callable) for deferred execution. The action is called only once for the given period in days. The action gets called at the time of license activation so we can scutter e.g. API calls to our license server independent of configured time and timezone of current server.

Parameters

string $actionName
callable|integer $actionOrExpire

If you pass int the action will be scheduled after this expiration in seconds

integer $periodInDays
string $minimumWpHook

hasInteractedWithFormOnce()

hasInteractedWithFormOnce()

Check if the form for this license was shown the user once. This allows you e.g.

show a form of the license activation directly after using the plugin for the first time.

getHint()

getHint(): string

Get a hint for this license activation. This can happen e.g. the remote status changed (revoked, expired) and we want to user show a notice for this. Can be `false` if none given.

Returns

string

getReceived()

getReceived(): false|array

Get the license activation we received from our remote license server. This returns also a result if you have deactivated your license already.

Returns

false|array

getReceivedClientProperties()

getReceivedClientProperties(): false|array

Get the received client properties from the last contact to our license server for this activation.

This returns also a result if you have deactivated your license already.

Returns

false|array

getReceivedClientProperty()

getReceivedClientProperty(string  $key,mixed  $default = false)

Get a received client property by key from the last contact to our license server for this activation.

This returns also a result if you have deactivated your license already.

Parameters

string $key
mixed $default

getCode()

getCode(): string|false

Get entered license code for this activation. Can be `false` if none given. If it is an empty string, the form got skipped through `#skip()`.

Returns

string|false

getInstallationType()

getInstallationType()

See `License#INSTALLATION_TYPE_*` constants.

isTelemetryDataSharingOptIn()

isTelemetryDataSharingOptIn()

Check if this license activation has enabled telemetry data sharing.

getLicense()

getLicense()

Get license instance.