| 1 |
<?php |
<?php |
| 2 |
// $Id: file.inc,v 1.197 2009/10/18 18:36:24 dries Exp $ |
// $Id: file.inc,v 1.198 2009/10/23 01:00:52 dries Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 1576 |
* from being scanned. |
* from being scanned. |
| 1577 |
* |
* |
| 1578 |
* @param $dir |
* @param $dir |
| 1579 |
* The base directory or URI for the scan, without trailing slash. |
* The base directory or URI to scan, without trailing slash. |
| 1580 |
* @param $mask |
* @param $mask |
| 1581 |
* The preg_match() regular expression of the files to find. |
* The preg_match() regular expression of the files to find. |
| 1582 |
* @param $options |
* @param $options |
| 1583 |
* An associative array of additional options, with the following keys: |
* An associative array of additional options, with the following elements: |
| 1584 |
* - 'nomask' |
* - 'nomask': The preg_match() regular expression of the files to ignore. |
| 1585 |
* The preg_match() regular expression of the files to ignore. Defaults to |
* Defaults to '/(\.\.?|CVS)$/'. |
| 1586 |
* '/(\.\.?|CVS)$/'. |
* - 'callback': The callback function to call for each match. There is no |
| 1587 |
* - 'callback' |
* default callback. |
| 1588 |
* The callback function to call for each match. There is no default |
* - 'recurse': When TRUE, the directory scan will recurse the entire tree |
| 1589 |
* callback. |
* starting at the provided directory. Defaults to TRUE. |
| 1590 |
* - 'recurse' |
* - 'key': The key to be used for the returned associative array of files. |
| 1591 |
* When TRUE, the directory scan will recurse the entire tree starting at |
* Possible values are 'uri', for the file's URI; 'filename', for the |
| 1592 |
* the provided directory. Defaults to TRUE. |
* basename of the file; and 'name' for the name of the file without the |
| 1593 |
* - 'key' |
* extension. Defaults to 'uri'. |
| 1594 |
* The key to be used for the returned array of files. Possible values are |
* - 'min_depth': Minimum depth of directories to return files from. Defaults |
| 1595 |
* 'filepath', for the path starting with $dir, 'filename', for the |
* to 0. |
|
* basename of the file, and 'name' for the name of the file without an |
|
|
* extension. Defaults to 'filepath'. |
|
|
* - 'min_depth' |
|
|
* Minimum depth of directories to return files from. Defaults to 0. |
|
| 1596 |
* @param $depth |
* @param $depth |
| 1597 |
* Current depth of recursion. This parameter is only used internally and |
* Current depth of recursion. This parameter is only used internally and |
| 1598 |
* should not be passed. |
* should not be passed in. |
| 1599 |
|
* |
| 1600 |
* @return |
* @return |
| 1601 |
* An associative array (keyed on the provided key) of objects with |
* An associative array (keyed on the chosen key) of objects with 'uri', |
| 1602 |
* 'uri', 'filename', and 'name' members corresponding to the |
* 'filename', and 'name' members corresponding to the matching files. |
|
* matching files. |
|
| 1603 |
*/ |
*/ |
| 1604 |
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) { |
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) { |
| 1605 |
// Merge in defaults. |
// Merge in defaults. |