function dir_recurse($path, $level = 0) { $d = opendir($path); while ($f = readdir($d)) { if ($f != '.' && $f != '..') { printf("%s`%s\n", str_repeat(" ", $level), $f); if (is_dir("{$path}/{$f}")) { dir_recurse("{$path}/{$f}", $level + 1); } } } closedir($d); }
function dir_recurse($dirName) { $dirHandle = opendir($dirName); while ($currFile = readdir($dirHandle)) { if ($currFile == '.' or $currFile == '..' or $dirName == '.' and $currFile == 'listhooks.php') { continue; } if (is_dir($dirName . '/' . $currFile)) { dir_recurse($dirName . '/' . $currFile); } else { $matches = preg_grep('#(run_filters|run_actions)\\(\'(.*?)\'#i', file($dirName . '/' . $currFile)); // echo $dirName,'\\',$currFile,' :: '; // echo count($matches),' matches found.<br />'; if (count($matches) > 0) { foreach ($matches as $lineNr => $lineContents) { $GLOBALS['hooks'][$dirName . '/' . $currFile][$lineNr] = $lineContents; } } } } }