16 protected $folderlist;
18 public function __construct($path)
20 $this->files = scandir($path);
23 if (!file_exists($path))
25 mkdir($path, 0777,
true);
38 $this->folderlist = array();
39 $this->
findFiles($dir, $this->folderlist);
40 return $this->folderlist;
51 $files = scandir($dir);
55 foreach($files as $val)
58 if($val ==
'.' || $val ==
'..')
62 if(is_dir($dir.
'/'.$val))
65 $dir_array[$dir][] = $val;
71 $dir_array[$dir][] = $val;
89 $cdir = scandir($dir);
90 foreach ($cdir as $key => $value)
92 if (!in_array($value,array(
".",
"..")))
94 if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
96 $result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
115 public function arrayToHtml($style,$folderStyle=null,$ftypes=null,$dot=null)
120 while(
sizeof($this->files)>$i)
122 if(($dot==
false)||($dot==null))
124 if(stristr($this->files[$i],$ftypes)!=
false)
127 if(($this->files[$i]!=
'.')&&($this->files[$i]!=
'..'))
129 $this->out.=$style[0].$this->files[$i++].$style[1];
139 if(($this->files[$i]!=
'.')&&($this->files[$i]!=
'..'))
141 $this->out.=$folderStyle[0].$this->files[$i++].$folderStyle[1];
151 if(is_file($this->files[$i]))
153 $this->out.=$style[0].$this->files[$i++].$style[1];
157 $this->out.=$folderStyle[0].$this->files[$i++].$folderStyle[1];