本文整理汇总了PHP中fn_get_dir_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_dir_contents函数的具体用法?PHP fn_get_dir_contents怎么用?PHP fn_get_dir_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_dir_contents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Gets theme patterns
* @param string $style_id style ID
* @return array theme patterns
*/
public static function get($style_id)
{
$style_id = fn_basename($style_id);
$url = Registry::get('config.current_location') . '/' . fn_get_theme_path('[relative]/[theme]/media/images/patterns/' . $style_id . '/');
$patterns = self::getPath($style_id);
return fn_get_dir_contents($patterns, false, true, '', $url);
}
示例2: fn_get_payment_templates
function fn_get_payment_templates()
{
$templates = fn_get_dir_contents(DIR_SKINS . Registry::get('settings.skin_name_customer') . '/customer/views/orders/components/payments/', false, true, '.tpl');
if (is_array($templates)) {
foreach ($templates as $k => $v) {
$templates[$k] = $v;
}
}
return $templates;
}
示例3: fn_settings_variants_addons_hybrid_auth_icons_pack
function fn_settings_variants_addons_hybrid_auth_icons_pack()
{
$available_icons_packs = array();
$theme_name = Settings::instance()->getValue('theme_name', '');
$icons_dir = fn_get_theme_path('[themes]/', 'C') . $theme_name . '/media/images/addons/hybrid_auth/icons/';
$icons_packs = fn_get_dir_contents($icons_dir);
foreach ($icons_packs as $id => $icons_packs_name) {
$available_icons_packs[$icons_packs_name] = $icons_packs_name;
}
return $available_icons_packs;
}
示例4: fn_settings_variants_appearance_default_image_previewer
function fn_settings_variants_appearance_default_image_previewer()
{
$previewers_path = Registry::get('config.dir.root') . '/js/tygh/previewers';
$previewers = fn_get_dir_contents($previewers_path, false, true, 'js');
$return = array();
foreach ($previewers as $previewer) {
$previewer_description = fn_get_file_description($previewers_path . '/' . $previewer, 'previewer-description');
$return[fn_basename($previewer, '.previewer.js')] = $previewer_description;
}
return $return;
}
示例5: removeDirectoryContent
public static final function removeDirectoryContent($path)
{
if (is_array($path)) {
foreach ($path as $dir) {
self::removeDirectoryContent($dir);
}
return true;
}
self::removeFiles(fn_get_dir_contents($path, true, true, '', $path));
return true;
}
示例6: get
/**
* Gets theme patterns
* @param string $style_id style ID
* @param boolean $url_prefix prefix files with URL if set to true
* @return array theme patterns
*/
public function get($style_id, $url_prefix = true)
{
$style_id = fn_basename($style_id);
$patterns = $this->getPath($style_id);
$url = $this->getUrl($style_id);
$prefix = $patterns . '/';
if ($url_prefix) {
$prefix = Registry::get('config.current_location') . '/' . fn_get_rel_dir($this->getPath($style_id) . '/');
}
return fn_get_dir_contents($patterns, false, true, '', $prefix);
}
示例7: create
/**
* Generates new snapshot
* @param array $params params list
*/
public static function create($params)
{
if (empty($params['dir_root'])) {
$params['dir_root'] = Registry::get('config.dir.root');
}
if (empty($params['dist'])) {
$params['dist'] = false;
}
$dir_root = $params['dir_root'];
$dist = $params['dist'];
$folders = array('app', 'js', $params['theme_rel_backend']);
if ($dist) {
$themes_dir = $params['themes_repo'];
$themes_dir_to = $params['themes_frontend'];
} else {
$themes_dir = $params['themes_frontend'];
}
$themes = fn_get_dir_contents($themes_dir);
$snapshot = array('time' => time(), 'files' => array(), 'dirs' => array(), 'themes' => array());
if ($dist) {
$snapshot['db_scheme'] = fn_get_contents($dir_root . '/install/database/scheme.sql');
// remove myslqdump comments
$snapshot['db_scheme'] = preg_replace('|/\\*!.+\\*/;\\n|imSU', '', $snapshot['db_scheme']);
// form list of tables
preg_match_all('/create table `(.+)`/imSU', $snapshot['db_scheme'], $tables);
$snapshot['db_tables'] = !empty($tables[1]) ? $tables[1] : array();
}
$new_snapshot = self::make($dir_root, $folders, array('config.local.php'));
self::arrayMerge($snapshot, $new_snapshot);
foreach ($folders as $folder_name) {
$path = $dir_root . '/' . $folder_name;
$new_snapshot = self::make($path);
self::arrayMerge($snapshot, $new_snapshot);
}
foreach ($themes as $theme_name) {
if (is_numeric($theme_name) && $theme_name === strval($theme_name + 0)) {
continue;
// this is company subfolder
}
$path = "{$themes_dir}/{$theme_name}";
if ($dist) {
$new_snapshot = self::make($path, array(), array(), array($themes_dir => $themes_dir_to), true);
} else {
$new_snapshot = self::make($path, array(), array(), array(), true);
}
$snapshot['themes'][$theme_name]['files'] = $snapshot['themes'][$theme_name]['dirs'] = array();
self::arrayMerge($snapshot['themes'][$theme_name], $new_snapshot);
}
$snapshot['addons'] = fn_get_dir_contents(Registry::get('config.dir.addons'));
fn_mkdir(Registry::get('config.dir.snapshots'));
$snapshot_filename = fn_strtolower(PRODUCT_VERSION . '_' . (PRODUCT_STATUS ? PRODUCT_STATUS . '_' : '') . PRODUCT_EDITION . ($dist ? '_dist' : ''));
$snapshot_filecontent = '<?php $snapshot' . ($dist ? '_dist' : '') . ' = ' . var_export($snapshot, true) . '; ?>';
fn_put_contents(Registry::get('config.dir.snapshots') . "{$snapshot_filename}.php", $snapshot_filecontent);
}
示例8: _getAddons
/**
* Returns addons list that need be installed for some PRODUCT TYPE
*
* @param string $product_type Product type
* @return array List af addons
*/
private function _getAddons($product_type = PRODUCT_EDITION)
{
$available_addons = fn_get_dir_contents(Registry::get('config.dir.addons'), true, false);
$addons_list = array();
foreach ($available_addons as $addon_name) {
$scheme = SchemesManager::getScheme($addon_name);
if (!empty($scheme)) {
$auto_install = $scheme->autoInstallFor();
if (in_array($product_type, $auto_install)) {
$addons_list[] = $addon_name;
}
}
}
return $addons_list;
}
示例9: getList
/**
* Gets list of styles
*
* @return array List of available styles
*/
public function getList($params = array())
{
$styles = array();
$style_files = array();
$path = $this->getStylesPath();
$style_files = fn_get_dir_contents($path, false, true, 'less');
fn_set_hook('styles_get_list', $style_files, $params);
if (!empty($style_files)) {
foreach ($style_files as $id => $style_id) {
$style_id = fn_basename($style_id, '.less');
$styles[$style_id] = self::get($style_id, $params);
}
}
return $styles;
}
示例10: rotate
public function rotate()
{
if (file_exists($this->path . $this->filename)) {
if (empty($this->save_name)) {
$this->save_name = date('log_commerceml.txt', TIME);
}
fn_rename($this->path . $this->filename, $this->path . $this->save_name);
$logs_list = fn_get_dir_contents($this->path, false, true);
if (!empty($logs_list) && count($logs_list) > self::MAX_LOGS_FILE) {
rsort($logs_list);
list(, $old_logs) = array_chunk($logs_list, self::MAX_LOGS_FILE);
foreach ($old_logs as $filename) {
fn_rm($this->path . $filename);
}
}
}
}
示例11: fn_mp_get_setting_templates
function fn_mp_get_setting_templates()
{
$templates = array();
$skin_path = fn_get_theme_path('[themes]/[theme]', 'A');
$relative_directory_path = 'addons/maps_provider/settings/';
$template_path = $skin_path . '/templates/' . $relative_directory_path;
$_templates = fn_get_dir_contents($template_path, false, true, '.tpl');
if (!empty($_templates)) {
$needles = array('settings_', '.tpl');
$replacements = array('', '');
foreach ($_templates as $template) {
if (preg_match('/^settings_/', $template, $m)) {
$_template = str_replace($needles, $replacements, $template);
// Get the provider name
$templates[$_template] = $relative_directory_path . $template;
}
}
}
return $templates;
}
示例12: getList
/**
* Gets list of styles
*
* @return array List of available styles
*/
public function getList($params = array())
{
$styles = array();
$style_files = array();
$path = $this->getStylesPath();
$style_files = fn_get_dir_contents($path, false, true, 'less');
/**
* Modifies styles list
*
* @param object $this Styles object
* @param array $style_files style files list
* @param array $params search params
*/
fn_set_hook('styles_get_list', $this, $style_files, $params);
if (!empty($style_files)) {
foreach ($style_files as $id => $style_id) {
$style_id = fn_basename($style_id, '.less');
$styles[$style_id] = $this->get($style_id, $params);
}
}
return $styles;
}
示例13: fn_init_skin
/**
* Init skin
*
* @param array $params request parameters
* @return boolean always true
*/
function fn_init_skin($params)
{
if ((Registry::get('settings.skin_name_' . AREA_NAME) == '' || !is_dir(DIR_SKINS . Registry::get('settings.skin_name_' . AREA_NAME))) && !defined('SKINS_PANEL')) {
$all = fn_get_dir_contents(DIR_SKINS, true);
$skin_found = false;
foreach ($all as $sk) {
if (is_file(DIR_SKINS . $sk . '/' . AREA_NAME . '/index.tpl')) {
Registry::set('settings.skin_name' . AREA_NAME, basename($sk));
$skin_found = true;
break;
}
}
if ($skin_found == false) {
die("No skins found");
} else {
echo <<<EOT
\t\t\t\t<div style="background: #ff0000; color: #ffffff; font-weight: bold;" align="center">SELECTED SKIN NOT FOUND. REPLACED BY FIRST FOUND</div>
EOT;
}
}
if (defined('DEVELOPMENT')) {
foreach (Registry::get('config.dev_skins') as $k => $v) {
Registry::set('settings.skin_name_' . $k, $v);
}
}
// Allow user to change the skin during the current session
if (defined('SKINS_PANEL')) {
$demo_skin = fn_get_cookie('demo_skin');
if (!empty($params['demo_skin'][AREA])) {
$tmp_skin = basename($params['demo_skin'][AREA]);
if (is_dir(DIR_SKINS . $tmp_skin)) {
Registry::set('settings.skin_name_' . AREA_NAME, $tmp_skin);
$demo_skin[AREA] = $tmp_skin;
} else {
Registry::set('settings.skin_name_' . AREA_NAME, $demo_skin[AREA]);
}
} elseif (empty($demo_skin[AREA])) {
$demo_skin[AREA] = 'basic';
}
Registry::set('settings.skin_name_' . AREA_NAME, $demo_skin[AREA]);
fn_set_cookie('demo_skin', $demo_skin);
Registry::set('demo_skin', array('selected' => $demo_skin, 'available_skins' => fn_get_available_skins(AREA_NAME)));
}
$skin_name = Registry::get('settings.skin_name_' . AREA_NAME);
Registry::set('config.skin_name', $skin_name);
Registry::set('config.skin_path', Registry::get('config.current_path') . '/skins/' . $skin_name . '/' . AREA_NAME);
Registry::set('config.no_image_path', Registry::get('config.images_path') . 'no_image.gif');
return true;
}
示例14: fn_copy_by_ftp
/**
* Copies files using FTP access
*
* @param string $source Absolute path (non-ftp) to source dir/file
* @param string $destination Absolute path (non-ftp) to destination dir/file
* @param array $ftp_access
* array(
* 'hostname',
* 'username',
* 'password',
* 'directory'
* )
* @return bool true if all files were copied or (string) Error message
*/
function fn_copy_by_ftp($source, $destination, $ftp_access)
{
try {
$ftp = new Ftp();
$ftp->connect($ftp_access['hostname']);
$ftp->login($ftp_access['username'], $ftp_access['password']);
$ftp->chdir($ftp_access['directory']);
$files = $ftp->nlist('');
if (!empty($files) && in_array('config.php', $files)) {
$ftp_destination = str_replace(Registry::get('config.dir.root'), '', $destination);
if (is_file($source)) {
// File
try {
$file = ltrim($ftp_destination, '/');
$ftp->put($file, $source, FTP_BINARY);
} catch (FtpException $e) {
throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
}
} else {
// Dir
$ftp->chdir($ftp_access['directory'] . $ftp_destination);
$struct = fn_get_dir_contents($source, false, true, '', '', true);
foreach ($struct as $file) {
$dir = dirname($file);
if (!$ftp->isDir($dir)) {
try {
$ftp->mkDirRecursive($dir);
} catch (FtpException $e) {
throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
}
}
try {
$ftp->put($file, $source . $file, FTP_BINARY);
} catch (FtpException $e) {
throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
}
}
}
return true;
} else {
throw new FtpException('ftp_directory_is_incorrect');
}
} catch (FtpException $e) {
return __('invalid_ftp_access') . ': ' . $e->getMessage();
}
return false;
}
示例15: fn_get_file
}
if ($mode == 'getfile' && !empty($_REQUEST['file'])) {
fn_get_file(Registry::get('config.dir.backups') . fn_basename($_REQUEST['file']));
} elseif ($mode == 'manage') {
$view = Tygh::$app['view'];
// Calculate database size and fill tables array
$status_data = db_get_array("SHOW TABLE STATUS");
$database_size = 0;
$all_tables = array();
foreach ($status_data as $k => $v) {
$database_size += $v['Data_length'] + $v['Index_length'];
$all_tables[] = $v['Name'];
}
$view->assign('database_size', $database_size);
$view->assign('all_tables', $all_tables);
$files = fn_get_dir_contents(Registry::get('config.dir.backups'), false, true, array('.sql', '.tgz', '.zip'), '', true);
sort($files, SORT_STRING);
$backup_files = array();
$date_format = Registry::get('settings.Appearance.date_format') . ' ' . Registry::get('settings.Appearance.time_format');
if (is_array($files)) {
$backup_dir = Registry::get('config.dir.backups');
foreach ($files as $file) {
$ext = fn_get_file_ext($backup_dir . $file);
$backup_files[$file]['size'] = filesize($backup_dir . $file);
$backup_files[$file]['create'] = fn_date_format(filemtime($backup_dir . $file), $date_format);
if ($ext == 'sql') {
$backup_files[$file]['type'] = 'database';
} else {
$backup_files[$file]['type'] = DataKeeper::getArchiveType($backup_dir . $file);
}
}