當前位置: 首頁>>代碼示例>>PHP>>正文


PHP list_files函數代碼示例

本文整理匯總了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;
    }
}
開發者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


注:本文中的list_files函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。