diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-03-10 22:37:09 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-03-10 22:37:09 -0400 |
commit | d91b5d4aa3acae17333eb7300bc0f6621dab11b2 (patch) | |
tree | 2d7553cb18d1ca557a88fc3d96c03b135bfe2c8e /app/Model/File.php | |
parent | 788ef2bc07206c676a8ad3f1e27aed9669c703ff (diff) |
Improve pull-request
Diffstat (limited to 'app/Model/File.php')
-rw-r--r-- | app/Model/File.php | 71 |
1 files changed, 7 insertions, 64 deletions
diff --git a/app/Model/File.php b/app/Model/File.php index 3c2f2b68..a8cce9f4 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -111,7 +111,7 @@ class File extends Base ->asc('name') ->findAll(); } - + /** * Get all images for a given task * @@ -127,7 +127,7 @@ class File extends Base ->asc('name') ->findAll(); } - + /** * Get all files without images for a given task * @@ -153,76 +153,19 @@ class File extends Base */ public function isImage($filename) { - $info = pathinfo($filename); - $extension = strtolower($info['extension']); + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); switch ($extension) { case 'jpeg': - case 'jpg': - case 'png': + case 'jpg': + case 'png': case 'gif': return true; - break; - default: - return false; - break; } - } - /** - * get Font-Awesome Icon for file extension - * - * @access public - * @param string $filename Filename - * @return string Font-Awesome-Icon-Name - */ - public function get_icon($filename){ - $info = pathinfo($filename); - $extension = strtolower($info['extension']); - switch ($extension) { - case 'jpeg': - case 'jpg': - case 'png': - case 'gif': - $icon = 'fa-file-image-o'; - break; - case 'xls': - case 'xlsx': - $icon = 'fa-file-excel-o'; - break; - case 'doc': - case 'docx': - $icon = 'fa-file-word-o'; - break; - case 'ppt': - case 'pptx': - $icon = 'fa-file-powerpoint-o'; - break; - case 'zip': - case 'rar': - $icon = 'fa-archive-o'; - break; - case 'mp3': - $icon = 'fa-audio-o'; - break; - case 'avi': - $icon = 'fa-video-o'; - break; - case 'php': - case 'html': - case 'css': - $icon = 'fa-code-o'; - break; - case 'pdf': - $icon = 'fa-file-pdf-o'; - break; - default: - $icon = 'fa-file-o'; - break; - } - return $icon; + return false; } - + /** * Generate the path for a new filename * |