mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-12 19:13:57 +02:00
sort files and dirs w/ natural sorting
This commit is contained in:
11
src/main.php
11
src/main.php
@@ -340,8 +340,8 @@ f00bar;
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
usort($dirs, [$this, "sortByName"]);
|
||||
usort($files, [$this, "sortByName"]);
|
||||
array_multisort(array_column($dirs, 'name'), SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $dirs);
|
||||
array_multisort(array_column($files, 'name'), SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $files);
|
||||
|
||||
return array_merge($dirs, $files);
|
||||
}
|
||||
@@ -1283,13 +1283,6 @@ f00bar;
|
||||
return true;
|
||||
}
|
||||
|
||||
// sorting function for file and dir arrays
|
||||
private function sortByName($a, $b) {
|
||||
if (strtolower($a['name']) == strtolower($b['name']))
|
||||
return 0;
|
||||
return (strtolower($a['name']) < strtolower($b['name'])) ? -1 : 1;
|
||||
}
|
||||
|
||||
// is cURL extention avaliable?
|
||||
private function checkCurl() {
|
||||
if (!function_exists("curl_init")
|
||||
|
Reference in New Issue
Block a user