/** * Get dir structure * * @param string $dir Dir path * * @return array */ private function getDirTree($dir) { $x = array(); $dirs = Finder::findDirectories("*")->in($dir); foreach ($dirs as $dir) { $x[$dir->getFilename()] = $this->getDirTree($dir->getPathName()); } return $x; }
/** * Delete items from cache with recursion * * @param string $absDir Absolute directory path */ public function deleteItemsRecursive($absDir) { $dirs = Finder::findDirectories("*")->from($absDir); $cache = $this->cache; foreach ($dirs as $dir) { unset($cache[array("content", $dir->getRealPath())]); } unset($cache[array("content", $absDir)]); $this->deleteItem(null, array("tags" => "treeview")); }
/** * Load themes from theme dir * * @param string $themeDir Dir with themes * * @return array */ public function loadThemes($themeDir) { $themes = array(); if (!is_dir($themeDir)) { return $themes; } $dirs = Finder::findDirectories("*")->in($themeDir); foreach ($dirs as $dir) { $themes[$dir->getFilename()] = ucfirst($dir->getFilename()); } return $themes; }