[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/event/ -> recursive_event_filter_iterator.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\event;
  15  
  16  /**
  17  * This filter ignores directories and files starting with a dot.
  18  * It also skips some directories that do not contain events anyway,
  19  * such as e.g. files/, store/ and vendor/
  20  */
  21  class recursive_event_filter_iterator extends \RecursiveFilterIterator
  22  {
  23      protected $root_path;
  24  
  25      /**
  26      * Construct
  27      *
  28      * @param \RecursiveIterator    $iterator
  29      * @param string                $root_path
  30      */
  31  	public function __construct(\RecursiveIterator $iterator, $root_path)
  32      {
  33          $this->root_path = str_replace(DIRECTORY_SEPARATOR, '/', $root_path);
  34          parent::__construct($iterator);
  35      }
  36  
  37      /**
  38      * Return the inner iterator's children contained in a recursive_event_filter_iterator
  39      *
  40      * @return recursive_event_filter_iterator
  41      */
  42  	public function getChildren()
  43      {
  44          return new self($this->getInnerIterator()->getChildren(), $this->root_path);
  45      }
  46  
  47      /**
  48      * {@inheritDoc}
  49      */
  50  	public function accept()
  51      {
  52          $relative_path = str_replace(DIRECTORY_SEPARATOR, '/', $this->current());
  53          $filename = $this->current()->getFilename();
  54  
  55          return (substr($relative_path, -4) === '.php' || $this->current()->isDir())
  56              && $filename[0] !== '.'
  57              && strpos($relative_path, $this->root_path . 'cache/') !== 0
  58              && strpos($relative_path, $this->root_path . 'develop/') !== 0
  59              && strpos($relative_path, $this->root_path . 'docs/') !== 0
  60              && strpos($relative_path, $this->root_path . 'ext/') !== 0
  61              && strpos($relative_path, $this->root_path . 'files/') !== 0
  62              && strpos($relative_path, $this->root_path . 'includes/utf/') !== 0
  63              && strpos($relative_path, $this->root_path . 'language/') !== 0
  64              && strpos($relative_path, $this->root_path . 'phpbb/db/migration/data/') !== 0
  65              && strpos($relative_path, $this->root_path . 'phpbb/event/') !== 0
  66              && strpos($relative_path, $this->root_path . 'store/') !== 0
  67              && strpos($relative_path, $this->root_path . 'tests/') !== 0
  68              && strpos($relative_path, $this->root_path . 'vendor/') !== 0
  69          ;
  70      }
  71  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1