aboutsummaryrefslogtreecommitdiff
path: root/app/class/Media.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-23 01:18:33 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-23 01:18:33 +0100
commita66df8c97f4aa70977b25478fc3b6413ebd9b9db (patch)
tree564670e31f82083411dd6749ccfb27f5038907fe /app/class/Media.php
parent11c729472634682fbcaa40caa5c510d490acfa4a (diff)
downloadwcms-a66df8c97f4aa70977b25478fc3b6413ebd9b9db.tar.gz
wcms-a66df8c97f4aa70977b25478fc3b6413ebd9b9db.zip
new media types
Diffstat (limited to 'app/class/Media.php')
-rw-r--r--app/class/Media.php45
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 = '![' . $this->id . '](' . $this->getincludepath() . ')';
break;
-
- case 'other':
- $code = '[' . $this->id . '](' . $this->getincludepath() . ')';
- break;
-
+
case 'sound':
- $code = '&lt;audio controls src="' . $this->getincludepath() . '"&gt;&lt;/audio&gt;';
+ $code = '&lt;audio controls src="' . $this->getincludepath() . '"&gt;&lt;/audio&gt;';
break;
-
+
case 'video':
- $code = '&lt;video controls=""&gt;&lt;source src="' . $this->getincludepath() . '" type="video/' . $this->extension . '"&gt;&lt;/video&gt;';
+ $code = '&lt;video controls=""&gt;&lt;source src="' . $this->getincludepath() . '" type="video/' . $this->extension . '"&gt;&lt;/video&gt;';
+ 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';
}
}