Skip to content

Commit

Permalink
[php:driver] add optional parameter $lineal into parents()
Browse files Browse the repository at this point in the history
`@param  bool|null $lineal only lineal parents`
  • Loading branch information
nao-pon committed Jan 14, 2014
1 parent 1c12c11 commit 9a1bd26
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions php/elFinderVolumeDriver.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1105,11 +1105,12 @@ public function tree($hash='', $deep=0, $exclude='') {
/**
* Return part of dirs tree from required dir up to root dir
*
* @param string $hash directory hash
* @param string $hash directory hash
* @param bool|null $lineal only lineal parents
* @return array
* @author Dmitry (dio) Levashov
**/
public function parents($hash) {
public function parents($hash, $lineal = false) {
if (($current = $this->dir($hash)) == false) {
return false;
}
Expand All @@ -1125,7 +1126,7 @@ public function parents($hash) {
}

array_unshift($tree, $stat);
if ($path != $this->root) {
if (!$lineal && ($path != $this->root)) {
foreach ($this->gettree($path, 0) as $dir) {
if (!in_array($dir, $tree)) {
$tree[] = $dir;
Expand Down

0 comments on commit 9a1bd26

Please sign in to comment.