concrete/src/File/Service/File.php
public function getDirectoryContents($dir, $ignoreFiles = [], $recursive = false)
    {
        $aDir = [];
        if (is_dir($dir)) {
            $handle = opendir($dir);
            while (($file = readdir($handle)) !== false) {
                if (substr($file, 0, 1) != '.' && (!in_array($file, $ignoreFiles))) {
                    if (is_dir($dir . '/' . $file)) {
                        if ($recursive) {
                            $aDir = array_merge($aDir, $this->getDirectoryContents($dir . '/' . $file, $ignoreFiles, $recursive));
                            $file = $dir . '/' . $file;
                        }
                        $aDir[] = preg_replace("/\/\//si", '/', $file);
                    } else {
                        if ($recursive) {
                            $file = $dir . '/' . $file;
                        }
                        $aDir[] = preg_replace("/\/\//si", '/', $file);
                    }
                }
            }
            closedir($handle);
        }

        return $aDir;
    }
public function getDirectoryContents($dir, $ignoreFiles = [], $recursive = false)
    {
        $aDir = [];
        if (is_dir($dir)) {
            $handle = opendir($dir);
            while (($file = readdir($handle)) !== false) {
                if (substr($file, 0, 1) != '.' && (!in_array($file, $ignoreFiles))) {
                    if (is_dir($dir . '/' . $file)) {
                        if ($recursive) {
                            $aDir = array_merge($aDir, $this->getDirectoryContents($dir . '/' . $file, $ignoreFiles, $recursive));
                            $file = $dir . '/' . $file;
                        }
                        $aDir[] = preg_replace("/\/\//si", '/', $file);
                    } else {
                        if ($recursive) {
                            $file = $dir . '/' . $file;
                        }
                        $aDir[] = preg_replace("/\/\//si", '/', $file);
                    }
                }
            }
            closedir($handle);
        }

        return $aDir;
    }
public function getDirectoryContents ( $ dir , $ ignoreFiles = [ ] , $ recursive = false ) { $ aDir = [ ] ; if ( is_dir ( $ dir ) ) { $ handle = opendir ( $ dir ) ; while ( ( $ file = readdir ( $ handle ) ) !== false ) { if ( substr ( $ file , 0 , 1 ) != '.' && ( ! in_array ( $ file , $ ignoreFiles ) ) ) { if ( is_dir ( $ dir . '/' . $ file ) ) { if ( $ recursive ) { $ aDir = array_merge ( $ aDir , $ this -> getDirectoryContents ( $ dir . '/' . $ file , $ ignoreFiles , $ recursive ) ) ; $ file = $ dir . '/' . $ file ; } $ aDir [ ] = preg_replace ( "/\/\//si" , '/' , $ file ) ; } else { if ( $ recursive ) { $ file = $ dir . '/' . $ file ; } $ aDir [ ] = preg_replace ( "/\/\//si" , '/' , $ file ) ; } } } closedir ( $ handle ) ; } return $ aDir ; }
Returns the contents of a directory.
Returns the contents of a directory .