Adding the feature license validations

This commit is contained in:
Gustavo Cruz
2015-03-09 17:47:57 -04:00
parent cb9c21b92e
commit a01e142b57
3 changed files with 144 additions and 112 deletions

View File

@@ -1,13 +1,19 @@
<?php
namespace Features\ActionsByEmail;
/**
* Description of ActionsByEmailService
*
*/
class ActionsByEmailService
{
public function saveConfiguration($params)
{
if (\PMLicensedFeatures
::getSingleton()
->verifyfeature('zCeazVrMjVTQVVLcTdwSHNaSzMwTGNCdXRqTm9aYlEzVnI=')) {
switch ($params['type']) {
case 'configuration':
require_once 'classes/model/AbeConfiguration.php';
@@ -22,10 +28,15 @@ class ActionsByEmailService
break;
}
}
}
public function loadConfiguration($params)
{
if ($params['type'] != 'activity') {
if ($params['type'] != 'activity'
|| (\PMLicensedFeatures
::getSingleton()
->verifyfeature('zCeazVrMjVTQVVLcTdwSHNaSzMwTGNCdXRqTm9aYlEzVnI=')))
{
return NULL;
}
set_include_path(PATH_FEATURES . 'ActionsByEmail' . PATH_SEPARATOR . get_include_path());
@@ -50,4 +61,5 @@ class ActionsByEmailService
$configuration['SYS_LANG'] = SYS_LANG;
return $configuration;
}
}

View File

@@ -28,7 +28,7 @@
class PMFeatureRegistry
{
private $features = array ();
private $triggers = array ();
private $keys = array ('ActionsByEmail' => 'zCeazVrMjVTQVVLcTdwSHNaSzMwTGNCdXRqTm9aYlEzVnI=');
private static $instance = null;
/**
@@ -65,6 +65,9 @@ class PMFeatureRegistry
*/
public function registerFeature ($featureName, $filename = null)
{
if (!$this->validateFeatureLicense($featureName)) {
return false;
}
$className = $featureName . "Feature";
$feature = new $className( $featureName, $filename );
if (isset( $this->features[$featureName] )) {
@@ -98,7 +101,7 @@ class PMFeatureRegistry
{
$feature = $this->retrieveFeature($featureName);
if ($feature) {
$feature->enable();
$feature->disable();
}
throw new Exception( "Unable to disable feature '$featureName' (feature not found)" );
}
@@ -168,5 +171,18 @@ class PMFeatureRegistry
}
}
public function validateFeatureLicense($featureName)
{
if (
isset($this->keys[$featureName])
&& PMLicensedFeatures
::getSingleton()
->verifyfeature($this->keys[$featureName])
) {
return true;
}
return false;
}
}
/*----------------------------------********---------------------------------*/

View File

@@ -1,5 +1,8 @@
<?php
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures
::getSingleton()
->verifyfeature('zCeazVrMjVTQVVLcTdwSHNaSzMwTGNCdXRqTm9aYlEzVnI=')) {
switch ($_REQUEST['action']) {
case 'processABE' :
$G_PUBLISH = new Publisher();
@@ -112,4 +115,5 @@ switch ($_REQUEST['action']) {
break;
}
}
/*----------------------------------********---------------------------------*/