Example #1
0
function getFolderList(Asset_Folder $rootFolder, &$folderList = array())
{
    if ($rootFolder->getParent()) {
        $folderList[] = array("parent" => $rootFolder->getParent()->getFullPath(), "key" => $rootFolder->getKey());
    }
    foreach ($rootFolder->getChilds() as $childFolder) {
        if ($childFolder instanceof Asset_Folder) {
            getFolderList($childFolder, $folderList);
        }
    }
}
 /**
  * get file + folder map recursively from a folder
  *
  * @param string $path		path to search
  * @return array
  * @access public
  */
 function getFolderList($path = '')
 {
     $ret = array();
     xoops_load("XoopsList");
     foreach (XoopsList::getDirListAsArray($path) as $folder) {
         foreach (getFolderList($path . DIRECTORY_SEPARATOR . $folder) as $key => $values) {
             $ret[$key] = $values;
         }
     }
     $ret[sha1(_RESOURCES_SALT_BLOWFISH . $path)] = array('is' => 'folder', 'path' => $path, 'files' => count($files = XoopsList::getFileListAsArray($path)));
     foreach ($files as $file) {
         $ret[sha1(_RESOURCES_SALT_BLOWFISH . ($md5 = md5_file($path . DIRECTORY_SEPARATOR . $file)))] = array('is' => 'file', 'file' => $file, 'path' => $path, 'bytes' => filesize($path . DIRECTORY_SEPARATOR . $file));
     }
     return $ret;
 }