Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExcludeFilter.php
Go to the documentation of this file.
1 <?php
8 
12 class ExcludeFilter extends \FilterIterator
13 {
19  protected $_filters;
20 
27  public function __construct(\Iterator $iterator, array $filters)
28  {
29  parent::__construct($iterator);
30  $this->_filters = $filters;
31  }
32 
38  public function accept()
39  {
40  $current = str_replace('\\', '/', $this->current()->__toString());
41  $currentFilename = str_replace('\\', '/', $this->current()->getFilename());
42 
43  if ($currentFilename == '.' || $currentFilename == '..') {
44  return false;
45  }
46 
47  foreach ($this->_filters as $filter) {
48  $filter = str_replace('\\', '/', $filter);
49  if (false !== strpos($current, $filter)) {
50  return false;
51  }
52  }
53 
54  return true;
55  }
56 }
__construct(\Iterator $iterator, array $filters)
$filters
Definition: uploader.phtml:11