elFinder\elFinderVolumeDriver::parents PHP Method

parents() public method

Return part of dirs tree from required dir up to root dir
Author: Dmitry (dio) Levashov
public parents ( string $hash ) : array
$hash string directory hash
return array
    public function parents($hash)
    {
        if (($current = $this->dir($hash)) == false) {
            return false;
        }
        $path = $this->decode($hash);
        $tree = array();
        while ($path && $path != $this->root) {
            $path = $this->_dirname($path);
            $stat = $this->stat($path);
            if (!empty($stat['hidden']) || !$stat['read']) {
                return false;
            }
            array_unshift($tree, $stat);
            if ($path != $this->root) {
                foreach ($this->gettree($path, 0) as $dir) {
                    if (!in_array($dir, $tree)) {
                        $tree[] = $dir;
                    }
                }
            }
        }
        return $tree ? $tree : array($current);
    }