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:
Sean Harvey 2008-10-16 03:55:33 +00:00
parent b91be01aa8
commit 31df9f440f

View File

@ -413,19 +413,31 @@ class File extends DataObject {
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() {
$types = array(
'gif' => 'GIF Image - good for diagrams',
'jpg' => 'JPEG Image - good for photos',
'jpeg' => 'JPEG Image - good for photos',
'png' => 'PNG Image - good general-purpose format',
'doc' => 'Word Document',
'xls' => 'Excel Spreadsheet',
'gif' => 'GIF image - good for diagrams',
'jpg' => 'JPEG image - good for photos',
'jpeg' => 'JPEG image - good for photos',
'png' => 'PNG image - good general-purpose format',
'doc' => 'Word document',
'xls' => 'Excel spreadsheet',
'zip' => 'ZIP compressed file',
'gz' => 'GZIP compressed file',
'dmg' => 'Apple Disk Image',
'dmg' => 'Apple disk image',
'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();
return isset($types[$ext]) ? $types[$ext] : 'unknown';