\Barn2\PTP_Lib\Plugin\LicenseEDD_Licensing

This class provides an interface to the EDD Software Licensing API. API requests are handled on the Barn2 website by the EDD Software Licensing plugin.

Summary

Methods
Properties
Constants
instance()
activate_license()
deactivate_license()
check_license()
get_latest_version()
No public properties found
EDD_LICENSING_ENDPOINT
API_TIMEOUT
No protected methods found
No protected properties found
N/A
api_request()
is_api_error()
get_api_error_message()
$_instance
N/A

Constants

EDD_LICENSING_ENDPOINT

EDD_LICENSING_ENDPOINT ='http://barn2.co.uk/edd-sl' :string

API_TIMEOUT

API_TIMEOUT =15 :integer

Properties

Methods

instance()

instance()

activate_license()

activate_license(string  $license_key,integer  $item_id,  $url): \Barn2\PTP_Lib\Plugin\License\stdClass

Activate the specified license key.

Returns a stdClass object containing two properties:

  • success: true or false. Whether the request returned successfully.
  • response: If success is true, it will contain the JSON-decoded response (an object) from the server containing the result. If success if false, it will contain an error message (string) indicating why the request failed.

Parameters

string $license_key

The license key to activate.

integer $item_id

The download ID for the item to check.

$url

Returns

\Barn2\PTP_Lib\Plugin\License\stdClass —

The result object (see above).

deactivate_license()

deactivate_license(string  $license_key,integer  $item_id,  $url): \Barn2\PTP_Lib\Plugin\License\stdClass

Deactivate the specified license key.

Returns a stdClass object containing two properties:

  • success: true or false. Whether the request returned successfully.
  • response: If success is true, it will contain the JSON-decoded response (an object) from the server containing the result. If success if false, it will contain an error message (string) indicating why the request failed.

Parameters

string $license_key

The license key to deactivate.

integer $item_id

The download ID for the item to check.

$url

Returns

\Barn2\PTP_Lib\Plugin\License\stdClass —

The result object (see above).

check_license()

check_license(string  $license_key,integer  $item_id,  $url): \Barn2\PTP_Lib\Plugin\License\stdClass

Checks the specified license key.

Returns a stdClass object containing two properties:

  • success: true or false. Whether the request returned successfully.
  • response: If success is true, it will contain the JSON-decoded response (an object) from the server containing the license information. If success if false, it will contain an error message (string) indicating why the request failed.

Parameters

string $license_key

The license key to check.

integer $item_id

The download ID for the item to check.

$url

Returns

\Barn2\PTP_Lib\Plugin\License\stdClass —

The result object (see above).

get_latest_version()

get_latest_version(string  $license_key,integer  $item_id,  $url,string  $slug,boolean  $beta_testing = false): \Barn2\PTP_Lib\Plugin\License\stdClass

Gets the latest version information for the specified plugin.

Returns a stdClass object containing two properties:

  • success: true or false. Whether the request returned successfully.
  • response: If success is true, it will contain the JSON-decoded response (an object) from the server containing the latest version information. If success if false, it will contain an error message (string) indicating why the request failed.

Parameters

string $license_key

The license key.

integer $item_id

The download ID for the item to check.

$url
string $slug

The plugin slug.

boolean $beta_testing

Whether to check for beta versions.

Returns

\Barn2\PTP_Lib\Plugin\License\stdClass —

The result object (see above).

api_request()

api_request(  $params)

Parameters

$params

is_api_error()

is_api_error(  $response)

Parameters

$response

get_api_error_message()

get_api_error_message(  $response)

Parameters

$response