|
@ -47,25 +47,23 @@ class FileManager |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
if ($result['is_file']) { |
|
|
if ($result['is_file']) { |
|
|
$result['size'] = $this->formatBytes($meta['size']); |
|
|
|
|
|
|
|
|
$result['meta']['size'] = $this->formatBytes($meta['size']); |
|
|
$files[] = $result; |
|
|
$files[] = $result; |
|
|
} else { |
|
|
} else { |
|
|
$directories[] = $result; |
|
|
$directories[] = $result; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
usort($directories, function($a, $b) { |
|
|
|
|
|
if (strtolower($a['filename']) < strtolower($b['filename'])) { |
|
|
|
|
|
return 0; |
|
|
|
|
|
} else { |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// sorting by filename
|
|
|
|
|
|
usort($directories, [$this, 'sortByFilename']); |
|
|
|
|
|
usort($files, [$this, 'sortByFilename']); |
|
|
|
|
|
|
|
|
|
|
|
// adding directories
|
|
|
foreach($directories as $directory) { |
|
|
foreach($directories as $directory) { |
|
|
$results[] = $directory; |
|
|
$results[] = $directory; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// adding files
|
|
|
foreach($files as $file) { |
|
|
foreach($files as $file) { |
|
|
$results[] = $file; |
|
|
$results[] = $file; |
|
|
} |
|
|
} |
|
@ -73,6 +71,19 @@ class FileManager |
|
|
return $results; |
|
|
return $results; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* sorting by filename, function for usort |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
private function sortByFilename($a, $b) |
|
|
|
|
|
{ |
|
|
|
|
|
if (strtolower($a['filename']) < strtolower($b['filename'])) { |
|
|
|
|
|
return 0; |
|
|
|
|
|
} else { |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
|
* @param [type] $size [description] |
|
|
* @param [type] $size [description] |
|
|