本文整理汇总了PHP中list_files函数的典型用法代码示例。如果您正苦于以下问题:PHP list_files函数的具体用法?PHP list_files怎么用?PHP list_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list_files函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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 :";
}
}
示例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;
}
示例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 :";
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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'];
}
示例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;
}
示例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;
}
示例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 . "");
}
}
}
}
示例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();
}
}
}
示例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;
}
}