コード例 #1
0
ファイル: dir-recurse.php プロジェクト: rflynn/php-examples
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);
}
コード例 #2
0
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;
                }
            }
        }
    }
}