Directory Filters

Directory Filters are a regular expression used to exclude certain files and folders from being accessed through the file manager.

If you are using the API for specifying single Image, Document and Media folders (the documentDir, documentURL, imageDir, imageURL, mediaDir and mediaURL properties) then you can use the dirFilters property to set filters that will be applied to each of those folders. See dirFilters.

If you are using the addDirectory method to configure multiple image document or media folders then each folder must be given it's own filters. See filters.

The syntax for each filter is identical to that used in PHP's regular expression functions.

Filters are matched against the entire directory path, not just the name of the file or folder.

Some tips:

This would match any folder with the name FOLDER_NAME:

'#(/|^)FOLDER_NAME(/|$)#D'

This would match the folder/subfolder folder only:

'#(/|^)folder/subfolder(/|$)#D'

This would match any folders starting with _

'#(/|^)_#'

Patterns must always be enclosed by # or / but using # is better because if you use / then any / in the pattern must be escaped.

The D modifier means that the $ sign matches the end (because normally it matches either the end or the end of the line)

The pipe | means OR. The ^ means the start of the folder path. So (/|^) means match any file or folder that either begins and is then followed by the pattern or has / followed by the pattern. The $ sign means match the end of the folder path so (/|$) means match the preceding pattern followed by either / or the end of the file path.

Patterns are matched against both files and folders and currently there is no way to discriminate between the two. However because WysiwygPro ignores any files that have no extension it is unlikely that any patterns you write for matching folders is going to match any files.

WysiwygPro has patterns built in for preventing access to the following files and folders. These patterns cannot be disabled.

  • Dreamweaver _notes folders

  • Front Page extension folders (_vti_cnf and others)

  • ASP .NET client folders (aspnet_client)

  • cgi-bin folders

  • Unix system files

  • Any file or folder containing illegal characters