本文整理汇总了PHP中gpFiles::ReadDir方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::ReadDir方法的具体用法?PHP gpFiles::ReadDir怎么用?PHP gpFiles::ReadDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpFiles
的用法示例。
在下文中一共展示了gpFiles::ReadDir方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_extra
function admin_extra()
{
global $langmessage, $dataDir;
$this->folder = $dataDir . '/data/_extra';
$this->areas = gpFiles::ReadDir($this->folder);
asort($this->areas);
$cmd = common::GetCommand();
$show = true;
switch ($cmd) {
case 'delete':
$this->DeleteArea();
break;
case 'save':
if ($this->SaveExtra()) {
break;
}
case 'edit':
if ($this->EditExtra()) {
$show = false;
}
break;
case 'rawcontent':
$this->RawContent();
break;
case 'inlineedit':
$this->InlineEdit();
die;
}
if ($show) {
$this->ShowExtras();
}
}
示例2: CheckPageFiles
/**
* Check page files for orphaned data files
*
*/
function CheckPageFiles()
{
global $dataDir, $gp_index;
$pages_dir = $dataDir . '/data/_pages';
$all_files = gpFiles::ReadDir($pages_dir, 'php');
foreach ($all_files as $key => $file) {
$all_files[$key] = $pages_dir . '/' . $file . '.php';
}
$page_files = array();
foreach ($gp_index as $slug => $index) {
$page_files[] = gpFiles::PageFile($slug);
}
$diff = array_diff($all_files, $page_files);
if (!count($diff)) {
return;
}
echo '<h2>Orphaned Data Files</h2>';
echo '<p>The following data files appear to be orphaned and are most likely no longer needed. Before completely removing these files, we recommend backing them up first.</p>';
echo '<table class="bordered"><tr><th>File</th></tr>';
foreach ($diff as $file) {
echo '<tr><td>' . $file . '</td></tr>';
}
echo '</table>';
}
示例3: SelectContent_Areas
function SelectContent_Areas($param, $count_gadgets)
{
global $dataDir, $langmessage, $config;
$slug = 'Admin_Theme_Content/' . rawurlencode($this->curr_layout);
$addQuery = 'cmd=addcontent&where=' . rawurlencode($param);
echo '<div id="area_lists">';
//extra content
echo '<div id="layout_extra_content">';
echo '<table class="bordered">';
echo '<tr><th colspan="2"> </th></tr>';
$extrasFolder = $dataDir . '/data/_extra';
$files = gpFiles::ReadDir($extrasFolder);
asort($files);
foreach ($files as $file) {
$extraName = $file;
echo '<tr><td>';
echo str_replace('_', ' ', $extraName);
echo '</td><td class="add">';
echo common::Link($slug, $langmessage['add'], $addQuery . '&insert=Extra:' . $extraName, array('data-cmd' => 'creq'));
echo '</td></tr>';
}
//new extra area
echo '<tr><td>';
echo '<form action="' . common::GetUrl($slug) . '" method="post">';
echo '<input type="hidden" name="cmd" value="addcontent" />';
echo '<input type="hidden" name="addtype" value="new_extra" />';
echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
echo '<input type="text" name="extra_area" value="" size="15" class="gpinput"/>';
includeFile('tool/SectionContent.php');
$types = section_content::GetTypes();
echo '<select name="type" class="gpselect">';
foreach ($types as $type => $info) {
echo '<option value="' . $type . '">' . $info['label'] . '</option>';
}
echo '</select> ';
echo ' <input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gpbutton"/>';
echo '</form>';
echo '</td><td colspan="2" class="add">';
echo '<form action="' . common::GetUrl($slug) . '" method="post">';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</form>';
echo '</td></tr>';
echo '</table>';
echo '</div>';
//gadgets
if ($count_gadgets > 0) {
echo '<div id="layout_gadgets" class="nodisplay">';
echo '<table class="bordered">';
echo '<tr><th colspan="2"> </th></tr>';
foreach ($config['gadgets'] as $gadget => $info) {
echo '<tr>';
echo '<td>';
echo str_replace('_', ' ', $gadget);
echo '</td>';
echo '<td class="add">';
echo common::Link($slug, $langmessage['add'], $addQuery . '&insert=' . $gadget, array('data-cmd' => 'creq'));
echo '</td>';
echo '</tr>';
}
echo '<tr><td colspan="2" class="add">';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</td></tr>';
echo '</table>';
echo '</div>';
}
//menus
echo '<div id="layout_menus" class="nodisplay">';
echo '<form action="' . common::GetUrl($slug) . '" method="post">';
echo '<input type="hidden" name="cmd" value="addcontent" />';
echo '<input type="hidden" name="addtype" value="preset_menu" />';
echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
echo '<table class="bordered">';
$this->PresetMenuForm();
echo '<tr><td colspan="2" class="add">';
echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</td></tr>';
echo '</table>';
echo '</form>';
echo '</div>';
echo '<div id="layout_custom" class="nodisplay">';
//custom area
echo '<form action="' . common::GetUrl($slug) . '" method="post">';
echo '<input type="hidden" name="cmd" value="addcontent" />';
echo '<input type="hidden" name="addtype" value="custom_menu" />';
echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
$this->CustomMenuForm();
echo '<tr><td colspan="2" class="add">';
echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</td></tr>';
echo '</table>';
echo '</form>';
echo '</div>';
echo '</div>';
}
示例4: GetAvailAddons
function GetAvailAddons()
{
global $dataDir;
$addonPath = $dataDir . '/addons';
if (!file_exists($addonPath)) {
message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
return array();
}
$folders = gpFiles::ReadDir($addonPath, 1);
$avail = array();
foreach ($folders as $key => $value) {
$fullPath = $addonPath . '/' . $key;
$info = $this->GetAvailInstall($fullPath);
if (!$info) {
continue;
}
$info['upgrade_key'] = $this->UpgradePath($info);
$avail[$key] = $info;
}
return $avail;
}
示例5: SetExported
function SetExported()
{
$this->exported = gpFiles::ReadDir($this->export_dir, $this->all_extenstions);
arsort($this->exported);
}
示例6: RmAll
/**
* Remove a file or directory and it's contents
*
*/
public static function RmAll($path)
{
if (empty($path)) {
return false;
}
if (is_link($path)) {
return @unlink($path);
}
if (!is_dir($path)) {
return @unlink($path);
}
$success = true;
$subDirs = array();
//$files = scandir($path);
$files = gpFiles::ReadDir($path, false);
foreach ($files as $file) {
$full_path = $path . '/' . $file;
if (!is_link($full_path) && is_dir($full_path)) {
$subDirs[] = $full_path;
continue;
}
if (!@unlink($full_path)) {
$success = false;
}
}
foreach ($subDirs as $subDir) {
if (!gpFiles::RmAll($subDir)) {
$success = false;
}
}
if ($success) {
return gpFiles::RmDir($path);
}
return false;
}
示例7: GetAvailAddons
/**
* Get a list of available addons
*
*/
function GetAvailAddons()
{
global $dataDir;
$addonPath = $dataDir . '/addons';
if (!file_exists($addonPath)) {
message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
return array();
}
$installed_path = $dataDir . '/data/_addoncode';
$folders = gpFiles::ReadDir($addonPath, 1);
$versions = array();
$avail = array();
foreach ($folders as $value) {
$fullPath = $addonPath . '/' . $value;
$info = $this->GetAvailInstall($fullPath);
if (!$info) {
continue;
}
$info['upgrade_key'] = admin_addons_tool::UpgradePath($info);
$avail[$value] = $info;
if (isset($info['Addon_Version']) && isset($info['Addon_Unique_ID'])) {
$id = $info['Addon_Unique_ID'];
$version = $info['Addon_Version'];
if (!isset($versions[$id])) {
$versions[$id] = $version;
continue;
}
if (version_compare($versions[$id], $version, '<')) {
$versions[$id] = $version;
}
}
}
if (!gp_unique_addons) {
return $avail;
}
//show only the most recent versions
$temp = array();
foreach ($avail as $key => $info) {
if (!isset($info['Addon_Version']) || !isset($info['Addon_Unique_ID'])) {
$temp[$key] = $info;
continue;
}
$id = $info['Addon_Unique_ID'];
$version = $info['Addon_Version'];
if (version_compare($versions[$id], $version, '>')) {
continue;
}
$temp[$key] = $info;
}
return $temp;
}
示例8: Getdata
function Getdata()
{
$this->areas = gpFiles::ReadDir($this->folder);
asort($this->areas);
}
示例9: CleanTemp
/**
* Clean old files and folders from the temporary folder
* Delete after 36 hours (129600 seconds)
*
*/
function CleanTemp()
{
global $dataDir;
$temp_folder = $dataDir . '/data/_temp';
$files = gpFiles::ReadDir($temp_folder, false);
foreach ($files as $file) {
if ($file == 'index.html') {
continue;
}
$full_path = $temp_folder . '/' . $file;
$mtime = (int) filemtime($full_path);
$diff = time() - $mtime;
if ($diff < 129600) {
continue;
}
gpFiles::RmAll($full_path);
}
}
示例10: ScheduledTasks
function ScheduledTasks($status)
{
global $dataDir;
switch ($status) {
case 'embedcheck':
case 'checkincompat':
//these will continue
break;
case 'checklater':
default:
return;
}
//clean cache
//delete files older than 2 weeks, they will be regenerated if needed
$cache_dir = $dataDir . '/data/_cache';
$cache_files = gpFiles::ReadDir($cache_dir, 'css');
$time = time();
foreach ($cache_files as $file) {
$full_path = $cache_dir . '/' . $file . '.css';
if ($time - filemtime($full_path) > 1209600) {
@unlink($full_path);
}
}
}
示例11: GenerateTrashIndex
function GenerateTrashIndex()
{
global $dataDir;
$trash_dir = $dataDir . '/data/_trash';
$trash_files = gpFiles::ReadDir($trash_dir);
natcasesort($trash_files);
$trash_titles = array();
foreach ($trash_files as $file) {
$trash_titles[$file] = array();
$trash_titles[$file]['label'] = admin_tools::LabelToSlug($file);
$trash_titles[$file]['time'] = time();
}
admin_trash::SaveTrashTitles($trash_titles);
return $trash_titles;
}
示例12: GetAvailAddons
/**
* Get a list of available addons
*
*/
function GetAvailAddons()
{
global $dataDir;
$addonPath = $dataDir . '/addons';
if (!file_exists($addonPath)) {
message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
return array();
}
$installed_path = $dataDir . '/data/_addoncode';
$folders = gpFiles::ReadDir($addonPath, 1);
$versions = array();
$avail = array();
foreach ($folders as $value) {
$fullPath = $addonPath . '/' . $value;
$info = $this->GetAvailInstall($fullPath);
if (!$info) {
continue;
}
$info['upgrade_key'] = admin_addons_tool::UpgradePath($info);
$avail[$value] = $info;
if (isset($info['Addon_Version']) && isset($info['Addon_Unique_ID'])) {
$id = $info['Addon_Unique_ID'];
if (!isset($versions[$id])) {
$versions[$id] = $info['Addon_Version'];
} elseif (version_compare($versions[$id], $info['Addon_Version'], '<')) {
$versions[$id] = $info['Addon_Version'];
continue;
}
}
if (!$info['upgrade_key']) {
$this->avail_count++;
}
}
if (gp_unique_addons) {
$avail = self::FilterUnique($avail, $versions);
}
return $avail;
}