diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-01-23 01:18:33 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-01-23 01:18:33 +0100 |
commit | a66df8c97f4aa70977b25478fc3b6413ebd9b9db (patch) | |
tree | 564670e31f82083411dd6749ccfb27f5038907fe /app/class/Media.php | |
parent | 11c729472634682fbcaa40caa5c510d490acfa4a (diff) | |
download | wcms-a66df8c97f4aa70977b25478fc3b6413ebd9b9db.tar.gz wcms-a66df8c97f4aa70977b25478fc3b6413ebd9b9db.zip |
new media types
Diffstat (limited to 'app/class/Media.php')
-rw-r--r-- | app/class/Media.php | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/app/class/Media.php b/app/class/Media.php index 4053bed..0be2013 100644 --- a/app/class/Media.php +++ b/app/class/Media.php @@ -16,6 +16,7 @@ class Media const IMAGE = array('jpg', 'jpeg', 'gif', 'png'); const SOUND = array('mp3', 'flac', 'wav', 'ogg'); const VIDEO = array('mp4', 'mov', 'avi', 'mkv'); + const ARCHIVE = array('zip', 'rar'); @@ -92,17 +93,17 @@ class Media case 'image': $code = ' . ')'; break; - - case 'other': - $code = '[' . $this->id . '](' . $this->getincludepath() . ')'; - break; - + case 'sound': - $code = '<audio controls src="' . $this->getincludepath() . '"></audio>'; + $code = '<audio controls src="' . $this->getincludepath() . '"></audio>'; break; - + case 'video': - $code = '<video controls=""><source src="' . $this->getincludepath() . '" type="video/' . $this->extension . '"></video>'; + $code = '<video controls=""><source src="' . $this->getincludepath() . '" type="video/' . $this->extension . '"></video>'; + break; + + default : + $code = '[' . $this->id . '](' . $this->getincludepath() . ')'; break; } @@ -125,10 +126,22 @@ class Media case 'video': $symbol = "🎞"; break; + + case 'document': + $symbol = "📓"; + break; - case 'other': + case 'archive': + $symbol = "🗜"; + break; + + case 'code': $symbol = "📄"; break; + + default : + $symbol = "🎲"; + break; } return $symbol; } @@ -206,16 +219,10 @@ class Media public function settype() { - if (isset($this->extension)) { - if (in_array($this->extension, $this::IMAGE)) { - $this->type = "image"; - } elseif (in_array($this->extension, $this::SOUND)) { - $this->type = "sound"; - } elseif (in_array($this->extension, $this::VIDEO)) { - $this->type = "video"; - } else { - $this->type = "other"; - } + if (!empty($this->extension) && isset(Model::MEDIA_EXT[$this->extension])) { + $this->type = Model::MEDIA_EXT[$this->extension]; + } else { + $this->type = 'other'; } } |