You are here

protected function Lists::getfiles in UEditor - 百度编辑器 8

遍历获取目录下的指定类型的文件

Parameters

$path:

array $files:

Return value

array

1 call to Lists::getfiles()
Lists::getList in src/Lists.php

File

src/Lists.php, line 52

Class

Lists

Namespace

Drupal\ueditor

Code

protected function getfiles($path, $allowFiles, &$files = array()) {
  $savepath = ueditor_get_savepath($path);
  $scanpath = 'public://' . $savepath;
  $files = \Drupal::service('file_system')
    ->scanDirectory($scanpath, '/\\.(' . $allowFiles . ')$/i');
  if (!empty($files)) {
    foreach ($files as $file) {
      $url = substr($file->uri, strlen($scanpath));
      $scanfiles[] = array(
        'url' => str_replace('//', '/', $path . $url),
        'mtime' => filemtime($file->uri),
      );
    }
  }
  return $scanfiles;
}