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


PHP listdir函数代码示例

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


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

示例1: listdir

    public static function listdir($dir, $dirs_stat)
    {
        $list = \OC\Files\Filesystem::getdirectorycontent($dir);
        if (sizeof($list) > 0) {
            $ret = '';
            //$d=explode('/',$dir);
            foreach ($list as $i) {
                if ($i['type'] == 'dir' && $i['name'] != '.') {
                    if (!isset($i['directory'])) {
                        $i['directory'] = '';
                    }
                    $ret .= '<li class="ui-droppable">
					 	<a href="./?app=files&dir=' . $i['directory'] . '/' . $i['name'] . '" data-pathname="' . $i['directory'] . '/' . $i['name'] . '">' . $i['name'] . '</a>' . listdir($dir . '/' . $i['name'], $dirs_stat) . '
						</li>
					';
                }
            }
            if ($ret != '') {
                $class = 'class="collapsed"';
                if ($dir == '' || isset($dirs_stat[$dir]) && $dirs_stat[$dir] == 'expanded') {
                    $class = 'class="expanded"';
                }
                $ret = '<ul ' . $class . ' data-path="' . $dir . '"><li></li>' . $ret . '</ul>';
            }
            return $ret;
        }
    }
开发者ID:ukitiyan,项目名称:files_tree,代码行数:27,代码来源:tree.php

示例2: print_files

 function print_files()
 {
     $data = array();
     //should declare array to be used to hold valid input files
     echo '<b>Ingesting the data files that are in the data directory!</b>';
     echo '<br>*******************************************************<br>';
     $dirfiles = listdir(ES__PLUGIN_DIR . "data");
     if ($dirfiles) {
         foreach ($dirfiles as $key => $filename) {
             if (substr($filename, -4) == '.txt' && !is_dir($filename)) {
                 $data[$filename] = php_strip_whitespace($filename);
                 $theData = make_post($filename);
                 insert_post($theData);
                 echo "<br>";
                 echo "<br>Finished.";
                 echo "<br>";
             } else {
                 $other[$filename] = !is_dir($filename) ? file_get_contents($filename) : '';
             }
         }
         $myFile = ES__PLUGIN_DIR . "/data/test.txt";
         $fh = fopen($myFile, 'r');
         $theData = fread($fh, filesize($myFile));
         fclose($fh);
     }
     insert_post($theData);
     echo "<br>";
     echo "<br>Finished.";
     echo "<br>";
 }
开发者ID:smehan,项目名称:wp-ingest,代码行数:30,代码来源:class.earthshare-ingest-admin.php

示例3: listdir

function listdir($start_dir = '.')
{
    global $foundPath;
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            # loop through the files, skipping . and .., and recursing if necessary
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                if (strpos($filepath, DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . FILENAME_ORDERS . ".php")) {
                    $foundPath = $filepath;
                }
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        # false if the function was called with an invalid non-directory argument
        $files = false;
    }
    return $files;
}
开发者ID:paynl,项目名称:zencart-plugin,代码行数:28,代码来源:return.php

示例4: hae_skannattu_lasku

function hae_skannattu_lasku($kasittele_seuraava = "")
{
    global $kukarow, $yhtiorow;
    $dir = $yhtiorow['skannatut_laskut_polku'];
    if (!is_dir($dir) or !is_writable($dir)) {
        return false;
    }
    // käydään läpi ensin käsiteltävät kuvat
    $files = listdir($dir);
    $files_count = count($files);
    // Jos ei ole yhtään tiedostoa, palautetaan false
    if ($files_count == 0) {
        return false;
    }
    // Tehdään palautusta varten array, palautetaan aina laskujen lukumäärä
    $palautus = array("lukumaara" => $files_count);
    // Katsotaan onko laskuja, jota käyttäjä voisi käsitellä
    $query = "SELECT kesken\n            FROM kuka\n            WHERE yhtio  = '{$kukarow["yhtio"]}'\n            AND extranet = ''";
    $kesken_chk_res = pupe_query($query);
    foreach ($files as $file) {
        $path_parts = pathinfo($file);
        mysql_data_seek($kesken_chk_res, 0);
        while ($kesken_chk_row = mysql_fetch_assoc($kesken_chk_res)) {
            // Jos tiedosto on tällä käyttäjällä kesken
            if (is_numeric($path_parts['filename']) and $path_parts['filename'] == $kukarow['kesken']) {
                // Palautetaan kesken -key, jos tämä on meillä kesken
                $palautus["kesken"] = $path_parts["basename"];
                $palautus["seuraava"] = $path_parts["basename"];
                return $palautus;
            } elseif ($path_parts['filename'] == $kesken_chk_row['kesken']) {
                continue 2;
            }
        }
        // Jos halutaan ottaa seuraava lasku käsittelyyn, päivitetään kuka -tiedot
        if ($kasittele_seuraava != "") {
            // Tämän tiedoston voi käsitellä seuraavaksi, laitetaan se käyttäjälle keskeneräiseksi
            list($micro, $timestamp) = explode(" ", microtime());
            $file_basename = substr($timestamp . substr($micro * 10, 0, 1), 2);
            $kukarow['kesken'] = $file_basename;
            $file_new = $dir . "/" . $file_basename . "." . $path_parts['extension'];
            $query = "UPDATE kuka SET kesken = '{$kukarow["kesken"]}'\n                WHERE yhtio = '{$kukarow["yhtio"]}'\n                AND kuka    = '{$kukarow["kuka"]}'";
            $kesken_upd_res = pupe_query($query);
            if (!rename($file, $file_new)) {
                echo t("Ei pystytä nimeämään tiedostoa") . "<br>";
                return false;
            }
            // Otetaan path parts uudesta tiedostonimestä
            $path_parts = pathinfo($file_new);
        }
        // Tämän laskun voi käsitellä
        $palautus["seuraava"] = $path_parts["basename"];
        return $palautus;
    }
    // Ei löytynyt yhtään sopivaa laskua
    return false;
}
开发者ID:Hermut,项目名称:pupesoft,代码行数:56,代码来源:ulask.php

