mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Added additional known file types, for audio and video files
MINOR Tweaked text of file type descriptions slightly git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64356 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b91be01aa8
commit
31df9f440f
@ -413,19 +413,31 @@ class File extends DataObject {
|
|||||||
return strtolower(substr($filename,strrpos($filename,'.')+1));
|
return strtolower(substr($filename,strrpos($filename,'.')+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the type of file for the given extension
|
||||||
|
* on the current file name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function getFileType() {
|
function getFileType() {
|
||||||
$types = array(
|
$types = array(
|
||||||
'gif' => 'GIF Image - good for diagrams',
|
'gif' => 'GIF image - good for diagrams',
|
||||||
'jpg' => 'JPEG Image - good for photos',
|
'jpg' => 'JPEG image - good for photos',
|
||||||
'jpeg' => 'JPEG Image - good for photos',
|
'jpeg' => 'JPEG image - good for photos',
|
||||||
'png' => 'PNG Image - good general-purpose format',
|
'png' => 'PNG image - good general-purpose format',
|
||||||
'doc' => 'Word Document',
|
'doc' => 'Word document',
|
||||||
'xls' => 'Excel Spreadsheet',
|
'xls' => 'Excel spreadsheet',
|
||||||
'zip' => 'ZIP compressed file',
|
'zip' => 'ZIP compressed file',
|
||||||
'gz' => 'GZIP compressed file',
|
'gz' => 'GZIP compressed file',
|
||||||
'dmg' => 'Apple Disk Image',
|
'dmg' => 'Apple disk image',
|
||||||
'pdf' => 'Adobe Acrobat PDF file',
|
'pdf' => 'Adobe Acrobat PDF file',
|
||||||
|
'mp3' => 'MP3 audio file',
|
||||||
|
'wav' => 'WAV audo file',
|
||||||
|
'avi' => 'AVI video file',
|
||||||
|
'mpg' => 'MPEG video file',
|
||||||
|
'mpeg' => 'MPEG video file'
|
||||||
);
|
);
|
||||||
|
|
||||||
$ext = $this->getExtension();
|
$ext = $this->getExtension();
|
||||||
|
|
||||||
return isset($types[$ext]) ? $types[$ext] : 'unknown';
|
return isset($types[$ext]) ? $types[$ext] : 'unknown';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user