2003-11-09 14:05:36 +00:00
|
|
|
<?php
|
|
|
|
|
2004-05-10 17:26:03 +00:00
|
|
|
/** @file directoryfilterdots.inc
|
|
|
|
* @ingroup Examples
|
|
|
|
* @brief class DirectoryFilterDots
|
|
|
|
* @author Marcus Boerger
|
2006-11-03 18:58:41 +00:00
|
|
|
* @date 2003 - 2006
|
2004-05-10 17:26:03 +00:00
|
|
|
*
|
|
|
|
* SPL - Standard PHP Library
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @ingroup Examples
|
2004-05-08 12:24:15 +00:00
|
|
|
* @brief A filtered DirectoryIterator
|
|
|
|
* @author Marcus Boerger
|
2006-11-03 18:58:41 +00:00
|
|
|
* @version 1.2
|
2004-05-08 12:24:15 +00:00
|
|
|
*
|
|
|
|
* This Iteraotr takes a pathname from which it creates a DirectoryIterator
|
|
|
|
* and makes it recursive. Further more it filters the entries '.' and '..'.
|
|
|
|
*/
|
2004-11-01 00:33:41 +00:00
|
|
|
class DirectoryFilterDots extends RecursiveFilterIterator
|
2003-11-09 14:05:36 +00:00
|
|
|
{
|
2004-05-08 12:24:15 +00:00
|
|
|
/** Construct from a path.
|
|
|
|
* @param $path directory to iterate
|
|
|
|
*/
|
|
|
|
function __construct($path)
|
|
|
|
{
|
2006-11-03 18:58:41 +00:00
|
|
|
parent::__construct(new RecursiveDirectoryIterator($path));
|
2003-11-09 14:05:36 +00:00
|
|
|
}
|
2004-05-08 12:24:15 +00:00
|
|
|
|
|
|
|
/** @return whether the current entry is neither '.' nor '..'
|
|
|
|
*/
|
|
|
|
function accept()
|
|
|
|
{
|
2004-10-08 21:12:15 +00:00
|
|
|
return !$this->getInnerIterator()->isDot();
|
2003-11-09 14:05:36 +00:00
|
|
|
}
|
|
|
|
|
2004-05-08 12:24:15 +00:00
|
|
|
/** @return the current entries path name
|
|
|
|
*/
|
|
|
|
function key()
|
|
|
|
{
|
2004-10-08 21:12:15 +00:00
|
|
|
return $this->getInnerIterator()->getPathname();
|
2003-11-09 14:05:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|