summaryrefslogtreecommitdiffstats
path: root/inc/module.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-18 18:04:56 +0200
committerSimon Rettberg2016-05-18 18:04:56 +0200
commit2e18b36a287ad9b25619f9e2a073dcedf6d620ee (patch)
tree96d802fdc1c21ee9aa9b4d89a6611db7d8502433 /inc/module.inc.php
parentModularized baseconfig fetching (api) (diff)
downloadslx-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.php21
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;