示例5: plugin_check_main

function plugin_check_main()
{
    global $themechecks, $data, $themename;
    $files = listdir(WP_PLUGIN_DIR);
    if ($files) {
        $css = array();
        $php = array();
        $other = array();
        foreach ($files as $key => $filename) {
            if (substr($filename, -4) == '.php') {
                if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                    $php[$filename] = php_strip_whitespace($filename);
                }
            } else {
                if (substr($filename, -4) == '.css') {
                    if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                        $css[$filename] = file_get_contents($filename);
                    }
                } else {
                    if (strpos($filename, 'plugins/theme-check') == false && strpos($filename, 'plugins/akismet') == false && strpos($filename, 'plugins/plugin-check') == false) {
                        $other[$filename] = file_get_contents($filename);
                    }
                }
            }
        }
        // run the checks
        $failed = !run_themechecks($php, $css, $other);
        global $checkcount;
        // second loop, to display the errors
        $plugins = get_plugins('/theme-check');
        $version = explode('.', $plugins['theme-check.php']['Version']);
        echo '<p>Running <strong>' . $checkcount . '</strong> tests against <strong>All Plugins</strong> using Theme-check Guidelines Version: <strong>' . $version[0] . '</strong> Plugin revision: <strong>' . $version[1] . '</strong></p>';
        $results = display_themechecks();
        $success = true;
        if (strpos($results, 'WARNING') !== false) {
            $success = false;
        }
        if (strpos($results, 'REQUIRED') !== false) {
            $success = false;
        }
        if ($success === false) {
            echo '<h2>' . __('One or more errors were found</h2>', 'themecheck');
        } else {
            echo '<h2>' . __('Your plugins have passed all the tests!', 'themecheck') . '</h2>';
            tc_success();
        }
        echo '<div class="tc-box">';
        echo '<ul class="tc-result">';
        echo $results;
        echo '</ul></div>';
    }
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:52,代码来源:main.php

示例6: listdir

function listdir($dirname, $level=0){
	$ds = opendir($dirname);
	while($file = readdir($ds)){
		$path = $dirname.'/'.$file;
		if($file !='.' && $file != '..'){
			if(is_dir($path)){
				echo str_repeat('&nbsp;&nbsp', $level).'|--'.$file.'<br />';
				$level++;
				listdir($path);
			}else{
				echo str_repeat('&nbsp;&nbsp;', $level),'|--'.$file.'<br />';
			}
		}
	}
}
开发者ID:xiaoxiaoJun,项目名称:phpper,代码行数:15,代码来源:文件目录list01.php

示例7: listdir

function listdir($start_dir = '.')
{
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        $files = false;
    }
    return $files;
}
开发者ID:qqq232575,项目名称:extends,代码行数:22,代码来源:dabao.php

示例8: listdir

function listdir($dir, $dirs_stat)
{
    $dir = stripslashes($dir);
    $list = \OC\Files\Filesystem::getdirectorycontent($dir);
    if (sizeof($list) > 0) {
        $ret = '';
        foreach ($list as $i) {
            if ($i['type'] == 'dir' && $i['name'] != '.') {
                $ret .= '<li data-dir="' . $dir . '/' . $i['name'] . '" class="tree-' . $i['id'] . '"><a data-pathname="' . $dir . '/' . $i['name'] . '" class="ft_sesam"></a>';
                $ret .= '<a href="./?app=files&dir=' . $dir . '/' . $i['name'] . '" data-pathname="' . $dir . '/' . $i['name'] . '" class="ft_link">';
                $ret .= $i['name'] . '</a>';
                if (in_array($dir . '/' . $i['name'], $dirs_stat)) {
                    $ret .= listdir($dir . '/' . $i['name'], $dirs_stat);
                }
                $ret .= '</li>';
            }
        }
        if ($ret != '') {
            $ret = '<ul data-path="' . $dir . '">' . $ret . '</ul>';
        }
        return stripslashes($ret);
    }
}
开发者ID:ukitiyan,项目名称:files_tree,代码行数:23,代码来源:explore.php

