فهرست منبع

Use scandir instead of opendir to ensure alphabetical order.

Danyel Bayraktar 10 سال پیش
والد
کامیت
8d82cde120
1فایلهای تغییر یافته به همراه2 افزوده شده و 3 حذف شده
  1. 2 3
      lib/pico.php

+ 2 - 3
lib/pico.php

@@ -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)) {
-            while (false !== ($file = readdir($handle))) {
+        if ($files = scandir($directory)) {
+            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;