public function rglob($pattern = '*', $flags = 0, $path = '')
{
if (!$path && ($dir = dirname($pattern)) != '.') {
if ($dir == '\\' || $dir == '/') {
$dir = '';
}
return $this->rglob(basename($pattern), $flags, $dir . DS);
}
if (stristr($path, '_notes') or stristr($path, '.git') or stristr($path, '.svn')) {
return false;
}
$paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
if (is_array($paths)) {
foreach ($paths as $p) {
$temp = array();
if (is_dir($p) and is_readable($p)) {
$temp = $this->rglob($pattern, false, $p . DS);
}
if (is_array($temp) and is_array($files)) {
$files = array_merge($files, $temp);
} elseif (is_array($temp)) {
$files = $temp;
}
}
}
return $files;
}