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


PHP dir::content方法代码示例

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


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

示例1: minify

 public function minify($cacheFile = null, $dir = null)
 {
     if ($dir === null) {
         $dir = dirname($_SERVER['SCRIPT_FILENAME']);
     }
     // MODIFICATION TIME FILES
     $mtFiles = array(__FILE__, $_SERVER['SCRIPT_FILENAME'], "conf/config.php");
     // GET SOURCE CODE FILES
     $files = dir::content($dir, array('types' => "file", 'pattern' => '/^.*\\.' . $this->type . '$/'));
     // GET NEWEST MODIFICATION TIME
     $mtime = 0;
     foreach (array_merge($mtFiles, $files) as $file) {
         $fmtime = filemtime($file);
         if ($fmtime > $mtime) {
             $mtime = $fmtime;
         }
     }
     $header = "Content-Type: {$this->mime[$this->type]}";
     // GET SOURCE CODE FROM CLIENT HTTP CACHE IF EXISTS
     httpCache::checkMTime($mtime, $header);
     // OUTPUT SOURCE CODE
     header($header);
     // GET SOURCE CODE FROM SERVER-SIDE CACHE
     if ($cacheFile !== null && file_exists($cacheFile) && (filemtime($cacheFile) >= $mtime || !is_writable($cacheFile))) {
         // with its distribution content
         readfile($cacheFile);
         die;
     }
     // MINIFY AND JOIN SOURCE CODE
     $source = "";
     foreach ($files as $file) {
         if (strlen($this->minCmd) && substr($file, 4, 1) != "_") {
             $cmd = str_replace("{file}", $file, $this->minCmd);
             $source .= `{$cmd}`;
         } else {
             $source .= file_get_contents($file);
         }
     }
     // UPDATE SERVER-SIDE CACHE
     if ($cacheFile !== null && (is_writable($cacheFile) || !file_exists($cacheFile) && dir::isWritable(dirname($cacheFile)))) {
         file_put_contents($cacheFile, $source);
         touch($cacheFile, $mtime);
     }
     // OUTPUT SOURCE CODE
     echo $source;
 }
开发者ID:brandon-bailey,项目名称:osdms,代码行数:46,代码来源:minifier.php

