Change use array to object
This commit is contained in:
@@ -326,19 +326,19 @@ class PMPluginRegistry
|
||||
}
|
||||
}
|
||||
|
||||
if(sizeof( $this->_aMenuOptionsToReplace )){
|
||||
if (count($this->_aMenuOptionsToReplace)) {
|
||||
unset($this->_aMenuOptionsToReplace);
|
||||
}
|
||||
|
||||
if(sizeof( $this->_aImportProcessCallbackFile )){
|
||||
if (count($this->_aImportProcessCallbackFile)) {
|
||||
unset($this->_aImportProcessCallbackFile);
|
||||
}
|
||||
|
||||
if(sizeof( $this->_aOpenReassignCallback )){
|
||||
if (count($this->_aOpenReassignCallback)) {
|
||||
unset($this->_aOpenReassignCallback);
|
||||
}
|
||||
|
||||
if (sizeof($this->_restExtendServices)) {
|
||||
if (count($this->_restExtendServices)) {
|
||||
$this->disableExtendsRestService($sNamespace);
|
||||
}
|
||||
//unregistering javascripts from this plugin
|
||||
@@ -1365,20 +1365,23 @@ class PMPluginRegistry
|
||||
/**
|
||||
* Register a extend rest service class from a plugin to be served by processmaker
|
||||
*
|
||||
* @param string $sNamespace The namespace for the plugin
|
||||
* @param string $namespace The namespace for the plugin
|
||||
* @param string $className The service (api) class name
|
||||
*/
|
||||
public function registerExtendsRestService($sNamespace, $className)
|
||||
public function registerExtendsRestService($namespace, $className)
|
||||
{
|
||||
$baseSrcPluginPath = PATH_PLUGINS . $sNamespace . 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[$sNamespace][$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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1391,9 +1394,9 @@ class PMPluginRegistry
|
||||
public function getExtendsRestService($className)
|
||||
{
|
||||
$responseRestExtendService = array();
|
||||
foreach ($this->_restExtendServices as $sNamespace => $restExtendService) {
|
||||
if (isset($restExtendService[$className])) {
|
||||
$responseRestExtendService = $restExtendService[$className];
|
||||
foreach ($this->_restExtendServices as $namespace => $restExtendService) {
|
||||
if (isset($restExtendService->{$className})) {
|
||||
$responseRestExtendService = $restExtendService->{$className};
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1403,16 +1406,16 @@ class PMPluginRegistry
|
||||
/**
|
||||
* Remove a extend rest service class from a plugin to be served by processmaker
|
||||
*
|
||||
* @param string $sNamespace
|
||||
* @param string $namespace
|
||||
* @param string $className The service (api) class name
|
||||
* @return bool
|
||||
*/
|
||||
public function disableExtendsRestService($sNamespace, $className = '')
|
||||
public function disableExtendsRestService($namespace, $className = '')
|
||||
{
|
||||
if (isset($this->_restExtendServices[$sNamespace][$className]) && !empty($className)) {
|
||||
unset($this->_restExtendServices[$sNamespace][$className]);
|
||||
} elseif (empty($className)) {
|
||||
unset($this->_restExtendServices[$sNamespace]);
|
||||
if (empty($className)) {
|
||||
unset($this->_restExtendServices[$namespace]);
|
||||
} elseif (isset($this->_restExtendServices[$namespace]->{$className})) {
|
||||
unset($this->_restExtendServices[$namespace]->{$className});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1673,7 +1676,7 @@ class PMPluginRegistry
|
||||
public function getMenuOptionsToReplace($strMenuName)
|
||||
{
|
||||
$oMenuFromPlugin = $this->_aMenuOptionsToReplace;
|
||||
if(sizeof($oMenuFromPlugin)) {
|
||||
if (count($oMenuFromPlugin)) {
|
||||
if (array_key_exists($strMenuName, $oMenuFromPlugin)) {
|
||||
return $oMenuFromPlugin[$strMenuName];
|
||||
}
|
||||
|
||||
@@ -1245,15 +1245,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 (\file_exists($classFile)) {
|
||||
if (empty($this->_restExtendServices[$Namespace])) {
|
||||
$this->_restExtendServices[$Namespace] = new \stdClass();
|
||||
}
|
||||
$this->_restExtendServices[$Namespace]->{$ClassName} = [
|
||||
'filePath' => $classFile,
|
||||
'classParent' => $ClassName,
|
||||
'classExtend' => 'Ext' . $ClassName
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1264,10 +1267,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 +1285,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});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ trait PluginStructure
|
||||
$this->buildCss(G::json_decode($plugin['PluginCss'], true));
|
||||
$this->buildJs(G::json_decode($plugin['PluginJs'], true));
|
||||
$this->buildRestService(G::json_decode($plugin['PluginRestService'], true));
|
||||
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes'], true));
|
||||
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user