Use scandir instead of opendir to ensure alphabetical order.

This commit is contained in:
Danyel Bayraktar 2015-07-14 13:31:51 +02:00
parent e942d40187
commit 8d82cde120

View File

@ -359,8 +359,8 @@ class Pico
protected function get_files($directory, $ext = '') protected function get_files($directory, $ext = '')
{ {
$array_items = array(); $array_items = array();
if ($handle = opendir($directory)) { if ($files = scandir($directory)) {
while (false !== ($file = readdir($handle))) { foreach ($files as $file) {
if (in_array(substr($file, -1), array('~', '#'))) { if (in_array(substr($file, -1), array('~', '#'))) {
continue; continue;
} }
@ -375,7 +375,6 @@ class Pico
} }
} }
} }
closedir($handle);
} }
return $array_items; return $array_items;