示例9: listdir

function listdir($start_dir = '.')
{
    $files = array();
    if (isDir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            # loop through the files, skipping . and .., and recursing if necessary
            if (strcmp($file, '.') == 0 || strcmp($file, '..') == 0) {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            if (isDir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        # false if the function was called with an invalid non-directory argument
        $files = false;
    }
    return $files;
}
开发者ID:pc37utn,项目名称:misc_scripts,代码行数:24,代码来源:mkitemdir.php

示例10: listdir

function listdir($start_dir = '.', $root_dir = null)
{
    if ($root_dir === null) {
        $root_dir = $start_dir;
    }
    $files = array();
    if (is_dir($start_dir)) {
        $fh = opendir($start_dir);
        while (($file = readdir($fh)) !== false) {
            if ($file === '.' || $file === '..') {
                continue;
            }
            $filepath = $start_dir . '/' . $file;
            array_push($files, substr($filepath, strlen($root_dir) + 1));
            if (is_dir($filepath)) {
                $files = array_merge($files, listdir($filepath, $root_dir));
            }
        }
        closedir($fh);
    } else {
        $files = false;
    }
    return $files;
}
开发者ID:george-hopkins,项目名称:wzp_tools,代码行数:24,代码来源:wzp_pack.php

示例11: dirname

    echo "Voidaan ajaa vain komentoriviltä!!!\n";
    die;
}
if (!`which recode`) {
    echo "Tarvitaan recode -ohjelma!\n";
    die;
}
$vain_recode = FALSE;
if (isset($argv[1]) and $argv[1] != '') {
    $vain_recode = TRUE;
}
// Pupeasennuksen root
$pupe_root_polku = dirname(__FILE__);
require_once "inc/functions.inc";
// Konvertoidaan kaikki filet:
$files = listdir($pupe_root_polku);
$finfo1 = finfo_open(FILEINFO_MIME_TYPE);
$finfo2 = finfo_open(FILEINFO_MIME_ENCODING);
foreach ($files as $file) {
    if (strpos($file, "UTF8_konversio.php") !== FALSE) {
        continue;
    }
    $mime = finfo_file($finfo1, $file);
    $encd = finfo_file($finfo2, $file);
    if (substr($mime, 0, 4) == "text" and $encd != "utf-8" and $encd != "us-ascii") {
        $mitenmeni = system("recode ISO_8859-1..UTF8 {$file}");
        echo "{$file}, {$encd}\n";
    }
    if ($vain_recode) {
        continue;
    }
开发者ID:Hermut,项目名称:pupesoft,代码行数:31,代码来源:UTF8_konversio.php

示例12: render

    public function render()
    {
        ?>
		<div style="text-align:center;">
			<button type="button" id="import-btn" class="btn">
				<?php 
        echo "Import new zip files";
        ?>
			</button>
			<button type="button" id="update-btn" class="btn">
				<?php 
        echo "Update DB files";
        ?>
			</button>
		</div>
		<?php 
        $files = listdir($this->importpath);
        $fileszip = array();
        // read themelist files
        $themelist = array();
        foreach ($files as $f) {
            if (strpos($f, "themelist.csv") !== false) {
                if (($handle = fopen($f, "r")) !== FALSE) {
                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                        if (count($data) == 2) {
                            $zipfilename = $data[0];
                            $date = $data[1];
                            $themelist[$zipfilename] = $date;
                        }
                    }
                    fclose($handle);
                }
            }
        }
        $history = new History();
        $countNew = 0;
        $countTotal = 0;
        foreach ($files as $f) {
            $path_parts = pathinfo($f);
            if (isset($path_parts['extension']) && $path_parts['extension'] == "zip") {
                $zipfilename = $path_parts['basename'];
                if (isset($themelist[$zipfilename])) {
                    $timestamp = strtotime($themelist[$zipfilename]);
                    if ($timestamp > 946681200) {
                        $id = $history->getIdFromZipName($zipfilename);
                        if ($id === false) {
                            $fileszip[$f] = $timestamp;
                            $countNew++;
                        }
                        $countTotal++;
                    }
                }
            }
        }
        asort($fileszip);
        echo "<br/>Not imported yet : {$countNew} / {$countTotal}<hr>";
        foreach ($fileszip as $file => $timestamp) {
            echo date("Y-m-d", $timestamp) . ' : ' . $file . '<br>';
        }
        /*	$count = 0;
        		foreach ($fileszip as $f)
        		{
        			if ($count > 5) break;
        			if(USE_DB)
        			{
        				$hash_md5 = md5_file($f); 
        				$hash_alpha = base_convert($hash_md5, 16, 36); // shorten hash to shorten urls (better looking, less bandwidth)
        				while(strlen($hash_alpha) < 25) $hash_alpha = '0'.$hash_alpha;
        				$history = new History();
        				$themeInfo = $history->loadThemeFromHash($hash_alpha);
        				if (!empty($themeInfo)) continue;
        			}
        			
        			$path_parts = pathinfo($f);
        			$path_item = $path_parts['dirname'];
        			$filename = $path_parts['filename'].'.'.$path_parts['extension'];
        		
        			$themeInfo = FileValidator::prepareThemeInfo($path_item.'/'.$filename, $filename, 'application/zip', false);
        
        			if (!empty($themeInfo))
        			{
        				$this->fileValidator = new FileValidator($themeInfo);
        				$this->fileValidator->validate();	
        				$this->fileValidator->serialize();
        				
        				$this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
        				$themeInfo = $this->fileValidator->themeInfo;
        				echo '<p>'.htmlspecialchars($themeInfo->name).' : '.intval($themeInfo->score).'%</p>';
        				$count++;
        			}
        		}*/
        ?>
		<script>
		var zips = new Array();
		var zip_index = 0;
		var theme_id_sart = 145;
		var theme_id = theme_id_sart;
		<?php 
        $a = array_keys($fileszip);
        for ($i = 0; $i < count($a); $i++) {
//.........这里部分代码省略.........
开发者ID:Vultur,项目名称:themecheck,代码行数:101,代码来源:controller_massimport.php

示例13: listdir

function listdir($dir, $level_count = 0)
{
    if (!@($thisdir = opendir($dir))) {
        return;
    }
    while ($item = readdir($thisdir)) {
        if (is_dir("{$dir}/{$item}") && substr("{$item}", 0, 1) != '.') {
            listdir("{$dir}/{$item}", $level_count + 1);
        }
    }
    if ($level_count > 0) {
        $dir = preg_replace("/\\/\\//", "/", $dir);
        $selected = isset($_GET['folder']) && $_GET['folder'] == $dir . '/' ? "selected='selected'" : "";
        $perm = substr(sprintf('%o', fileperms($dir)), -3);
        echo "<option value=\"" . $dir . "/\" {$selected}>[{$perm}] " . $dir . "/</option>\n";
    }
    return;
}
开发者ID:vzool,项目名称:php_srrFileManager,代码行数:18,代码来源:index.php

示例14: build_path

 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once "openmediavault/autoloader.inc";
    require_once "openmediavault/globals.inc";
    require_once "openmediavault/env.inc";
    require_once "openmediavault/functions.inc";
    // Load and initialize the RPC services that are not handled by the
    // engine daemon.
    $directory = build_path(DIRECTORY_SEPARATOR, $GLOBALS['OMV_DOCUMENTROOT_DIR'], "rpc");
    foreach (listdir($directory, "inc") as $path) {
        require_once $path;
    }
    $rpcServiceMngr =& \OMV\Rpc\ServiceManager::getInstance();
    $rpcServiceMngr->initializeServices();
    // Initialize the data models.
    $modelMngr = \OMV\DataModel\Manager::getInstance();
    $modelMngr->load();
    $session =& \OMV\Session::getInstance();
    $session->start();
    $server = new \OMV\Rpc\Proxy\Json();
    $server->handle();
    $server->cleanup();
} catch (\Exception $e) {
    if (isset($server)) {
        $server->cleanup();
开发者ID:svn2github,项目名称:omv2,代码行数:31,代码来源:rpc.php

示例15: listdiraux

        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
/*
* Clean up the documentation directory from prior use
*/
if (is_dir('documentation')) {
    deltree('documentation');
}
mkdir('documentation');
$files = listdir('documentation-base');
sort($files, SORT_LOCALE_STRING);
/*
* Loop through files in documentation-base directory, creating a mirror
* structure in documentation, and applying the post-process rules defined
* below
*/
foreach ($files as $f) {
    $r = str_replace('documentation-base', 'documentation', $f);
    $dList = explode('/', $r);
    $titleList = $dList;
    /*
     * Get rid of the initial directory
     */
    array_shift($titleList);
    $depth = count($dList) - 2;
开发者ID:gohanman,项目名称:ADOdb,代码行数:31,代码来源:fix-static-docs.php


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