mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
04ce8ea28f
|
@ -367,6 +367,34 @@ function utf8_basename($path, $suffix='') { /* {{{ */
|
||||||
return $file;
|
return $file;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a valid file name
|
||||||
|
*
|
||||||
|
* This function returns a valid file name for the given document content
|
||||||
|
* or an arbitrary string. If a document content is given the name of
|
||||||
|
* the document will be used. The extension of the file name will be
|
||||||
|
* either taken from the document name or the original file. If the two
|
||||||
|
* differ the extension from the original file name will be used.
|
||||||
|
*
|
||||||
|
* @param object|string $content document content or an arbitrary string
|
||||||
|
* @return string valid file name
|
||||||
|
*/
|
||||||
|
function getFilenameByDocname($content) { /* {{{ */
|
||||||
|
if(is_string) {
|
||||||
|
$filename = $content;
|
||||||
|
} else {
|
||||||
|
$document = $content->getDocument();
|
||||||
|
$ext = pathinfo($document->getName(), PATHINFO_EXTENSION);
|
||||||
|
$oext = pathinfo($content->getOriginalFileName(), PATHINFO_EXTENSION);
|
||||||
|
if($ext == $oext)
|
||||||
|
$filename = $document->getName();
|
||||||
|
else {
|
||||||
|
$filename = $document->getName().'.'.$oext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function getLogger($prefix='') { /* {{{ */
|
function getLogger($prefix='') { /* {{{ */
|
||||||
global $settings;
|
global $settings;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user