framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
protected function getFilesRecursively( $directory, $zipMaxSize )
  {
    $allFiles = array();
    $_zipFilesSize = 0;
    $serverPath = str_replace('\\','/',$directory);

    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $file ) {
      if ( !$this->checkOneFile($file) ){
        continue;
      }
      if ( !empty($zipMaxSize) ){
        clearstatcache();
        $_zipFilesSize += $file->getSize();
        if ( $_zipFilesSize > $zipMaxSize ) {
          $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG);
        }
      }
      $pathName = str_replace('\\','/',$file->getPathname());
      if ( $file->isDir() ){
        // skip dot folders on unix systems ( do not try to use isDot() as $file is not a  DirectoryIterator obj )
        if ( in_array($file->getFilename(),array('..','.')) ){
          continue;
        }
        if ($pathName != rtrim($serverPath,'/')){
          $allFiles[ ltrim(str_ireplace(rtrim($serverPath,'/'),'',$pathName),'/') ] = '';
        }
      } else {
        $allFiles[$pathName] = str_ireplace($serverPath,'',$pathName);
      }
    }

    return $allFiles;
  }
protected function getFilesRecursively( $directory, $zipMaxSize )
  {
    $allFiles = array();
    $_zipFilesSize = 0;
    $serverPath = str_replace('\\','/',$directory);

    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $file ) {
      if ( !$this->checkOneFile($file) ){
        continue;
      }
      if ( !empty($zipMaxSize) ){
        clearstatcache();
        $_zipFilesSize += $file->getSize();
        if ( $_zipFilesSize > $zipMaxSize ) {
          $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG);
        }
      }
      $pathName = str_replace('\\','/',$file->getPathname());
      if ( $file->isDir() ){
        // skip dot folders on unix systems ( do not try to use isDot() as $file is not a  DirectoryIterator obj )
        if ( in_array($file->getFilename(),array('..','.')) ){
          continue;
        }
        if ($pathName != rtrim($serverPath,'/')){
          $allFiles[ ltrim(str_ireplace(rtrim($serverPath,'/'),'',$pathName),'/') ] = '';
        }
      } else {
        $allFiles[$pathName] = str_ireplace($serverPath,'',$pathName);
      }
    }

    return $allFiles;
  }
protected function getFilesRecursively ( $ directory , $ zipMaxSize ) { $ allFiles = array ( ) ; $ _zipFilesSize = 0 ; $ serverPath = str_replace ( '\\' , '/' , $ directory ) ; foreach ( new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ directory ) , RecursiveIteratorIterator :: CHILD_FIRST ) as $ file ) { if ( ! $ this -> checkOneFile ( $ file ) ) { continue ; } if ( ! empty ( $ zipMaxSize ) ) { clearstatcache ( ) ; $ _zipFilesSize += $ file -> getSize ( ) ; if ( $ _zipFilesSize > $ zipMaxSize ) { $ this -> _errorHandler -> throwError ( CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG ) ; } } $ pathName = str_replace ( '\\' , '/' , $ file -> getPathname ( ) ) ; if ( $ file -> isDir ( ) ) { // skip dot folders on unix systems ( do not try to use isDot() as $file is not a  DirectoryIterator obj ) if ( in_array ( $ file -> getFilename ( ) , array ( '..' , '.' ) ) ) { continue ; } if ( $ pathName != rtrim ( $ serverPath , '/' ) ) { $ allFiles [ ltrim ( str_ireplace ( rtrim ( $ serverPath , '/' ) , '' , $ pathName ) , '/' ) ] = '' ; } } else { $ allFiles [ $ pathName ] = str_ireplace ( $ serverPath , '' , $ pathName ) ; } } return $ allFiles ; }
Get list of all files in given directory, including sub-directories

@param string $directory
@param int $zipMaxSize Maximum zip file size
@return array $allFiles
Get list of all files in given directory including sub - directories