1
0

recursive-dir-with-DirectoryIterator.php 1002 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * dolphin. Collection of useful PHP skeletons.
  4. * Copyright (C) 2013 Johannes 'Banana' Keßler
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  8. *
  9. * You should have received a copy of the
  10. * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
  11. * along with this program. If not, see http://www.sun.com/cddl/cddl.html
  12. */
  13. /**
  14. * return recursive all data from the given directory
  15. * @see http://www.php.net/manual/de/class.directoryiterator.php
  16. * @author banana mail@bananas-playground.net
  17. * @param string $directory The directory to read
  18. * @return array $files
  19. */
  20. function readDirRecusrive($directory) {
  21. $files = array();
  22. $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('../'.STATIC_CACHE_PATH, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
  23. foreach ($it as $file) {
  24. $files[] = $file->getPathName();
  25. }
  26. return $files;
  27. }
  28. ?>