public function getThemeNames() { $folder = new \GO\Base\Fs\Folder(\GO::config()->root_path . 'views/Extjs3/themes'); $items = $folder->ls(); $themes = array(); foreach ($items as $folder) { if ($folder->isFolder() && $folder->child('Layout.php')) { $themes[] = $folder->name(); } } return $themes; }
/** * Get all the available holiday files * * @return array key => label */ public static function getAvailableHolidayFiles() { $holidays = array(); $folderPath = \GO::config()->root_path . 'language/holidays/'; $folder = new \GO\Base\Fs\Folder($folderPath); $children = $folder->ls(); foreach ($children as $child) { $label = \GO::t($child->nameWithoutExtension()); $holidays[$label] = array('filename' => $child->nameWithoutExtension(), 'label' => $label); } ksort($holidays); return array_values($holidays); }
public function getFileStorageCronJobClasses($folderName = 'cron') { $foundCronJobClasses = array(); $folderPath = \GO::config()->file_storage_path . 'php/' . $folderName; $folder = new \GO\Base\Fs\Folder($folderPath); \GO::debug("CRONFILE SEARCH IN FOLDER: " . $folder->path()); if ($folder->exists()) { $items = $folder->ls(); $reflectionClasses = array(); foreach ($items as $item) { if (is_file($item)) { $className = 'GOFS\\Cron\\' . $item->nameWithoutExtension(); $reflectionClasses[] = new \ReflectionClass($className); } } foreach ($reflectionClasses as $reflectionClass) { if ($this->_checkIsCronJobClassFile($reflectionClass)) { \GO::debug("CRONFILE FOUND: " . $reflectionClass->name); $cronJob = new $reflectionClass->name(); $foundCronJobClasses[$reflectionClass->name] = $cronJob->getLabel(); } } } return $foundCronJobClasses; }
protected function actionThumbs() { $response['results'] = array(); $folder = new \GO\Base\Fs\Folder(\GO::modules()->bookmarks->path . "icons"); $filesystemObjects = $folder->ls(); foreach ($filesystemObjects as $imgObject) { $response['results'][] = array('filename' => $imgObject->name()); } $response['success'] = true; return $response; }
/** * Find classes in a folder * * @param string $path Relative from $config['file_storage_path'].'php/' * @return \ReflectionClass[] */ public static function findFsClasses($subfolder, $subClassOf = null) { $classes = array(); $folder = new \GO\Base\Fs\Folder(\GO::config()->file_storage_path . 'php/' . $subfolder); if ($folder->exists()) { $items = $folder->ls(); foreach ($items as $item) { if ($item instanceof \GO\Base\Fs\File) { $className = 'GOFS\\'; $subFolders = explode('/', $subfolder); foreach ($subFolders as $sf) { $className .= ucfirst($sf) . '\\'; } $className .= $item->nameWithoutExtension(); $rc = new \ReflectionClass($className); if ($subClassOf == null || $rc->isSubclassOf($subClassOf)) { $classes[] = $rc; } } } } return $classes; }