Addon licensed

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
Line 14: Line 14:
  
  
'''Example 1 - Calling addon_licensed()'''
+
'''Example 1 - Calling addon_licensed() for template'''
 
You can stick this code in any php file included with your template (i.e. includethis.php, pgm-auto_menu.php, license_check.php -- wherever).   
 
You can stick this code in any php file included with your template (i.e. includethis.php, pgm-auto_menu.php, license_check.php -- wherever).   
 
<pre>
 
<pre>
Line 21: Line 21:
 
}
 
}
 
</pre>
 
</pre>
 +
 +
'''Example 2 - Calling addon_licensed() for a plugin'''
 +
<pre>
 +
if ( !addon_licensed("SPORTS-Snowboarder-blue") ) {
 +
  echo "This template is not licensed!"; exit;
 +
}
 +
</pre>
 +
 +
==Where to add this code in your plugin==
 +
We recommend you add this code to some crucial part of your plugin, like its management module if it has one. The idea is that you want to add it to a location in your plugin's code that is a key structural point...so your plugin won't function if it isn't licensed.
 +
 +
For example, let's say somebody purchases your plugin and installs it, then gets a refund and we delete their license...if you don't add a license check somewhere in your code, that customer will be able to continue to use your plugin for free unless he tries to install a new version release of your plugin...in which case we do our own license check and will reject his request.
 +
 +
Note that this issue does not apply with templates. If you add a license check to a php file included with your template that check will run every time the site is loaded...so the whole site will break if the license goes bad (as long as they are trying to use your template), which is what you want.
  
 
[[Category:Plugins]]
 
[[Category:Plugins]]
 
[[Category:Templates]]
 
[[Category:Templates]]

Revision as of 15:54, 17 September 2008

Syntax
addon_licensed(addon_folder_name)


What it does
Checks whether domain is licensed to use specified addon (identified by name addon folder)
Returns true/false based on whether addon is/is not licensed
Description
The purpose of this function is to provide a way for premium addon developers to build license checking into their addon. For plugins, it's not incredibly important that you include a call to this function, because it is called by Pro Edition when plugin is initially installed (will not allow install to proceed if license check fails), but you're still welcome to use it as a double-check/extra layer of anti-piracy. For premium templates however there is no built-in license checking at install time, so it's highly advised that you place a call to this function somewhere in one of your template includes (even if that means creating a template include specifically for the license check).
Scope
This function is defined in shared_functions.php, you can call it from anywhere.


Example 1 - Calling addon_licensed() for template You can stick this code in any php file included with your template (i.e. includethis.php, pgm-auto_menu.php, license_check.php -- wherever).

if ( !addon_licensed("SPORTS-Snowboarder-blue") ) {
   echo "This template is not licensed!"; exit;
}

Example 2 - Calling addon_licensed() for a plugin

if ( !addon_licensed("SPORTS-Snowboarder-blue") ) {
   echo "This template is not licensed!"; exit;
}

Where to add this code in your plugin

We recommend you add this code to some crucial part of your plugin, like its management module if it has one. The idea is that you want to add it to a location in your plugin's code that is a key structural point...so your plugin won't function if it isn't licensed.

For example, let's say somebody purchases your plugin and installs it, then gets a refund and we delete their license...if you don't add a license check somewhere in your code, that customer will be able to continue to use your plugin for free unless he tries to install a new version release of your plugin...in which case we do our own license check and will reject his request.

Note that this issue does not apply with templates. If you add a license check to a php file included with your template that check will run every time the site is loaded...so the whole site will break if the license goes bad (as long as they are trying to use your template), which is what you want.

Personal tools