This replaces the full Freemius WordPress SDK with a lite implementation for your premium WordPress plugin. This script allows only the following functions to work:
- License key activation/deactivation
- Plugin updates
This script already adds a license activation link in your plugin's area in the Admin Plugins page where users can add or remove their license key.
This script also provides minimal PHP functions for checking whether a license key is currently activated or not.
- Copy all of the files into your own plugin.
- Require the
freemius.phpfile in your own code. - Edit
freemius.phpand fill it up with your product details.
To prevent unwanted function and class naming conflicts, go through the code and rename the following:
- The
fla_ffunction name - The
FLA_Freemiusclass name
The full Freemius SDK is quite heavy on the server, especially if you just need to license key activation and plugin updates.
Since this is not the full implementation of the Freemius SDK, you will have to implement in your website the following:
- Freemius plan checkout links - so users can purchase your product
- Customer portal in your store - so users can manage their licenses
Since this is a simpler approach to doing things (more like how EDD does things), then users will have to do their own site management especially when it comes to development or staging sites.
This script uses the much lighter (Freemius PHP SDK)[https://github.com/Freemius/freemius-php-sdk] and the proof of concept (Freemius SDK Lite)[https://github.com/Freemius/wp-sdk-lite] to use just the essential functions for license key activation/deactivation and plugin updates.
The freemius directory is needed in order to trick Freemius' parser into thinking that the Freemius SDK is present during deployment.
The script provides a few PHP functions that you can use to determine the activation status of your plugin.
Check if the current license is for a specific plan.
if ( fla_f()->is_plan( 'professional' ) ) {
// Do only if the professional plan is active.
}Similar to Freemius's can_use_premium_code function, returns true if there is a valid license key active.
if ( fla_f()->can_use_premium_code() ) {
// Do only if there is a valid license key activated
}Similar to Freemius's is__premium_only function, returns true if there is a valid license key active.
if ( fla_f()->is__premium_only() ) {
// Do only if there is a valid license key activated
}