本文整理汇总了PHP中General::listStructureFlat方法的典型用法代码示例。如果您正苦于以下问题:PHP General::listStructureFlat方法的具体用法?PHP General::listStructureFlat怎么用?PHP General::listStructureFlat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General::listStructureFlat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listStructureFlat
function listStructureFlat($dir = ".", $filters = array(), $recurse = true, $sort = "asc", $strip_root = NULL, $exclude = array(), $ignore_hidden = true)
{
$files = array();
if (!($handle = @opendir($dir))) {
return array();
}
while (($file = @readdir($handle)) != false) {
if ($file != '.' && $file != '..' && (!$ignore_hidden || $ignore_hidden && $file[0] != '.')) {
if (@is_dir("{$dir}/{$file}")) {
if ($recurse) {
$files = array_merge($files, General::listStructureFlat("{$dir}/{$file}", $filters, $recurse, $sort, $strip_root, $exclude, $ignore_hidden));
}
} else {
$can_include = true;
if (!empty($filters)) {
$can_include = in_array(General::getExtension($file), $filters);
}
if (!empty($exclude)) {
$can_include = !in_array(General::getExtension($file), $exclude);
}
if ($can_include) {
$files[] = array("name" => $file, "path" => $dir);
}
}
}
}
@closedir($handle);
if ($sort == 'desc') {
usort($files, array('General', 'fileSortR'));
} elseif ($sort == 'mtime') {
usort($files, array('General', 'filemtimeSort'));
} else {
usort($files, array('General', 'fileSort'));
}
if ($strip_root) {
for ($ii = 0; $ii < count($files); $ii++) {
$files[$ii]['path'] = str_replace($strip_root, "", $files[$ii]['path']);
}
}
return $files;
}
示例2: array_merge
/***
*
* Symphony web publishing system
*
* Copyright 2004–2006 Twenty One Degrees Pty. Ltd.
*
* @version 1.7
* @licence https://github.com/symphonycms/symphony-1.7/blob/master/LICENCE
*
***/
$GLOBALS['pageTitle'] = "Pages";
$pages = $DB->fetch("SELECT * FROM `tbl_pages` WHERE `sortorder` > -1 ORDER BY `sortorder` ASC");
$pages = array_merge($pages, $DB->fetch("SELECT * FROM `tbl_pages` WHERE `sortorder` = -1 ORDER BY `sortorder` ASC"));
$assets = General::listStructureFlat(WORKSPACE, array("css", "js", "xml", "txt", "html"), true, "asc", WORKSPACE);
$utilities = $DB->fetch("SELECT * FROM `tbl_utilities` ORDER BY `name` ASC");
$masters = General::listStructureFlat(WORKSPACE . "/masters", array("xsl"), true, "asc", WORKSPACE);
$DSM = new DatasourceManager(array('parent' => &$Admin));
$datasources = $DSM->listAll();
if (isset($_GET['_f'])) {
switch ($_GET['_f']) {
case "complete":
$Admin->pageAlert("selected-success", array("Page(s)", "deleted"));
break;
}
}
?>
<form action="<?php
print $Admin->getCurrentPageURL();
?>
" method="post">
<h2><!-- PAGE TITLE --> <a class="create button" href="<?php
示例3: intval
$GLOBALS['pageTitle'] = "File Manager";
$current_page = 1;
if (isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg'])) {
$current_page = intval($_REQUEST['pg']);
}
$ignore = array("events", "data-sources", "text-formatters", "pages", "masters", "utilities");
$path = '/workspace/';
if (isset($_REQUEST['filter'])) {
$path = $_REQUEST['filter'];
$path = '/workspace/' . trim($path, '/') . '/';
}
$limitFilesToTypes = array();
if (!$Admin->authorIsSuper()) {
$limitFilesToTypes = preg_split('@\\s*,\\s*@i', $Admin->getConfigVar('filetype_restriction', 'filemanager'), -1, PREG_SPLIT_NO_EMPTY);
}
$files = General::listStructureFlat(DOCROOT . $path, $limitFilesToTypes, false, "asc", WORKSPACE);
$files_count_total = count($files);
$files_count_remaining = $files_count_total - ($current_page - 1) * $Admin->getConfigVar('pagination_maximum_rows', 'symphony');
$files = array_slice($files, ($current_page - 1) * $Admin->getConfigVar('pagination_maximum_rows', 'symphony'), $Admin->getConfigVar('pagination_maximum_rows', 'symphony'));
$directories = General::listDirStructure(WORKSPACE, true, "asc", DOCROOT);
$date = new SymDate($Admin->getConfigVar("time_zone", "region"), $Admin->getConfigVar("date_format", "region"));
if (isset($_GET['_f'])) {
switch ($_GET['_f']) {
case "upload-fail":
$Admin->pageAlert("upload-fail", NULL, false, 'error');
break;
case "upload-success":
$Admin->pageAlert("upload-success", NULL, false, 'error');
break;
case "deleted":
$Admin->pageAlert("selected-success", array("File(s)", "deleted"), false, 'error');