Jarves\Filesystem\Filesystem::getFiles PHP Method

getFiles() public method

Same as in getFile() but in a list. array( array( path => path to the file/folder for usage in the administration and modules. Not the full http path. No trailing slash! name => basename(path) ctime => as unix timestamps mtime => as unix timestamps size => filesize in bytes (not for folders) type => 'file' | 'dir' mount => boolean (if the folder is a mount point) ) )
public getFiles ( string $path ) : File[]
$path string
return Jarves\Model\File[]
    public function getFiles($path)
    {
        //$access = jarvesAcl::check(3, $path, 'read', true);
        //if (!$access) return false;
        $fs = $this->getAdapter($path);
        $path = $this->normalizePath($path);
        if ($path == '/trash') {
            #return $this->getTrashFiles();
        }
        $items = $fs->getFiles($path);
        if (!is_array($items)) {
            return $items;
        }
        if (count($items) == 0) {
            return array();
        }
        usort($items, function ($a, $b) {
            return strnatcasecmp($a ? $a->getPath() : '', $b ? $b->getPath() : '');
        });
        return $items;
    }

Usage Example

コード例 #1
0
ファイル: WebFilesystem.php プロジェクト: jarves/jarves
 /**
  * @param string $path
  * @return \Jarves\Model\File[]
  */
 public function getFiles($path)
 {
     $items = parent::getFiles($path);
     $fs = $this->getAdapter($path);
     if ($fs->getMountPath()) {
         foreach ($items as &$file) {
             $file->setMountPoint($fs->getMountPath());
         }
     }
     if ('/' === $path) {
         foreach ($this->jarvesConfig->getSystemConfig()->getMountPoints() as $mountPoint) {
             $fileInfo = new FileInfo();
             $fileInfo->setPath('/' . $mountPoint->getPath());
             //                $fileInfo->setIcon($mountPoint->getIcon());
             $fileInfo->setType(FileInfo::DIR);
             $fileInfo->setMountPoint(true);
             array_unshift($items, $fileInfo);
         }
     }
     return $this->wrap($items);
 }
All Usage Examples Of Jarves\Filesystem\Filesystem::getFiles