* @param $excludePattern Regular expression to exclude more files (preg_match())
* @param $recursive whether to scan recursively
* @param $suffix Suffix for positive matches ($extension will be appended, too)
+ * @param $withPrefixSuffix Whether to include prefix/suffix in found entries
* @return $foundMatches All found positive matches for above criteria
*/
-function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = FALSE, $addBaseDir = TRUE, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = TRUE, $suffix = '') {
+function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = FALSE, $addBaseDir = TRUE, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = TRUE, $suffix = '', $withPrefixSuffix = TRUE) {
// Add default entries we should always exclude
array_unshift($excludeArray, '.', '..', '.svn', '.htaccess');
if ($addBaseDir === TRUE) {
// With base path
array_push($foundMatches, $fileName);
+ } elseif ($withPrefixSuffix === FALSE) {
+ // No prefix/suffix
+ array_push($foundMatches, substr($baseFile, strlen($prefix), -strlen($suffix . $extension)));
} else {
// No base path
array_push($foundMatches, $baseFile);