/** * * enumerates the files in folder(s) * @param $folder */ function getResidentFiles($folder, $exclude) { global $_zp_resident_files; $dirs = array_diff(scandir($folder), $exclude); $localfiles = array(); $localfolders = array(); foreach ($dirs as $file) { $file = str_replace('\\', '/', $file); $key = str_replace(SERVERPATH . '/', '', filesystemToInternal($folder . '/' . $file)); if (is_dir($folder . '/' . $file)) { $localfolders[] = $key; $localfolders = array_merge($localfolders, getResidentFiles($folder . '/' . $file, $exclude)); } else { $localfiles[] = $key; } } return array_merge($localfiles, $localfolders); }
/** * * enumerates the files in folder(s) * @param $folder */ function getResidentFiles($folder) { global $_zp_resident_files; $localfiles = array(); $localfolders = array(); if (file_exists($folder)) { $dirs = scandir($folder); foreach ($dirs as $file) { if ($file[0] != '.') { $file = str_replace('\\', '/', $file); $key = $folder . '/' . $file; if (is_dir($folder . '/' . $file)) { $localfolders = array_merge($localfolders, getResidentFiles($folder . '/' . $file)); } else { if (getSuffix($key) == 'php') { $localfiles[] = $key; } } } } } return array_merge($localfiles, $localfolders); }