diff options
author | Simon Rettberg | 2016-05-18 18:04:56 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-05-18 18:04:56 +0200 |
commit | 2e18b36a287ad9b25619f9e2a073dcedf6d620ee (patch) | |
tree | 96d802fdc1c21ee9aa9b4d89a6611db7d8502433 /inc/module.inc.php | |
parent | Modularized baseconfig fetching (api) (diff) | |
download | slx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.tar.gz slx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.tar.xz slx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.zip |
MORE WMORK
Diffstat (limited to 'inc/module.inc.php')
-rw-r--r-- | inc/module.inc.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/inc/module.inc.php b/inc/module.inc.php index 246505b5..13d9c1e4 100644 --- a/inc/module.inc.php +++ b/inc/module.inc.php @@ -22,8 +22,9 @@ class Module /** * Check whether given module is available, that is, all dependencies are - * met. If the module is available, it will be activated, so all it's classes - * are available through the auto-loader. + * met. If the module is available, it will be activated, so all its classes + * are available through the auto-loader, and any js or css is added to the + * final page output. * * @param string $moduleId module to check * @return bool true if module is available and activated @@ -88,6 +89,20 @@ class Module return self::$modules; } + /** + * @return \Module[] List of modules that have been activated + */ + public static function getActivated() + { + $ret = array(); + foreach (self::$modules as $module) { + if ($module->activated) { + $ret[] = $module; + } + } + return $ret; + } + public static function init() { if (self::$modules !== false) @@ -97,7 +112,7 @@ class Module return; self::$modules = array(); while (($dir = readdir($dh)) !== false) { - if (empty($dir) || preg_match('/[^a-zA-Z0-9]/', $dir)) + if (empty($dir) || preg_match('/[^a-zA-Z0-9_]/', $dir)) continue; if (!is_file('modules/' . $dir . '/config.json')) continue; |