本文整理汇总了PHP中list_files函数的典型用法代码示例。如果您正苦于以下问题:PHP list_files函数的具体用法?PHP list_files怎么用?PHP list_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list_files函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: amr_ical_uninstall
function amr_ical_uninstall()
{
if (function_exists('delete_option')) {
// delete all options we may have used over time
delete_option('amr-ical-calendar_preview_url');
delete_option('amr-ical-events-version');
delete_option('amr-ical-events-list');
delete_option("amricalWidget");
delete_option("amr-ical-widget");
delete_option('amr-ical-images-to-use');
echo '<p>' . __('amr ical options deleted from database', 'amr-ical-events-list') . '</p>';
unlink();
// now look for and delete cache files in upload dir
$upload_dir = wp_upload_dir();
$dir_to_delete = $upload_dir . '/ical-events-cache/';
$files = list_files($dir_to_delete);
if ($files) {
$files_to_delete = array_merge($files_to_delete, $files);
}
$deleted = $wp_filesystem->delete($dir_to_delete, true);
// delete recurively
echo '<p>' . __('amr ical cached ics files deleted ', 'amr-ical-events-list') . '</p>';
echo '<p>' . __('Css files may also exist. They and the css folder have not been deleted as they have been shared with other plugins.', 'amr-ical-events-list') . '</p>';
$cssdir = $upload_dir . '/css/';
$files = list_files($cssdir);
foreach ($files as $i => $file) {
echo '<br />' . $file;
}
} else {
echo '<p>Wordpress Function delete_option does not exist.</p>';
return false;
}
}
开发者ID:greg3560,项目名称:plailly,代码行数:33,代码来源:uninstall.php
示例2: list_files
function list_files($dir)
{
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
try {
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$dizin = opendir($dir);
while ($dosya = readdir($dizin)) {
if (strpos($dosya, '.') !== FALSE) {
if ($dosya != "." && $dosya != "..") {
$name = $dir . "/" . $dosya;
$sql = "SELECT name FROM dizinler WHERE name = '" . $name . "' ";
$result = $conn->query($sql);
if (!($result->num_rows > 0)) {
echo $name . " - bu dosya onceki veritabaninde yok kontrol etmek isteyebilirsiniz.</br>";
}
}
} else {
if ($dosya != "." && $dosya != "..") {
list_files($dir . "/" . $dosya . "");
}
}
}
$conn->close();
} catch (Exception $e) {
echo "Hata :";
}
}
开发者ID:vtataroglu,项目名称:BirKacPhPKodu,代码行数:33,代码来源:tespit.php
示例3: list_files
function list_files($dir, $follow_links)
{
$result = array();
if (TRUE == is_dir($dir)) {
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if (TRUE == is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$result = array_merge(list_files($dir . DIRECTORY_SEPARATOR . $file, $follow_links), $result);
} else {
if (TRUE == is_file($dir . DIRECTORY_SEPARATOR . $file)) {
$result[] = $dir . DIRECTORY_SEPARATOR . $file;
} else {
if (TRUE == is_link($dir . DIRECTORY_SEPARATOR . $file)) {
if (TRUE == $follow_links) {
if (TRUE == is_file(readlink($dir . DIRECTORY_SEPARATOR . $file))) {
$result[] = readlink($dir . DIRECTORY_SEPARATOR . $file);
} else {
if (TRUE == is_dir(readlink($dir . DIRECTORY_SEPARATOR . $file))) {
$result = array_merge(list_files(readlink($dir . DIRECTORY_SEPARATOR . $file), $follow_links), $result);
}
}
}
}
}
}
}
}
return $result;
}
开发者ID:jaegerindustries,项目名称:password_search,代码行数:29,代码来源:password_search.php
示例4: list_files
function list_files($dir)
{
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
try {
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$dizin = opendir($dir);
while ($dosya = readdir($dizin)) {
if (strpos($dosya, '.') !== FALSE) {
if ($dosya != "." && $dosya != "..") {
$name = $dir . "/" . $dosya;
$sql = "INSERT INTO dizinler (name) VALUES ('" . $name . "')";
if ($conn->query($sql) === TRUE) {
echo "OK : " . $name . "</br>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
} else {
if ($dosya != "." && $dosya != "..") {
list_files($dir . "/" . $dosya . "");
}
}
}
$conn->close();
} catch (Exception $e) {
echo "Hata :";
}
}
开发者ID:vtataroglu,项目名称:BirKacPhPKodu,代码行数:34,代码来源:kaydet.php
示例5: list_files
/**
* Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep.
* The depth of the recursiveness can be controlled by the $levels param.
*
* @since 2.6.0
*
* @param string $folder Full path to folder
* @param int $levels (optional) Levels of folders to follow, Default: 100 (PHP Loop limit).
* @return bool|array False on failure, Else array of files
*/
function list_files($folder = '', $levels = 100)
{
if (empty($folder)) {
return false;
}
if (!$levels) {
return false;
}
$files = array();
if ($dir = @opendir($folder)) {
while (($file = readdir($dir)) !== false) {
if (in_array($file, array('.', '..'))) {
continue;
}
if (is_dir($folder . '/' . $file)) {
$files2 = list_files($folder . '/' . $file, $levels - 1);
if ($files2) {
$files = array_merge($files, $files2);
} else {
$files[] = $folder . '/' . $file . '/';
}
} else {
$files[] = $folder . '/' . $file;
}
}
}
@closedir($dir);
return $files;
}
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:39,代码来源:file.php
示例6: get_download_files
function get_download_files()
{
$base_dir = 'attachment/downloads';
$files = list_files($base_dir, "", 0, false);
$retval = array();
foreach ($files as $file) {
$retval[$file] = $file;
}
return $retval;
}
开发者ID:articaST,项目名称:integriaims,代码行数:10,代码来源:functions_file_releases.php
示例7: get_template_files
function get_template_files()
{
$base_dir = 'include/mailtemplates';
$files = list_files($base_dir, ".tpl", 1, 0);
$retval = array();
foreach ($files as $file) {
$retval[$file] = $file;
}
return $retval;
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:10,代码来源:setup_mailtemplates.php
示例8: get_font_files
function get_font_files()
{
global $config;
$base_dir = $config['homedir'] . '/include/fonts';
$files = list_files($base_dir, ".ttf", 1, 0);
$retval = array();
foreach ($files as $file) {
$retval[$config['homedir'] . 'include/fonts/' . $file] = $file;
}
return $retval;
}
开发者ID:articaST,项目名称:integriaims,代码行数:11,代码来源:setup_visual.php
示例9: get_logo_files
function get_logo_files()
{
$base_dir = 'images/custom_logos';
$files = list_files($base_dir, ".png", 1, 0);
$files = array_merge($files, list_files($base_dir, ".jpg", 1, 0));
$files = array_merge($files, list_files($base_dir, ".gif", 1, 0));
$retval = array();
foreach ($files as $file) {
$retval["custom_logos/{$file}"] = $file;
}
return $retval;
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:12,代码来源:setup_crm.php
示例10: __construct
/**
* Constructor
* Loads the spam rules from the admin/resources/spam_rules directory.
*
* @return Void Does not return anything.
*/
public function __construct() {
$spam_rule_files = list_files(SENDSTUDIO_RESOURCES_DIRECTORY . '/spam_rules');
foreach ($spam_rule_files as $spam_rule) {
$filename_parts = pathinfo($spam_rule);
if (isset($filename_parts['extension']) && $filename_parts['extension'] == 'php') {
require(SENDSTUDIO_RESOURCES_DIRECTORY . '/spam_rules/' . $spam_rule);
}
}
$this->rules = &$GLOBALS['Spam_Rules'];
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:18,代码来源:spam_check.php
示例11: list_files
function list_files($dir)
{
$result = array();
if (is_dir($dir) === TRUE) {
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if (is_dir("{$dir}/{$file}") === TRUE) {
$result = array_merge(list_files("{$dir}/{$file}"), $result);
} else {
$result[] = "{$dir}/{$file}";
}
}
}
return $result;
}
开发者ID:LucaBongiorni,项目名称:password_search,代码行数:15,代码来源:password_search.php
示例12: list_files
function list_files($dir)
{
$result = array();
if (TRUE === is_dir($dir)) {
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if (TRUE === is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$result = array_merge(list_files($dir . DIRECTORY_SEPARATOR . $file), $result);
} else {
$result[] = $dir . DIRECTORY_SEPARATOR . $file;
}
}
}
return $result;
}
开发者ID:nhavens,项目名称:password_search,代码行数:15,代码来源:password_search.php
示例13: list_files
function list_files($dir)
{
$dizin = opendir($dir);
while ($dosya = readdir($dizin)) {
if (strpos($dosya, '.') !== FALSE) {
if ($dosya != "." && $dosya != "..") {
$name = $dir . "/" . $dosya;
kontrolEt(file_get_contents($name), $name);
}
} else {
if ($dosya != "." && $dosya != "..") {
list_files($dir . "/" . $dosya . "");
}
}
}
}
开发者ID:vtataroglu,项目名称:BirKacPhPKodu,代码行数:16,代码来源:scan.php
示例14: upload
function upload($the_file)
{
global $the_path, $the_file_name;
$error = validate_upload($the_file);
if ($error) {
form($error);
} else {
# cool, we can continue
if (!@copy($the_file, $the_path . $the_file_name)) {
form("\n<b>Error, check the path to and the permissions for the upload directory</b>");
} else {
chmod($the_path . $the_file_name, 0755);
list_files();
form();
}
}
}
开发者ID:radicalsuz,项目名称:amp,代码行数:17,代码来源:doc_upload.php
示例15: list_files
/**
* List files recursivly and scan them
*
* @return bool
*/
function list_files($prefix, $path, &$userdata)
{
if (is_dir($prefix . $path) && is_resource($handle = @opendir($prefix . $path))) {
while ($name = readdir($handle)) {
if (strpos($name, ".xml") !== false) {
scan_file($prefix, $path . $name, $userdata);
} else {
if (is_dir($prefix . $path . $name) && $name !== 'CVS' && $name !== '.' && $name !== '..') {
list_files($prefix, $path . $name . DIRECTORY_SEPARATOR, $userdata);
}
}
}
closedir($handle);
return true;
} else {
return false;
}
}
开发者ID:guoyu07,项目名称:NYAF,代码行数:23,代码来源:script-skel.php
示例16: main
function main($in_dir, $out_dir)
{
require_once __DIR__ . "/app.php";
$files_parsed = 0;
$postData = new Aruna\Micropub\PostData();
foreach (list_files($in_dir) as $file) {
// read post_data
$in_filename = $file[0];
$out_filename = $out_dir . "/" . basename($in_filename, ".json") . ".html";
$post_data = json_decode(file_get_contents($in_filename), true);
// convert mf json to viewModel
$view_model = new Aruna\PostViewModel($postData->toMfArray($post_data));
// render viewModel as html
$post_html = $app['twig']->render("post_" . $view_model->type() . ".html", array("post" => $view_model));
file_put_contents($out_filename, $post_html);
$files_parsed += 1;
}
print sprintf("Processed %s files", $files_parsed);
}
开发者ID:j4y-funabashi,项目名称:aruna,代码行数:19,代码来源:convert_aruna_json.php
示例17: list_files
function list_files($dir)
{
if ($dh = opendir($dir)) {
$files = array();
$inner_files = array();
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (is_dir($dir . "/" . $file)) {
$inner_files = list_files($dir . "/" . $file);
if (is_array($inner_files)) {
$files = array_merge($files, $inner_files);
}
} else {
array_push($files, $dir . "/" . $file);
}
}
}
closedir($dh);
return $files;
}
}
开发者ID:rocketpastsix,项目名称:foxycms,代码行数:21,代码来源:list_files.php
示例18: list_files
/**
* List all files from a directory in an array
*
* @param string $directory The source directory
* @param string $expression [optional] Regex for filtering result filenames
* @param bool $recursive [optional] Boolean value if listing will be recursive
*
* @return array
*/
function list_files($directory, $expression = null, $recursive = true)
{
$files = array();
if (!is_dir($directory)) {
return $files;
}
$fsentries = glob(rtrim(rtrim($directory, '/'), '\\') . '/*');
foreach ($fsentries as $path) {
if (is_dir($path) && $recursive) {
$files = array_merge($files, list_files($path, $expression, $recursive));
}
# If current is file
#
if (is_file($path)) {
if ($expression != null && in_array(preg_match($expression, $path), array(false, 0))) {
continue;
}
array_push($files, realpath($path));
}
}
sort($files, SORT_STRING);
return $files;
}
开发者ID:allenlinatoc,项目名称:assetmon,代码行数:32,代码来源:functions.php
示例19: function
/**
* Function ListFiles
*
* Creates list of files in a given directory and all its subdirectories.
*
* @param string $dir
* @param string $extension
*
* @return ... returns array with file names
*
====== Additional resources on this function ======
(1) PHP scandir function
(2) http://www.webmaster-talk.com/php-forum/41811-list-files-in-directory-sub-directories.html
>>> The site provides the following function (below), which was slightly modified
to extract only files with specified extension
function ListFiles($dir) {
if($dh = opendir($dir)) {
$files = Array();
$inner_files = Array();
while($file = readdir($dh)) {
if($file != "." && $file != ".." && $file[0] != '.') {
if(is_dir($dir . "/" . $file)) {
$inner_files = ListFiles($dir . "/" . $file);
if(is_array($inner_files)) $files = array_merge($files, $inner_files);
} else {
array_push($files, $dir . "/" . $file);
}
}
}
closedir($dh);
return $files;
}
}
====== Usage example: looping through all XML files ======
foreach (list_files('/home', 'xml') as $key=>$file){
echo $file ."<br />";
}
*
*
*/
function list_files($dir, $extension)
{
if ($dh = opendir($dir)) {
$files = array();
$inner_files = array();
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$inner_files = list_files($dir . DIRECTORY_SEPARATOR . $file, $extension);
if (is_array($inner_files)) {
$files = array_merge($files, $inner_files);
}
} else {
if (file_extension($file) == $extension) {
//add files with the specified extension
array_push($files, $dir . DIRECTORY_SEPARATOR . $file);
}
}
}
}
closedir($dh);
return $files;
}
}
开发者ID:ondkal,项目名称:utils,代码行数:76,代码来源:list_files.php
示例20: add_dir
/**
* Add a directory full of images
*
* @param $base string
* @return array
*/
function add_dir($base)
{
$results = array();
foreach (list_files($base) as $full_path) {
$short_path = str_replace($base, "", $full_path);
$filename = basename($full_path);
$tags = path_to_tags($short_path);
$result = "{$short_path} (" . str_replace(" ", ", ", $tags) . ")... ";
try {
add_image($full_path, $filename, $tags);
$result .= "ok";
} catch (UploadException $ex) {
$result .= "failed: " . $ex->getMessage();
}
$results[] = $result;
}
return $results;
}
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:24,代码来源:imageboard.pack.php
注:本文中的list_files函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论