Properties

$domain

$domain : string

MainWP installation domain name.

Type

string — Emtpy 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.

__construct()

__construct() 

MainWP_Api_Manager constructor.

Run each time the class is called.

Replace HTTP procol to HTTPS.

get_domain()

get_domain() : string

Get domain.

Returns

string —

Current MainWP Dashboard URL.

get_upgrade_url()

get_upgrade_url() : string

Get Upgrade URL.

Returns

string —

Activation upgrade 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.

license_key_activation()

license_key_activation(array  $api, string  $api_key, string  $api_email) : array

Check API Key & API Email again MainWP Servers.

Parameters

array $api

Extension activation info.

string $api_key

API license key.

string $api_email

API email address.

Returns

array —

Activation info.

license_key_deactivation()

license_key_deactivation(array  $api) : array

Deactivate license Key.

Parameters

array $api

Extension activation info.

Returns

array —

Deactivation info.

test_login_api()

test_login_api(string  $username, string  $password) : mixed

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

Parameters

string $username

MainWP registered username.

string $password

MainWP registered password.

Returns

mixed —

test_login_api() login test result.

purchase_software()

purchase_software(string  $username, string  $password, string  $productId) : mixed

Check if the user purchased the software.

Parameters

string $username

MainWP registered username.

string $password

MainWP registered password.

string $productId

extension (product) ID.

Returns

mixed —

purchase_software() purchase extensions.

get_purchased_software()

get_purchased_software(string  $username, string  $password, string  $productId = '', boolean  $no_register = false) : array

Get users purchased extensions.

Parameters

string $username

MainWP registered username.

string $password

MainWP registered password.

string $productId

extension (product) ID.

boolean $no_register

registration request.

Returns

array —

Purchased extensions.

grab_license_key()

grab_license_key(array  $api, string  $username, string  $password) : mixed

Grab users associate MainWP License key for the selected Extension.

Parameters

array $api

Extension activation info.

string $username

MainWP registered username.

string $password

MainWP registered password.

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.

update_check()

update_check(array  $args) : mixed

Check if Extensions have an update.

Parameters

array $args

Request arguments.

Returns

mixed —

update_check() plugin info.

request_plugin_information()

request_plugin_information(array  $args) : array

Request plugin information

Parameters

array $args

Request arguments.

Returns

array —

Plugin info.

__clone()

__clone() 

Cloning is forbidden.

__wakeup()

__wakeup() 

Unserializing instances of this class is forbidden.

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.