当前位置: 首页>>代码示例>>PHP>>正文


PHP scan_dir函数代码示例

本文整理汇总了PHP中scan_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP scan_dir函数的具体用法?PHP scan_dir怎么用?PHP scan_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了scan_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: scan_dir

function scan_dir($path, $project)
{
    global $projects;
    $children = [];
    $dh = opendir($path);
    while (($entry = readdir($dh)) !== false) {
        if (preg_match('/^[.]/', $entry)) {
            continue;
        }
        $entry_path = $path . '/' . $entry;
        if (is_dir($entry_path)) {
            $entry_children = scan_dir($entry_path, $project);
            if (!empty($entry_children)) {
                $children[] = ['text' => $entry, 'id' => $entry_path, 'lines' => [], 'children' => $entry_children];
            }
        } elseif (preg_match('/[.]php$/', $entry)) {
            $lines = [];
            foreach (explode("\n", file_get_contents($entry_path)) as $i => $line) {
                $lines[] = ['line' => $i, 'code' => $line];
            }
            $children[] = ['leaf' => true, 'id' => preg_replace('/^' . preg_quote($projects[$project], '/') . '/', $project, $entry_path), 'text' => $entry, 'lines' => $lines];
        }
    }
    closedir($dh);
    return $children;
}
开发者ID:joeyhub,项目名称:xdebug_trace_browser,代码行数:26,代码来源:file_list.php

示例2: wlist

function wlist()
{
    $lines = null;
    $args = func_get_args();
    switch ($args[0]) {
        case 'scan':
            if ($elements = scan_dir($args[2]['path'], 'DIR')) {
                foreach ($elements as $value) {
                    if (is_file($args[2]['path'] . $value . $args[2]['find'])) {
                        $about = @parse_ini_file($args[2]['path'] . $value . '/protocol/about.gl.php');
                        $name = $about['product'] ? $about['product'] : $value;
                        $lines[$name] = $args[3] ? href(THIS, $args[3], $value) : href($value);
                        unset($about);
                    }
                }
            }
            break;
        default:
            if (is_array($args[2])) {
                foreach ($args[2] as $link => $name) {
                    $lines[$link] = href(THIS, $args[3], $name);
                }
            }
            break;
    }
    //Выводим массив ссылок ;)
    if ($lines) {
        foreach ($lines as $name => $link) {
            form("label", icon($args[1]) . '<a href="' . $link . '">' . $name . '</a>');
        }
    } else {
        html('<br> Wlist lib. (C) Kazin Fedor, 2010');
    }
}
开发者ID:cheevauva,项目名称:trash,代码行数:34,代码来源:wlist.gl.php

示例3: scan_dir

function scan_dir($id)
{
    $result = true;
    foreach ($GLOBALS['db']->select("dir", ['owner' => $_SESSION["username"], 'parent' => $id]) as $d) {
        $result = scan_dir($d["id"]);
    }
    $result = delete_dir($id);
    return $result;
}
开发者ID:BirkhoffLee,项目名称:allendisk,代码行数:9,代码来源:ajax_delete_dir.php

示例4: get_icons

function get_icons()
{
    $files = scan_dir('images/games', true);
    $string = '<option value="0">' . CHOOSE . '</option>';
    foreach ($files as $value) {
        $string .= '<option value="' . $value . '">' . $value . '</option>';
    }
    return $string;
}
开发者ID:ECP-Black,项目名称:ECP,代码行数:9,代码来源:games.php

示例5: get_topic_pics

function get_topic_pics($pic = '')
{
    $pics = '<option value="0">' . CHOOSE . '</option>';
    $folder = scan_dir('images/topics/', true);
    foreach ($folder as $value) {
        $pic == $value ? $sub = 'selected' : ($sub = '');
        $pics .= '<option ' . $sub . ' value="' . $value . '">' . $value . '</option>';
    }
    return $pics;
}
开发者ID:ECP-Black,项目名称:ECP,代码行数:10,代码来源:topics.php

示例6: scan_dir

function scan_dir($id, $per)
{
    $result = true;
    foreach ($GLOBALS['db']->select("dir", ['parent' => $id]) as $k) {
        $result = $GLOBALS['db']->update("dir", ['share' => $per], ['id' => $k['id']]);
        $result = scan_dir($k["id"], $per);
    }
    foreach ($GLOBALS['db']->select("file", ['dir' => $id]) as $d) {
        $result = $GLOBALS['db']->update("file", ['share' => $per], ['id' => $d['id']]);
    }
    return $result;
}
开发者ID:BirkhoffLee,项目名称:allendisk,代码行数:12,代码来源:ajax_share.php

