function get_available_rotators() { $result = array(); $d = new Dir(self::ROTATOR_GALLERIES_ROOT_PATH); $dirs = $d->listFolders(); foreach ($dirs as $d) { $result[] = $d->getName(); } return $result; }
public static function get_available_configurations() { $d = new Dir(self::CONFIG_DIR); $folders = $d->listFolders(); $result = array(); foreach ($folders as $fold) { if ($fold->getName() != self::COMMON_CONFIG) { $result[] = $fold->getName(); } } return $result; }
static function get_all_available_by_category($nome_categoria) { $result = array(); $category_root = new Dir(DS . ModuleUtils::get_modules_path() . DS . $nome_categoria . DS); if ($category_root->exists() && $category_root->isDir()) { $all_folders = $category_root->listFolders(); foreach ($all_folders as $mod) { //aggiunto controllo su esistenza modulo definizione $mod_def = new File($mod->getPath() . self::MODULE_DEFINITION_FILE); if ($mod_def->exists()) { $result[] = $mod->getName(); } } } if ($nome_categoria == ModuleUtils::FRAMEWORK_CATEGORY_NAME) { $result[] = ModuleUtils::FRAMEWORK_MODULE_NAME; } return $result; }
function index() { $current_folder = new Dir($this->get_current_folder()); $all_subfolders = $current_folder->listFolders(); $result = array(); $result["elements"] = array(); foreach ($all_subfolders as $fold) { $gallery_marker = $fold->newFile("_gallery.ini"); $f = array(); if ($gallery_marker->exists()) { $f = array(); $f["type"] = "gallery"; $f["name"] = $fold->getName(); } else { $f = array(); $f["type"] = "folder"; $f["name"] = $fold->getName(); } $result["elements"][] = $f; } return $result; }
static function delete_image_thumbnails($path) { if ($path instanceof File) { $image_file = $path; } else { $image_file = new File($path); } $image_dir = $image_file->getDirectory(); $full_cache_dir = new Dir(self::THUMBNAILS_DIR . $image_dir->getPath()); $folders = $full_cache_dir->listFolders(); foreach ($folders as $f) { $image_thumb = $f->newFile($image_file->getFilename()); if ($image_thumb->exists()) { $image_thumb->delete(); } if ($f->isEmpty()) { $f->delete(); } } if ($full_cache_dir->isEmpty()) { $full_cache_dir->delete(); } }