Ok, so now our license file contains the constant 'versiontype'. We can check for this in our PHP file via the Source Guardian "
sg_get_const()" loader API function. If the constant
exists and it's value is 'free', it's the free version. If it exists and it's value is 'commercial', it's the commercial version. Here is a code example.
NOTE: This check would take place inside an encoded PHP file.
<?php
$sg_const = (function_exists('sg_get_const') ? sg_get_const('versiontype') : '');
if (in_array($sg_const, array('free','commercial'))) {
switch($sg_const) {
case 'free':
// free version - do appropriate action
break;
case 'commercial':
// commercial version - do appropriate action or other checks
break;
}
} else {
// invalid..do appropriate action.
}
?>
We are not going to go over the PHP functions/code used here. A basic understanding of PHP is assumed. So, basically you check for the value of the constant and do an
appropriate action. You can have as many constants as you need and you can determine how best to use them.
Do testing in Source Guardian and Maian Guardian to get a feel for how things work.