]> git.mxchange.org Git - mailer.git/commitdiff
Added optional withPrefixSuffix parameter (sorry for becoming silent)
authorRoland Häder <roland@mxchange.org>
Tue, 23 Apr 2013 23:42:56 +0000 (23:42 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 23 Apr 2013 23:42:56 +0000 (23:42 +0000)
inc/functions.php

index 01f21ce86940b7ff2c8b24a4e84984f211fff6ba..45ef7fce2cb93b47e53e3ccc018d324cddd350b0 100644 (file)
@@ -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);