本文整理汇总了PHP中getFiles函数的典型用法代码示例。如果您正苦于以下问题:PHP getFiles函数的具体用法?PHP getFiles怎么用?PHP getFiles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFiles函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getFiles
function getFiles(&$rdi, $depth = 0)
{
if (!is_object($rdi)) {
return;
}
$files = array();
// order changes per machine
for ($rdi->rewind(); $rdi->valid(); $rdi->next()) {
if ($rdi->isDot()) {
continue;
}
if ($rdi->isDir() || $rdi->isFile()) {
$indent = '';
for ($i = 0; $i <= $depth; ++$i) {
$indent .= " ";
}
$files[] = $indent . $rdi->current() . "\n";
if ($rdi->hasChildren()) {
getFiles($rdi->getChildren(), 1 + $depth);
}
}
}
asort($files);
var_dump(array_values($files));
}
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:25,代码来源:1804.php
示例2: getFiles
function getFiles($dir, $ext, $exclude = array())
{
$returnList = array();
$nextDirs = array();
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
if (is_dir($file)) {
array_push($nextDirs, $file);
} else {
$info = pathinfo($dir . '/' . $file);
if ($info['extension'] == $ext) {
$dontInclude = false;
for ($l = 0; $l < count($exclude); ++$l) {
if (strtolower($file) == strtolower($exclude[$l])) {
$dontInclude = true;
}
}
if (!$dontInclude) {
array_push($returnList, $file);
}
}
}
}
}
closedir($dh);
}
for ($i = 0; $i < count($nextDirs); ++$i) {
$newFiles = getFiles($dir . '/' . $nextDirs[$i], $ext, $exclude);
for ($j = 0; $j < count($newFiles); ++$j) {
array_push($returnList, $nextDirs[$i] . '/' . $newFiles[$j]);
}
}
return $returnList;
}
开发者ID:beastx,项目名称:Septimo-Regimiento-Ikariam-Script,代码行数:35,代码来源:changeHostForProd.php
示例3: buildCache
/**
* Builds the cache of Dashlets by scanning the system
*/
function buildCache()
{
global $beanList;
$dashletFiles = array();
$dashletFilesCustom = array();
getFiles($dashletFiles, 'modules', '/^.*\\/Dashlets\\/[^\\.]*\\.php$/');
getFiles($dashletFilesCustom, 'custom/modules', '/^.*\\/Dashlets\\/[^\\.]*\\.php$/');
$cacheDir = create_cache_directory('dashlets/');
$allDashlets = array_merge($dashletFiles, $dashletFilesCustom);
$dashletFiles = array();
foreach ($allDashlets as $num => $file) {
if (substr_count($file, '.meta') == 0) {
// ignore meta data files
$class = substr($file, strrpos($file, '/') + 1, -4);
$dashletFiles[$class] = array();
$dashletFiles[$class]['file'] = $file;
$dashletFiles[$class]['class'] = $class;
if (is_file(preg_replace('/(.*\\/.*)(\\.php)/Uis', '$1.meta$2', $file))) {
// is there an associated meta data file?
$dashletFiles[$class]['meta'] = preg_replace('/(.*\\/.*)(\\.php)/Uis', '$1.meta$2', $file);
require $dashletFiles[$class]['meta'];
if (isset($dashletMeta[$class]['module'])) {
$dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
}
}
$filesInDirectory = array();
getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\\/Dashlets\\/[^\\.]*\\.icon\\.(jpg|jpeg|gif|png)$/i');
if (!empty($filesInDirectory)) {
$dashletFiles[$class]['icon'] = $filesInDirectory[0];
// take the first icon we see
}
}
}
write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php');
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:38,代码来源:DashletCacheBuilder.php
示例4: getFiles
function getFiles(&$modx, &$results, &$filesfound, $directory, $listing = array(), $count = 0)
{
$dummy = $count;
if (@($handle = opendir($directory))) {
while ($file = readdir($handle)) {
if ($file == '.' || $file == '..' || strpos($file, '.') === 0) {
continue;
} else {
if ($h = @opendir($directory . $file . "/")) {
closedir($h);
$count = -1;
$listing["{$file}"] = getFiles($modx, $results, $filesfound, $directory . $file . "/", array(), $count + 1);
} else {
$listing[$dummy] = $file;
$dummy = $dummy + 1;
$filesfound++;
}
}
}
} else {
$results .= $modx->lexicon('import_site_failed') . " Could not open '{$directory}'.<br />";
}
@closedir($handle);
return $listing;
}
开发者ID:adamwintle,项目名称:flexibility5,代码行数:25,代码来源:html.php
示例5: getFiles
/**
* Get files under a directory recursive.
*
* @param string $dir
* @param array $exceptions
* @access private
* @return array
*/
function getFiles($dir, $exceptions = array())
{
static $files = array();
if (!is_dir($dir)) {
return $files;
}
$dir = realpath($dir) . '/';
$entries = scandir($dir);
foreach ($entries as $entry) {
if ($entry == '.' or $entry == '..' or $entry == '.svn' or $entry == 'db') {
continue;
}
if (in_array($entry, $exceptions)) {
continue;
}
$fullEntry = $dir . $entry;
if (is_file($fullEntry)) {
$files[] = $dir . $entry;
} else {
$nextDir = $dir . $entry;
getFiles($nextDir);
}
}
return $files;
}
开发者ID:dyp8848,项目名称:chanzhieps,代码行数:33,代码来源:syncext.php
示例6: getFiles
function getFiles($fileName, &$updateTime = 0, $url = '', $levels = 100, $types = array('jpg', 'png', 'gif', 'jpeg', 'css', 'js'))
{
if (empty($fileName) || !$levels) {
return false;
}
$files = array();
if (is_file($fileName)) {
$updateTime = getMax(filectime($fileName), $updateTime);
$files[] = $url;
} else {
if ($dir = @opendir($fileName)) {
while (($file = readdir($dir)) !== false) {
if (in_array($file, array('.', '..'))) {
continue;
}
if (is_dir($fileName . '/' . $file)) {
$files2 = getFiles($fileName . '/' . $file, $updateTime, $url . '/' . $file, $levels - 1);
if ($files2) {
$files = array_merge($files, $files2);
}
} else {
$updateTime = getMax(filectime($fileName . '/' . $file), $updateTime);
$type = end(explode(".", $file));
if (in_array($type, $types)) {
$files[] = $url . '/' . $file;
}
}
}
}
}
@closedir($dir);
// echo date("Y-m-d H:i:s",$updateTime).'<hr>';
return $files;
}
开发者ID:sdgdsffdsfff,项目名称:auto_manifest,代码行数:34,代码来源:util.php
示例7: nm_get_languages
function nm_get_languages()
{
$languages = array();
$files = getFiles(NMLANGPATH);
foreach ($files as $file) {
if (isFile($file, NMLANGPATH, 'php')) {
$lang = basename($file, '.php');
$languages[$lang] = NMLANGPATH . $file;
}
}
ksort($languages);
return $languages;
}
开发者ID:Vin985,项目名称:clqweb,代码行数:13,代码来源:functions.php
示例8: generateSitemapWithoutPing
public static function generateSitemapWithoutPing()
{
global $SITEURL;
$filenames = getFiles(GSDATAPAGESPATH);
if (count($filenames)) {
foreach ($filenames as $file) {
if (isFile($file, GSDATAPAGESPATH, 'xml')) {
$data = getXML(GSDATAPAGESPATH . $file);
if ($data->url != '404' && $data->private != 'Y') {
$pagesArray[] = array('url' => (string) $data->url, 'parent' => (string) $data->parent, 'date' => (string) $data->pubDate, 'menuStatus' => (string) $data->menuStatus);
}
}
}
}
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
$languages = return_i18n_available_languages();
$deflang = return_i18n_default_language();
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
$xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
if (count($pagesSorted)) {
foreach ($pagesSorted as $page) {
// set <loc>
if (count($languages) > 1) {
$pos = strrpos($page['url'], '_');
if ($pos !== false) {
$pageLoc = find_i18n_url(substr($page['url'], 0, $pos), $page['parent'], substr($page['url'], $pos + 1));
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent'], $deflang);
}
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent']);
}
// set <lastmod>
$pageLastMod = makeIso8601TimeStamp(date("Y-m-d H:i:s", strtotime($page['date'])));
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
$pagePriority = $page['menuStatus'] == 'Y' ? '1.0' : '0.5';
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', htmlspecialchars($pageLoc));
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
XMLsave($xml, $file);
}
开发者ID:Vin985,项目名称:clqweb,代码行数:51,代码来源:sitemap.class.php
示例9: loadModules
function loadModules()
{
global $ARI_ADMIN_MODULES;
global $ARI_DISABLED_MODULES;
global $loaded_modules;
$modules_path = "./modules";
if (is_dir($modules_path)) {
$filter = ".module";
$recursive_max = 1;
$recursive_count = 0;
$files = getFiles($modules_path, $filter, $recursive_max, $recursive_count);
foreach ($files as $key => $path) {
// build module object
include_once $path;
$path_parts = pathinfo($path);
list($name, $ext) = split("\\.", $path_parts['basename']);
// check for module and get rank
if (class_exists($name)) {
$module = new $name();
// check if admin module
$found = 0;
if ($ARI_ADMIN_MODULES) {
$admin_modules = split(',', $ARI_ADMIN_MODULES);
foreach ($admin_modules as $key => $value) {
if ($name == $value) {
$found = 1;
break;
}
}
}
// check if disabled module
$disabled = 0;
if ($ARI_DISABLED_MODULES) {
$disabled_modules = split(',', $ARI_DISABLED_MODULES);
foreach ($disabled_modules as $key => $value) {
if ($name == $value) {
$disabled = 1;
break;
}
}
}
// if not admin module or admin user add to module name to array
if (!$disabled && (!$found || $_SESSION['ari_user']['admin'])) {
$loaded_modules[$name] = $module;
}
}
}
} else {
$_SESSION['ari_error'] = _("{$path} not a directory or not readable");
}
}
开发者ID:carriercomm,项目名称:Freeside,代码行数:51,代码来源:common.php
示例10: getFiles
function getFiles($dir, $subfolder = '.')
{
$handle = opendir($dir);
$templates = array();
while ($file = readdir($handle)) {
if (is_file($dir . '/' . $file) and substr($file, -3) == 'tpl') {
$templates[] = $subfolder . '/' . $file;
} elseif (is_dir($dir . '/' . $file) and $file != '.' && $file != '..') {
$templates = array_merge($templates, getFiles($dir . '/' . $file, $subfolder . '/' . $file));
}
}
closedir($handle);
return $templates;
}
开发者ID:jhubert,项目名称:php-invoice,代码行数:14,代码来源:pickfile.php
示例11: getFiles
/**
* Retrieves all file names from a directory
*
* @param string $dir_name Name of the directory from which to extract file names
* @return string[] $file_list
*/
function getFiles($dir_name)
{
$dir_files = scandir($dir_name);
$file_list = array();
foreach ($dir_files as $file_name) {
$file = "{$dir_name}/{$file_name}";
if (is_file($file)) {
$file_list[] = $file;
} elseif ($file_name[0] != '.' && is_dir($file)) {
$file_list = array_merge(getFiles($file), $file_list);
}
}
return $file_list;
}
开发者ID:pantheon-systems,项目名称:terminus,代码行数:20,代码来源:make-docs.php
示例12: __construct
public function __construct(SugarView &$view)
{
require_once 'include/utils/file_utils.php';
$files = array();
getFiles($files, 'custom/include/utils/DevToolKit', '/\\.php/');
foreach ($files as $file) {
preg_match("/\\/(\\w+)\\.php\$/", $file, $matches);
$class = $matches[1];
require_once $file;
$bean = new $class($view);
if ($bean->has_metadata()) {
$this->toolkits[] = $bean;
}
}
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:15,代码来源:DevToolKitManager.php
示例13: getFiles
function getFiles($dir, &$results = array(), $filename = 'template.html')
{
$files = scandir($dir);
foreach ($files as $key => $value) {
$path = realpath($dir . '/' . $value);
if (!is_dir($path)) {
if ($value == $filename) {
$results[] = $path;
}
} else {
if ($value != "." && $value != "..") {
getFiles($path, $results);
}
}
}
return $results;
}
开发者ID:mackraja,项目名称:practise,代码行数:17,代码来源:test7.php
示例14: getFiles
function getFiles($path, $base_path = null)
{
$path_files = array_diff(scandir($path), array('..', '.'));
$files = array();
foreach ($path_files as $file) {
$file_path = $path . '/' . $file;
if ($file[0] == '.') {
continue;
}
if (is_dir($file_path)) {
$files = array_merge($files, getFiles($file_path, $base_path ?: $path));
} else {
$files[] = $base_path ? str_replace($base_path . '/', '', $file_path) : $file_path;
}
}
return $files;
}
开发者ID:maggo,项目名称:patterns,代码行数:17,代码来源:app.php
示例15: getFiles
function getFiles($i, $pref)
{
$output = array();
foreach ($i as $f) {
$f = $pref . '/' . $f;
if (is_dir($f)) {
$base = basename($f);
if ($base[0] !== '.') {
if ($base !== 'tests' and $base !== 'smarty' and $base !== 'tinymce' and $base !== 'smarty-plugins') {
$output = array_merge($output, getFiles(scandir($f), $f));
}
}
} else {
$output[] = $f;
}
}
return $output;
}
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:18,代码来源:updatetranslation.php
示例16: uploadmulti
/**
* 上传单个或多个文件
* @param int $type
* $type为0:上传图片
* $type为1:上传视频
*/
function uploadmulti($type)
{
// print_r($_FILES);die;
$files = getFiles();
$path = dirname(dirname(__FILE__));
//获取upload_image的上层目录的绝对路径
if ($type == 0) {
$uploadPath = $path . '/upload_image';
} else {
$uploadPath = $path . '/upload_video';
}
foreach ($files as $fileInfo) {
$upload = new upload($fileInfo, $uploadPath, false);
$dest = $upload->uploadFile();
$uploadFiles[] = $dest;
}
$uploadFiles = array_values(array_filter($uploadFiles));
return $uploadFiles;
}
开发者ID:skdliuyang,项目名称:wechat-subscribe,代码行数:25,代码来源:uploadFiles.php
示例17: uploadmulti
/**
* 上传单个或多个文件
* @param int $type
* $type为0:上传图片
* $type为1:上传视频
* $type为2:上传缩略图
*/
function uploadmulti($fileName, $type)
{
// print_r($_FILES);die;
$files = getFiles();
if ($type == 0) {
$uploadPath = '../../../common/upload_image';
} elseif ($type == 1) {
$uploadPath = '../../../common/upload_video';
} else {
$uploadPath = '../../../common/upload_thumb';
}
foreach ($files as $fileInfo) {
$upload = new upload($fileName, $fileInfo, $uploadPath, false);
$dest = $upload->uploadFile();
$uploadFiles[] = $dest;
}
$uploadFiles = array_values(array_filter($uploadFiles));
return $uploadFiles;
}
开发者ID:sunpeijun,项目名称:wechat_subscribe,代码行数:26,代码来源:uploadFiles.php
示例18: getFiles
function getFiles($src)
{
if ($handle = opendir($src)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_file("{$src}/{$file}") && eregi('.pdf', $file)) {
$url = str_replace("..", $_SERVER['HTTP_HOST'], $src);
echo ' <p><a href="http://' . $url . '/' . $file . '" target="_blank">' . $file . "</a></p>\n";
} else {
if (is_dir("{$src}/{$file}")) {
echo "\t\t\t\t\t<h2>{$file}</h2>\n";
getFiles("{$src}/{$file}");
}
}
}
}
closedir($handle);
}
}
开发者ID:vijo,项目名称:xmoovstream,代码行数:19,代码来源:resources.php
示例19: getFiles
function getFiles($dir)
{
$files = array();
$d = opendir($dir);
if ($d) {
while ($f = readdir($d)) {
if ($f == '.' || $f == '..' || $f == '.svn' || $f == '.git') {
continue;
}
if (is_dir($dir . '/' . $f)) {
$files = array_merge($files, getFiles($dir . '/' . $f));
} else {
$files[] = $dir . '/' . $f;
}
}
closedir($d);
}
return $files;
}
开发者ID:gsmadhusudan,项目名称:NRE,代码行数:19,代码来源:fileheader.php
示例20: themes
/**
* Outputs a table with currently detected themes in
*
* @version 1.0
* @since 1.0.0
* @author Dan Aldridge
*
* @return void
*/
public function themes()
{
$objForm = Core_Classes_coreObj::getForm();
$objTPL = Core_Classes_coreObj::getTPL();
$objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'table' => cmsROOT . 'modules/core/views/admin/themes/manageTable.tpl'));
$dir = cmsROOT . 'themes';
$tpls = getFiles($dir);
//echo dump($tpls);
foreach ($tpls as $tpl) {
if ($tpl['type'] !== 'dir') {
continue;
}
$tplName = secureMe($tpl['name'], 'alphanum');
$details = $this->getDetails($tplName);
//echo dump($details, $tplName);
$objTPL->assign_block_vars('theme', array('NAME' => doArgs('name', 'N/A', $details), 'VERSION' => doArgs('version', '0.0', $details), 'ENABLED' => 'true', 'COUNT' => '9001', 'MODE' => doArgs('mode', 'N/A', $details), 'AUTHOR' => doArgs('author', 'N/A', $details)));
}
$objTPL->parse('table', false);
Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Theme Management', 'CONTENT' => $objTPL->get_html('table', false), 'ICON' => 'fa-icon-user')));
}
开发者ID:richard-clifford,项目名称:CSCMS,代码行数:29,代码来源:panel.themes.php
注:本文中的getFiles函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论