当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::getFileLister方法代码示例

本文整理汇总了PHP中Akeeba\Engine\Factory::getFileLister方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getFileLister方法的具体用法?PHP Factory::getFileLister怎么用?PHP Factory::getFileLister使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Akeeba\Engine\Factory的用法示例。


在下文中一共展示了Factory::getFileLister方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLogFiles

 /**
  * Get an array with the names of all log files in this backup profile
  *
  * @return  string[]
  */
 public function getLogFiles()
 {
     $configuration = Factory::getConfiguration();
     $outdir = $configuration->get('akeeba.basic.output_directory');
     $files = Factory::getFileLister()->getFiles($outdir);
     $ret = array();
     if (!empty($files) && is_array($files)) {
         foreach ($files as $filename) {
             $basename = basename($filename);
             if (substr($basename, 0, 7) == 'akeeba.' && substr($basename, -4) == '.log' && $basename != 'akeeba.log') {
                 $tag = str_replace('akeeba.', '', str_replace('.log', '', $basename));
                 if (!empty($tag)) {
                     $parts = explode('.', $tag);
                     $key = array_pop($parts);
                     $key = str_replace('id', '', $key);
                     $key = is_numeric($key) ? sprintf('%015u', $key) : $key;
                     if (empty($parts)) {
                         $key = str_repeat('0', 15) . '.' . $key;
                     } else {
                         $key .= '.' . implode('.', $parts);
                     }
                     $ret[$key] = $tag;
                 }
             }
         }
     }
     krsort($ret);
     return $ret;
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:34,代码来源:Log.php

示例2: getLogFiles

 function getLogFiles()
 {
     $configuration = Factory::getConfiguration();
     $outdir = $configuration->get('akeeba.basic.output_directory');
     $files = Factory::getFileLister()->getFiles($outdir);
     $ret = array();
     if (!empty($files) && is_array($files)) {
         foreach ($files as $filename) {
             $basename = basename($filename);
             if (substr($basename, 0, 7) == 'akeeba.' && substr($basename, -4) == '.log' && $basename != 'akeeba.log') {
                 $tag = str_replace('akeeba.', '', str_replace('.log', '', $basename));
                 if (!empty($tag)) {
                     $ret[] = $tag;
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:19,代码来源:logs.php

示例3: substr

 /**
  * Returns a listing of contained directories and files, as well as their
  * exclusion status
  * @param string $root The root directory
  * @param string $node The subdirectory to scan
  * @return array
  */
 private function &get_listing($root, $node)
 {
     // Initialize the absolute directory root
     $directory = substr($root, 0);
     // Replace stock directory tags, like [SITEROOT]
     $stock_dirs = Platform::getInstance()->get_stock_directories();
     if (!empty($stock_dirs)) {
         foreach ($stock_dirs as $key => $replacement) {
             $directory = str_replace($key, $replacement, $directory);
         }
     }
     $directory = Factory::getFilesystemTools()->TranslateWinPath($directory);
     // Clean and add the node
     $node = Factory::getFilesystemTools()->TranslateWinPath($node);
     if ($node == '/') {
         $node = '';
     }
     // Just a dir. sep. is treated as no dir at all
     // Trim leading and trailing slashes
     $node = trim($node, '/');
     // Add node to directory
     if (!empty($node)) {
         $directory .= '/' . $node;
     }
     // Add any required trailing slash to the node to be used below
     if (!empty($node)) {
         $node .= '/';
     }
     // Get a filters instance
     $filters = Factory::getFilters();
     // Get a listing of folders and process it
     $folders = Factory::getFileLister()->getFolders($directory);
     asort($folders);
     $folders_out = array();
     if (!empty($folders)) {
         foreach ($folders as $folder) {
             $folder = Factory::getFilesystemTools()->TranslateWinPath($folder);
             // Filter out files whose names result to an empty JSON representation
             $json_folder = json_encode($folder);
             $folder = json_decode($json_folder);
             if (empty($folder)) {
                 continue;
             }
             $test = $node . $folder;
             $status = array();
             // Check dir/all filter (exclude)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'all', $byFilter);
             $status['directories'] = !$result ? 0 : ($byFilter == 'directories' ? 1 : 2);
             // Check dir/content filter (skip_files)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'content', $byFilter);
             $status['skipfiles'] = !$result ? 0 : ($byFilter == 'skipfiles' ? 1 : 2);
             // Check dir/children filter (skip_dirs)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'children', $byFilter);
             $status['skipdirs'] = !$result ? 0 : ($byFilter == 'skipdirs' ? 1 : 2);
             // Add to output array
             $folders_out[$folder] = $status;
         }
     }
     unset($folders);
     $folders = $folders_out;
     // Get a listing of files and process it
     $files = Factory::getFileLister()->getFiles($directory);
     asort($files);
     $files_out = array();
     if (!empty($files)) {
         foreach ($files as $file) {
             // Filter out files whose names result to an empty JSON representation
             $json_file = json_encode($file);
             $file = json_decode($json_file);
             if (empty($file)) {
                 continue;
             }
             $test = $node . $file;
             $status = array();
             // Check file/all filter (exclude)
             $result = $filters->isFilteredExtended($test, $root, 'file', 'all', $byFilter);
             $status['files'] = !$result ? 0 : ($byFilter == 'files' ? 1 : 2);
             $status['size'] = @filesize($directory . '/' . $file);
             // Add to output array
             $files_out[$file] = $status;
         }
     }
     unset($files);
     $files = $files_out;
     // Return a compiled array
     $retarray = array('folders' => $folders, 'files' => $files);
     return $retarray;
     /* Return array format
      * [array] :
      * 		'folders' [array] :
      * 			(folder_name) => [array]:
      *				'directories'	=> 0|1|2
      *				'skipfiles'		=> 0|1|2
//.........这里部分代码省略.........
开发者ID:densem-2013,项目名称:exikom,代码行数:101,代码来源:fsfilters.php

示例4: substr

 /**
  * Returns a listing of contained directories and files, as well as their
  * exclusion status
  * @param string $root The root directory
  * @param string $node The subdirectory to scan
  * @return array
  */
 private function &get_listing($root, $node)
 {
     // Initialize the absolute directory root
     $directory = substr($root, 0);
     // Replace stock directory tags, like [SITEROOT]
     $stock_dirs = Platform::getInstance()->get_stock_directories();
     if (!empty($stock_dirs)) {
         foreach ($stock_dirs as $key => $replacement) {
             $directory = str_replace($key, $replacement, $directory);
         }
     }
     $directory = Factory::getFilesystemTools()->TranslateWinPath($directory);
     // Clean and add the node
     $node = Factory::getFilesystemTools()->TranslateWinPath($node);
     if ($node == '/') {
         $node = '';
     }
     // Just a dir. sep. is treated as no dir at all
     // Trim leading and trailing slashes
     $node = trim($node, '/');
     // Add node to directory
     if (!empty($node)) {
         $directory .= '/' . $node;
     }
     // Add any required trailing slash to the node to be used below
     if (!empty($node)) {
         $node .= '/';
     }
     // Get a filters instance
     $filters = Factory::getFilters();
     // Detect PHP 5.2.5or earlier, with broken json_decode implementation
     $phpversion = PHP_VERSION;
     $vparts = explode('.', $phpversion);
     if ($vparts[0] == 5 && $vparts[1] == 2 && $vparts[2] <= 5 || $vparts[0] == 5 && $vparts[1] == 1) {
         define('AKEEBA_SAFE_JSON', false);
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
     } else {
         $test = '-test-';
         $tj = json_encode($test);
         $test = json_decode($test);
         if ($test == '-test-') {
             define('AKEEBA_SAFE_JSON', true);
         } else {
             define('AKEEBA_SAFE_JSON', false);
             require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
         }
     }
     // Get a listing of folders and process it
     $folders = Factory::getFileLister()->getFolders($directory);
     asort($folders);
     $folders_out = array();
     if (!empty($folders)) {
         foreach ($folders as $folder) {
             $folder = Factory::getFilesystemTools()->TranslateWinPath($folder);
             // Filter out files whose names result to an empty JSON representation
             if (AKEEBA_SAFE_JSON) {
                 $json_folder = json_encode($folder);
                 $folder = json_decode($json_folder);
             } else {
                 $jsonobj = new Akeeba_Services_JSON(0);
                 $json_folder = $jsonobj->encode($folder);
                 $folder = $jsonobj->decode($json_folder);
             }
             if (empty($folder)) {
                 continue;
             }
             $test = $node . $folder;
             $status = array();
             // Check dir/all filter (exclude)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'all', $byFilter);
             $status['directories'] = !$result ? 0 : ($byFilter == 'directories' ? 1 : 2);
             // Check dir/content filter (skip_files)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'content', $byFilter);
             $status['skipfiles'] = !$result ? 0 : ($byFilter == 'skipfiles' ? 1 : 2);
             // Check dir/children filter (skip_dirs)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'children', $byFilter);
             $status['skipdirs'] = !$result ? 0 : ($byFilter == 'skipdirs' ? 1 : 2);
             // Add to output array
             $folders_out[$folder] = $status;
         }
     }
     unset($folders);
     $folders = $folders_out;
     // Get a listing of files and process it
     $files = Factory::getFileLister()->getFiles($directory);
     asort($files);
     $files_out = array();
     if (!empty($files)) {
         foreach ($files as $file) {
             // Filter out files whose names result to an empty JSON representation
             if (AKEEBA_SAFE_JSON) {
                 $json_file = json_encode($file);
                 $file = json_decode($json_file);
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:lojinha,代码行数:101,代码来源:fsfilters.php


注:本文中的Akeeba\Engine\Factory::getFileLister方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。