1.20.x file.module file_fnmatch($pattern, $string)

A wrapper function for the PHP function fnmatch().

We include this, because Windows servers do not implement fnmatch() until PHP Version 5.3. See: http://php.net/manual/en/function.fnmatch.php

File

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

Code

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