ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Filesystem.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Component Installer.
5  *
6  * (c) Rob Loach (http://robloach.net)
7  *
8  * For the full copyright and license information, please view the LICENSE.md
9  * file that was distributed with this source code.
10  */
11 
13 
15 
20 {
33  public function recursiveGlob($pattern, $flags = 0)
34  {
35  // Perform the glob search.
36  $files = glob($pattern, $flags);
37 
38  // Check if this is to be recursive.
39  if (strpos($pattern, '**') !== FALSE) {
40  $dirs = glob(dirname($pattern).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR|GLOB_NOSORT);
41  if ($dirs) {
42  foreach ($dirs as $dir) {
43  $files = array_merge($files, $this->recursiveGlob($dir.DIRECTORY_SEPARATOR.basename($pattern), $flags));
44  }
45  }
46  }
47 
48  return $files;
49  }
50 
62  public function recursiveGlobFiles($pattern, $flags = 0)
63  {
64  $files = $this->recursiveGlob($pattern, $flags);
65 
66  return array_filter($files, 'is_file');
67  }
68 }
$files
Definition: add-vimline.php:18
recursiveGlobFiles($pattern, $flags=0)
Performs a recursive glob search for files with the given pattern.
Definition: Filesystem.php:62
recursiveGlob($pattern, $flags=0)
Performs a recursive-enabled glob search with the given pattern.
Definition: Filesystem.php:33
Provides basic file system operations.
Definition: Filesystem.php:19