Class Name:

MP_CORE_Verify_license

Purpose:

To verify whether a Theme or Plugin license code is valid or not.

Overview:

This class checks with an outside API to verify whether it is active/valid. It takes the name of the plugin or theme, and the Software API URL it should check for verification.

For more info about setting up a Software API, look at the MP_Repo plugin.

This class will store the license and store whether it is active or not in the options database.

It will be stored under these keys in the database:

$software_name + ‘_license_key’
$software_name + ‘_license_status_valid’

Note: the $software_name is the name of the plugin sanitized. That means it is all lowercase and space becomes dashes. So “My Plugin” becomes “my-plugin”.

Usage:

 

$plugin = array(
     'software_name'      => 'My plugin or theme',
     'software_api_url'   => 'http://mysoftwareurl.com'
);

new MP_CORE_Verify_License( $plugin ); 

The $plugin array keys and values:

  • software_name (string)(required) – The name of the plugin or theme.
  • software_api_url (string) – URL that should be checked.