• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP findFiles函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: findFiles

function findFiles($dir)
{
    $dir = trim($dir);
    if (substr($dir, -1) != '/') {
        $dir .= "/";
    }
    $files = array();
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file == "." || $file == "..") {
                    continue;
                }
                switch (filetype($dir . $file)) {
                    case "file":
                        if (substr($file, -4) == ".php") {
                            $files[] = $dir . $file;
                        }
                        break;
                    case "dir":
                        $files = array_merge($files, findFiles($dir . $file));
                        break;
                }
            }
            closedir($dh);
        }
    }
    return $files;
}
开发者ID:arif4562,项目名称:GAE-IP-TO-COUNTRY,代码行数:29,代码来源:parser.php


示例2: searchSourceFiles

 protected function searchSourceFiles()
 {
     if (!$this->config['quiet']) {
         printf("Pack source files in path %s\n", $this->config['srcpath']);
     }
     $files = array();
     findFiles($this->config['srcpath'], $files);
     return $files;
 }
开发者ID:wuzongan,项目名称:myproject,代码行数:9,代码来源:ResEncrypt.php


示例3: findAllFiles

function findAllFiles($paths)
{
    $dirs = allDirs($paths);
    $files = array();
    foreach ($dirs as $dir) {
        $files = array_merge($files, findFiles($dir));
    }
    return $files;
}
开发者ID:janpaul123,项目名称:photoframed,代码行数:9,代码来源:dirs.php


示例4: filesautocomplete

 function filesautocomplete(Silex\Application $app, Request $request)
 {
     $term = $request->get('term');
     if (empty($_GET['ext'])) {
         $extensions = 'jpg,jpeg,gif,png';
     } else {
         $extensions = $_GET['extensions'];
     }
     $files = findFiles($term, $extensions);
     $app['debug'] = false;
     return $app->json($files);
 }
开发者ID:robertkraig,项目名称:bolt,代码行数:12,代码来源:Async.php


示例5: findFiles

function findFiles($base, $dir, &$results = [])
{
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        $name = $path;
        $i = strpos($name, $base);
        $name = substr($name, $i, strlen($name) - $i);
        $i = strrpos($name, '/');
        if (is_dir($path)) {
            if ($value != '.' && $value != '..') {
                $newDir = str_replace('raw_stock', 'stock', $name);
                if (!is_dir($newDir)) {
                    mkdir($newDir);
                }
                $results[] = ['name' => $value, 'description' => $description, 'items' => []];
                findFiles($base, $path, $results[count($results) - 1]['items']);
            }
        } else {
            if (strpos($path, '.DS_Store') === false) {
                $description = substr($name, $i + 1, strlen($name) - $i - 1);
                $i = strpos($description, '.');
                $description = substr($description, 0, $i);
                $i = strpos($description, '-');
                $prefix = substr($description, 0, $i);
                $hasDescription = false;
                $source = '';
                $sourceDomain = '';
                switch ($prefix) {
                    case 'pexels':
                        $hasDescription = true;
                        $source = 'Free stock photos - Pexels';
                        $sourceDomain = 'https://www.pexels.com/';
                        break;
                    case 'stocksnap':
                        $hasDescription = true;
                        $source = 'StockSnap.io - Beautiful Free Stock Photos (CC0)';
                        $sourceDomain = 'https://stocksnap.io/';
                        break;
                }
                $smallFilename = str_replace(['raw_stock', $prefix . '-', '.jpg'], ['stock', '', '-small.jpg'], $name);
                $mediumFilename = str_replace(['raw_stock', $prefix . '-', '.jpg'], ['stock', '', '-medium.jpg'], $name);
                $largeFilename = str_replace(['raw_stock', $prefix . '-', '.jpg'], ['stock', '', '-large.jpg'], $name);
                if ($hasDescription) {
                    $description = substr($description, $i + 1, strlen($description) - $i - 1);
                    $description = ucfirst(implode(' ', explode('-', $description)));
                }
                $results[] = ['name' => $name, 'sizes' => ['small' => ['width' => 200, 'filename' => $smallFilename], 'medium' => ['width' => 600, 'filename' => $mediumFilename], 'large' => ['filename' => $largeFilename]], 'description' => $description, 'source' => $source, 'sourceDomain' => $sourceDomain];
            }
        }
    }
}
开发者ID:ArnoVanDerVegt,项目名称:ScrapbookMedia,代码行数:52,代码来源:process.php


