You are here

function file_entity_fnmatch in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.module \file_entity_fnmatch()

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

1 call to file_entity_fnmatch()
file_entity_match_mimetypes in ./file_entity.module
Checks if pattern(s) match mimetype(s).

File

./file_entity.module, line 2589
Extends Drupal file entities to be fieldable and viewable.

Code

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