Properties

$domain

$domain : string

MainWP installation domain name.

Type

string — Empty by default.

$instance

$instance : mixed

Protected static variable to hold the single instance of the class.

Type

mixed — Default null

$upgrade_url

$upgrade_url : string

Extensions upgrade URL.

Type

string — Default URL 'https://mainwp.com/'

$renew_license_url

$renew_license_url : string

Extensions license renewal URL.

Type

string — Default 'https://mainwp.com/my-account'

Methods

instance()

instance() : mixed

Return the single instance of the class.

Returns

mixed —

$instance The single instance of the class.

__clone()

__clone() 

Cloning is forbidden.

__wakeup()

__wakeup() 

Un-serializing instances of this class is forbidden.

__construct()

__construct() 

MainWP_Api_Manager constructor.

Run each time the class is called.

Replace HTTP protocol to HTTPS.

get_upgrade_url()

get_upgrade_url() : string

Get Upgrade URL.

Returns

string —

Activation upgrade URL.

get_domain()

get_domain() : string

Get domain URL.

Returns

string —

domain URL.

get_activation_info()

get_activation_info(mixed  $ext_key) : mixed

Get activation info.

Parameters

mixed $ext_key

extension key.

Returns

mixed —

get_option() get activation information.

set_activation_info()

set_activation_info(mixed  $ext_key, mixed  $info) : mixed

Store activation info.

Parameters

mixed $ext_key

Extension key.

mixed $info

Activation information.

Returns

mixed —

Set activation info.

remove_activation_info()

remove_activation_info(mixed  $ext_key) : mixed

Remove activation info.

Parameters

mixed $ext_key

Extension key.

Returns

mixed —

Remove activation info.

license_key_activation()

license_key_activation(array  $api_slug, string  $api_key) : array

Check API Key & API Email again MainWP Servers.

Parameters

array $api_slug

Extension activation info.

string $api_key

API license key.

Returns

array —

Activation info.

license_key_deactivation()

license_key_deactivation(array  $api_slug, array  $api_key) : array

Deactivate license Key.

Parameters

array $api_slug

Extension activation info.

array $api_key

Extension activation api key.

Returns

array —

Deactivation info.

verify_mainwp_api()

verify_mainwp_api(string  $api_key) : mixed

Test the users MainWP.com Login details against MainWP Server.

Parameters

string $api_key

MainWP api key.

Returns

mixed —

Login test result.

purchase_software()

purchase_software(string  $productId) : mixed

Check if the user purchased the software.

Parameters

string $productId

extension (product) ID.

Returns

mixed —

purchase_software() purchase extensions.

get_purchased_extension()

get_purchased_extension(string  $api_key, string  $productId = '', boolean  $no_register = false) : array

Get users purchased extensions.

Parameters

string $api_key

api key.

string $productId

extension (product) ID.

boolean $no_register

registration request.

Returns

array —

Purchased extensions.

grab_license_key()

grab_license_key(array  $api_slug, string  $master_api_key) : mixed

Grab users associate MainWP License key for the selected Extension.

Parameters

array $api_slug

Extension activation info.

string $master_api_key

MainWP master api key.

Returns

mixed —

Activation info.

check_response_for_api_errors()

check_response_for_api_errors(array  $response) : string

Check if $response contains any api errors.

Parameters

array $response

Response array.

Returns

string —

$error Error message.

check_response_for_intall_errors()

check_response_for_intall_errors(array  $response, string  $software_title = '') : string

Check if $response contains any install errors.

Parameters

array $response

Response array.

string $software_title

Extension title.

Returns

string —

$return Installation Error messages.

request_extension_information()

request_extension_information(array  $args) : array

Request plugin information

Parameters

array $args

Request arguments.

Returns

array —

Plugin info.

replace_license_key()

replace_license_key(array  $args) : boolean

Deactivate the current license key before activating the new license key.

Parameters

array $args

Request arguments.

Returns

boolean —

True on success, false on failure.