From 264adf0387ce0cff0fb3ec9e90b9bc02a0fa4a9c Mon Sep 17 00:00:00 2001 From: quix0r Date: Tue, 23 Apr 2013 23:42:56 +0000 Subject: [PATCH] Added optional withPrefixSuffix parameter (sorry for becoming silent) --- inc/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 01f21ce869..45ef7fce2c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1772,9 +1772,10 @@ function isExtraTitleSet () { * @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'); @@ -1853,6 +1854,9 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = FALSE, $ad 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); -- 2.39.5