本文整理汇总了PHP中Dir::findFilesEndingWith方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::findFilesEndingWith方法的具体用法?PHP Dir::findFilesEndingWith怎么用?PHP Dir::findFilesEndingWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::findFilesEndingWith方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Dir
static function list_files($plugin_path)
{
$plugin_dir = new Dir(self::DEFAULT_DIR . $plugin_path);
$final_result = array();
if ($plugin_dir->exists()) {
$all_files = $plugin_dir->findFilesEndingWith(self::DEFAULT_EXTENSION);
foreach ($all_files as $f) {
$final_result[] = $f->getIncludePath();
}
}
return $final_result;
}
示例2: array
function get_gallery()
{
$gallery_name = Params::get("gallery_name");
$result = array();
$result["gallery_name"] = $gallery_name;
$d = new Dir(self::GALLERY_ROOT_PATH . $gallery_name);
$files = $d->listFiles();
$image_list = array();
foreach ($files as $f) {
if ($f->isFile() && $f->getExtension() != ".ini") {
$image = array();
$image["path"] = $f->getPath();
$image["title"] = str_replace("_", " ", $f->getName());
$image_list[$f->getFilename()] = $image;
}
}
$gallery_dir = new Dir(self::GALLERY_ROOT_PATH . $gallery_name . DS);
$found_files = $gallery_dir->findFilesEndingWith("gallery.ini");
if (count($found_files) > 0) {
$gallery_ini_file = $found_files[0];
$gallery_props = PropertiesUtils::readFromFile($gallery_ini_file, true);
$enhanced_image_list = array();
foreach ($section as $s) {
$path = $s["path"];
if (strpos($path, "DS") === 0) {
$new_image["path"] = $path;
} else {
$new_image["path"] = self::GALLERY_ROOT_PATH . $gallery_name . $s["path"];
}
$f = new File($new_image["path"]);
$new_image["title"] = isset($s["title"]) ? $s["title"] : str_replace("_", " ", $f->getName());
$new_image["description"] = isset($s["description"]) ? $s["description"] : null;
$enhanced_image_list[] = $new_image;
}
$result["image_list"] = $enhanced_image_list;
} else {
$result["image_list"] = $image_list;
}
return $result;
}
示例3: testFindFilesEndingWithBasic
function testFindFilesEndingWithBasic()
{
$d = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/io/advances_dir_list/");
$only_image_png = $d->findFilesEndingWith("image.png");
$this->assertTrue(count($only_image_png) == 2, "Il numero dei file trovati non corrisponde!!");
}