diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:02:25 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:02:25 -0400 |
commit | eeac2329baab1fdae7cbf6c707ed2ffd8beb4c1b (patch) | |
tree | 511c2fe47f8fbb1ea90e59e7a7a7f5e3530aa9ed /app/Helper/File.php | |
parent | 65e9e5d1bed9f88ecfd43eb2c1e780a7c22c151f (diff) |
Helpers refactoring
Diffstat (limited to 'app/Helper/File.php')
-rw-r--r-- | app/Helper/File.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/app/Helper/File.php b/app/Helper/File.php new file mode 100644 index 00000000..a35e4283 --- /dev/null +++ b/app/Helper/File.php @@ -0,0 +1,56 @@ +<?php + +namespace Helper; + +/** + * File helpers + * + * @package helper + * @author Frederic Guillot + */ +class File extends \Core\Base +{ + /** + * Get file icon + * + * @access public + * @param string $filename Filename + * @return string Font-Awesome-Icon-Name + */ + public function icon($filename){ + + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); + + switch ($extension) { + case 'jpeg': + case 'jpg': + case 'png': + case 'gif': + return 'fa-file-image-o'; + case 'xls': + case 'xlsx': + return 'fa-file-excel-o'; + case 'doc': + case 'docx': + return 'fa-file-word-o'; + case 'ppt': + case 'pptx': + return 'fa-file-powerpoint-o'; + case 'zip': + case 'rar': + return 'fa-file-archive-o'; + case 'mp3': + return 'fa-audio-o'; + case 'avi': + return 'fa-video-o'; + case 'php': + case 'html': + case 'css': + return 'fa-code-o'; + case 'pdf': + return 'fa-file-pdf-o'; + } + + return 'fa-file-o'; + } +} |