Plugin Exchange API
SiteSupra has a built-in Plugin Exchange API support starting from SiteSupra version 3.1.
The Plugin Exchange API allows developer functionality to check the license type and plugin version acquired by the customer.
Also the API allows to check the expiration date if one was applied to the license.
About SiteSupra plugins window
About SiteSupra plugins window is located at the SiteSupra Help menu.
The user can see the list of acquired plugins with information on each of them in the window.
Function checkPluginKey
Function validates plugin key.
<? mixed checkPluginKey(string plugin_code [, string plugin_password]) ?>
|
Function analyzes plugin_code and plugin_password and returns an array if both parameters are valid or false if they not.
See Adding your plugin (step by step) for more information on creating plugin's code and password.
The returned data array structure:
<? Array ( [name] => 'Site tracker' // plugin name [version] => '12.12.1212' // plugin version [generated] => '20050204' // key generation date [expiration] => 30 // expiration rule (days) [vendor] => 'SiteSupra' // vendor name [license_code] => 'SSU_TRIAL' // license CODE [license_name] => 'SSU Trial' // license Name [url] => 'http://www.myplugin.com', // plugin home URL ) ?>
|
The function returns false in following cases:
- If there's no information about given plugin in the SiteSupra key.
- If plugin's code is wrong or undefined.
- If plugin's password is different from provided.
- If the plugin has embedded function and it returns false.
Using the password
While editing the plugin's information on the Plugin Exchange enter the password. The password is an extra security measure to ensure
no one can re-create the plugin's License Key.:
Enter the password validation in your plugin's code:
<? if(!$key = checkPluginKey('PLUGIN_CODE', 'myPluginPassword')) { die('Invalid plugin key'); } else { print_r($key); } ?>
|
Using embedded function
While editing the plugin's information on the Plugin Exchange specify the embedded function:
Enter the function validation In your plugin's code:
<? define('MYKEY','yekym');
if(!$key = checkPluginKey('PLUGIN_CODE')) { die('Invalid plugin key'); } else { print_r($key); } ?>
|
Function getPluginInfo
The function returns information about the given plugin or all plugins that are registered on
the system and entered into the SiteSupra License key.
<? mixed getPluginInfo([string plugin_code]) ?>
|
The Parameter plugin_code is optional. If no plugin code is given,
the function returns information about all plugins registered on the system and entered into the SiteSupra License key.
The function returns false in the following cases:
- If there's no information about given plugin in the SiteSupra key.
- If you no plugin code is send to the function, and there's no information about the plugin in the SiteSupra License key.
Example
<? if($allPluginKeys = checkPluginKey()) { print_r($allPluginKeys); }
/** Result
Array ( [TRCK] => Array ( [id] => 2035 // plugin unique ID [name] => 'Site tracker' // plugin name [version] => 12.12.1212 // plugin version [generated] => 20050204 // key generation date [expiration] => 30 // expiration rule (days) [vendor] => 'SiteSupra' // vendor name [license_code] => 'SSU_TRIAL' // license CODE [license_name] => 'SSU Trial' // license Name [url] => 'http://www.myplugin.com', // plugin home URL ), [BANNERMAN] => Array ( [id] => 3114 // plugin unique ID [name] => 'Banner manager' // plugin name [version] => 3.2 // plugin version [generated] => 20050311 // key generation date [expiration] => 0 // expiration rule (days) [vendor] => 'SiteSupra' // vendor name [license_code] => 'SSU_FREE' // license CODE [license_name] => 'SSU Freeware' // license Name [url] => 'http://www.myplugin.com', // plugin home URL ), ) */
?>
|