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


PHP FileManager::scanDir方法代码示例

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


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

示例1: loadFiles

 /**
  * Load translations from a given path.
  *
  * @access   private
  * @param    string $path
  * @throws   Exception\Fatal
  * @version  1.2.0-dev
  * @since    1.2.0-dev
  */
 private function loadFiles($path)
 {
     $localePath = $path . DS . 'locale';
     $langs = Router::getLangs();
     if (file_exists($localePath)) {
         $scannedDir = \FileManager::scanDir($localePath, 0);
         foreach ($scannedDir as $dirId => &$file) {
             list($lang, $type) = explode('.', $file);
             // check language
             if (!in_array($lang, $langs)) {
                 unset($scannedDir[$dirId]);
                 continue;
             }
             // import data from single file
             switch ($type) {
                 case 'json':
                     $fileTranslations = static::importFileJson($localePath . DS . $file, $lang);
                     break;
                 default:
                     $fileTranslations = [];
             }
             // count translations per type
             $appPart = NULL;
             if (strpos($path, PATH_FW) !== FALSE) {
                 $appPart = 'fw';
             } elseif (strpos($path, PATH_MODULES) !== FALSE) {
                 $appPart = 'module';
             } elseif (strpos($path, PATH_APP) !== FALSE) {
                 $appPart = 'app';
             }
             // do counting per app part
             $counting = 0;
             foreach ($fileTranslations as $context => $translation) {
                 $counting += count($translation);
             }
             $temp =& $this->amountLoadedPerType[$appPart];
             switch ($appPart) {
                 case 'module':
                     $module = str_replace(PATH_MODULES, '', $path);
                     $temp[$module][$lang] = $counting;
                     break;
                 case 'app':
                 case 'fw':
                     $temp[$lang] = $counting;
                     break;
             }
             // merge data
             $this->loadedContent = array_replace_recursive($this->loadedContent, $fileTranslations);
         }
     }
 }
开发者ID:ktrzos,项目名称:plethora,代码行数:60,代码来源:Import.php

示例2: setNewModules

 /**
  * this method will insert the new active modules in site database if
  * does not exist
  */
 private function setNewModules()
 {
     foreach (FileManager::scanDir($this->modulesDir) as $module) {
         $ModuleConfig = $this->getModuleConfig($module);
         if ($ModuleConfig['active']) {
             $this->db->setSQL("SELECT * FROM modules WHERE `name` = '{$ModuleConfig['name']}'");
             $moduleRecord = $this->db->fetchRecord(PDO::FETCH_ASSOC);
             if (empty($moduleRecord)) {
                 $data['name'] = $ModuleConfig['name'];
                 $data['enable'] = '0';
                 $data['installed_version'] = $ModuleConfig['version'];
                 $this->db->setSQL($this->db->sqlBind($data, 'modules', 'I'));
                 $this->db->execOnly();
             }
         }
     }
     return;
 }
开发者ID:nagyist,项目名称:tutus,代码行数:22,代码来源:Modules.php

示例3: setNewModules

 /**
  * this method will insert the new active modules in site database if
  * does not exist
  */
 private function setNewModules()
 {
     foreach (FileManager::scanDir($this->modulesDir) as $module) {
         $m = $this->getModuleConfig($module);
         if ($m['active']) {
             $name = $m['name'];
             $this->db->setSQL("SELECT count(*) AS total FROM modules WHERE `name` = '{$name}'");
             $rec = $this->db->fetchRecord(PDO::FETCH_ASSOC);
             if ($rec['total'] == 0) {
                 $data['name'] = $m['name'];
                 $data['enable'] = 0;
                 $data['installed_version'] = $m['version'];
                 $this->db->setSQL($this->db->sqlBind($data, 'modules', 'I'));
                 $this->db->execOnly();
             }
         }
     }
     return;
 }
开发者ID:nhom5UET,项目名称:tichhophethong,代码行数:23,代码来源:Modules.php

示例4: setNewModules

 /**
  * this method will insert the new active modules in site database if
  * does not exist
  */
 private function setNewModules()
 {
     Matcha::pauseLog(true);
     foreach (FileManager::scanDir($this->modulesDir) as $module) {
         $ModuleConfig = $this->getModuleConfig($module);
         if ($ModuleConfig['active']) {
             $moduleRecord = $this->m->load(['name' => $ModuleConfig['name']])->one();
             if (empty($moduleRecord)) {
                 $data = new stdClass();
                 $data->title = $ModuleConfig['title'];
                 $data->name = $ModuleConfig['name'];
                 $data->description = $ModuleConfig['description'];
                 $data->enable = '0';
                 $data->installed_version = $ModuleConfig['version'];
                 $this->m->save($data);
             }
         }
     }
     Matcha::pauseLog(false);
     return;
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:25,代码来源:Modules.php


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