public function Lists::getList in UEditor - 百度编辑器 8
File
- src/
Lists.php, line 14
Class
Namespace
Drupal\ueditorCode
public function getList() {
$size = $this->request
->get('size', $this->listSize);
$start = $this->request
->get('start', 0);
$end = $start + $size;
/* 获取文件列表 */
$files = $this
->getfiles($this->path, $this->allowFiles);
if (!count($files)) {
return [
"state" => "no match file",
"list" => array(),
"start" => $start,
"total" => count($files),
];
}
/* 获取指定范围的列表 */
$len = count($files);
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--) {
$list[] = $files[$i];
}
/* 返回数据 */
$result = [
"state" => "SUCCESS",
"list" => $list,
"start" => $start,
"total" => count($files),
];
return $result;
}