regexfindfile.inc 885 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /** @file regexfindfile.inc
  3. * @ingroup Examples
  4. * @brief class RegexFindFile
  5. * @author Marcus Boerger
  6. * @date 2003 - 2005
  7. *
  8. * SPL - Standard PHP Library
  9. */
  10. /** @ingroup Examples
  11. * @brief Find files by regular expression
  12. * @author Marcus Boerger
  13. * @version 1.1
  14. *
  15. */
  16. class RegexFindFile extends FindFile
  17. {
  18. /** Construct from path and regular expression
  19. *
  20. * @param $path the directory to search in
  21. * If path contains ';' then this parameter is split and every
  22. * part of it is used as separate directory.
  23. * @param $regex perl style regular expression to find files with
  24. */
  25. function __construct($path, $regex)
  26. {
  27. parent::__construct($path, $regex);
  28. }
  29. /** @return whether the current filename matches the regular expression.
  30. */
  31. function accept()
  32. {
  33. return preg_match($this->getSearch(), $this->current());
  34. }
  35. }
  36. ?>