mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-15 07:58:40 +00:00
Implement filter
This commit is contained in:
parent
184e407201
commit
916497f329
|
|
@ -81,12 +81,17 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
throw new PathException($path);
|
throw new PathException($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
$path = rtrim($path, '\\/');
|
$path = rtrim($path, '\\/');
|
||||||
|
$iterator = new \RecursiveIteratorIterator(
|
||||||
foreach ($iterator = new \RecursiveIteratorIterator(
|
|
||||||
new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS),
|
new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
\RecursiveIteratorIterator::SELF_FIRST) as $item
|
\RecursiveIteratorIterator::SELF_FIRST);
|
||||||
|
|
||||||
|
if ($filter !== '*') {
|
||||||
|
return \RegexIterator($iterator, '/' . $filter . '/i', \RecursiveRegexIterator::GET_MATCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($iterator as $item
|
||||||
) {
|
) {
|
||||||
$list[] = str_replace('\\', '/', $iterator->getSubPathname());
|
$list[] = str_replace('\\', '/', $iterator->getSubPathname());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user