本文整理匯總了PHP中Backend\Core\Engine\Model::getModulesOnFilesystem方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::getModulesOnFilesystem方法的具體用法?PHP Model::getModulesOnFilesystem怎麽用?PHP Model::getModulesOnFilesystem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::getModulesOnFilesystem方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setModule
/**
* Set the module
*
* We can't rely on the parent setModule function, because config could be
* called before any authentication is required.
*
* @param string $module The module to load.
* @throws BackendException If module is not allowed
*/
public function setModule($module)
{
// does this module exist?
$modules = BackendModel::getModulesOnFilesystem();
if (!in_array($module, $modules)) {
// set correct headers
header('HTTP/1.1 403 Forbidden');
// throw exception
throw new BackendException('Module not allowed.');
}
// set property
$this->module = $module;
}
示例2: getInstallableModules
/**
* Get all the modules that can be installed
*
* @return array The modules
*/
protected function getInstallableModules()
{
$modules = array_unique(array_merge(ForkInstaller::getRequiredModules(), BackendModel::getModulesOnFilesystem(false)));
$this->removeHiddenModules($modules);
return array_combine($modules, $modules);
}
示例3: setModule
/**
* Set the module
*
* We can't rely on the parent setModule function, because a cronjob requires no login
*
* @param string $module The module to load.
*/
public function setModule($module)
{
// does this module exist?
$modules = BackendModel::getModulesOnFilesystem();
if (!in_array($module, $modules)) {
// set correct headers
\SpoonHTTP::setHeadersByCode(403);
// throw exception
throw new Exception('Module not allowed.');
}
// set property
$this->module = $module;
}
示例4: getModules
/**
* Get modules based on the directory listing in the backend application.
*
* If a module contains a info.xml it will be parsed.
*
* @return array
*/
public static function getModules()
{
$installedModules = (array) BackendModel::getContainer()->getParameter('installed_modules');
$modules = BackendModel::getModulesOnFilesystem(false);
$manageableModules = array();
// get more information for each module
foreach ($modules as $moduleName) {
if (in_array($moduleName, self::$ignoredModules)) {
continue;
}
$module = array();
$module['id'] = 'module_' . $moduleName;
$module['raw_name'] = $moduleName;
$module['name'] = \SpoonFilter::ucfirst(BL::getLabel(\SpoonFilter::toCamelCase($moduleName)));
$module['description'] = '';
$module['version'] = '';
$module['installed'] = false;
$module['cronjobs_active'] = true;
if (in_array($moduleName, $installedModules)) {
$module['installed'] = true;
}
try {
$infoXml = @new \SimpleXMLElement(BACKEND_MODULES_PATH . '/' . $module['raw_name'] . '/info.xml', LIBXML_NOCDATA, true);
$info = self::processModuleXml($infoXml);
// set fields if they were found in the XML
if (isset($info['description'])) {
$module['description'] = BackendDataGridFunctions::truncate($info['description'], 80);
}
if (isset($info['version'])) {
$module['version'] = $info['version'];
}
// check if cronjobs are set
if (isset($info['cronjobs'])) {
foreach ($info['cronjobs'] as $cronjob) {
if (!$cronjob['active']) {
$module['cronjobs_active'] = false;
break;
}
}
}
} catch (\Exception $e) {
// don't act upon error, we simply won't possess some info
}
$manageableModules[] = $module;
}
return $manageableModules;
}