1<?php 2 3/** @file directoryfilterdots.inc 4 * @ingroup Examples 5 * @brief class DirectoryFilterDots 6 * @author Marcus Boerger 7 * @date 2003 - 2006 8 * 9 * SPL - Standard PHP Library 10 */ 11 12/** @ingroup Examples 13 * @brief A filtered DirectoryIterator 14 * @author Marcus Boerger 15 * @version 1.2 16 * 17 * This Iterator takes a pathname from which it creates a RecursiveDirectoryIterator 18 * and makes it recursive. Further more it filters the entries '.' and '..'. 19 */ 20class DirectoryFilterDots extends RecursiveFilterIterator 21{ 22 /** Construct from a path. 23 * @param $path directory to iterate 24 */ 25 function __construct($path) 26 { 27 parent::__construct(new RecursiveDirectoryIterator($path)); 28 } 29 30 /** @return whether the current entry is neither '.' nor '..' 31 */ 32 function accept() 33 { 34 return !$this->getInnerIterator()->isDot(); 35 } 36 37 /** @return the current entries path name 38 */ 39 function key() 40 { 41 return $this->getInnerIterator()->getPathname(); 42 } 43} 44 45?> 46