Clanbite Since 1.6.0

class License_Client

One licence key per site owner unlocks every add-on they bought. This class activates the key for this site, keeps the activation token, asks for updates in a single batched request and requests the (single-use) download at the moment the administrator clicks Update.

State lives in the option clanbite_license_state (autoload off). The key and the activation token are encrypted with a key derived from the site's salts, never returned to the browser and never logged. Define CLANBITE_LICENSE_KEY in wp-config.php to supply the key from code (managed hosts, deployments).

class final

Full name
Kernowdev\Clanbite\Updates\License_Client

Constants

NameValueDescription
OPTION'clanbite_license_state'

Methods

  • activate() Activate a licence key for this site.
  • auto_activate() Activate from CLANBITE_LICENSE_KEY when defined and not yet activated (throttled after a failure).
  • catalog() The extensions this site may see and install: everything for an activated licence, only free ones without one.
  • check() Ask the server which installed add-ons have updates.
  • deactivate() Deactivate this site (frees its seat) and forget the key.
  • get_state() Saved state with defaults.
  • is_activated() Whether this site holds an activation token.
  • key_from_constant() Whether the key comes from CLANBITE_LICENSE_KEY.
  • key() The licence key in use: the constant when defined, otherwise the stored (decrypted) one.
  • needs_license() Whether this site is missing a licence that one of its add-ons needs.
  • plugin_info() Details for the "View details" modal.
  • public_status() Cheap summary for clanbite_get_license_status().
  • refresh() Refresh the licence summary and entitlements from the server.
  • request_package() Request a single-use download for a release.
  • server_host() Host of the update server.
  • server_usable() Whether the configured server URL may be used (HTTPS, or HTTP on a local environment).
  • summary() Everything the Licence screen shows (never the key).

Defined in inc/updates/class-license-client.php

Changelog

VersionDescription
1.6.0Introduced.