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


PHP dir_list函数代码示例

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


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

示例1: load_menu

 function load_menu($selected = null)
 {
     $menu = dir_list(CONTROLLERS_DIR);
     foreach ($menu as $voice) {
         $menu_list[] = array('name' => $voice, 'link' => basename($_SERVER['SCRIPT_NAME']) . '/' . $voice . '/', 'selected' => $selected == $voice);
     }
     return $menu_list;
 }
开发者ID:jffuchs,项目名称:rainframework,代码行数:8,代码来源:Menu.php

示例2: dir_list

function dir_list($path)
{
    foreach (scandir($path) as $file) {
        if ($file != '.' && $file != '..') {
            if (is_dir($path . $file)) {
                dir_list($path . $file . '/');
            } else {
                echo '<div class="avatar" onclick="select(\'' . addslashes($path . $file) . '\')"><img title="' . $path . $file . '" src="' . $path . $file . '"></div>' . "\n";
            }
        }
    }
}
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:12,代码来源:avatars.php

示例3: dir_list

function dir_list($path, $display = 'block')
{
    if (!($dir = opendir($path))) {
        echo $path . ' introuvable';
    } else {
        ?>
<ul style="line-height:1.3em; list-style:none;display:<?php 
        echo $display;
        ?>
" id="ul_<?php 
        echo $GLOBALS['i'];
        ?>
"><?php 
        while (($item = readdir($dir)) !== false) {
            if (in_array($item, array('.', '..'))) {
                continue;
            }
            ?>
<li><?php 
            echo $item;
            $full_path = $path . $item;
            switch (true) {
                case is_dir($full_path):
                    echo " <a id='cross_" . ($GLOBALS['i'] + 1) . "' href='javascript:void(0);' onclick=\"toggleBloc('" . ($GLOBALS['i'] + 1) . "');\">+</a>";
                    $GLOBALS['i']++;
                    dir_list($full_path . '/', 'none');
                    break;
                case is_link($full_path):
                    ?>
 (raccourci)<?php 
                    break;
                case is_file($full_path):
                    ?>
 (fichier<?php 
                    echo @filesize($full_path) === false ? null : ', ' . filesize($full_path) . ' octets';
                    ?>
)<?php 
                    break;
                default:
                    ?>
 (???)<?php 
            }
            ?>
</li><?php 
        }
        ?>
</ul><?php 
    }
    closedir($dir);
}
开发者ID:philou42,项目名称:idem,代码行数:50,代码来源:dir-li.php

示例4: dir_list

function dir_list($path, $exts = '', $list = array())
{
    $path = dir_path($path);
    $files = glob($path . '*');
    foreach ($files as $v) {
        if (!$exts || preg_match("/\\.({$exts})/i", $v)) {
            $list[] = retrieve($v);
            if (is_dir($v)) {
                $list = dir_list($v, $exts, $list);
            }
        }
    }
    return $list;
}
开发者ID:bianle,项目名称:esmart,代码行数:14,代码来源:test.php

