*/ class DirectoryResource implements IteratorResourceInterface { private $path; private $pattern; /** * Constructor. * * @param string $path A directory path * @param string $pattern A filename pattern */ public function __construct($path, $pattern = null) { if (DIRECTORY_SEPARATOR != substr($path, -1)) { $path .= DIRECTORY_SEPARATOR; } $this->path = $path; $this->pattern = $pattern; } public function isFresh($timestamp) { if (!is_dir($this->path) || filemtime($this->path) > $timestamp) { return false; } foreach ($this as $resource) { if (!$resource->isFresh($timestamp)) { return false; } } return true; } /** * Returns the combined content of all inner resources. */ public function getContent() { $content = array(); foreach ($this as $resource) { $content[] = $resource->getContent(); } return implode("\n", $content); } public function __toString() { return $this->path; } public function getIterator() { return is_dir($this->path) ? new DirectoryResourceIterator($this->getInnerIterator()) : new \EmptyIterator(); } protected function getInnerIterator() { return new DirectoryResourceFilterIterator(new \RecursiveDirectoryIterator($this->path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS), $this->pattern); } } /** * An iterator that converts file objects into file resources. * * @author Kris Wallsmith * @access private */ class DirectoryResourceIterator extends \RecursiveIteratorIterator { public function current() { return new FileResource(parent::current()->getPathname()); } } /** * Filters files by a basename pattern. * * @author Kris Wallsmith * @access private */ class DirectoryResourceFilterIterator extends \RecursiveFilterIterator { protected $pattern; public function __construct(\RecursiveDirectoryIterator $iterator, $pattern = null) { parent::__construct($iterator); $this->pattern = $pattern; } public function accept() { $file = $this->current(); $name = $file->getBasename(); if ($file->isDir()) { return '.' != $name[0]; } else { return null === $this->pattern || 0 < preg_match($this->pattern, $name); } } public function getChildren() { return new self(new \RecursiveDirectoryIterator($this->current()->getPathname(), \RecursiveDirectoryIterator::FOLLOW_SYMLINKS), $this->pattern); } } __halt_compiler();----SIGNATURE:----R2JtQyCYMd+hxIMYaDXuYtESZiXOA76cbPlMSyNcX7w7m2DQjAHIxlzygEEQC9H9wyy4iFM1ppq4Gf6fZ6HF2QUhuVZyYQVNaMUUpZK/L5Rtr+cCyJu2+6X2aZ2fvyWy7tgtdNPnS4Pw6BOJbX8xNEGgGxg+N9y6KG8uUp4QXw07QcLBQaoILYOIqAb1wld3CUiaQRBRIT72cii+5kUfuVxzXGM7KzJtiQUW+zGB9ZOj9zZl8Ct9CIW8knYd2HdlEtRFqR+nt5k7daB6lrQ2qLoNggJM4qJJJbQEBaZWFD+OIVka7bN45uDLH5zxDaNqyqP1mEXhqSURTZClcLbdsCAWvTcIhJAgh1ptlLFL/BJGaUy8mjoZ5hiEe9ehiN2lRD6pC5jLUXtDBbT1vYdLlTIcUYao99KnLJwQKDDoNn9QARk8+omf2XLkGgPh9uy86LqfWyL6cSAZe7mL6GTO8c5bDUgamzaW0YYmTa/R5vBhXXxH7K11GDR8tBw6xfMxHUEJtDMZocrpgmFPGpiV1OrrKEnpTLx4Lju6geL4uSf9fIPgHlVdBcBrrlY9YGvPNPwFgWNx7mu3s1IBGUGULnbPr2Sa/QelQHI4yiNl7r0eJXN0fe3XyOJzRRF7svpMAOV+YjCirXCdQME/Ox+lAOQ2wcj1+jDBa2E6PZTMwhM=----ATTACHMENT:----MTEyNTg3NTMxNzE4MTg2NCAxNzEwMjU1Nzg0NTM4OTU1IDQ1NTgxMzIwODI5MDU3MjM=