Merge pull request #244 from muja/scandir

Use scandir instead of opendir to ensure alphabetical order.
pico-3.0-alpha
Tyler Heshka 10 years ago
commit 2fdcacc14b
  1. 5
      lib/pico.php

@ -363,8 +363,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;
} }
@ -379,7 +379,6 @@ class Pico
} }
} }
} }
closedir($handle);
} }
return $array_items; return $array_items;

Loading…
Cancel
Save