1 file.module file_fnmatch($pattern, $string)

A wrapper function for the PHP function fnmatch().

Windows servers did not implement fnmatch() until PHP version 5.3. Now that Backdrop requires newer PHP versions, the fnmatch() function should be called directly.

Deprecated

Since 1.22.0

File

core/modules/file/file.module, line 2053
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_fnmatch($pattern, $string) {
  watchdog_deprecated_function('file', __FUNCTION__);
  if (empty($pattern) || empty($string)) {
    return FALSE;
  }
  if (!function_exists('fnmatch')) {
    return preg_match("#^" . strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' => '.', '\[' => '[', '\]' => ']')) . "$#", $string);
  }
  return fnmatch($pattern, $string);
}