mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-25 04:38:53 +00:00
[ticket/16955] Wrap RecursiveDirectoryIteratorr calls for dot prefix filter
PHPBB3-16955
This commit is contained in:
parent
40e8a737c3
commit
733f4e2530
1 changed files with 30 additions and 1 deletions
|
@ -22,9 +22,38 @@ namespace phpbb\iterator;
|
||||||
*/
|
*/
|
||||||
class recursive_dot_prefix_filter_iterator extends \RecursiveFilterIterator
|
class recursive_dot_prefix_filter_iterator extends \RecursiveFilterIterator
|
||||||
{
|
{
|
||||||
public function accept()
|
/**
|
||||||
|
* Check whether the current element of the iterator is acceptable
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function accept(): bool
|
||||||
{
|
{
|
||||||
$filename = $this->current()->getFilename();
|
$filename = $this->current()->getFilename();
|
||||||
return $filename[0] !== '.' || !$this->current()->isDir();
|
return $filename[0] !== '.' || !$this->current()->isDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sub path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSubPath(): string
|
||||||
|
{
|
||||||
|
$directory_iterator = $this->getInnerIterator();
|
||||||
|
assert($directory_iterator instanceof \RecursiveDirectoryIterator);
|
||||||
|
return $directory_iterator->getSubPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sub path and name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSubPathname(): string
|
||||||
|
{
|
||||||
|
$directory_iterator = $this->getInnerIterator();
|
||||||
|
assert($directory_iterator instanceof \RecursiveDirectoryIterator);
|
||||||
|
return $directory_iterator->getSubPathname();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue