remove getMimeType(), it has been moved to SeedDMS_Core

This commit is contained in:
Uwe Steinmann 2022-11-17 11:34:28 +01:00
parent e719f31167
commit 2c96fb5a1c

View File

@ -395,34 +395,6 @@ function getFilenameByDocname($content) { /* {{{ */
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
} /* }}} */
/**
* Return the mimetype of a given file
*
* This functions uses finfo but will correct some mimetypes which are
* not propperly determined or could be more specific, e.g. text/plain
* which is actually text/markdown. In thoses cases
* the file extension will be taken into account.
*
* @param string $filename name of file on disc
* @return string mimetype
*/
function getMimeType($filename) { /* {{{ */
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $filename);
switch($mimetype) {
case 'application/octet-stream':
case 'text/plain':
$lastDotIndex = strrpos($filename, ".");
if($lastDotIndex === false) $fileType = ".";
else $fileType = substr($filename, $lastDotIndex);
if($fileType == '.md')
$mimetype = 'text/markdown';
break;
}
return $mimetype;
} /* }}} */
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
global $settings;