示例7: appendix_scan_dir

function appendix_scan_dir($link = ' ')
{
    $dir = scan_dir(str_replace('kernel/', '', GLISS_DIR) . 'appendix', DIR);
    foreach ($dir as $key => $value) {
        if ($link == $value) {
            $sel = '" selected >';
        } else {
            $sel = '" >';
        }
        echo '<option value="' . $value . $sel . $value . '</option>' . "\n";
    }
}
开发者ID:cheevauva,项目名称:trash,代码行数:12,代码来源:index.php

示例8: scan_dir

 function scan_dir($dir, $pfix = "")
 {
     $r = array();
     $dh = opendir($dir);
     while ($fn = readdir($dh)) {
         if (is_dir("{$dir}/{$pfix}{$fn}")) {
             $r += scan_dir($dir, "{$pfix}{$fn}/");
         } else {
             $r[] = "{$pfix}{$fn}";
         }
     }
     return $r;
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:13,代码来源:xt_searchcache_staticf.php

示例9: scan_dir

	function scan_dir ($dir, $exceptions_array){
		$scand_dir = scandir($dir);
		$scan_dir_string = array();
		foreach ($scand_dir as $file) {
			if(!in_array(strtolower($file), $exceptions_array)){
				$scan_file = $dir.'/'.$file;
				if(is_dir($scan_file)){
					$scan_file= scan_dir ($scan_file, $exceptions_array);
				}
				array_push($scan_dir_string, $scan_file);
			}
		}
		return implode(',', $scan_dir_string);
	}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:14,代码来源:backup.php

示例10: scan_dir

function scan_dir($location)
{
    $output = '';
    foreach ($GLOBALS['db']->select('dir', ['parent' => $location, 'owner' => $_SESSION["username"], 'recycle' => '0']) as $d) {
        $sdir = $GLOBALS['db']->select('dir', ['parent' => $d["id"], 'owner' => $_SESSION["username"], 'recycle' => '0']);
        if ($sdir[0]["id"] != null) {
            $output .= '<li><span class="tree-indicator"><i class="ion-ios7-minus-empty"></i></span>
                        <a href="#" class="filetreeselector" data-id="' . $d["id"] . '">' . $d["name"] . '</a>
                        <ul class="dir-tree" data-parent="' . $d["id"] . '">' . scan_dir($d["id"]) . '</ul></li>';
        } else {
            $output .= '<li><a href="#" class="filetreeselector" data-id="' . $d["id"] . '" >' . $d["name"] . '</a></li>';
        }
    }
    return $output;
}
开发者ID:BirkhoffLee,项目名称:allendisk,代码行数:15,代码来源:ajax_list_dir_back.php

示例11: admin_settings

 function admin_settings()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         unset($_POST['submit']);
         $_POST['SITE_URL'] = strrpos($_POST['SITE_URL'], '/') !== strlen($_POST['SITE_URL']) - 1 ? check_url($_POST['SITE_URL'] . '/') : check_url($_POST['SITE_URL']);
         $sql = 'UPDATE ' . DB_PRE . 'ecp_settings SET ';
         foreach ($_POST as $key => $value) {
             $sql .= $key . ' = "' . strsave($value) . '", ';
         }
         $sql = substr($sql, 0, strlen($sql) - 2);
         if ($db->query($sql)) {
             header('Location: ?section=admin&site=settings');
         }
     } else {
         $dir = scan_dir('templates', true);
         $designs = '';
         foreach ($dir as $value) {
             if (is_dir('templates/' . $value)) {
                 $designs .= '<option ' . ($value == DESIGN ? 'selected="selected"' : '') . ' value="' . $value . '">' . $value . '</option>';
             }
         }
         $tpl = new smarty();
         $tpl->assign('designs', $designs);
         $tpl->assign('langs', get_languages());
         $dir = scan_dir('module', true);
         $start = '';
         foreach ($dir as $value) {
             if (is_dir('module/' . $value)) {
                 $start .= '<option ' . ('modul|' . $value == STARTSEITE ? 'selected="selected"' : '') . ' value="modul|' . $value . '">' . $value . '</option>';
             }
         }
         $start .= '<option value="">-----' . OWN_SITES . '----</option>';
         $db->query('SELECT headline, cmsID FROM ' . DB_PRE . 'ecp_cms ORDER BY headline ASC');
         while ($row = $db->fetch_assoc()) {
             $title = json_decode($row['headline'], true);
             isset($title[LANGUAGE]) ? $title = $title[LANGUAGE] : ($title = $title[DEFAULT_LANG]);
             $start .= '<option ' . ('cms|' . $row['cmsID'] == STARTSEITE ? 'selected="selected"' : '') . ' value="cms|' . $row['cmsID'] . '">' . $title . '</option>';
         }
         $tpl->assign('startseite', $start);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/settings.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(SETTINGS, $content, '', 1);
     }
 }
