/** * Get all modules * * @return array */ public static function getModules() { $moduleList = array(); self::$modules = array(); $noMod = array('.', '..'); $doc = new DOMDocument(); if (is_dir(MODULE_CONFIG_DIR)) { $dp = opendir(MODULE_CONFIG_DIR); while ($file = readdir($dp)) { if (!in_array($file, $noMod)) { $doc->load(MODULE_CONFIG_DIR . DIRECTORY_SEPARATOR . $file); if ($doc->documentElement->childNodes) { $nList = $doc->documentElement->childNodes; foreach ($nList as $n) { if ($n->nodeName == 'module' && ($name = $n->getAttribute('name')) && ($nameSpc = $n->getAttribute('namespace'))) { $moduleList[$name] = array('package' => $n->getAttribute('package'), 'status' => strtolower($n->getAttribute('enabled')) == 'true' ? 1 : 0, 'version' => $n->getAttribute('version'), 'namespace' => $nameSpc); } } } } } } return $moduleList; }