PluginDetail keeps your properties private

This commit is contained in:
Ronald Quenta
2017-08-02 15:48:29 -04:00
parent cc5fcb08bc
commit 6ca19b77c9
4 changed files with 42 additions and 39 deletions

View File

@@ -11,6 +11,7 @@
$this->sSetupPage = 'setupPage'; $this->sSetupPage = 'setupPage';
$this->aWorkspaces = array ( ); $this->aWorkspaces = array ( );
$this->iVersion = 0.45; $this->iVersion = 0.45;
$this->bPrivate = true;
return $res; return $res;
} }

View File

@@ -13,29 +13,29 @@ class PluginDetail
use Attributes; use Attributes;
/** @var string */ /** @var string */
private $sNamespace; public $sNamespace;
/** @var string */ /** @var string */
private $sDescription = ''; public $sDescription = '';
/** @var string */ /** @var string */
private $sClassName; public $sClassName;
/** @var string */ /** @var string */
private $sFriendlyName = ''; public $sFriendlyName = '';
/** @var string */ /** @var string */
private $sFilename; public $sFilename;
/** @var string */ /** @var string */
private $sPluginFolder = ''; public $sPluginFolder = '';
/** @var string */ /** @var string */
private $sSetupPage = ''; public $sSetupPage = '';
/** @var string */ /** @var string */
private $sCompanyLogo = ''; public $sCompanyLogo = '';
/** @var array */ /** @var array */
private $aWorkspaces = []; public $aWorkspaces = [];
/** @var bool */ /** @var bool */
private $enabled = false; public $enabled = false;
/** @var bool */ /** @var bool */
private $bPrivate = false; public $bPrivate = false;
/** @var int */ /** @var int */
private $iVersion = 0; public $iVersion = 0;
/** /**
* This function is the constructor of the pluginDetail class * This function is the constructor of the pluginDetail class

View File

@@ -797,11 +797,11 @@ class PluginRegistry
} }
if ($found) { if ($found) {
require_once($classFile); require_once($classFile);
$sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->sClassName, 0, 1) . $sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace( str_replace(
'plugin', 'Plugin',
'class', 'Class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->sClassName, 1) substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
); );
$obj = new $sClassName(); $obj = new $sClassName();
$methodName = $trigger->getTriggerName(); $methodName = $trigger->getTriggerName();

View File

@@ -81,11 +81,11 @@ trait PluginStructure
/** /**
* Ser information of all Plugins * Ser information of all Plugins
* @param array $_aPlugins * @param array $plugins
*/ */
public function setPlugins($_aPlugins) public function setPlugins($plugins)
{ {
$this->_aPlugins = $_aPlugins; $this->_aPlugins = $plugins;
} }
/** /**
@@ -93,19 +93,21 @@ trait PluginStructure
*/ */
private function constructStructure() private function constructStructure()
{ {
$Plugins = PluginsRegistry::getPluginsEnabled(BasePeer::TYPE_PHPNAME); $Plugins = PluginsRegistry::loadPlugins(BasePeer::TYPE_PHPNAME);
foreach ($Plugins as $plugin) { foreach ($Plugins as $plugin) {
$this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin); $this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin);
$this->buildMenus(\G::json_decode($plugin['PluginMenus'], true)); if ($plugin['PluginEnable']) {
$this->buildFolders(\G::json_decode($plugin['PluginFolders'], true)); $this->buildMenus(\G::json_decode($plugin['PluginMenus'], true));
$this->buildTriggers(\G::json_decode($plugin['PluginTriggers'], true)); $this->buildFolders(\G::json_decode($plugin['PluginFolders'], true));
$this->buildPmFunctions(\G::json_decode($plugin['PluginPmFunctions'], true)); $this->buildTriggers(\G::json_decode($plugin['PluginTriggers'], true));
$this->buildRedirectLogin(\G::json_decode($plugin['PluginRedirectLogin'], true)); $this->buildPmFunctions(\G::json_decode($plugin['PluginPmFunctions'], true));
$this->buildSteps(\G::json_decode($plugin['PluginSteps'], true)); $this->buildRedirectLogin(\G::json_decode($plugin['PluginRedirectLogin'], true));
$this->buildCss(\G::json_decode($plugin['PluginCss'], true)); $this->buildSteps(\G::json_decode($plugin['PluginSteps'], true));
$this->buildJs(\G::json_decode($plugin['PluginJs'], true)); $this->buildCss(\G::json_decode($plugin['PluginCss'], true));
$this->buildRestService(\G::json_decode($plugin['PluginRestService'], true)); $this->buildJs(\G::json_decode($plugin['PluginJs'], true));
$this->buildAttributes($plugin['PluginNamespace'], \G::json_decode($plugin['PluginAttributes'], true)); $this->buildRestService(\G::json_decode($plugin['PluginRestService'], true));
$this->buildAttributes($plugin['PluginNamespace'], \G::json_decode($plugin['PluginAttributes']));
}
} }
} }
@@ -139,7 +141,7 @@ trait PluginStructure
private function buildMenus($menus) private function buildMenus($menus)
{ {
$response = []; $response = [];
foreach ($menus as $index => $menu) { foreach ($menus as $menu) {
$response[] = new MenuDetail($menu['Namespace'], $menu['MenuId'], $menu['Filename']); $response[] = new MenuDetail($menu['Namespace'], $menu['MenuId'], $menu['Filename']);
} }
$this->_aMenus = array_merge($this->_aMenus, $response); $this->_aMenus = array_merge($this->_aMenus, $response);
@@ -152,7 +154,7 @@ trait PluginStructure
private function buildFolders($folders) private function buildFolders($folders)
{ {
$response = []; $response = [];
foreach ($folders as $index => $folder) { foreach ($folders as $folder) {
$response[] = new FolderDetail($folder['Namespace'], $folder['FolderId'], $folder['FolderName']); $response[] = new FolderDetail($folder['Namespace'], $folder['FolderId'], $folder['FolderName']);
} }
$this->_aFolders = array_merge($this->_aFolders, $response); $this->_aFolders = array_merge($this->_aFolders, $response);
@@ -165,7 +167,7 @@ trait PluginStructure
private function buildTriggers($triggers) private function buildTriggers($triggers)
{ {
$response = []; $response = [];
foreach ($triggers as $index => $trigger) { foreach ($triggers as $trigger) {
$response[] = new TriggerDetail($trigger['Namespace'], $trigger['TriggerId'], $trigger['TriggerName']); $response[] = new TriggerDetail($trigger['Namespace'], $trigger['TriggerId'], $trigger['TriggerName']);
} }
$this->_aTriggers = array_merge($this->_aTriggers, $response); $this->_aTriggers = array_merge($this->_aTriggers, $response);
@@ -177,7 +179,7 @@ trait PluginStructure
*/ */
private function buildPmFunctions($pmFunctions) private function buildPmFunctions($pmFunctions)
{ {
foreach ($pmFunctions as $index => $pmFunction) { foreach ($pmFunctions as $pmFunction) {
$this->_aPmFunctions = array_merge($this->_aPmFunctions, [$pmFunction]); $this->_aPmFunctions = array_merge($this->_aPmFunctions, [$pmFunction]);
} }
} }
@@ -189,7 +191,7 @@ trait PluginStructure
private function buildRedirectLogin($redirectLogin) private function buildRedirectLogin($redirectLogin)
{ {
$response = []; $response = [];
foreach ($redirectLogin as $index => $trigger) { foreach ($redirectLogin as $trigger) {
$response[] = new RedirectDetail($trigger['Namespace'], $trigger['RoleCode'], $trigger['PathMethod']); $response[] = new RedirectDetail($trigger['Namespace'], $trigger['RoleCode'], $trigger['PathMethod']);
} }
$this->_aRedirectLogin = array_merge($this->_aRedirectLogin, $response); $this->_aRedirectLogin = array_merge($this->_aRedirectLogin, $response);
@@ -202,7 +204,7 @@ trait PluginStructure
private function buildSteps($steps) private function buildSteps($steps)
{ {
$response = []; $response = [];
foreach ($steps as $index => $step) { foreach ($steps as $step) {
$response[] = new StepDetail( $response[] = new StepDetail(
$step['Namespace'], $step['Namespace'],
$step['StepId'], $step['StepId'],
@@ -221,7 +223,7 @@ trait PluginStructure
private function buildCss($css) private function buildCss($css)
{ {
$response = []; $response = [];
foreach ($css as $index => $c) { foreach ($css as $c) {
$response[] = new CssFile($c['Namespace'], $c['CssFile']); $response[] = new CssFile($c['Namespace'], $c['CssFile']);
} }
$this->_aCss = array_merge($this->_aCss, $response); $this->_aCss = array_merge($this->_aCss, $response);
@@ -234,7 +236,7 @@ trait PluginStructure
private function buildJs($js) private function buildJs($js)
{ {
$response = []; $response = [];
foreach ($js as $index => $j) { foreach ($js as $j) {
$response[] = new JsFile($j['Namespace'], $j['CoreJsFile'], $j['PluginJsFile']); $response[] = new JsFile($j['Namespace'], $j['CoreJsFile'], $j['PluginJsFile']);
} }
$this->_aJs = array_merge($this->_aJs, $response); $this->_aJs = array_merge($this->_aJs, $response);
@@ -246,7 +248,7 @@ trait PluginStructure
*/ */
private function buildRestService($restServices) private function buildRestService($restServices)
{ {
foreach ($restServices as $index => $restService) { foreach ($restServices as $restService) {
$this->_restServices = array_merge($this->_restServices, $restService); $this->_restServices = array_merge($this->_restServices, $restService);
} }
} }