_build() 공개 메소드

internal function to build singular directory trees, used by File_Find::maptree()
public _build ( string $directory, string $separator = "/" ) : void
$directory string name of the directory to read
$separator string directory separator
리턴 void
예제 #1
0
 /**
  * Map the directory tree given by the directory_path parameter.
  *
  * @param string $directory contains the directory path that you
  * want to map.
  *
  * @return array a two element array, the first element containing a list
  * of all the directories, the second element containing a list of all the
  * files.
  *
  * @author Sterling Hughes <*****@*****.**>
  * @access public
  */
 function &maptree($directory)
 {
     /* if called statically */
     if (!isset($this) || !is_a($this, "File_Find")) {
         $obj = new File_Find();
         return $obj->maptree($directory);
     }
     /* clear the results just in case */
     $this->files = array();
     $this->directories = array();
     /* strip out trailing slashes */
     $directory = preg_replace('![\\\\/]+$!', '', $directory);
     $this->_dirs = array($directory);
     while (count($this->_dirs)) {
         $dir = array_pop($this->_dirs);
         File_Find::_build($dir, $this->dirsep);
         array_push($this->directories, $dir);
     }
     sort($this->directories);
     sort($this->files);
     $retval = array($this->directories, $this->files);
     return $retval;
 }
예제 #2
0
파일: Find.php 프로젝트: rhempen/cms
 /**
  * Map the directory tree given by the directory_path parameter.
  *
  * @param string $directory contains the directory path that you
  * want to map.
  *
  * @return array a two element array, the first element containing a list
  * of all the directories, the second element containing a list of all the
  * files.
  *
  * @author Sterling Hughes <*****@*****.**>
  * @access public
  */
 function &maptree($directory)
 {
     /* if called statically */
     if (!isset($this) || !is_a($this, "File_Find")) {
         $obj =& new File_Find();
         return $obj->maptree($directory);
     }
     /* clear the results just in case */
     $this->files = array();
     $this->directories = array();
     /* consistency rules - strip out trailing slashes */
     $directory = preg_replace('![\\\\/]+$!', '', $directory);
     /* use only native system directory delimiters */
     $directory = preg_replace("![\\\\/]+!", DIRECTORY_SEPARATOR, $directory);
     $this->_dirs = array($directory);
     while (count($this->_dirs)) {
         $dir = array_pop($this->_dirs);
         File_Find::_build($dir);
         array_push($this->directories, $dir);
     }
     return array($this->directories, $this->files);
 }
예제 #3
0
 /**
  * Map the directory tree given by the directory_path parameter.
  *
  * @param string $directory contains the directory path that you
  * want to map.
  *
  * @return array a two element array, the first element containing a list
  * of all the directories, the second element containing a list of all the
  * files.
  *
  * @author Sterling Hughes <*****@*****.**>
  * @access public
  */
 function &maptree($directory)
 {
     $this->_dirs = array($directory);
     while (count($this->_dirs)) {
         $dir = array_pop($this->_dirs);
         File_Find::_build($dir);
         array_push($this->directories, $dir);
     }
     return array($this->directories, $this->files);
 }