示例2: getDirInfo

 protected function getDirInfo($dir, $removable = false)
 {
     if (substr(basename($dir), 0, 1) == "." || !is_dir($dir) || !is_readable($dir)) {
         return false;
     }
     $dirs = dir::content($dir, array('types' => "dir"));
     if (is_array($dirs)) {
         foreach ($dirs as $key => $cdir) {
             if (substr(basename($cdir), 0, 1) == ".") {
                 unset($dirs[$key]);
             }
         }
         $hasDirs = count($dirs) ? true : false;
     } else {
         $hasDirs = false;
     }
     $writable = dir::isWritable($dir);
     $info = array('name' => stripslashes(basename($dir)), 'readable' => is_readable($dir), 'writable' => $writable, 'removable' => $removable && $writable && dir::isWritable(dirname($dir)), 'hasDirs' => $hasDirs);
     if ($dir == "{$this->config['uploadDir']}/{$this->session['dir']}") {
         $info['current'] = true;
     }
     return $info;
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:23,代码来源:browser.php

示例3: header

 *   @version 3.0-dev
 *    @author Pavel Tzonkov <sunhater@sunhater.com>
 * @copyright 2010-2014 KCFinder Project
 *   @license http://opensource.org/licenses/GPL-3.0 GPLv3
 *   @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
 *      @link http://kcfinder.sunhater.com
 */
namespace kcfinder;

require "core/autoload.php";
if (!isset($_GET['lng']) || $_GET['lng'] == 'en') {
    header("Content-Type: text/javascript");
    die;
}
$file = "lang/" . $_GET['lng'] . ".php";
$files = dir::content("lang", array('types' => "file", 'pattern' => '/^.*\\.php$/'));
if (!in_array($file, $files)) {
    header("Content-Type: text/javascript");
    die;
}
$mtime = @filemtime($file);
if ($mtime) {
    httpCache::checkMTime($mtime);
}
require $file;
header("Content-Type: text/javascript; charset={$lang['_charset']}");
foreach ($lang as $english => $native) {
    if (substr($english, 0, 1) != "_") {
        echo "browser.labels['" . text::jsValue($english) . "']=\"" . text::jsValue($native) . "\";";
    }
}
开发者ID:ethan42411,项目名称:bludit-plugins,代码行数:31,代码来源:js_localize.php

示例4: chdir

<?php

/** This file is part of KCFinder project
 *
 *      @desc Join all JavaScript files in current directory
 *   @package KCFinder
 *   @version 2.4
 *    @author Pavel Tzonkov <pavelc@users.sourceforge.net>
 * @copyright 2010, 2011 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
chdir("..");
// For compatibality
chdir("..");
require "lib/helper_httpCache.php";
require "lib/helper_dir.php";
$files = dir::content("js/browser", array('types' => "file", 'pattern' => '/^.*\\.js$/'));
foreach ($files as $file) {
    $fmtime = filemtime($file);
    if (!isset($mtime) || $fmtime > $mtime) {
        $mtime = $fmtime;
    }
}
httpCache::checkMTime($mtime);
header("Content-Type: text/javascript");
foreach ($files as $file) {
    require $file;
}
开发者ID:kilrizzy,项目名称:Nakid-CMS,代码行数:30,代码来源:joiner.php

示例5: getLangs

 protected function getLangs()
 {
     if (isset($this->session['langs'])) {
         return $this->session['langs'];
     }
     $files = dir::content("lang", array('pattern' => '/^[a-z]{2,3}(\\-[a-z]{2})?\\.php$/', 'types' => "file"));
     $langs = array();
     if (is_array($files)) {
         foreach ($files as $file) {
             include $file;
             $id = substr(basename($file), 0, -4);
             $langs[$id] = isset($lang['_native']) ? $lang['_native'] : (isset($lang['_lang']) ? $lang['_lang'] : $id);
         }
     }
     $this->session['langs'] = $langs;
     return $langs;
 }
开发者ID:Radius17,项目名称:kcfinder,代码行数:17,代码来源:browser.php

示例6: getFiles

 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $img = new fastImage($file);
         $type = $img->getType();
         if ($type !== false) {
             $size = $img->getSize($file);
             if (is_array($size) && count($size)) {
                 $thumb_file = "{$thumbDir}/" . basename($file);
                 if (!is_file($thumb_file)) {
                     $this->makeThumb($file, false);
                 }
                 $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($type, array("gif", "jpeg", "png"));
             } else {
                 $smallThumb = false;
             }
         } else {
             $smallThumb = false;
         }
         $img->close();
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:biji_katak,代码行数:40,代码来源:browser.php

示例7: get_couch_thumbs

 static function get_couch_thumbs($filename, $dir = null)
 {
     if ($dir === null) {
         // filename is a full path containing the folder
         $dir = dirname($filename);
     }
     $filename = basename($filename);
     $ext = file::getExtension($filename, false);
     $name = strlen($ext) ? substr($filename, 0, -strlen($ext) - 1) : $filename;
     $thumbs = dir::content($dir, array('types' => "file", 'pattern' => "/{$name}(?:-\\d{1,}x\\d{1,})\\.{$ext}/i"));
     if ($thumbs === false) {
         return array();
     }
     return $thumbs;
 }
开发者ID:bayurianoputra,项目名称:forum-ff,代码行数:15,代码来源:helper_dir.php

示例8: array

<?php

/** This file is part of KCFinder project
 *
 *      @desc Join all JavaScript files in current directory
 *   @package KCFinder
 *   @version 2.51
 *    @author Pavel Tzonkov <pavelc@users.sourceforge.net>
 * @copyright 2010, 2011 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
// chdir(".."); // For compatibality
// chdir("..");
require INST_PATH . "vendors/kcfinder/lib/helper_httpCache.php";
require INST_PATH . "vendors/kcfinder/lib/helper_dir.php";
$files = dir::content(INST_PATH . "vendors/kcfinder/js/browser", array('types' => "file", 'pattern' => '/^.*\\.js$/'));
sort($files);
foreach ($files as $file) {
    $fmtime = filemtime($file);
    if (!isset($mtime) || $fmtime > $mtime) {
        $mtime = $fmtime;
    }
}
httpCache::checkMTime($mtime);
header("Content-Type: text/javascript");
foreach ($files as $file) {
    require $file;
}
开发者ID:rantes,项目名称:proyectosig,代码行数:30,代码来源:joiner.php


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