WC_Download_Handler::get_download_content_type PHP Method

get_download_content_type() private static method

Get content type of a download.
private static get_download_content_type ( string $file_path ) : string
$file_path string
return string
    private static function get_download_content_type($file_path)
    {
        $file_extension = strtolower(substr(strrchr($file_path, "."), 1));
        $ctype = "application/force-download";
        foreach (get_allowed_mime_types() as $mime => $type) {
            $mimes = explode('|', $mime);
            if (in_array($file_extension, $mimes)) {
                $ctype = $type;
                break;
            }
        }
        return $ctype;
    }