/** * Get a list of all backend modules. * * @return array */ public static function getBackendList() { if (self::$backendList) { return self::$backendList; } // find all backend directories $dirs = glob(Curry_Util::path(Curry_Core::$config->curry->projectPath, 'include', '*', 'Backend'), GLOB_ONLYDIR); if (!$dirs) { $dirs = array(); } $dirs[] = Curry_Util::path(Curry_Core::$config->curry->basePath, 'include', 'Curry', 'Backend'); // find all php files in the directories self::$backendList = array(); foreach ($dirs as $dir) { $it = new Curry_FileFilterIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)), '/\\.php$/'); foreach ($it as $file) { $path = realpath($file->getPathname()); $pos = strrpos($path, DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR); if ($pos !== FALSE) { $pi = pathinfo($path); $className = str_replace(DIRECTORY_SEPARATOR, '_', substr($path, $pos + 9, -4)); if (class_exists($className, true)) { $r = new ReflectionClass($className); if (is_subclass_of($className, 'Curry_Backend') && !$r->isAbstract()) { self::$backendList[$className] = $pi['filename']; } } } } } ksort(self::$backendList); return self::$backendList; }