aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-16 19:58:09 -0800
committerzotlabs <mike@macgirvin.com>2017-11-16 19:58:09 -0800
commitab363e31322d699ee53f052d5198c3a7680f8cc8 (patch)
tree67438256c56be04e254ed2975123ae477a0ddb0b /include
parent7c655c8d61c1210815d024f7945bedf2ae7279fd (diff)
downloadvolse-hubzilla-ab363e31322d699ee53f052d5198c3a7680f8cc8.tar.gz
volse-hubzilla-ab363e31322d699ee53f052d5198c3a7680f8cc8.tar.bz2
volse-hubzilla-ab363e31322d699ee53f052d5198c3a7680f8cc8.zip
improve the icon mappings for cloud tile view
Diffstat (limited to 'include')
-rw-r--r--include/attach.php12
-rw-r--r--include/text.php27
2 files changed, 35 insertions, 4 deletions
diff --git a/include/attach.php b/include/attach.php
index 96b9c0b44..0f07fe035 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -31,7 +31,6 @@ function z_mime_content_type($filename) {
'txt' => 'text/plain',
'htm' => 'text/html',
'html' => 'text/html',
- 'php' => 'text/html',
'css' => 'text/css',
'md' => 'text/markdown',
'bb' => 'text/bbcode',
@@ -41,8 +40,17 @@ function z_mime_content_type($filename) {
'swf' => 'application/x-shockwave-flash',
'flv' => 'video/x-flv',
'epub' => 'application/epub+zip',
+ 'c' => 'text/plain',
+ 'h' => 'text/plain',
+ 'sh' => 'text/plain',
+ 'py' => 'text/plain',
+ 'php' => 'text/plain',
+ 'rb' => 'text/plain',
+ 'pdl' => 'text/plain',
+
// images
+
'png' => 'image/png',
'jpe' => 'image/jpeg',
'jpeg' => 'image/jpeg',
@@ -73,9 +81,7 @@ function z_mime_content_type($filename) {
'flac' => 'audio/flac',
'opus' => 'audio/ogg',
'webm' => 'video/webm',
-// 'webm' => 'audio/webm',
'mp4' => 'video/mp4',
-// 'mp4' => 'audio/mp4',
'mkv' => 'video/x-matroska',
// adobe
diff --git a/include/text.php b/include/text.php
index c74e515d2..ee8318d7c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2710,6 +2710,9 @@ function getIconFromType($type) {
'application/octet-stream' => 'fa-file-o',
//Text
'text/plain' => 'fa-file-text-o',
+ 'text/markdown' => 'fa-file-text-o',
+ 'text/bbcode' => 'fa-file-text-o',
+ 'text/html' => 'fa-file-text-o',
'application/msword' => 'fa-file-word-o',
'application/pdf' => 'fa-file-pdf-o',
'application/vnd.oasis.opendocument.text' => 'fa-file-word-o',
@@ -2739,11 +2742,33 @@ function getIconFromType($type) {
'video/x-matroska' => 'fa-file-video-o'
);
- $iconFromType = 'fa-file-o';
+ $catMap = [
+ 'application' => 'fa-file-code-o',
+ 'multipart' => 'fa-folder',
+ 'audio' => 'fa-file-audio-o',
+ 'video' => 'fa-file-video-o',
+ 'text' => 'fa-file-text-o',
+ 'image' => 'fa=file-picture-o',
+ 'message' => 'fa-file-text-o'
+ ];
+
+
+ $iconFromType = '';
if (array_key_exists($type, $iconMap)) {
$iconFromType = $iconMap[$type];
}
+ else {
+ $parts = explode('/',$type);
+ if($parts[0] && $catMap[$parts[0]]) {
+ $iconFromType = $catMap[$parts[0]];
+ }
+ }
+
+ if(! $iconFromType) {
+ $iconFromType = 'fa-file-o';
+ }
+
return $iconFromType;
}