function _filebrowser_match_path in Filebrowser 6.2
Same name and namespace in other branches
- 8 filebrowser.helpers.inc \_filebrowser_match_path()
- 7.4 filebrowser.helpers.inc \_filebrowser_match_path()
- 7.2 filebrowser.helpers.inc \_filebrowser_match_path()
- 7.3 filebrowser.helpers.inc \_filebrowser_match_path()
Helper function to match a pattern on the path
Parameters
path path to process:
patterns to search (seperated by cr):
Return value
TRUE if at least one pattern is found
3 calls to _filebrowser_match_path()
- filebrowser_form_upload_validate in ./
filebrowser.form.upload.inc - uploads validation.
- _filebrowser_cant_view_file in includes/
node.inc - Check if user should not view a specific file.
- _filebrowser_can_view_file in includes/
node.inc - Check if user can view a specific file.
File
- includes/
helpers.inc, line 74 - Misc helper functions.
Code
function _filebrowser_match_path($path, $patterns) {
static $regexps = NULL;
if (!isset($regexps[$patterns])) {
$regexps[$patterns] = '/^(' . preg_replace(array(
'/(\\r\\n?|\\n)/',
'/\\\\\\*/',
), array(
'|',
'.*',
), preg_quote($patterns, '/')) . ')$/';
}
$result = preg_match($regexps[$patterns], _filebrowser_safe_basename($path)) == 1;
return $result;
}