Merged revisions 47621 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq

........
  r47621 | ischommer | 2008-01-04 21:44:07 +1300 (Fri, 04 Jan 2008) | 1 line
  
  added get_file_extension()
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52398 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-04-09 11:08:58 +00:00
parent 46dc0e805c
commit 00f95679ce

View File

@ -401,7 +401,18 @@ class File extends DataObject {
* legacy code.
*/
function getExtension() {
return strtolower(substr($this->getField('Filename'),strrpos($this->getField('Filename'),'.')+1));
return self::get_file_extension($this->getField('Filename'));
}
/**
* Gets the extension of a filepath or filename,
* by stripping away everything before the last "dot".
*
* @param string $filename
* @return string
*/
public static function get_file_extension($filename) {
return strtolower(substr($filename,strrpos($filename,'.')+1));
}
function getFileType() {