示例6: preFill

 /**
  * Add some records with dummy content..
  *
  * Only fill the contenttypes passed as parameters
  * If the parameters is empty, only fill empty tables
  *
  * @see preFillSingle
  * @param array $contenttypes
  * @return string
  */
 public function preFill($contenttypes = array())
 {
     $this->guzzleclient = new \Guzzle\Service\Client('http://loripsum.net/api/');
     $output = "";
     // get a list of images..
     $this->images = findFiles('', 'jpg,jpeg,png');
     $empty_only = empty($contenttypes);
     foreach ($this->app['config']->get('contenttypes') as $key => $contenttype) {
         $tablename = $this->getTablename($key);
         if ($empty_only && $this->hasRecords($tablename)) {
             $output .= __("Skipped <tt>%key%</tt> (already has records)", array('%key%' => $key)) . "<br>\n";
             continue;
         } elseif (!in_array($key, $contenttypes) && !$empty_only) {
             $output .= __("Skipped <tt>%key%</tt> (not checked)", array('%key%' => $key)) . "<br>\n";
             continue;
         }
         $amount = isset($contenttype['prefill']) ? $contenttype['prefill'] : 5;
         for ($i = 1; $i <= $amount; $i++) {
             $output .= $this->preFillSingle($key, $contenttype);
         }
     }
     $output .= "<br>\n\n" . __('Done!');
     return $output;
 }
开发者ID:viyancs,项目名称:bolt,代码行数:34,代码来源:Storage.php


示例7: showUsage

