Location: PHPKode > scripts > tgcSPL > tgcspl/include/DomNodeFilter.php
<?php
/**
 * Allows DomNode-filtering
 *
 * $Id: DomNodeFilter.php,v 1.1 2004/09/24 01:25:49 luckec Exp $
 *
 * @package     tgcSPL
 * @subpackage  FilterIterators
 * @author      Carsten Lucke <hide@address.com>
 * @copyright   Carsten Lucke <hide@address.com>
 */
 
/**
 * Allows DomNode-filtering
 *
 * $Id: DomNodeFilter.php,v 1.1 2004/09/24 01:25:49 luckec Exp $
 *
 * @package     tgcSPL
 * @subpackage  FilterIterators
 * @access      public
 * @version     1.0.0
 * @author      Carsten Lucke <hide@address.com>
 */
class tgcSPL_DomNodeFilter extends FilterIterator
{
    protected $allow;
    
   /**
    * Constructor
    *
    * @param    object Iterator $it     iterator
    * @param    array           $allow  array containing nodetype-constants that will be filtered out   
    */
    public function __construct(Iterator $it, $allow)
    {
        parent::__construct($it);
        $this->allow = $allow;
    }
    
    public function accept()
    {
        return in_array($this->current()->nodeType, $this->allow);
    }
}
?>
Return current item: tgcSPL