From: Roland Häder Date: Tue, 23 Apr 2013 23:42:56 +0000 (+0000) Subject: Added optional withPrefixSuffix parameter (sorry for becoming silent) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2f7fcd4e249c96579e6e1d33737c49c819074231;p=mailer.git Added optional withPrefixSuffix parameter (sorry for becoming silent) --- 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);