This commit is contained in:
wangyidong
2022-04-24 16:08:28 +08:00
parent 422383fe9d
commit a7bc51b608
6 changed files with 238 additions and 121 deletions
+40
View File
@@ -137,6 +137,15 @@ class devModel extends model
public function getAPIs($module)
{
$fileName = $this->app->getModuleRoot() . $module . DS . 'control.php';
if(!file_exists($fileName))
{
$extPaths = $this->getModuleExtPath();
foreach($extPaths as $extPath)
{
$fileName = $extPath . $module . DS . 'control.php';
if(file_exists($fileName)) break;
}
}
if($module != 'common' and $module != 'dev') include $fileName;
$classReflect = new ReflectionClass($module);
@@ -251,9 +260,40 @@ class devModel extends model
$group = zget($this->config->dev->group, $module, 'other');
$modules[$group][] = $module;
}
$extPaths = $this->getModuleExtPath();
foreach($extPaths as $extPath)
{
if(empty($extPath)) continue;
foreach(glob($extPath . '*') as $path)
{
if(!file_exists($path . DS . 'control.php')) continue;
$module = basename($path);
if($module == 'editor' or $module == 'help' or $module == 'setting' or $module == 'common') continue;
$group = zget($this->config->dev->group, $module, 'other');
$modules[$group][] = $module;
}
}
return $modules;
}
/**
* Get module ext path.
*
* @access public
* @return array
*/
public function getModuleExtPath()
{
$extPaths = array();
if($this->config->edition != 'open') $extPaths['common'] = $this->app->getExtensionRoot() . $this->config->edition . DS;
$extPaths['xuan'] = $this->app->getExtensionRoot() . 'xuan' . DS;
return $extPaths;
}
/**
* Trim asterisks and whitespace from the beginning and whitespace from the end of lines.
*