Beispiel #1
0
 private static function get_files($pattern, $flags = 0, $path = '')
 {
     if (!$path && ($dir = dirname($pattern)) != '.') {
         if ($dir == '\\' || $dir == '/') {
             $dir = '';
         }
         // End IF Statement
         return self::get_files(basename($pattern), $flags, $dir . '/');
     }
     // End IF Statement
     $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
     $files = glob($path . $pattern, $flags);
     if (is_array($paths)) {
         foreach ($paths as $p) {
             $found_files = array();
             $retrieved_files = (array) self::get_files($pattern, $flags, $p . '/');
             foreach ($retrieved_files as $file) {
                 if (!in_array($file, self::$found_files)) {
                     $found_files[] = $file;
                 }
             }
             self::$found_files = array_merge(self::$found_files, $found_files);
             if (is_array($files) && is_array($found_files)) {
                 $files = array_merge($files, $found_files);
             }
         }
         // End FOREACH Loop
     }
     return $files;
 }