Addons that Require Licenses
If your script requires a commercial license, you have 3 options:
- Handle the license requirements and entry from the installed addon.
- Use the
$meta_info key "vendor_license" to install regardless of whether a valid license was entered (ie, your addon script will just detect an invalid license and handle as you wish).
- Use the
$meta_info key "vendor_license" to install only if the license entered was valid.
The first step is to create an 'install_field' key called 'vendor_license', as well as a simple check in 'install_field_hook'.
After that:
To simply allow them to enter a ^\w+$ license key and put it in
[% vendor_license %]:
'vendor_license' => {},
To allow them to enter a license key of any format you wish and put it in
[% vendor_license %]:
'vendor_license' => {
'string_is_ok' => sub {
my($lisc_string) = @_; # 32 digits
return 1 if length $lisc_string == 32 && $lisc_string =~ m/^\d+$/; # ^\d{32}$
return 0;
},
},
The following will allow the customer to enter anything into the field and have a script verify the license key is valid or else not install/upgrade it:
'vendor_license' => {
'verify_url' => 'http://foo.bar.baz/lisc.pl',
#?lisc=license_string_from_input_here
'url_says_its_ok' => sub {
my ($url_result) = @_; # it is empty if url failed
return 1 if $url_result =~ m/Vendor says Valid/;
return 0;
},
},
Topic revision: r7 - 19 Feb 2011 - 01:04:50 - Main.JustinSchaefer
CpanelAddons.LicensedAddons moved from Sandbox.LicensedAddons on 18 May 2009 - 17:09 by Main.JustinSchaefer