示例5: getJs

 public function getJs()
 {
     //合并分开的app.js
     pc_base::load_sys_func('dir');
     $filelist = dir_list(PHPCMS_PATH . 'statics/js/app/build/', 'js');
     $models_js = '';
     foreach ($filelist as $k => $v) {
         $value = file_get_contents($v);
         $models_js .= "\r" . $value;
     }
     $app_path = "http://" . $_SERVER['HTTP_HOST'] . "/";
     //dump($filelist);
     //echo template('content','js');
     include template('content', 'js');
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:15,代码来源:index.php

示例6: index

 public function index()
 {
     $exts = array('html', 'css', 'js');
     $type = $_GET['type'] ? $_GET['type'] : 'html';
     if ($type == 'html') {
         $path = $this->filepath;
     } else {
         $path = $this->publicpath . $type . '/';
     }
     $files = dir_list($path, $type);
     foreach ($files as $key => $file) {
         $filename = basename($file);
         $templates[$key]['value'] = substr($filename, 0, strrpos($filename, '.'));
         $templates[$key]['filename'] = $filename;
         $templates[$key]['filepath'] = $file;
         $templates[$key]['filesize'] = byte_format(filesize($file));
         $templates[$key]['filemtime'] = filemtime($file);
         $templates[$key]['ext'] = strtolower(substr($filename, strrpos($filename, '.') - strlen($filename)));
     }
     $this->assign('templates', $templates);
     $this->display();
 }
开发者ID:JavaAFei,项目名称:yun001,代码行数:22,代码来源:TemplateAction.class.php

示例7: index

 function index()
 {
     $tempfiles = dir_list($this->path, 'php');
     $list = $this->dao->Field('id,pay_code,status,listorder,pay_name')->select();
     foreach ((array) $list as $key => $r) {
         $installed[$r['pay_code']] = $r;
     }
     foreach ($tempfiles as $r) {
         $filename = basename($r);
         $pay_code = str_replace('.class.php', '', $filename);
         import("@.Pay." . $pay_code);
         $pay = new $pay_code();
         $paylist[$pay_code] = $pay->setup();
         if ($installed[$pay_code]) {
             $paylist[$pay_code]['id'] = $installed[$pay_code]['id'];
             $paylist[$pay_code]['status'] = $installed[$pay_code]['status'];
             $paylist[$pay_code]['listorder'] = $installed[$pay_code]['listorder'];
             $paylist[$pay_code]['pay_name'] = $installed[$pay_code]['pay_name'];
         }
     }
     $this->assign('list', $paylist);
     $this->display();
 }
开发者ID:yunsite,项目名称:yourphpcms,代码行数:23,代码来源:PaymentAction.class.php

示例8: dir_list

?>
</div> 

<hr class="chubby"> 

<div class="table_actions clearfix"> 
		
		<?php 
if ($cms_user['media']) {
    ?>
		<ul id="status_actions"> 
			<li id="status_action_delete"><a href="">Delete</a></li>
			<?php 
    // Display batch upload button if there are files in the batch folder
    if (file_exists('media/batch/')) {
        $batch_media = dir_list('media/batch/');
        if (count($batch_media) > 0) {
            ?>
					<li id="media_batch_upload"><a href="">Batch upload <span id="media_batch_total"><?php 
            echo count($batch_media);
            ?>
</span> items<span id="media_batch_percent"></span></a></li>
					<?php 
        }
    }
    ?>
		</ul> 
		<?php 
}
?>
	
开发者ID:Shairi,项目名称:directus-5-legacy,代码行数:30,代码来源:media.php

示例9: die

// admin
if ($smartysh->config["frontpage_site"] === false) {
    if ($smartysh->runtime["site_dir"] == "") {
        if (isset($_GET["action"])) {
            if ($_GET["action"] == "new_project") {
                if (isset($_GET["name"])) {
                    echo "todo new ";
                } else {
                    die("name attribute needed");
                }
            }
        }
        $smarty->template_dir = $smartysh->config["code_path"] . "/admin/templates";
        $smarty->assign("access_log", get_access_log(array("limit" => 10)));
        $smarty->assign("access_log_site", get_site_access_log(array("limit" => 10)));
        $files = dir_list($smartysh->config["basepath"]);
        foreach ($files as &$ma) {
            $tmp[] =& $ma["timestamp"];
        }
        array_multisort($tmp, SORT_DESC, $files, SORT_DESC);
        $smarty->assign("files", $files);
        $smarty->display("index.tpl");
        die;
    }
}
// load custom site functions
if (file_exists($smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/functions.php")) {
    require_once $smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/functions.php";
}
// build all templates
// todo build also logged templates
开发者ID:hkirsman,项目名称:smartysh_test2,代码行数:31,代码来源:index.php

示例10: session_start

<?php

session_start();
require_once "../../../includes/db_functions.inc.php";
require_once "../../../includes/config.inc.php";
require_once "../../../includes/filelist.inc.php";
$dir = $setting['sitepath'] . '/avatars';
$files = dir_list($dir);
$os = array("gif", "jpg", "jpeg", "png", "GIF", "JPG", "JPEG", "PNG");
$n = 0;
$num = 0;
$count = count($files);
if ($count == 0) {
    echo '<p>No free avatars available.</p>';
    exit;
}
$avquery = yasDB_select("SELECT avatar FROM avatars WHERE userid = {$_SESSION['userid']}");
if ($avquery->num_rows != 0) {
    while ($avfile = $avquery->fetch_array(MYSQL_ASSOC)) {
        echo '
		<div class="avatarpics">
		<ul>
		<li class="even"><input type="image" class="useravatars" src="' . $setting['siteurl'] . 'avatars/' . $avfile['avatar'] . '" onclick="switchAvatar(\'' . $avfile['avatar'] . '\');return false">
		<center><input type="image" src="' . $setting['siteurl'] . 'templates/' . $setting['theme'] . '/skins/' . $setting['skin'] . '/images/close.png" height="15" width="15" name="avatar" value="Remove" onclick="deleteAvatar(\'' . addslashes($avfile['avatar']) . '\');return false"/></center></li>
		</ul>
		</div>';
    }
}
$avquery->close();
while ($num < $count) {
    $file = $files[$num]['name'];
开发者ID:royalswe,项目名称:yas26,代码行数:31,代码来源:loadavatars.inc.php

示例11: die

// admin
if ($htmlwarrior->config['frontpage_site'] === false) {
    if ($htmlwarrior->runtime['site_dir'] == '') {
        if (isset($_GET['action'])) {
            if ($_GET['action'] == 'new_project') {
                if (isset($_GET['name'])) {
                    echo 'todo new ';
                } else {
                    die('name attribute needed');
                }
            }
        }
        $smarty->setTemplateDir($htmlwarrior->config['code_path'] . '/admin/templates');
        $smarty->assign('access_log', get_access_log(array('limit' => 10)));
        $smarty->assign('access_log_site', get_site_access_log(array('limit' => 10)));
        $files = dir_list($htmlwarrior->config['basepath']);
        foreach ($files as &$ma) {
            $tmp[] =& $ma['timestamp'];
        }
        array_multisort($tmp, SORT_DESC, $files, SORT_DESC);
        $smarty->assign('files', $files);
        $smarty->display('index.tpl');
        die;
    }
}
// load custom site functions
if (file_exists($htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/functions.php')) {
    require_once $htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/functions.php';
}
// load custom site configs
if (file_exists($htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/cfg/config.php')) {
开发者ID:hkirsman,项目名称:html-warrior,代码行数:31,代码来源:index.php

示例12: util_define_timezone

<?php

/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../private/lib/secu.lib.php";
require_once __DIR__ . "/../private/lib/dir.lib.php";
require_once __DIR__ . "/../private/lib/ajax.lib.php";
require_once __DIR__ . "/../private/lib/util.lib.php";
util_define_timezone();
$resp = array();
if (isset($_POST["resend"])) {
    $resp["resend"] = $_POST["resend"];
}
if (!secu_isloged() && (!isset($_POST["pass"]) || !secu_login($_POST["pass"]))) {
    echo ajax_format($resp, "wrong password.");
    exit;
}
$resp["list"] = dir_list();
echo ajax_format($resp);
开发者ID:Ricain,项目名称:Spic,代码行数:22,代码来源:list.ajax.php

示例13: ini_set

 if (!$cms_user['media']) {
     $error[] = "Media management is disabled for your account";
 } else {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Push the limits...
     ini_set("memory_limit", "104857600");
     ini_set("max_execution_time", "3600");
     ini_set("max_input_time", "3600");
     ini_set("post_max_size", "105857600");
     ini_set("upload_max_filesize", "104857600");
     ini_set("output_buffering", "on");
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Batch upload from folder
     if (isset($_GET['batch'])) {
         if (file_exists('../media/batch/')) {
             $batch_media = dir_list('../media/batch/', false, true);
             if (count($batch_media) > 0) {
                 // No need to use this GET-ID since we are deleting them as we go
                 $_POST['url_media'] = $batch_media[0];
             }
         }
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Allow for multiple files (Chrome, FireFox and Safari)
     $files_uploaded = count($_FILES['upload_media']['name']);
     $files_to_add = $files_uploaded ? $files_uploaded : 1;
     for ($file_indice = 0; $file_indice < $files_to_add; $file_indice++) {
         //////////////////////////////////////////////////////////////////////////////
         // If there are uploaded files let's set the info
         if ($files_uploaded > 0) {
             $file_upload = array();
开发者ID:Shairi,项目名称:directus-5-legacy,代码行数:31,代码来源:upload.php

示例14: copy_move_items

function copy_move_items($dir)
{
    // copy and move are only allowed if the user may read and change files
    if ($GLOBALS["action"] == "copy" && !permissions_grant_all($dir, NULL, array("read", "create"))) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if ($GLOBALS["action"] == "move" && !permissions_grant($dir, NULL, "change")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $first = $GLOBALS['__POST']["first"];
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = $GLOBALS['__POST']["new_dir"];
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // Copy or Move?
    if ($GLOBALS["action"] != "move") {
        $_img = "_img/__copy.gif";
    } else {
        $_img = "_img/__cut.gif";
    }
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        $msg = $GLOBALS["action"] != "move" ? $GLOBALS["messages"]["actcopyitems"] : $GLOBALS["messages"]["actmoveitems"];
        show_header($msg);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
    function NewDir(newdir) {
        document.selform.new_dir.value = newdir;
        document.selform.submit();
    }

    function Execute() {
        document.selform.confirm.value = "true";
    }
//-->
</script>
<?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<BR><IMG SRC=\"" . $_img . "\" align=\"ABSMIDDLE\" ALT=\"\">&nbsp;";
        echo htmlspecialchars(sprintf($GLOBALS["action"] != "move" ? $GLOBALS["messages"]["actcopyfrom"] : $GLOBALS["messages"]["actmovefrom"], $s_dir, $s_ndir));
        echo "<IMG SRC=\"_img/__paste.gif\" align=\"ABSMIDDLE\" ALT=\"\">\n";
        // Form for Target Directory & New Names
        echo "<BR><BR><FORM name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><TABLE>\n";
        echo "<INPUT type=\"hidden\" name=\"do_action\" value=\"" . $GLOBALS["action"] . "\">\n";
        echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        echo "<INPUT type=\"hidden\" name=\"first\" value=\"n\">\n";
        echo "<INPUT type=\"hidden\" name=\"new_dir\" value=\"" . htmlspecialchars($new_dir) . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</TABLE><BR><TABLE>\n";
        // Print Text Inputs to change Names
        for ($i = 0; $i < $cnt; ++$i) {
            $selitem = $GLOBALS['__POST']["selitems"][$i];
            if (isset($GLOBALS['__POST']["newitems"][$i])) {
                $newitem = $GLOBALS['__POST']["newitems"][$i];
                if ($first == "y") {
                    $newitem = $selitem;
                }
            } else {
                $newitem = $selitem;
            }
            $s_item = $selitem;
            if (strlen($s_item) > 50) {
                $s_item = substr($s_item, 0, 47) . "...";
            }
            echo "<TR><TD><IMG SRC=\"_img/_info.gif\" align=\"ABSMIDDLE\" ALT=\"\">";
            // Old Name
            echo "<INPUT type=\"hidden\" name=\"selitems[]\" value=\"";
            echo htmlspecialchars($selitem) . "\">&nbsp;" . htmlspecialchars($s_item) . "&nbsp;";
            // New Name
            echo "</TD><TD><INPUT type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
            echo htmlspecialchars($newitem) . "\"></TD></TR>\n";
        }
        // Submit & Cancel
        echo "</TABLE><BR><TABLE><TR>\n<TD>";
        echo "<INPUT type=\"submit\" value=\"";
        echo $GLOBALS["action"] != "move" ? $GLOBALS["messages"]["btncopy"] : $GLOBALS["messages"]["btnmove"];
        echo "\" onclick=\"javascript:Execute();\"></TD>\n<TD>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></TD>\n</TR></FORM></TABLE><BR>\n";
        return;
//.........这里部分代码省略.........
开发者ID:realtimeprojects,项目名称:quixplorer,代码行数:101,代码来源:fun_copy_move.php

示例15: dir_iconv

 /**
  * 转换目录下面的所有文件编码格式
  * 
  * @param	string	$in_charset		原字符集
  * @param	string	$out_charset	目标字符集
  * @param	string	$dir			目录地址
  * @param	string	$fileexts		转换的文件格式
  * @return	string	如果原字符集和目标字符集相同则返回false,否则为true
  */
 static function dir_iconv($in_charset, $out_charset, $dir, $fileexts = 'php|html|htm|shtml|shtm|js|txt|xml')
 {
     if ($in_charset == $out_charset) {
         return false;
     }
     $list = dir_list($dir);
     foreach ($list as $v) {
         if (pathinfo($v, PATHINFO_EXTENSION) == $fileexts && is_file($v)) {
             file_put_contents($v, iconv($in_charset, $out_charset, file_get_contents($v)));
         }
     }
     return true;
 }
开发者ID:sujinw,项目名称:tcphp,代码行数:22,代码来源:file.class.php


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