开发者ID:ECP-Black,项目名称:ECP,代码行数:47,代码来源:settings.php

示例12: scan_dir

function scan_dir($dir)
{
    if (!is_dir($dir)) {
        return;
    }
    foreach (glob("{$dir}/*") as $file) {
        if (is_dir($file)) {
            if (basename($file) != "CVS") {
                scan_dir($file);
            }
        } else {
            if (fnmatch("*.h", $file)) {
                scan_file($file);
            }
        }
    }
}
开发者ID:clockzhong,项目名称:WrapLAMP,代码行数:17,代码来源:extern_c.php

示例13: scan_dir

function scan_dir($location, $current)
{
    $output = '';
    foreach ($GLOBALS['db']->select('dir', ['parent' => $location, 'owner' => $_SESSION["username"], 'recycle' => '0']) as $d) {
        $sdir = $GLOBALS['db']->select('dir', ['parent' => $d["id"], 'owner' => $_SESSION["username"], 'recycle' => '0']);
        if ($current == $d["id"]) {
            $ct = ' class="current"';
        } else {
            $ct = '';
        }
        if ($sdir[0]["id"] != null) {
            $output .= '<li' . $ct . '><i class="fa fa-folder-open"></i> <a href="home.php?dir=' . $d["id"] . '" data-id="' . $d["id"] . '">' . $d["name"] . '</a>
                        <ul data-parent="' . $d["id"] . '">' . scan_dir($d["id"], $_GET["current"]) . '</ul></li>';
        } else {
            $output .= '<li' . $ct . '><i class="fa fa-folder"></i> <a href="home.php?dir=' . $d["id"] . '" data-id="' . $d["id"] . '" >' . $d["name"] . '</a></li>';
        }
    }
    return $output;
}
开发者ID:BirkhoffLee,项目名称:allendisk,代码行数:19,代码来源:ajax_dir_tree.php

示例14: scan_dir

function scan_dir($dir)
{
    $BANNED_FILES = array("dev", ".", "..", "Thumbs.db", "desktop.ini");
    $directory = scandir($dir);
    foreach ($directory as $file) {
        if (!is_in_array($file, $BANNED_FILES)) {
            if (is_dir($dir . "/" . $file)) {
                echo "<optgroup label='" . $file . "'>";
                scan_dir($dir . "/" . $file);
                echo "</optgroup>\n";
            } else {
                echo "<option label='" . basename($file, ".png") . "' value='" . $dir . "/" . $file . "'";
                if ($file == "nes-8x8.png") {
                    echo " selected";
                }
                echo ">" . $file . "</option>\n";
            }
        }
    }
}
开发者ID:belaw,项目名称:mosaic-generator,代码行数:20,代码来源:index.php

示例15: help_invoke_main

function help_invoke_main()
{
    $section = REQ('section');
    $path = SKIN . '/help/sections/';
    $scan = scan_dir($path);
    $result = array();
    foreach ($scan as $id) {
        $id = str_replace('.tpl', '', $id);
        if (!$section || $section && $section == $id) {
            $result[$id] = proc_tpl("help/sections/{$id}");
        }
    }
    cn_assign('help_sections', $result);
    if ($section) {
        echo exec_tpl('window', "style=help/style.css", "title=HELP - {$section}", 'content=' . exec_tpl('help/main'));
    } else {
        echoheader('-@help/style.css', 'Help section');
        echo exec_tpl('help/main');
        echofooter();
    }
}
开发者ID:JulioCF,项目名称:cutenews-2.0,代码行数:21,代码来源:help.php


注:本文中的scan_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。