static function titleMimeType($file_path)
{
$mtype = '';
if (preg_match('/epub$/', $file_path) == 1) {
return Utilities::MIME_EPUB;
} else {
if (preg_match('/mobi$/', $file_path) == 1) {
return 'application/x-mobipocket-ebook';
} else {
if (preg_match('/azw3?$/', $file_path) == 1) {
return 'application/vnd.amazon.ebook';
} else {
if (preg_match('/pdf$/', $file_path) == 1) {
return 'application/pdf';
} else {
if (preg_match('/txt$/', $file_path) == 1) {
return 'text/plain';
} else {
if (preg_match('/html$/', $file_path) == 1) {
return 'text/html';
} else {
if (preg_match('/zip$/', $file_path) == 1) {
return 'application/zip';
}
}
}
}
}
}
}
if (function_exists('mime_content_type')) {
$mtype = mime_content_type($file_path);
} else {
if (function_exists('finfo_file')) {
$finfo = finfo_open(FILEINFO_MIME);
$mtype = finfo_file($finfo, $file_path);
finfo_close($finfo);
}
}
if ($mtype == '') {
$mtype = 'application/force-download';
}
return $mtype;
}