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


PHP Files::listFiles方法代码示例

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


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

示例1: listFiles

 public function listFiles()
 {
     Zend_Loader::loadClass('Files');
     $files = new Files();
     $list = $files->listFiles('public/files/uploaded/');
     sort($list);
     $all = array();
     foreach ($list as $filename) {
         $row['name'] = $filename;
         $row['filesize'] = filesize('public/files/uploaded/' . $filename);
         array_push($all, $row);
     }
     return $all;
 }
开发者ID:stinger,项目名称:mailer,代码行数:14,代码来源:FilesService.php

示例2: listAction

 public function listAction()
 {
     $format = $this->_getParam('format', 'ajax');
     switch ($format) {
         case 'xml':
             $this->_helper->layout->setLayout('xml');
             $this->_helper->viewRenderer('list-xml');
             break;
         default:
             $this->_helper->layout->setLayout('ajax');
     }
     Zend_Loader::loadClass('Files');
     $files = new Files();
     $this->view->list = $files->listFiles('public/files/uploaded/');
 }
开发者ID:stinger,项目名称:mailer,代码行数:15,代码来源:IndexController.php

示例3: synchronize

 /**
  * Index files from a remote container
  *
  * @param	string	$folder_id	The folder id to refresh. Files will be fetched from its assigned container
  * @return	array
  *
  **/
 public function synchronize($folder_id)
 {
     $folder = Folder::find($folder_id);
     //list of files should be obtainable via files
     $files = Files::listFiles($folder->location, $folder->remote_container);
     // did the fetch go ok?
     if ($files['status']) {
         $valid_records = array();
         $known = array();
         $known_files = File::findByFolderId($folder_id);
         // now we build an array with the database filenames as the keys so we can compare with the cloud list
         foreach ($known_files as $item) {
             $known[$item->filename] = $item;
         }
         foreach ($files['data'] as $file) {
             // it's a totally new file
             if (!array_key_exists($file['filename'], $known)) {
                 $insert = array('id' => substr(md5(microtime() + $data['filename']), 0, 15), 'folder_id' => $folder_id, 'user_id' => ci()->current_user->id, 'type' => $file['type'], 'name' => $file['filename'], 'filename' => $file['filename'], 'path' => $file['path'], 'description' => '', 'extension' => $file['extension'], 'mimetype' => $file['mimetype'], 'filesize' => $file['filesize'], 'date_added' => $file['date_added']);
                 // we add the id to the list of records that have existing files to match them
                 $valid_records[] = File::create($insert);
             } else {
                 // it's totally not a new file
                 // update with the details we got from the cloud
                 File::where('id', $known[$file['filename']]->id)->update($file);
                 // we add the id to the list of records that have existing files to match them
                 $valid_records[] = $known[$file['filename']]->id;
             }
         }
         // Ok then. Let's clean up the records with no files and get out of here
         File::where('folder_id', $folder_id)->whereNotIn('id', $valid_records)->delete();
         return $this->result(true, trans('files.synchronization_complete'), $folder->name, $files['data']);
     } else {
         return $this->result(null, trans('files.no_records_found'));
     }
 }
开发者ID:sharenjoy,项目名称:cmsharenjoy,代码行数:42,代码来源:FilerRepository.php


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