本文整理汇总了PHP中openDir函数的典型用法代码示例。如果您正苦于以下问题:PHP openDir函数的具体用法?PHP openDir怎么用?PHP openDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了openDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadDir
function loadDir($dirName)
{
if ($handle = openDir($dirName)) {
echo "<tr class='trTitle'><td>类型</td><td>文件名</td><td>大小</td><td>最后修改时间</td><td>操作</td></tr>";
while (false !== ($files = readDir($handle))) {
if ($files != "." && $files != "..") {
$urlStrs = $dirName . "/" . $files;
if (!is_dir($dirName . "/" . $files)) {
$types = "文件";
$cons = "<a href=\"loaddir.php?action=edit&urlstr={$urlStrs}\">编辑</a>";
$className = "file";
$fileSize = getSize($dirName . "/" . $files);
$fileaTime = date("Y-m-d H:i:s", getEditTime($dirName . "/" . $files));
$arrayfile[] = "<tr class='{$className}'><td>{$types}</td><td>{$files}</td><td>" . $fileSize . " bytes</td><td>{$fileaTime}</td><td>{$cons}</td></tr>";
}
//echo "<tr class='$className'><td>$types</td><td>$files</td><td>".$fileSize." bytes</td><td>$fileaTime</td><td>$cons</td></tr>";
}
}
//$arraydirLen=count($arraydir);
//for($i=0;$i<$arraydirLen;$i++) echo $arraydir[$i];
$arrayfileLen = count($arrayfile);
for ($i = 0; $i < $arrayfileLen; $i++) {
echo $arrayfile[$i];
}
//echo $arraydir;
closeDir($handle);
}
}
开发者ID:jyyy410team,项目名称:hts,代码行数:28,代码来源:loaddir-old.php
示例2: load
public function load()
{
$this->headline = $GLOBALS['language']->getString("FILES");
if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
$_GET['dir'] = "";
}
$uploadpath = Settings::getInstance()->get("root") . "content/uploads/";
$this->template = new Template();
$this->template->load("plugin_filelistwidget_filelist");
$this->template->show_if("FILES_EXIST", false);
$this->template->show_if("NOFILES", false);
$this->template->assign_var("DIR", htmlentities($_GET['dir']));
$actions = ActionList::get("plugin_filelistwidget");
$dir = $_GET['dir'];
if (file_exists($uploadpath . $dir)) {
$this->delete($uploadpath);
$this->rename($dir, $uploadpath);
$verzeichnis = openDir($uploadpath . $dir);
$pre = "";
$path = "";
foreach (explode("/", $dir) as $cDir) {
$index = $this->template->add_loop_item("PATH");
$path .= "/" . $cDir;
if ($path == "/") {
$this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files");
$this->template->assign_loop_var("PATH", $index, "LABEL", "/");
$path = "";
} else {
$this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files&dir=" . $path);
$this->template->assign_loop_var("PATH", $index, "LABEL", $cDir);
}
}
if (trim($_GET['dir']) != "" & trim($_GET['dir']) != "/") {
$this->template->assign_var("DELETEFOLDERLINK", "<a href=\"/admin/index.php?page=files&rmdir=" . $_GET['dir'] . "\">Ordner löschen</a>");
} else {
$this->template->assign_var("DELETEFOLDERLINK", "");
}
$files = FileServer::getFiles($uploadpath . $dir);
}
if (isset($files) && sizeOf($files) > 0) {
$this->template->show_if("FILES_EXIST", true);
$this->template->show_if("NOFILES", false);
foreach ($files as $file) {
$index = $this->template->add_loop_item("FILES");
$this->template->assign_loop_var("FILES", $index, "IMAGE", $this->getImageCode($uploadpath, $dir, $file));
$this->template->assign_loop_var("FILES", $index, "FILELINK", "<a href=\"../content/uploads" . $dir . "/" . $file . "\">" . $file . "</a>");
$params = array();
$params['dir'] = $_GET['dir'];
$params['file'] = $file;
$this->template->assign_loop_var("FILES", $index, "ACTIONS", $actions->getCode($params));
}
} else {
$this->template->show_if("FILES_EXIST", false);
$this->template->show_if("NOFILES", true);
}
$this->template->assign_var("MESSAGE", "");
$this->content = $this->template->getCode();
}
开发者ID:srueegger,项目名称:1zu12bB,代码行数:58,代码来源:filelistwidget.php
示例3: loadAll
public function loadAll()
{
$pluginpath = Settings::getInstance()->get("root") . "system/plugins";
$oDir = openDir($pluginpath);
while ($item = readDir($oDir)) {
$this->AddInfo($item);
}
closeDir($oDir);
}
开发者ID:srueegger,项目名称:1zu12bB,代码行数:9,代码来源:pluginlist.php
示例4: get_teaser_array
/**
* This function returns a list of teaser - images contained in the $teaser - directory
*/
function get_teaser_array($teaser_directory)
{
$teaser_array = array();
$directory = openDir($teaser_directory);
while ($file = readDir($directory)) {
if ($file != "." && $file != "..") {
array_push($teaser_array, $teaser_directory . $file);
}
}
closeDir($directory);
return $teaser_array;
}
开发者ID:sleekshop,项目名称:demoshop,代码行数:15,代码来源:teaser.inc.php
示例5: getFiles
function getFiles()
{
//get list of all files for use in other routines
global $dirPtr, $theFiles;
chdir(".");
$dirPtr = openDir(".");
$currentFile = readDir($dirPtr);
while ($currentFile !== false) {
$theFiles[] = $currentFile;
$currentFile = readDir($dirPtr);
}
// end while
}
开发者ID:ashutoshdev,项目名称:phptutorials-1,代码行数:13,代码来源:QuizMachine.php
示例6: get_filelist
private function get_filelist()
{
$filelist = array();
$contentfolderpath = 'content/';
$contentfolder = openDir($contentfolderpath);
while ($file = readDir($contentfolder)) {
if ($file != "." && $file != ".." && !is_dir($contentfolderpath . "/" . $file)) {
$pathparts = pathinfo($file);
$filelist[$pathparts['filename']] = $file;
}
}
closeDir($contentfolder);
return $filelist;
}
开发者ID:Drakenson,项目名称:DrakeWork,代码行数:14,代码来源:worker.class.php
示例7: getFolders
/**
*
* @param string $dir
* @return array
*/
public static function getFolders($dir)
{
$res = array();
$oDir = openDir($dir);
while ($item = readDir($oDir)) {
if (is_dir($dir . "/" . $item)) {
if ($item != "." && $item != "..") {
$res[] = $item;
}
}
}
closeDir($oDir);
return $res;
}
开发者ID:srueegger,项目名称:1zu12bB,代码行数:19,代码来源:fileserver.php
示例8: copyFiles
/**
* Copies all files from one directory to another directory.
* @param string $sourceDirectory The source directory.
* @param string $targetDirectory The target directory.
*/
public function copyFiles($sourceDirectory, $targetDirectory)
{
$dir = openDir($sourceDirectory);
@mkDir($targetDirectory);
while (false !== ($file = readDir($dir))) {
if ($file == '.' || $file == '..') {
continue;
}
if (is_dir($sourceDirectory . '/' . $file)) {
$this->copyFiles($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
} else {
copy($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
}
}
closeDir($dir);
}
开发者ID:rutgerkok,项目名称:rCMS,代码行数:21,代码来源:BulkFileSystem.php
示例9: __construct
/**
* @param string $configDir
*/
public function __construct($configDir)
{
$yml = new Parser();
$configFilesPath = [];
if (is_dir($configDir)) {
$dirHandler = openDir($configDir);
while ($data = readdir($dirHandler)) {
$configFilesPath[] = $data;
}
$configFilesPath = array_diff($configFilesPath, ['.', '..']);
closedir();
}
$config = [];
foreach ($configFilesPath as $configFilePath) {
$config[$configFilePath] = $yml->parse(file_get_contents($configDir . '/' . $configFilePath));
}
$this->config = $config;
}
开发者ID:valous,项目名称:captcha,代码行数:21,代码来源:Config.php
示例10: loadClassPath
/**
* Метод рекурсивно собирает все классы в директории.
*
* @param string $dirAbsPath - путь к директории
* @param array $classes - карта [PsUtil] => [C:/www/postupayu.ru/www/kitcore/utils/PsUtil.php]
* @param bool $skipDirClasses - пропускать ли классы в корневой директории.
* Флаг позволит не подключать классы, лежащие в корне kitcore,
* так как их мы подключим сами (Globals, Defines, PsCoreIncluder)
*/
public static function loadClassPath($dirAbsPath, array &$classes, $skipDirClasses)
{
if (!is_dir($dirAbsPath)) {
return;
//---
}
$dir = openDir($dirAbsPath);
while ($file = readdir($dir)) {
if (!is_valid_file_name($file)) {
continue;
}
$isphp = ends_with($file, '.php');
if ($isphp && $skipDirClasses) {
continue;
}
$path = next_level_dir($dirAbsPath, $file);
if ($isphp) {
$classes[cut_string_end($file, '.php')] = $path;
} else {
self::loadClassPath($path, $classes, false);
}
}
closedir($dir);
}
开发者ID:ilivanoff,项目名称:www,代码行数:33,代码来源:PsCoreIncluder.php
示例11: array
$zaehler = 0;
$zeit = 0;
//Arrays für ansprechende Zeitausgabe
$monate = array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
$tage = array("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag");
//Nun die Routine, um Dateien aus einem Verzeichnis auszulesen:
//Erstes Verzeichnis wird geöffnet:
$topdir = openDir("../graph");
//Jede Datei in erstem Verzeichnis ausgelesen:
while ($topfile = readDir($topdir)) {
//Überprüfung, ob die Datei kein versteckter Ordner ist, wenn nicht wird ein Titel geschrieben
if (substr($topfile, 0, 1) != ".") {
echo "<div class=\"titel\"><h1>{$topfile}</h1></div>";
echo "<div class=\"liste\">";
//Gefundenes Kategorienverzeichnis wird geöffnet und nun nach Bildern durchsucht. JS-Links werden generiert.
$categorydir = openDir("../graph/{$topfile}");
while ($file = readDir($categorydir)) {
if (substr($file, 0, 1) != ".") {
echo "<a href='javascript:anzeigen(\"../graph/{$topfile}/{$file}\")' id=\"{$zaehler}\">{$file}</a><br>\n";
$zaehler = $zaehler + 1;
//Datei mit der Höchsten änderungszeit wird gesucht
if (filemtime("../graph/{$topfile}/{$file}") > $zeit) {
$zeit = fileatime("../graph/{$topfile}/{$file}");
}
}
}
//Zeiten werden formatiert
$zeit_monat = $monate[date("n", $zeit) - 1];
$zeit_tag = $tage[date("N", $zeit) - 1];
$zeit_datum = date("d.", $zeit);
$zeit_uhrzeit = date("H:i:s", $zeit);
开发者ID:jogi91,项目名称:purepo,代码行数:31,代码来源:index.php
示例12: getCover
/**
* Title
*
* Description
*
* @access public
*/
function getCover($path) {
$common_covers=array('cover.jpg');
foreach($common_covers as $file) {
if (file_exists($path.$file)) {
return $file;
}
}
//search for images
@$d=openDir($path);
if ($d) {
$files=array();
$biggest_size=0;
$biggest_file='';
while ($file=readDir($d)) {
if (preg_match('/\.jpg$/is', $file)
|| preg_match('/\.jpeg$/is', $file)
|| preg_match('/\.gif$/is', $file)
|| preg_match('/\.png$/is', $file)
) {
$file_size=filesize($path.$file);
if ($file_size>$biggest_size) {
$biggest_size=$file_size;
$biggest_file=$file;
}
//$files=array('FILENAME'=>$file);
}
}
closeDir($d);
if ($biggest_file) {
return $biggest_file;
}
}
}
开发者ID:novozhenets,项目名称:majordomo,代码行数:44,代码来源:app_mediabrowser.class.php
示例13: poidsDossier
public static function poidsDossier($dossier)
{
$dir = openDir($dossier);
$poids = 0;
while ($f = readdir($dir)) {
if ($f != '.' && $f != '..') {
if (is_dir($dossier . $f)) {
$poids += poidsDossier($dossier . $f . '/');
} else {
$poids += filesize($dossier . $f);
}
}
}
return $poids;
}
开发者ID:Elrenardo,项目名称:FoxFWcms-4,代码行数:15,代码来源:FoxFWFile.php
示例14: getSubDirNames
/**
* Получает названия папок, вложенных в переданную директорию
*
* @param array $allowed - список допустимых названий подпапок
*/
public final function getSubDirNames($dirs = null, $allowed = null, $denied = null)
{
$result = array();
$allowed = $allowed === null ? null : to_array($allowed);
if (is_array($allowed) && empty($allowed)) {
return $result;
}
$denied = $denied === null ? null : to_array($denied);
$absDirPath = $this->absDirPath($dirs);
if (is_dir($absDirPath)) {
$dir = openDir($absDirPath);
if ($dir) {
$absDirPath = ensure_dir_endswith_dir_separator($absDirPath);
while ($file = readdir($dir)) {
if (!is_valid_file_name($file)) {
continue;
}
if (is_array($allowed) && !in_array($file, $allowed)) {
continue;
}
if (is_array($denied) && in_array($file, $denied)) {
continue;
}
if (is_dir($absDirPath . $file)) {
$result[] = $file;
}
}
closedir($dir);
}
}
return $result;
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:37,代码来源:DirManager.php
示例15: getNotYetInstalledPlugins
function getNotYetInstalledPlugins()
{
$col = array();
$paths = array($this->_getCustomPluginsRoot(), $this->_getOfficialPluginsRoot());
$exclude = array('.', '..', 'CVS', '.svn');
foreach ($paths as $path) {
$dir = openDir($path);
while ($file = readDir($dir)) {
if (!in_array($file, $exclude) && is_dir($path . '/' . $file)) {
if (!$this->isPluginInstalled($file) && !in_array($file, $col)) {
$col[] = $file;
}
}
}
closeDir($dir);
}
return $col;
}
开发者ID:nterray,项目名称:tuleap,代码行数:18,代码来源:PluginFactory.class.php
示例16: openDir
<?php
$htmlDir = "../htmlObjectHarness";
$svgViewer = "../SvgViewer.swf";
$fhDir = openDir($htmlDir);
while ($file = readdir($fhDir)) {
$file = $htmlDir . "/" . $file;
if (preg_match('/\\.htm[l]*$/si', $file)) {
$fh = fopen($file, "r");
$content = fread($fh, filesize($file));
fclose($fh);
if (preg_match('/<object.*?\\/>/si', $content, $match)) {
if (stripos($match[0], 'classid="') === false) {
if (!preg_match('/data="([^"]+)" width="([^"]+)" height="([^"]+)"/si', $match[0], $matches)) {
print "Error updateing file: {$file}\n";
break;
}
$svg = $matches[1];
$width = $matches[2];
$height = $matches[3];
$newTag = '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="" id="mySVGViewerObj" width=' . $width . ' height=' . $height . '>
<param name=movie value="' . $svgViewer . '">
<param name="FlashVars" value="sourceType=url_svg&svgURL=' . $svg . '">
<param name="wmode" value="transparent">
<embed play=false name="mySVGViewerObj"
src="' . $svgViewer . '" quality=high wmode="transparent"
width=' . $width . ' height=' . $height . ' type="application/x-shockwave-flash"
FlashVars="sourceType=url_svg&svgURL=' . $svg . '">
</embed >
开发者ID:haibalai,项目名称:svg-viewer,代码行数:31,代码来源:updateHtmlObjectsToSwf.php
示例17: _registerPlugins
/**
* Seeks out plugins in the filesystem and puts them in a nice array
* These plugins are not necessarily installed
*
* @access public
* @since 2/23/06
*/
function _registerPlugins($directory)
{
$_SESSION['registeredPlugins'] = array();
// open the plugin directory
if ($directory != 'plugins-dist' && $directory != 'plugins-local') {
throw new InvalidArgumentException("'{$directory}' should be 'plugins-dist' or 'plugins-local'");
}
$plugPath = MYDIR . "/" . $directory . "/";
$pDirHandle = openDir($plugPath);
// directories that should be there and are not plugins
$ignore = array(".", "..", "CVS");
// first grab a domain folder and then look inside it
while ($domainDir = readdir($pDirHandle)) {
$domainPath = $plugPath . "/" . $domainDir;
if (is_dir($domainPath) && !in_array($domainDir, $ignore) && preg_match("/^[a-zA-Z0-9_]+\$/", $domainDir)) {
$domain = $domainDir;
$dDirHandle = openDir($domainPath);
// now take an authority folder and open it
while ($authDir = readdir($dDirHandle)) {
$authPath = $domainPath . "/" . $authDir;
if (is_dir($authPath) && !in_array($authDir, $ignore) && preg_match("/^[a-zA-Z0-9\\._]+\$/", $authDir)) {
$authority = $authDir;
$aDirHandle = openDir($authPath);
// finally find all the keyword folders (each is a plugin)
while ($keyDir = readdir($aDirHandle)) {
$keyPath = $authPath . "/" . $keyDir;
if (is_dir($keyPath) && !in_array($keyDir, $ignore) && preg_match("/^[a-zA-Z0-9_]+\$/", $keyDir)) {
$keyword = $keyDir;
$type = new Type($domain, $authority, $keyword);
$indexString = $type->asString();
// unique types are placed in the array
if (!isset($_SESSION['registeredPlugins'][$indexString])) {
$_SESSION['registeredPlugins'][$indexString] = $type;
}
}
}
}
}
}
}
}
开发者ID:adamfranco,项目名称:segue,代码行数:48,代码来源:PluginManager.class.php
示例18: files
function files($parameters="") {
global $REQUEST_URI;
global $out;
global $mode;
$dir=str_replace('\\\'', "'", $_SERVER['REQUEST_URI']);
$dir=preg_replace("/^\/.*?\//", "./", $dir);
$dir=preg_replace("/\?.*?$/", "", $dir);
$dir=urldecode($dir);
//echo utf2win($dir);
//exit;
$paths=split("/", $dir);
$old="";
$history=array();
foreach($paths as $v) {
if ($v=="") continue;
if ($v==".") continue;
$rec=array();
$rec['TITLE']=$v;
$rec['PATH']=$old."$v/";
$old.="$v/";
$history[]=$rec;
}
$out['HISTORY']=$history;
$out['CURRENT_DIR_TITLE']=($dir);
$out['CURRENT_DIR']=urlencode($dir);
$act_dir=INIT_DIR."$dir";
if (@$mode=="descr") {
global $file;
global $new_descr;
global $REMOTE_ADDR;
global $can_edit;
if (strpos($can_edit, $REMOTE_ADDR)>0) setDescription($act_dir, $file, $new_descr);
$mode="";
header("Location:?\n\n");
exit;
}
$descriptions=getDescriptions($act_dir);
$d=openDir($act_dir);
$dirs=array();
while ($file=readDir($d)) {
if (($file==".") || ($file=="..")) {
continue;
}
if (Is_Dir($act_dir.$file)) {
$rec=array();
$rec['TITLE']=$file;
$rec['TITLE_SHORT']=$rec['TITLE'];
if (strlen($rec['TITLE_SHORT'])>30) {
$rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 30).'...';
}
if (IsSet($descriptions[$file])) {
$rec['DESCR']=$descriptions[$file];
}
$rec['PATH']=urlencode("$file").'/';
$rec['REAL_PATH']=$dir.$file;
$dirs[]=$rec;
}
}
closeDir($d);
$dirs=mysort_array($dirs, "TITLE");
if (count($dirs)>0) $out['DIRS']=$dirs;
$d=openDir($act_dir);
$files=array();
while ($file=readDir($d)) {
if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
continue;
}
if (Is_File($act_dir.$file)) {
$rec=array();
$rec['TITLE']=$file;
if (IsSet($descriptions[$file])) {
$rec['DESCR']=$descriptions[$file];
}
if (strlen($rec['TITLE'])>30) {
$rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 30)."...";
} else {
$rec['TITLE_SHORT']=$rec['TITLE'];
}
$rec['PATH']="$file";
$size=filesize($act_dir.$file);
$total_size+=$size;
if ($size>1024) {
if ($size>1024*1024) {
$size=(((int)(($size/1024/1024)*10))/10)." Mb";
} else {
$size=(int)($size/1024)." Kb";
}
} else {
$size.=" b";
}
//.........这里部分代码省略.........
开发者ID:novozhenets,项目名称:majordomo,代码行数:101,代码来源:app_run.php
示例19: _SIZE_get
/**
* Function that will doest the sum of files in the directory
*
* @param string sFolder, required. the path to check
* @param bool bSubfolders, optional, default value TRUE; do you wants the list of the subfolders too?
* @private
* @type int
**/
function _SIZE_get($sFolder, $bSubfolders)
{
$sum = -1;
$dir = openDir(realpath($sFolder));
while ($oObj = readDir($dir)) {
if (is_file(realpath($sFolder) . $this->cSep . $oObj)) {
$sum += filesize(realpath($sFolder) . $this->cSep . $oObj);
}
if ($bSubfolders && is_dir(realpath($sFolder) . $this->cSep . $oObj) && $oObj != '.' && $oObj != '..') {
$sum += $this->_SIZE_get(realpath($sFolder) . $this->cSep . $oObj, TRUE);
}
}
//while
closeDir($dir);
return $sum;
}
开发者ID:BackupTheBerlios,项目名称:nxwcms-svn,代码行数:24,代码来源:class_dir.php
示例20: getModulesList
function getModulesList()
{
$dir = openDir(DIR_MODULES);
$lst = array();
while ($file = readDir($dir)) {
if (Is_Dir(DIR_MODULES . "{$file}") && $file != "." && $file != "..") {
$rec = array();
$rec['FILENAME'] = $file;
$lst[] = $rec;
}
}
function cmp_modules($a, $b)
{
return strcmp($a["FILENAME"], $b["FILENAME"]);
}
usort($lst, 'cmp_modules');
$this->modules = $lst;
return $lst;
}
开发者ID:AirKing555,项目名称:majordomo,代码行数:19,代码来源:control_modules.class.php
注:本文中的openDir函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论