本文整理汇总了PHP中FileList类的典型用法代码示例。如果您正苦于以下问题:PHP FileList类的具体用法?PHP FileList怎么用?PHP FileList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
$fs = FileSet::getByID($this->fsID);
$fileList = new FileList();
$fileList->filterBySet($fs);
$fileList->filterByType(FileType::T_IMAGE);
$fileList->sortByFileSetDisplayOrder();
$images = $fileList->get(1000, 0);
$this->set('images', $images);
$this->set('picture', $this->getPicture());
}
示例2: on_get_list
/**
* Вывод списка файлов.
*/
public static function on_get_list(Context $ctx)
{
try {
$options = array('#raw' => true, 'name' => 'list', 'title' => t('Файловый архив'), 'path' => os::webpath(MCMS_SITE_FOLDER, $ctx->config->get('modules/files/storage')), 'advsearch' => true, 'canedit' => true, 'mode' => $ctx->get('mode', 'table'), 'scope' => $ctx->get('scope'), 'type' => 'file');
$tmp = new FileList($ctx, $options['scope']);
return $tmp->getHTML('files', $options);
} catch (TableNotFoundException $e) {
if ($e->getTableName() != 'node__idx_filetype') {
throw $e;
}
throw new Exception(t('Отсутствует индекс по полю filetype, <a href="@url">исправьте это</a> и возвращайтесь.', array('@url' => 'admin/structure/fields/edit?type=file&field=filetype&destination=' . urlencode(MCMS_REQUEST_URI))));
}
}
示例3: getList
public function getList()
{
if ($this->xml) {
return $this->document->saveXML();
} else {
$html = $this->document->saveHTML();
if ($this->includefiles) {
$filelist = new FileList(array(), array('class' => 'type'), $this->parent, false);
$html .= $filelist->getList();
}
return $html;
}
}
示例4: _prepare
private function _prepare($fs)
{
$fl = new FileList();
$fl->filterByExtension("js");
$fl->filterBySet($fs);
$files = $fl->get();
$setFiles = array();
foreach ($files as $f) {
$fv = $f->getRecentVersion();
$fn = $fv->getFileName();
$this->_exists[$fn] = $f;
}
}
示例5: loadFileSet
function loadFileSet(){
if (intval($this->fsID) < 1) {
return false;
}
Loader::helper('concrete/file');
Loader::model('file_attributes');
Loader::library('file/types');
Loader::model('file_list');
Loader::model('file_set');
$ak = FileAttributeKey::getByHandle('height');
$fs = FileSet::getByID($this->fsID);
$fileList = new FileList();
$fileList->filterBySet($fs);
$fileList->filterByType(FileType::T_IMAGE);
$fileList->sortByFileSetDisplayOrder();
$files = $fileList->get(1000,0);
$image = array();
$image['duration'] = $this->duration;
$image['fadeDuration'] = $this->fadeDuration;
$image['groupSet'] = 0;
$image['url'] = '';
$images = array();
$maxHeight = 0;
foreach ($files as $f) {
$fp = new Permissions($f);
if(!$fp->canViewFile()) { continue; }
$image['fID'] = $f->getFileID();
$image['fileName'] = $f->getFileName();
$image['fullFilePath'] = $f->getPath();
$image['url'] = $f->getRelativePath();
// find the max height of all the images so slideshow doesn't bounce around while rotating
$vo = $f->getAttributeValueObject($ak);
if (is_object($vo)) {
$image['imgHeight'] = $vo->getValue('height');
}
if ($maxHeight == 0 || $image['imgHeight'] > $maxHeight) {
$maxHeight = $image['imgHeight'];
}
$images[] = $image;
}
$this->images = $images;
}
示例6: getFileList
static function getFileList($dir, $recurse = false)
{
// массив, хранящий возвращаемое значение
$retval = array();
// добавить конечный слеш, если его нет
if (substr($dir, -1) != "/") {
$dir .= "/";
}
// указание директории и считывание списка файлов
$d = @dir($dir) or die("getFileList: Не удалось открыть каталог {$dir} для чтения");
while (false !== ($entry = $d->read())) {
// пропустить скрытые файлы
if ($entry[0] == ".") {
continue;
}
if (is_dir("{$dir}{$entry}")) {
$retval[] = "{$dir}{$entry}";
if ($recurse && is_readable("{$dir}{$entry}/")) {
$retval = array_merge($retval, FileList::getFileList("{$dir}{$entry}/", true));
}
} elseif (is_readable("{$dir}{$entry}")) {
$retval[] = "{$dir}{$entry}";
}
}
$d->close();
return $retval;
}
示例7: getUnsortedPermittedFilesetImages
public static function getUnsortedPermittedFilesetImages($fsID)
{
Loader::model('file_set');
Loader::model('file_list');
$fsHasDisplayOrder = version_compare(APP_VERSION, '5.4.1', '>=');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
if ($fsHasDisplayOrder) {
$fl->sortByFileSetDisplayOrder();
}
$all_files = $fl->get();
$permitted_files = array();
foreach ($all_files as $f) {
$fp = new Permissions($f);
if ($fp->canRead()) {
$permitted_files[] = $f;
}
}
return $permitted_files;
}
示例8: getPermittedFilesetImages
public static function getPermittedFilesetImages($fsID, $use_file_props_for_title_and_caption = false)
{
Loader::model('file_set');
Loader::model('file_list');
$fsHasDisplayOrder = version_compare(APP_VERSION, '5.4.1', '>=');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
if ($fsHasDisplayOrder) {
$fl->sortByFileSetDisplayOrder();
}
$all_files = $fl->get();
$permitted_files = array();
foreach ($all_files as $f) {
$fp = new Permissions($f);
if ($fp->canRead()) {
$fv = $f->getRecentVersion();
$permitted_files[$f->fID] = array('file' => $f, 'fID' => $f->fID, 'position' => $fsHasDisplayOrder ? $f->fsDisplayOrder : 0, 'title' => $use_file_props_for_title_and_caption ? $fv->getTitle() : '', 'caption' => $use_file_props_for_title_and_caption ? $fv->getDescription() : '');
}
}
return $permitted_files;
}
示例9: getLastControllerModTime
protected static function getLastControllerModTime(array $controllerDirs)
{
$controllerFiles = array();
foreach ($controllerDirs as $dir) {
$controllerFiles = array_merge($controllerFiles, FileList::getFilesRecursively($dir));
}
$lastTime = 0;
foreach ($controllerFiles as $file) {
$fileModTime = filemtime($file);
if ($fileModTime > $lastTime) {
$lastTime = $fileModTime;
}
}
return $lastTime;
}
示例10: getMootoolsPluginFiles
public function getMootoolsPluginFiles($fs)
{
Loader::model('file_set');
Loader::model('file_list');
// $u = new User();
$fl = new FileList();
$fl->filterByMootoolsPlugin(true);
$fl->filterByExtension("js");
// $fl->filter('u.uID', $u->getUserID(), '=');
$fl->sortByAttributeKey("ak_" . MOOTOOLS_PLUGIN_DISPLAY_ORDER);
$fl->filterBySet($fs);
$files = $fl->get();
return $files;
}
示例11: start
public function start()
{
global $projectTmpDir, $php_errormsg;
$authenticator = new Auth();
if ($authenticator->auth()) {
ob_start();
if (!empty($_GET['a'])) {
$action = $_GET['a'];
$interval = empty($_GET['delay']) ? 5 : (int) $_GET['delay'];
$fileScanner = new FileList();
$fileScanner->setInterval($interval);
if ($action === 'cleanUp') {
$this->removeTempFiles();
print json_encode(array('type' => 'cleanUp', 'status' => 'ok', 'phpError' => $php_errormsg));
} else {
if ($action === 'getFileList') {
echo $fileScanner->performScanning();
} else {
if ($action === 'getSignatureScanResult') {
$this->detector = new MalwareDetector();
$this->detector->setRequestDelay($interval);
print $this->detector->malwareScanRound();
} else {
if ($action === 'getWebsiteLog') {
//REPORTING
$xmlLog = $this->getXMLReport();
$logFilename = $projectTmpDir . '/scan_log.xml';
file_put_contents2($logFilename, $xmlLog);
print json_encode(array('type' => 'getWebsiteLog', 'status' => 'ok', 'phpError' => $php_errormsg));
}
}
}
}
} else {
//GENERATE INTERFACE
$fileScanner = new FileList();
define('PS_ARCHIVE_DOWNLOAD_URL', $_SERVER['PHP_SELF'] . '?controller=download&f=report');
$this->templateOutput($fileScanner->getInterval());
}
}
}
示例12: mkdir
if (!is_dir(dirname($CFG->INCLUDE_PATH . $value->Name))) {
mkdir(dirname($CFG->INCLUDE_PATH . $value->Name), 0775, true);
}
file_put_contents($CFG->INCLUDE_PATH . $value->Name, $tmp);
echo $value->Name . " (" . $value->Size . " bytes): " . $value->MD5 . "\n";
} else {
echo "ERRORE di DOWNLOAD: " . $value->Name . " (" . $value->Size . " bytes): " . $value->MD5 . "\n";
}
} else {
echo "ERRORE di DOWNLOAD: " . $value->Name . "\n";
}
}
echo "</pre>";
//Calcola Le differenze DA CANCELLARE
//Gestisci Elenco Locale
$tmp = new FileList("/");
$tmp->IncludeFolders(true);
$tmp->Load();
$lFileList = $tmp->toArray();
$NeedFile = array_udiff($lFileList, $rFileList, array("File", "compare"));
usort($NeedFile, array("File", "compare"));
echo "Cancellazione Files non utilizzati\n";
echo "<pre>";
foreach ($NeedFile as $value) {
if (is_dir($CFG->INCLUDE_PATH . $value->Name)) {
if (count(scandir($CFG->INCLUDE_PATH . $value->Name)) == 2) {
rmdir($CFG->INCLUDE_PATH . $value->Name);
echo "CARTELLA: " . $value->Name . "\n";
}
} else {
if ($value->Name != "/Common/config.inc.php") {
示例13: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$cp = FilePermissions::getGlobal();
if (!$cp->canAccessFileManager()) {
die(t("Unable to access the file manager."));
}
Loader::model('file_list');
Loader::model('file_set');
$fileList = new FileList();
$fileList->enableStickySearchRequest();
$req = $fileList->getSearchRequest();
$form = Loader::helper('form');
$s1 = FileSet::getMySets();
if (count($s1) > 0) {
?>
<div class="span4" style="width: 280px">
<?php
echo $form->label('fsID', t('In Set(s)'));
?>
<div class="input">
<select multiple name="fsID[]" class="chosen-select">
<?php
foreach ($s1 as $s) {
?>
<option value="<?php
echo $s->getFileSetID();
?>
"><?php
echo $s->getFileSetName();
?>
示例14: generateAffectedPaths
private function generateAffectedPaths()
{
if ($this->isRawDiffSource()) {
return array();
}
$repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistSubversionAPI) {
$file_list = new FileList($this->getArgument('paths', array()));
$paths = $repository_api->getSVNStatus($externals = true);
foreach ($paths as $path => $mask) {
if (!$file_list->contains($repository_api->getPath($path), true)) {
unset($paths[$path]);
}
}
$warn_externals = array();
foreach ($paths as $path => $mask) {
$any_mod = $mask & ArcanistRepositoryAPI::FLAG_ADDED || $mask & ArcanistRepositoryAPI::FLAG_MODIFIED || $mask & ArcanistRepositoryAPI::FLAG_DELETED;
if ($mask & ArcanistRepositoryAPI::FLAG_EXTERNALS) {
unset($paths[$path]);
if ($any_mod) {
$warn_externals[] = $path;
}
}
}
if ($warn_externals && !$this->hasWarnedExternals) {
echo phutil_console_format("%s\n\n%s\n\n", pht("The working copy includes changes to '%s' paths. These " . "changes will not be included in the diff because SVN can not " . "commit 'svn:externals' changes alongside normal changes.", 'svn:externals'), pht("Modified '%s' files:", 'svn:externals'), phutil_console_wrap(implode("\n", $warn_externals), 8));
$prompt = pht('Generate a diff (with just local changes) anyway?');
if (!phutil_console_confirm($prompt)) {
throw new ArcanistUserAbortException();
} else {
$this->hasWarnedExternals = true;
}
}
} else {
$paths = $repository_api->getWorkingCopyStatus();
}
foreach ($paths as $path => $mask) {
if ($mask & ArcanistRepositoryAPI::FLAG_UNTRACKED) {
unset($paths[$path]);
}
}
return $paths;
}
示例15: getFilesetImages
static function getFilesetImages($fsID, $randomize = false)
{
Loader::model('file_set');
Loader::model('file_list');
$fs = FileSet::getByID($fsID);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->filterByType(FileType::T_IMAGE);
$fl->setPermissionLevel('canRead');
if ($randomize) {
$fl->sortBy('RAND()', 'asc');
} else {
$fl->sortByFileSetDisplayOrder();
//Requires 5.4.1 or higher: version_compare(APP_VERSION, '5.4.1', '>=');
}
$files = $fl->get();
return $files;
}