mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
fix __list in Configure class
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5500 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
28ebd0bf66
commit
7cc6e815d9
1 changed files with 13 additions and 12 deletions
|
@ -144,25 +144,26 @@ class Configure extends Object {
|
||||||
* Returns an array of filenames of PHP files in given directory.
|
* Returns an array of filenames of PHP files in given directory.
|
||||||
*
|
*
|
||||||
* @param string $path Path to scan for files
|
* @param string $path Path to scan for files
|
||||||
* @return array List of files in directory
|
* @param string $suffix if false, return only directories. if string, match and return files
|
||||||
|
* @return array List of directories or files in directory
|
||||||
*/
|
*/
|
||||||
function __list($path, $suffix = null) {
|
function __list($path, $suffix = false) {
|
||||||
$dir = opendir($path);
|
$Folder =& new Folder($path);
|
||||||
$items = array();
|
$contents = $Folder->read(false, true);
|
||||||
|
if(is_array($contents)) {
|
||||||
while (false !== ($item = readdir($dir))) {
|
if(!$suffix) {
|
||||||
if (substr($item, 0, 1) != '.') {
|
return $contents[0];
|
||||||
if (empty($suffix) || (!empty($suffix) && substr($item, -strlen($suffix)) == $suffix)) {
|
} else {
|
||||||
if (!empty($suffix)) {
|
foreach($content[1] as $item) {
|
||||||
|
if (substr($item, -strlen($suffix)) == $suffix) {
|
||||||
$item = substr($item, 0, strlen($item) - strlen($suffix));
|
$item = substr($item, 0, strlen($item) - strlen($suffix));
|
||||||
}
|
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
closedir($dir);
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Used to write a dynamic var in the Configure instance.
|
* Used to write a dynamic var in the Configure instance.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue