Merged in bugfix/HOR-3987 (pull request #6124)

HOR-3987

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Marco Antonio Nina Mena
2017-10-20 13:23:31 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 307 additions and 299 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -92,7 +92,7 @@ class PluginRegistry
public static function newInstance()
{
self::$instance = new PluginRegistry();
if (! is_object(self::$instance) || get_class(self::$instance) != "ProcessMaker\Plugins\PluginRegistry") {
if (!is_object(self::$instance) || get_class(self::$instance) != "ProcessMaker\Plugins\PluginRegistry") {
throw new Exception("Can't load main PluginRegistry object.");
}
return self::$instance;
@@ -122,10 +122,10 @@ class PluginRegistry
$plugin->sDescription,
$plugin->sSetupPage,
$plugin->iVersion,
isset($plugin->sCompanyLogo) ? $plugin->sCompanyLogo: '',
isset($plugin->aWorkspaces) ? $plugin->aWorkspaces: [],
isset($plugin->enable) ? $plugin->enable: false,
isset($plugin->bPrivate) ? $plugin->bPrivate: false
isset($plugin->sCompanyLogo) ? $plugin->sCompanyLogo : '',
isset($plugin->aWorkspaces) ? $plugin->aWorkspaces : [],
isset($plugin->enable) ? $plugin->enable : false,
isset($plugin->bPrivate) ? $plugin->bPrivate : false
);
$this->_aPluginDetails[$Namespace] = $detail;
}
@@ -204,6 +204,7 @@ class PluginRegistry
}
Cache::pull(self::NAME_CACHE);
}
/**
* Get the plugin details, by filename
* @param string $Filename
@@ -476,7 +477,7 @@ class PluginRegistry
if (isset($this->_aPluginDetails[$Namespace])) {
/** @var PluginDetail $detail */
$detail = $this->_aPluginDetails[$Namespace];
$className= $detail->getClassName();
$className = $detail->getClassName();
/** @var enterprisePlugin $oPlugin */
$oPlugin = new $className($detail->getNamespace(), $detail->getFile());
$oPlugin->setup();
@@ -857,13 +858,13 @@ class PluginRegistry
require_once($classFile);
$sClassNameA = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace(
['Plugin','plugin'],
['Plugin', 'plugin'],
'Class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
);
$sClassNameB = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace(
['Plugin','plugin'],
['Plugin', 'plugin'],
'class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
);
@@ -891,7 +892,7 @@ class PluginRegistry
public function existsTrigger($TriggerId)
{
$found = false;
/** @var TriggerDetail $trigger */
/** @var TriggerDetail $trigger */
foreach ($this->_aTriggers as $trigger) {
if ($trigger->equalTriggerId($TriggerId)) {
//review all folders registered for this namespace
@@ -1125,7 +1126,8 @@ class PluginRegistry
$ActionSave,
$ActionExecute,
$ActionGetFields
) {
)
{
$found = false;
/** @var CaseSchedulerPlugin $caseScheduler */
foreach ($this->_aCaseSchedulerPlugin as $caseScheduler) {
@@ -1245,15 +1247,18 @@ class PluginRegistry
*/
public function registerExtendsRestService($Namespace, $ClassName)
{
$baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . "src";
$apiPath = PATH_SEP . "Services" . PATH_SEP . "Ext" . PATH_SEP;
$baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . 'src';
$apiPath = PATH_SEP . 'Services' . PATH_SEP . 'Ext' . PATH_SEP;
$classFile = $baseSrcPluginPath . $apiPath . 'Ext' . $ClassName . '.php';
if (file_exists($classFile)) {
$this->_restExtendServices[$Namespace][$ClassName] = array(
"filePath" => $classFile,
"classParent" => $ClassName,
"classExtend" => 'Ext' . $ClassName
);
if (empty($this->_restExtendServices[$Namespace])) {
$this->_restExtendServices[$Namespace] = new stdClass();
}
$this->_restExtendServices[$Namespace]->{$ClassName} = [
'filePath' => $classFile,
'classParent' => $ClassName,
'classExtend' => 'Ext' . $ClassName
];
}
}
@@ -1264,10 +1269,10 @@ class PluginRegistry
*/
public function getExtendsRestService($ClassName)
{
$responseRestExtendService = array();
$responseRestExtendService = [];
foreach ($this->_restExtendServices as $Namespace => $restExtendService) {
if (isset($restExtendService[$ClassName])) {
$responseRestExtendService = $restExtendService[$ClassName];
if (isset($restExtendService->{$ClassName})) {
$responseRestExtendService = $restExtendService->{$ClassName};
break;
}
}
@@ -1282,10 +1287,10 @@ class PluginRegistry
*/
public function disableExtendsRestService($Namespace, $ClassName = '')
{
if (isset($this->_restExtendServices[$Namespace][$ClassName]) && !empty($ClassName)) {
unset($this->_restExtendServices[$Namespace][$ClassName]);
} elseif (empty($ClassName)) {
if (empty($ClassName)) {
unset($this->_restExtendServices[$Namespace]);
} elseif (isset($this->_restExtendServices[$Namespace]->{$ClassName})) {
unset($this->_restExtendServices[$Namespace]->{$ClassName});
}
}