public function listAction() { $modulesDir = MOD_DIR; if (!file_exists($modulesDir)) { return; } $modules = Gio_Core_Module::getAllModules(array('core')); $this->view->modules = $modules; }
public function __construct() { $routesFile = array(); $modules = Gio_Core_Module::getAllModules(); if (empty($modules)) { return; } foreach ($modules as $index => $module) { $routesDir = ROOT_DIR . DS . 'modules' . DS . $module . DS . 'configs' . DS . 'routes'; if (!file_exists($routesDir)) { continue; } $routesIterator = new DirectoryIterator($routesDir); foreach ($routesIterator as $route) { if ($route->isDot()) { continue; } $routeName = $route->getFilename(); if ('CVS' == $routeName || '.svn' == strtolower($routeName) || 'index.html' == $routeName || '.htaccess' == $routeName) { continue; } $routesFile[] = $routesDir . DS . $routeName; } } if (!empty($routesFile)) { foreach ($routesFile as $index1 => $routeFile) { $routesIni = @parse_ini_file($routeFile, true); foreach ($routesIni as $index2 => $routeItem) { $route = array(); $route['name'] = (string) $index2; $route['frontend'] = isset($routeItem['frontend']) && (string) $routeItem['frontend'] == 'true' ? true : false; $route['url'] = (string) $routeItem['url']; $route['type'] = (string) $routeItem['type']; $route['reverse'] = isset($routeItem['reverse']) ? (string) $routeItem['reverse'] : null; $route['reverse_no_rewrite'] = isset($routeItem['reverse_no_rewrite']) ? (string) $routeItem['reverse_no_rewrite'] : null; $route['module'] = (string) $routeItem['module']; $route['controller'] = (string) $routeItem['controller']; $route['action'] = (string) $routeItem['action']; $route['params'] = isset($routeItem['params']) ? $routeItem['params'] : null; $route['langKey'] = isset($routeItem['langKey']) ? $routeItem['langKey'] : null; $route['csrf'] = isset($routeItem['csrf']) ? (array) $routeItem['csrf'] : null; $route['localization']['enable'] = isset($routeItem['localization']['enable']) && (string) $routeItem['localization']['enable'] == 'true' ? 'true' : 'false'; $route['localization']['identifier'] = isset($routeItem['localization']['identifier']) ? (array) $routeItem['localization']['identifier'] : null; $this->_routes[$route['name']] = $route; } } } return $this; }