add addDirSep()

This commit is contained in:
Uwe Steinmann 2017-11-21 08:34:19 +01:00
parent 5543333291
commit 7520634c61

View File

@ -565,9 +565,25 @@ function get_extension($mimetype) { /* {{{ */
case 'application/pdf': return '.pdf';
case 'application/postscript': return '.ps';
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': return '.docx';
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': return '.pptx';
case 'text/plain': return '.txt';
case 'text/csv': return '.csv';
default: return false;
}
} /* }}} */
/**
* Adds a missing front slash to a string
*
* This function is used for making sure a directory name has a
* trailing directory separator
*/
function addDirSep($str) { /* {{{ */
if(trim($str) == '')
return '';
if(substr(trim($str), -1, 1) != DIRECTORY_SEPARATOR)
return trim($str).DIRECTORY_SEPARATOR;
else
return trim($str);
} /* }}} */
?>