Returns true if the given extension has a registered MIME type.

@param extension A file extension without the leading '.'
@return True iff there is an extension entry in the map.
969684
public static boolean hasExtension(String extension) {
        if (extension == null || extension.length() == 0) {
            return false;
        }
        return extensionToMimeTypeMap.containsKey(extension);
    }
39486
function hasFileType(file, fileExt) {
  file = path.basename(file);
  var ext = path.extname(file);
  do {
    if (ext === fileExt) {
      return true;
    } else {
      file = path.basename(file, ext);
      ext = path.extname(file);
    }
  } while (ext);
  return false;
}
587982
public static function hasExtension(string $uri, string $extension): bool
    {
        $extension       = '.' . ltrim($extension, '.');
        $uriLength       = mb_strlen($uri);
        $extensionLength = mb_strlen($extension);
        if ($extensionLength > $uriLength) {
            return false;
        }

        return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
    }
652244
public function is($extension)
    {
        $this->getIterator();
        if (!is_array($extension)) {
            $extension = array( $extension );
        }
        $ok = false;
        foreach ($extension as $_ext) {
            if (strtolower($this->iterator->current()->getExtension())==strtolower($_ext)) {
                $ok = true;
            }
        }
        return ($this->iterator->current()->isFile() &&
            WebFilesystem::isCommonFile($this->iterator->current()->getRealPath()) &&
            $ok);
    }
1053474
private String determineMimeType(File file){
        String mimeType = MIME_MAP.getContentType(file);
        // if mimeType detection failed, fall back to the default
        if (mimeType == null || mimeType.equalsIgnoreCase("")){
            mimeType = DEFAULT_MIMETYPE;
        }
        return mimeType;
    }
157254
def _file_type(file):
    
    # %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Verification of file type %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if "." in file:  # File with known extension.
        file_type = file.split(".")[-1]
    else:  # File without known extension.
        file_type = magic.from_file(file, mime=True).split("/")[-1]

    return file_type
5240
private static boolean isTargetValid(File fi, boolean ignoreCase, String... fileExt) {
        if (fi == null || fileExt == null || fileExt.length == 0)
            return true;

        String ext = getExtension(fi);

        for (String str : fileExt) {
            if (ignoreCase ? ext.equalsIgnoreCase(str) : ext.equals(str))
                return true;
        }

        return false;
    }
277602
def extension_by_source(source, mime_type):
    ""

    # TODO: should get this information from the plugin
    extension = source.plugin_name
    if extension:
        return extension

    if mime_type:
        return mime_type.split("/")[-1]
1232942
public static boolean isHtmlFileExtension(String extension) {
		for (final String ext : HTML_FILE_EXTENSIONS) {
			if (Strings.equal(ext, extension)) {
				return true;
			}
		}
		return false;
	}
440972
public static boolean isImage(String suffix) {
        if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
            String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
            return isMatch(regex, suffix);
        }
        return false;
    }
482337
@Override
    public boolean isFileExtensionRegistered(String fileTypeExtension) throws OSException {
        try {
            getFileExtension(fileTypeExtension);
            return true;
        } catch (OSException e) {
            return false;
        }
    }
473325
private static boolean isExtFile(String filePath, String ext) {
        return filePath != null && filePath.endsWith(ext);
    }
415467
public static boolean isSafeMediaType(final String mediaType) {
        return mediaType != null && VALID_MIME_TYPE.matcher(mediaType).matches()
                && !DANGEROUS_MEDIA_TYPES.contains(mediaType);
    }
743533
public static boolean addStaticExtension(String extension) {
    	if(AssertUtils.isEmpty(extension)) {
    		return false;
    	}
    	
    	if(!extension.startsWith(".")) {
    		extension = "." + extension;
    	}
    	
    	extension = extension.toLowerCase();
    	
    	return STATIC_RESOURCE_EXTENSIONS.add(extension);
    }
853776
@Override
	public boolean containsValidPrefix(final String key) {
		if (key != null) {
			lock.readLock().lock();
			try {
				for (final String aPrefix : prefixes) {
					if (key.equals(aPrefix) || key.startsWith(aPrefix + getPrefixDelimiter())) {
						return true;
					}
				}
			} finally {
				lock.readLock().unlock();
			}
		}
		return false;
	}
1214724
public static function detectByFileExtension(string $extension): string
    {
        static $extToMimeTypeMap;

        if (! $extToMimeTypeMap) {
            $extToMimeTypeMap = static::getExtensionToMimeTypeMap();
        }

        if (isset($extToMimeTypeMap[$extension])) {
            return $extToMimeTypeMap[$extension];
        }

        return 'text/plain';
    }
31202
function extensionMatches (filename) {
		var extname = path.extname(filename);
		if (extname) {
			return extname === extension;
		}
		return true;
	}