本文整理汇总了PHP中Folder::get_files方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::get_files方法的具体用法?PHP Folder::get_files怎么用?PHP Folder::get_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::get_files方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
function clear_cache($module_id = false)
{
import('io/filesystem/folder');
$folder = new Folder(FEEDS_PATH, OPEN_NOW);
$files = null;
if ($module_id !== false) {
$files = $folder->get_files('`' . $module_id . '_.*`');
} else {
$files = $folder->get_files();
}
foreach ($files as $file) {
$file->delete();
}
}
示例2: delete_files
private function delete_files(Folder $folder, $regex = '')
{
$files_to_delete = $folder->get_files($regex, true);
foreach ($files_to_delete as $file) {
$file->delete();
}
}
示例3: load_distribution_properties
public static function load_distribution_properties($prefered_lang)
{
global $DISTRIBUTION_MODULES;
//If the distribution properties exist in the prefered language
if (is_file('distribution/' . $prefered_lang . '.php')) {
//We load them
include 'distribution/' . $prefered_lang . '.php';
} else {
//We try to load another lang
$distribution_folder = new Folder('distribution');
$distribution_files = $distribution_folder->get_files('`distribution_[a-z_-]+\\.php`i');
if (count($distribution_files) > 0) {
include 'distribution/distribution_' . $distribution_files[0]->get_name() . '.php';
} else {
//We couldn't load anything, we just have to define them to default values
//Name of the distribution (localized)
define('DISTRIBUTION_NAME', 'Default distribution');
//Description of the distribution (localized)
define('DISTRIBUTION_DESCRIPTION', 'This distribution is the default distribution. You will manage to install PHPBoost with the default configuration but it will install only the kernel without any module.');
//Distribution default theme
define('DISTRIBUTION_THEME', 'base');
//Home page
define('DISTRIBUTION_START_PAGE', UserUrlBuilder::home()->rel());
//Can people register?
define('DISTRIBUTION_ENABLE_USER', false);
//Debug mode?
define('DISTRIBUTION_ENABLE_DEBUG_MODE', true);
//Enable bench?
define('DISTRIBUTION_ENABLE_BENCH', false);
//Modules list
$DISTRIBUTION_MODULES = array();
}
}
}
示例4: list_tu_recursive
function list_tu_recursive($directory, $recursive = false)
{
$files = array();
$folder = new Folder($directory);
foreach ($folder->get_files('`^.+Test\\.php$`') as $file) {
$files[] = preg_replace('`^[\\./]*kernel/`', '', $file->get_path());
}
if ($recursive) {
foreach ($folder->get_folders() as $folder) {
$files = array_merge($files, list_tu_recursive($folder->get_path(), true));
}
}
return $files;
}
示例5: change_day
function change_day()
{
global $Sql, $CONFIG_USER;
#######Taches de maintenance#######
$yesterday_timestamp = time() - 86400;
$Sql->query_inject("INSERT INTO " . DB_TABLE_STATS . " (stats_year, stats_month, stats_day, nbr, pages, pages_detail) VALUES ('" . gmdate_format('Y', $yesterday_timestamp, TIMEZONE_SYSTEM) . "', '" . gmdate_format('m', $yesterday_timestamp, TIMEZONE_SYSTEM) . "', '" . gmdate_format('d', $yesterday_timestamp, TIMEZONE_SYSTEM) . "', 0, 0, '')", __LINE__, __FILE__);
$last_stats = $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . "stats");
#######Statistiques#######
$Sql->query_inject("UPDATE " . DB_TABLE_STATS_REFERER . " SET yesterday_visit = today_visit", __LINE__, __FILE__);
$Sql->query_inject("UPDATE " . DB_TABLE_STATS_REFERER . " SET today_visit = 0, nbr_day = nbr_day + 1", __LINE__, __FILE__);
$Sql->query_inject("DELETE FROM " . DB_TABLE_STATS_REFERER . " WHERE last_update < '" . (time() - 604800) . "'", __LINE__, __FILE__);
$pages_displayed = pages_displayed();
import('io/filesystem/file');
$pages_file = new File(PATH_TO_ROOT . '/cache/pages.txt');
$pages_file->delete();
$total_visit = $Sql->query("SELECT total FROM " . DB_TABLE_VISIT_COUNTER . " WHERE id = 1", __LINE__, __FILE__);
$Sql->query_inject("DELETE FROM " . DB_TABLE_VISIT_COUNTER . " WHERE id <> 1", __LINE__, __FILE__);
$Sql->query_inject("UPDATE " . DB_TABLE_VISIT_COUNTER . " SET time = '" . gmdate_format('Y-m-d', time(), TIMEZONE_SYSTEM) . "', total = 1 WHERE id = 1", __LINE__, __FILE__);
$Sql->query_inject("INSERT INTO " . DB_TABLE_VISIT_COUNTER . " (ip, time, total) VALUES('" . USER_IP . "', '" . gmdate_format('Y-m-d', time(), TIMEZONE_SYSTEM) . "', '0')", __LINE__, __FILE__);
$Sql->query_inject("UPDATE " . DB_TABLE_STATS . " SET nbr = '" . $total_visit . "', pages = '" . array_sum($pages_displayed) . "', pages_detail = '" . addslashes(serialize($pages_displayed)) . "' WHERE id = '" . $last_stats . "'", __LINE__, __FILE__);
Session::garbage_collector();
import('io/filesystem/folder');
$week = 3600 * 24 * 7;
$cache_image_folder_path = new Folder(PATH_TO_ROOT . '/images/maths/');
foreach ($cache_image_folder_path->get_files('`\\.png$`') as $image) {
if (time() - $image->get_last_modification_date() > $week) {
$image->delete();
}
}
import('modules/modules_discovery_service');
$modules_loader = new ModulesDiscoveryService();
$modules = $modules_loader->get_available_modules('on_changeday');
foreach ($modules as $module) {
if ($module->is_enabled()) {
$module->functionality('on_changeday');
}
}
$CONFIG_USER['delay_unactiv_max'] = $CONFIG_USER['delay_unactiv_max'] * 3600 * 24;
if (!empty($CONFIG_USER['delay_unactiv_max']) && $CONFIG_USER['activ_mbr'] != 2) {
$Sql->query_inject("DELETE FROM " . DB_TABLE_MEMBER . " WHERE timestamp < '" . (time() - $CONFIG_USER['delay_unactiv_max']) . "' AND user_aprob = 0", __LINE__, __FILE__);
}
if ($CONFIG_USER['verif_code'] == '1') {
$Sql->query_inject("DELETE FROM " . DB_TABLE_VERIF_CODE . " WHERE timestamp < '" . (time() - 3600 * 24) . "'", __LINE__, __FILE__);
}
import('core/updates');
new Updates();
}
示例6: list_files
private function list_files($theme_selected)
{
$files = array();
$files[] = new FormFieldSelectChoiceOption('--', '');
$folder = new Folder(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_files_path);
foreach ($folder->get_files('`\\.tpl$`') as $file) {
$files[] = new FormFieldSelectChoiceOption($file->get_name(), $file->get_name_without_extension());
}
foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $id => $module) {
$folder = new Folder(PATH_TO_ROOT . '/' . $module->get_id() . '/templates');
if ($folder->exists()) {
foreach ($folder->get_files('`\\.tpl$`') as $file) {
$files[] = new FormFieldSelectChoiceOption(LangLoader::get_message('module', 'admin-modules-common') . ' ' . ModulesManager::get_module($module->get_id())->get_configuration()->get_name() . ' : ' . $file->get_name(), $module->get_id() . '/' . $file->get_name_without_extension());
}
}
}
$folder = new Folder(PATH_TO_ROOT . '/user/templates');
if ($folder->exists()) {
foreach ($folder->get_files('`\\.tpl$`') as $file) {
$files[] = new FormFieldSelectChoiceOption(LangLoader::get_message('users', 'user-common') . ' : ' . $file->get_name(), 'user/' . $file->get_name_without_extension());
}
}
return $files;
}
示例7: clear_cache
/**
* @desc Clear the cache of the specified module_id.
* @param mixed $module_id the module module_id or false. If false,
* Clear all feeds data from the cache
* @static
*/
public static function clear_cache($module_id = false)
{
$folder = new Folder(FEEDS_PATH);
$files = null;
if ($module_id !== false) {
// Clear only this module cache
$files = $folder->get_files('`' . $module_id . '_.*`');
foreach ($files as $file) {
$file->delete();
}
} else {
// Clear the whole cache
AppContext::get_cache_service()->clear_syndication_cache();
}
}
示例8: retrieve
define('DIR', str_replace('/install/install.php', '', $server_path));
define('SID', '');
$step = retrieve(GET, 'step', 1, TUNSIGNED_INT);
$step = $step > STEPS_NUMBER ? 1 : $step;
$lang = retrieve(GET, 'lang', DEFAULT_LANGUAGE);
if (!@(include_once 'lang/' . $lang . '/install_' . $lang . '.php')) {
include_once 'lang/' . DEFAULT_LANGUAGE . '/install_' . DEFAULT_LANGUAGE . '.php';
$lang = DEFAULT_LANGUAGE;
}
@(include_once '../lang/' . $lang . '/errors.php');
if (is_file('distribution/distribution_' . $lang . '.php')) {
include 'distribution/distribution_' . $lang . '.php';
} else {
import('io/filesystem/folder');
$distribution_folder = new Folder('distribution');
$distribution_files = $distribution_folder->get_files('`distribution_[a-z_-]+\\.php`i');
if (count($distribution_files) > 0) {
include 'distribution/distribution_' . $distribution_files[0]->get_name() . '.php';
} else {
define('DISTRIBUTION_NAME', 'Default distribution');
define('DISTRIBUTION_DESCRIPTION', 'This distribution is the default distribution. You will manage to install PHPBoost with the default configuration but it will install only the kernel without any module.');
define('DISTRIBUTION_THEME', 'base');
define('DISTRIBUTION_START_PAGE', '/member/member.php');
define('DISTRIBUTION_ENABLE_USER', false);
$DISTRIBUTION_MODULES = array();
}
}
import('members/user');
$user_data = array('m_user_id' => 1, 'login' => 'login', 'level' => ADMIN_LEVEL, 'user_groups' => '', 'user_lang' => $lang, 'user_theme' => DISTRIBUTION_THEME, 'user_mail' => '', 'user_pm' => 0, 'user_editor' => 'bbcode', 'user_timezone' => 1, 'avatar' => '', 'user_readonly' => 0, 'user_id' => 1, 'session_id' => '');
$user_groups = array();
$User = new User($user_data, $user_groups);
示例9: clear
/**
* {@inheritdoc}
*/
public function clear()
{
$cache_dir = new Folder(PATH_TO_ROOT . '/cache');
$files = $cache_dir->get_files('`^' . $this->prefix . '-.*`');
foreach ($files as $file) {
$file->delete();
}
}
示例10: redirect
$Sql->query_close($result);
###### Régénération du cache des rangs #######
$Cache->Generate_file('ranks');
redirect(HOST . SCRIPT);
} elseif (!empty($_GET['del']) && !empty($get_id)) {
$Sql->query_inject("DELETE FROM " . DB_TABLE_RANKS . " WHERE id = '" . $get_id . "'", __LINE__, __FILE__);
###### Régénération du cache des rangs #######
$Cache->Generate_file('ranks');
redirect(HOST . SCRIPT);
} else {
$Template->set_filenames(array('admin_ranks' => 'admin/admin_ranks.tpl'));
$Template->assign_vars(array('THEME' => get_utheme(), 'L_REQUIRE_RANK_NAME' => $LANG['require_rank_name'], 'L_REQUIRE_NBR_MSG_RANK' => $LANG['require_nbr_msg_rank'], 'L_CONFIRM_DEL_RANK' => $LANG['confirm_del_rank'], 'L_RANKS_MANAGEMENT' => $LANG['rank_management'], 'L_ADD_RANKS' => $LANG['rank_add'], 'L_RANK_NAME' => $LANG['rank_name'], 'L_NBR_MSG' => $LANG['nbr_msg'], 'L_IMG_ASSOC' => $LANG['img_assoc'], 'L_DELETE' => $LANG['delete'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_ADD' => $LANG['add']));
import('io/filesystem/folder');
$rank_options_array = array();
$image_folder_path = new Folder(PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/ranks');
foreach ($image_folder_path->get_files('`\\.(png|jpg|bmp|gif)$`i') as $image) {
$file = $image->get_name();
$rank_options_array[] = $file;
}
$result = $Sql->query_while("SELECT id, name, msg, icon, special\n\tFROM " . DB_TABLE_RANKS . " \n\tORDER BY msg", __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
if ($row['special'] == 0) {
$del = '<a href="admin_ranks.php?del=1&id=' . $row['id'] . '" onclick="javascript:return Confirm();"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/delete.png" alt="" title="" /></a>';
} else {
$del = $LANG['special_rank'];
}
$rank_options = '<option value="">--</option>';
foreach ($rank_options_array as $icon) {
$selected = $icon == $row['icon'] ? ' selected="selected"' : '';
$rank_options .= '<option value="' . $icon . '"' . $selected . '>' . $icon . '</option>';
}
示例11: import
function Clear_cache()
{
import('io/filesystem/folder');
$thumb_folder_path = new Folder('./pics/thumbnails/');
foreach ($thumb_folder_path->get_files('`\\.(png|jpg|bmp|gif)$`i') as $thumbs) {
$this->delete_file('./pics/thumbnails/' . $thumbs->get_name());
}
}
示例12: clear_all_temporary_cache_files
private static function clear_all_temporary_cache_files()
{
//We delete all the images generated by the LaTeX formatter
$cache_image_folder_path = new Folder(PATH_TO_ROOT . '/images/maths/');
$files = $cache_image_folder_path->get_files('`\\.png$`');
foreach ($files as $image) {
if ($image->get_last_modification_date() < self::get_one_week_ago_timestamp()) {
$image->delete();
}
}
}
示例13: add_classes
private static function add_classes($directory, $pattern, $recursive = true)
{
$files = array();
$folder = new Folder($directory);
$relative_path = Path::get_path_from_root($folder->get_path());
$files = $folder->get_files($pattern);
foreach ($files as $file) {
$filename = $file->get_name();
$classname = $file->get_name_without_extension();
self::$autoload[$classname] = $relative_path . '/' . $filename;
}
if ($recursive) {
$folders = $folder->get_folders('`^[a-z]{1}.*$`i');
foreach ($folders as $a_folder) {
if (!in_array($a_folder->get_path_from_root(), self::$exclude_paths) && !in_array($a_folder->get_name(), self::$exclude_folders_names)) {
self::add_classes($a_folder->get_path(), $pattern);
}
}
}
}
示例14: COUNT
$ckeck_module = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_MODULES . " WHERE name = '" . strprotect($module_name) . "'", __LINE__, __FILE__);
if (!empty($ckeck_module)) {
$info_module = load_ini_file('../' . $module_name . '/lang/', get_ulang());
$previous_version = $Sql->query("SELECT version FROM " . DB_TABLE_MODULES . " WHERE name = '" . strprotect($module_name) . "'", __LINE__, __FILE__);
$dir_db_module = get_ulang();
$dir = '../' . $module_name . '/db';
import('io/filesystem/folder');
$folder_path = new Folder($dir . '/' . $dir_db_module);
foreach ($folder_path->get_folders('`^[a-z0-9_ -]+$`i') as $dir) {
$dir_db_module = $dir->get_name();
break;
}
$filesupdate = array();
$dir_db = '../' . urldecode($module_name) . '/db/' . $dir_db_module . '/';
$folder_path = new Folder($dir_db);
foreach ($folder_path->get_files('`.*\\.(php|sql)$`i') as $files) {
$file = $files->get_name();
if (strpos($file, DBTYPE) !== false) {
$array_info = explode('_', $file);
if (isset($array_info[1]) && version_compare($info_module['version'], $array_info[1], '>=') && version_compare($previous_version, $array_info[1], '<')) {
$filesupdate[$array_info[1]] = $file;
}
}
}
uksort($filesupdate, 'version_compare');
$_GET['filesupdate_errors'] = false;
foreach ($filesupdate as $key => $module_update_name) {
if (strpos($module_update_name, '.php') !== false) {
@(include_once $dir_db . $module_update_name);
} else {
$Sql->parse($dir_db . $module_update_name, PREFIX);
示例15: get_class
private function get_class($directory, $pattern, $type)
{
$classes = array();
$folder = new Folder($directory);
foreach ($folder->get_files($pattern) as $file) {
$classes[] = array('name' => $file->get_name_without_extension(), 'type' => $type);
}
return $classes;
}