if (count($args) == 0) {
    showUsage();
}
$dir = $args[0];
# Check Protection
if (isset($options['protect']) && isset($options['unprotect'])) {
    die("Cannot specify both protect and unprotect.  Only 1 is allowed.\n");
}
if (isset($options['protect']) && $options['protect'] == 1) {
    die("You must specify a protection option.\n");
}
# Prepare the list of allowed extensions
global $wgFileExtensions;
$extensions = isset($options['extensions']) ? explode(',', strtolower($options['extensions'])) : $wgFileExtensions;
# Search the path provided for candidates for import
$files = findFiles($dir, $extensions, isset($options['search-recursively']));
# Initialise the user for this operation
$user = isset($options['user']) ? User::newFromName($options['user']) : User::newFromName('Maintenance script');
if (!$user instanceof User) {
    $user = User::newFromName('Maintenance script');
}
$wgUser = $user;
# Get block check. If a value is given, this specified how often the check is performed
if (isset($options['check-userblock'])) {
    if (!$options['check-userblock']) {
        $checkUserBlock = 1;
    } else {
        $checkUserBlock = (int) $options['check-userblock'];
    }
} else {
    $checkUserBlock = false;
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:31,代码来源:importImages.php


示例8: findFiles

<?php

require 'build.php';
$extension = 'json';
$object_files = findFiles('../objects/', $extension);
$title = 'Collier MVC - Generate Objects';
$page_title = 'Generate Objects';
if ($_POST['generate'] == 1) {
    $gen = generateMVC(false);
    if ($gen['success']) {
        $body = '
				<ol class="breadcrumb">
					<li><a href="../../public/index.php">Getting Started</a></li>
					<li><a href="generate_mvc.php">Generate Objects</a></li>
				</ol>

				<div class="row pad">
					<div class="col-md-8">
						<p class="bg-success pad"><span class="glyphicon glyphicon-ok"></span> <b>Successfully generated MVC scripts.</b></p>
					</div>
					<div class="col-md-4">
						<center>
							<p>Ready to continue?</p>
							<a class="btn btn-primary" href="../../public/instructions.php?testing=1">Next Step</a>
						</center>
					</div>
				</div>

				<div class="row">
					<div class="col-md-8">
						<p>Your code has been generated. You can now find your model and controllers in their dedicated folders.</p>
开发者ID:jocodev1,项目名称:colliermvc,代码行数:31,代码来源:generate_mvc.php


示例9: VARCHAR

$p = $CFG->dbprefix;
echo "Checking plugins table...<br/>\n";
$plugins = "{$p}lms_plugins";
$table_fields = $PDOX->metadata($plugins);
if ($table_fields === false) {
    echo "Creating plugins table...<br/>\n";
    $sql = "\ncreate table {$plugins} (\n    plugin_id        INTEGER NOT NULL AUTO_INCREMENT,\n    plugin_path      VARCHAR(255) NOT NULL,\n\n    version          BIGINT NOT NULL,\n\n    title            VARCHAR(2048) NULL,\n\n    json             TEXT NULL,\n    created_at       DATETIME NOT NULL,\n    updated_at       DATETIME NOT NULL,\n\n    UNIQUE(plugin_path),\n    PRIMARY KEY (plugin_id)\n) ENGINE = InnoDB DEFAULT CHARSET=utf8;";
    $q = $PDOX->queryReturnError($sql);
    if (!$q->success) {
        die("Unable to create lms_plugins table: " . implode(":", $q->errorInfo));
    }
    echo "Created plugins table...<br/>\n";
}
echo "Checking for any needed upgrades...<br/>\n";
// Scan the tools folders
$tools = findFiles("database.php", "../");
if (count($tools) < 1) {
    echo "No database.php files found...<br/>\n";
    return;
}
// A simple precedence order..   Will have to improve this.
foreach ($tools as $k => $tool) {
    if (strpos($tool, "core/lti/database.php") && $k != 0) {
        $tmp = $tools[0];
        $tools[0] = $tools[$k];
        $tools[$k] = $tmp;
        break;
    }
}
$maxversion = 0;
$maxpath = '';
开发者ID:ixtel,项目名称:tsugi,代码行数:31,代码来源:upgrade.php


示例10: lmsDie

    echo "<p>This tool must be launched by the instructor</p>";
    $OUTPUT->footer();
    exit;
}
// See https://canvas.instructure.com/doc/api/file.link_selection_tools.html
// Needed return values
$content_return_types = LTIX::postGet("ext_content_return_types", false);
$content_return_url = LTIX::postGet("ext_content_return_url", false);
if (strlen($content_return_url) < 1) {
    lmsDie("Missing ext_content_return_url");
}
if (strpos($content_return_types, "lti_launch_url") === false) {
    lmsDie("This tool requires ext_content_return_types=lti_launch_url");
}
// Scan the tools folders for registration settings
$tools = findFiles("register.php", "../");
if (count($tools) < 1) {
    lmsDie("No register.php files found...<br/>\n");
}
echo "<ul>\n";
$toolcount = 0;
foreach ($tools as $tool) {
    $path = str_replace("../", "", $tool);
    // echo("Checking $path ...<br/>\n");
    unset($REGISTER_LTI2);
    require $tool;
    if (isset($REGISTER_LTI2) && is_array($REGISTER_LTI2)) {
        if (isset($REGISTER_LTI2['name']) && isset($REGISTER_LTI2['short_name']) && isset($REGISTER_LTI2['description'])) {
        } else {
            lmsDie("Missing required name, short_name, and description in " . $tool);
        }
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:31,代码来源:canvas-content-item.php


示例11: compile_java

 function compile_java()
 {
     $projPath = $this->config['project_dir'];
     $binPath = $projPath . '/bin';
     if (!is_dir($binPath)) {
         mkdir($binPath);
     }
     $classesPath = $binPath . '/classes';
     if (!is_dir($classesPath)) {
         mkdir($classesPath);
     }
     $files = array();
     findFiles($projPath . '/src', $files);
     findFiles($projPath . '/gen', $files);
     $cmd_str = 'javac -encoding utf8 -target ' . $this->java_version . ' -source ' . $this->java_version . ' -bootclasspath ' . $this->boot_class_path . ' -d ' . $classesPath;
     foreach ($files as $file) {
         $cmd_str = $cmd_str . ' ' . $file;
     }
     $cmd_str = $cmd_str . ' -classpath ' . $this->class_path;
     $retval = $this->exec_sys_cmd($cmd_str);
     return $retval;
 }
开发者ID:rainswan,项目名称:Quick-Cocos2dx-Community,代码行数:22,代码来源:ApkBuilder.php


示例12: copyDir

 private function copyDir($srcPath, $dstPath, $flagCheck)
 {
     $files = array();
     findFiles($srcPath, $files);
     foreach ($files as $src) {
         $dest = str_replace($srcPath, $dstPath, $src);
         $this->replaceFile($src, $dest, "create", $flagCheck);
     }
 }
开发者ID:amorwilliams,项目名称:Quick-Cocos2dx-Community,代码行数:9,代码来源:ProjectCreator.php


示例13: findFiles

function findFiles($dir, array &$files)
{
    $dir = rtrim($dir, "/\\") . DS;
    $dh = opendir($dir);
    if ($dh == false) {
        return;
    }
    while (($file = readdir($dh)) !== false) {
        if ($file == '.' || $file == '..' || $file == ".DS_Store") {
            continue;
        }
        $path = $dir . $file;
        if (is_dir($path)) {
            findFiles($path, $files);
        } elseif (is_file($path)) {
            $files[] = $path;
        }
    }
    closedir($dh);
}
开发者ID:quinsmpang,项目名称:Quick-3.3,代码行数:20,代码来源:init.php


示例14: showUsage

if (count($args) == 0) {
    showUsage();
}
$dir = $args[0];
# Check Protection
if (isset($options['protect']) && isset($options['unprotect'])) {
    die("Cannot specify both protect and unprotect.  Only 1 is allowed.\n");
}
if (isset($options['protect']) && $options['protect'] == 1) {
    die("You must specify a protection option.\n");
}
# Prepare the list of allowed extensions
global $wgFileExtensions;
$extensions = isset($options['extensions']) ? explode(',', strtolower($options['extensions'])) : $wgFileExtensions;
# Search the path provided for candidates for import
$files = findFiles($dir, $extensions);
# Initialise the user for this operation
$user = isset($options['user']) ? User::newFromName($options['user']) : User::newFromName('Maintenance script');
if (!$user instanceof User) {
    $user = User::newFromName('Maintenance script');
}
$wgUser = $user;
# Get block check. If a value is given, this specified how often the check is performed
if (isset($options['check-userblock'])) {
    if (!$options['check-userblock']) {
        $checkUserBlock = 1;
    } else {
        $checkUserBlock = (int) $options['check-userblock'];
    }
} else {
    $checkUserBlock = false;
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:importImages.php


示例15: translatePathToRelIMG

        }
    } else {
        $message = "Invalid file format. Images must be in jpg, png, gif, or bmp format.";
    }
}
function translatePathToRelIMG($imgpath)
{
    // krumo($imgpath);
    $newPath = explode("/web/", $imgpath)[1];
    return $newPath;
}
// en Images.pgp
// $images=readImagesFolder();
//krumo($images);
// pintamos las imágenes disponibles
$images = findFiles($_SESSION['destacados_img_folder'], $ext = array("png", "gif", "jpg"));
//krumo($images);
$availableImgs = "";
foreach ($images as $path) {
    $relPath = translatePathToRelIMG($path);
    $deletepath = $_SERVER['PHP_SELF'] . "?delete=" . $path;
    $availableImgs .= "<div class='popupImgs' style='width:200px;display: inline-block;margin:0 10px'>";
    $availableImgs .= "<a class='destthumb' href='#imgModal' data-toggle='modal' data-relimg-url='{$relPath}' data-img-url='{$path}'><img  width='200' height='auto' src='{$path}' /></a>";
    $availableImgs .= "<div style='word-break:break-all;font-size:11px'>{$path}</div><a href='{$deletepath}'  onclick='return confirm(\"Borrar Imagen?\")'><span class='glyphicon glyphicon-remove ' style='color:red'></span></a></div>";
}
$_SESSION['destacados_folderimages'] = $images;
?>
    
    <!doctype html>
    <html>
    <head>
开发者ID:TahicheVivo,项目名称:CREditor,代码行数:31,代码来源:image_destacados_generator.php


示例16: findFiles

<p>This request is missing custom parameters to configure which tool you would
like to select to run on this system.   You Learning Management system can
set these custom parameters as key/value pairs.
</p>
</div>
<p>
While each tool hosted in this system may have its own custom parameters
here are some of the parameters that you might need to use.
<ul>
<li> <b>assn=mod/pythonauto/auto.php</b> - the <b>assn</b> parameter selects
which tool to run in the system.</li>
<li> <b>exercise=3.3</b> - For the pythonauto tool, use this custom parameter
to select the exercise.</li>
<li> <b>done=_close</b> - Some tools have a "Done" button.  If this is a URL
when the user presses "Done" within the tool they will be sent to the URL.
If this is "_close" the window will be closed - this makes the most sense
if the original launch was a popup window.  If this parameter is omitted,
no "Done" button will be shown - this is useful if the tool is launched
in an iframe.</li>
</ul>
<p>
<?php 
$tools = findFiles();
if (count($tools) > 1) {
    echo "<p>Tools in this system:</p><ul>\n";
    foreach ($tools as $tool) {
        echo "<li>" . htmlent_utf8($tool) . "</li>\n";
    }
    echo "</ul>\n";
}
$OUTPUT->footer();
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:31,代码来源:noredir.php


示例17: header

    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
} else {
    $dir = @$_SESSION['display.dir'];
    $dircount = @$_SESSION['display.dircount'];
    $previous = @$_SESSION['display.previous'];
    if (strlen($dir) <= 0 || file_exists($dir)) {
        $dir = newDir($settings['photo.dirs']);
        $dircount = 0;
    }
    $files = findFiles($dir);
    if ($dircount > $settings['photo.max_from_dir'] || $dircount >= count($files)) {
        $tries = 0;
        do {
            $dir = newDir($settings['photo.dirs']);
            $dircount = 0;
            $files = findFiles($dir);
        } while ((count($files) <= 0 || $previousDir == $dir) && $tries++ < 100);
    }
    do {
        $file = $files[rand(0, count($files) - 1)];
    } while ($file == $previous && count($files) > 1);
    $dircount++;
    $_SESSION['display.dir'] = $dir;
    $_SESSION['display.dircount'] = $dircount;
    $_SESSION['display.previous'] = $file;
}
$width = $_REQUEST['width'];
$height = $_REQUEST['height'];
// Info string
$info = '';
if ($settings['photo.show_filename']) {
开发者ID:janpaul123,项目名称:photoframed,代码行数:31,代码来源:random_picture.php


示例18: preFill

 public function preFill()
 {
     $this->guzzleclient = new Guzzle\Service\Client('http://loripsum.net/api/');
     $output = "";
     // get a list of images..
     $this->images = findFiles('', 'jpg,jpeg,png');
     foreach ($this->config['contenttypes'] as $key => $contenttype) {
         $amount = isset($contenttype['prefill']) ? $contenttype['prefill'] : 5;
         for ($i = 1; $i <= $amount; $i++) {
             $output .= $this->preFillSingle($key, $contenttype);
         }
     }
     $output .= "\n\nDone!";
     return $output;
 }
开发者ID:LeonB,项目名称:site,代码行数:15,代码来源:storage.php


示例19: switch

<?php

use App\Metacom\Metacom;
//Autoload classes.
require __DIR__ . '/../vendor/autoload.php';
if (isset($argv[1])) {
    switch ($argv[1]) {
        case "-extract":
            findFiles();
            break;
        case "-compare":
            compare();
            break;
        case "-update":
            compare(true);
            break;
        case "-generate":
            generate();
            break;
        default:
            break;
    }
} else {
    echo "Welcome to Metacom: The PHP comment framework! \n";
}
function findFiles()
{
    $path = realpath(getcwd());
    $it = new RecursiveDirectoryIterator($path);
    $display = array('php', 'html');
    $metacom = new Metacom();
开发者ID:jeremybrammer,项目名称:Metacom,代码行数:31,代码来源:metacom.php


示例20: findFiles

//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
// Do not add trailing slash '/'
$directory = ".";
// This key must match the key spesified in your flash recorder ez publish object.
// If they don't match no files will be returned.
// IMPORTANT: Change the key (here and in your flash recorder object) from the
// default key if you do not want people to be able to retreive the file list.
$key = "ThisIsTheDefaultKeyChangeMe";
$limit = 10;
if (isset($_GET["key"]) === false || $_GET['key'] != $key) {
    return;
}
$files = findFiles($directory);
// Output the list one file pr line
$counter = 0;
foreach ($files as $file) {
    if ($counter < $limit) {
        echo $file . "\n";
    } else {
        break;
    }
    $counter++;
}
// Find all files in $directory with $fileExtension as their extension.
// This function will not look for files recursively.
// Returns an array of filenames sorted by mtime (modified), newest first.
function findFiles($directory, $fileExtension = '.flv')
{
开发者ID:heliopsis,项目名称:ezflow,代码行数:31,代码来源:flash_video_list.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP findMembers函数代码示例发布时间:2022-05-15
下一篇:
PHP findAllFiles函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap