当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::files方法代码示例

本文整理汇总了PHP中Folder::files方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::files方法的具体用法?PHP Folder::files怎么用?PHP Folder::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


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

示例1: gconfig

function gconfig(string $value = NULL)
{
    global $gconfig;
    if (empty($gconfig)) {
        $configs = array_merge(Folder::files(EXTERNAL_CONFIG_DIR, 'php'), Folder::files(CONFIG_DIR, 'php'), Folder::files(INTERNAL_CONFIG_DIR, 'php'));
        $gconfig = [];
        foreach ($configs as $file) {
            $file = removeExtension($file);
            $gconfig = array_merge($gconfig, (array) Config::get($file));
        }
    }
    if ($value === NULL) {
        return $gconfig;
    }
    return $gconfig[$value] ?? false;
}
开发者ID:znframework,项目名称:znframework,代码行数:16,代码来源:Config.php

示例2: isWritable

 /**
  * Checks if the page or any of its files are writable
  *
  * @return boolean
  */
 public function isWritable()
 {
     $folder = new Folder($this->root());
     if (!$folder->isWritable()) {
         return false;
     }
     foreach ($folder->files() as $f) {
         if (!$f->isWritable()) {
             return false;
         }
     }
     return true;
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:18,代码来源:page.php

示例3: resizeOnDemandDeleteFile

function resizeOnDemandDeleteFile($file, $name)
{
    if (in_array($file->extension(), array('jpg', 'jpeg', 'png'))) {
        $path = str_replace('/', DS, $file->page()->id());
        $root = kirby()->roots()->index() . DS . 'thumbs' . DS . $path;
        $folder = new Folder($root);
        $pattern = '/' . $name . '-[1-9][0-9]{2,3}-[a-f0-9]{12}\\.' . $file->extension() . '$/';
        // delete all resized versions of this image
        foreach ($folder->files() as $file) {
            if (preg_match($pattern, $file->filename())) {
                $file->delete();
            }
        }
    }
}
开发者ID:aoimedia,项目名称:kirby-resize-on-demand-plugin,代码行数:15,代码来源:resizeOnDemand.php

示例4: size

 public function size($file = '', $type = "b", $decimal = 2)
 {
     // Parametre kontrolleri yapılıyor. --------------------------------------------
     if (!is_string($file)) {
         return Error::set('Error', 'stringParameter', 'file');
     }
     if (!is_string($type)) {
         $type = "b";
     }
     if (!file_exists($file)) {
         return Error::set('File', 'notFoundError', $file);
     }
     // ------------------------------------------------------------------------------
     $size = 0;
     $extension = extension($file);
     $fileSize = filesize($file);
     // Bu bir dosya ise
     if (!empty($extension)) {
         $size += $fileSize;
     } else {
         $folderFiles = Folder::files($file);
         // Dizin içerisinde dosyalar mevcut ise
         if ($folderFiles) {
             // Hesaplanan boyuta dosya boyutlarını ilave et
             foreach ($folderFiles as $val) {
                 $size += $this->size($file . "/" . $val);
             }
             $size += $fileSize;
         } else {
             // Dizin içerisinde herhangi bir dosya mevcut değilse
             $size += $fileSize;
         }
     }
     // Dosyanın boyutunun hangi birim ile gösterileceğinin kontrolü yapılmaktadır.
     // BYTES
     if ($type === "b") {
         return $size;
     }
     // KILO BYTES
     if ($type === "kb") {
         return round($size / 1024, $decimal);
     }
     // MEGA BYTES
     if ($type === "mb") {
         return round($size / (1024 * 1024), $decimal);
     }
     // GIGA BYTES
     if ($type === "gb") {
         return round($size / (1024 * 1024 * 1024), $decimal);
     }
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:51,代码来源:File.php

示例5: package

 public static function package($packages = "", $differentExtension = array())
 {
     if (!is_string($packages) || !isDirExists($packages) || !is_array($differentExtension)) {
         Error::set(lang('Error', 'stringParameter', 'packages'));
         Error::set(lang('Error', 'dirParameter', 'packages'));
         Error::set(lang('Error', 'arrayParameter', 'differentExtension'));
         return false;
     }
     if (Folder::files($packages)) {
         foreach (Folder::files($packages) as $val) {
             if (extension($val) === "php") {
                 require_once suffix($packages) . $val;
             } elseif (extension($val) === "js") {
                 echo '<script type="text/javascript" src="' . baseUrl() . suffix($packages) . $val . '"></script>' . eol();
             } elseif (extension($val) === "css") {
                 echo '<link href="' . baseUrl() . suffix($packages) . $val . '" rel="stylesheet" type="text/css" />' . eol();
             } else {
                 if (!empty($differentExtension)) {
                     if (in_array(extension($val), $differentExtension)) {
                         require_once suffix($packages) . $val;
                     }
                 }
             }
         }
     } else {
         return false;
     }
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:28,代码来源:Import.php

示例6: foreach

    ?>
</a></li>
					</ul>
				</li>
				<?php 
}
?>
			</ul>
		</section>
		
		<section class="contenu demi">
			<h4>Fichiers liés à ce dossier</h4>
			
			<ul class="listeDesFichiers">
				<?php 
$fichiers = $dossier->files();
if (count($fichiers)) {
    foreach ($fichiers as $fichier) {
        $e = new Event($fichier['id']);
        $c = new People($e->get('people'));
        ?>
				<a href="uploads/<?php 
        echo $fichier['url'];
        ?>
" target="_blank">
					<li class="fichier">
						<strong><?php 
        echo $fichier['name'];
        ?>
</strong>
						<em><?php 
开发者ID:leqg,项目名称:leqg,代码行数:31,代码来源:dossier.tpl.php


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