aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Storage/Browser.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-12-17 10:04:24 +0000
committerMario <mario@mariovavti.com>2020-12-17 10:04:24 +0000
commitb2e80efe3f42c6329be7356580d62ea3525717b8 (patch)
tree5ebda5b5e6b33062938d6e5a865ecd64a09c3d1b /Zotlabs/Storage/Browser.php
parentb4b566318a0e52b6396445ddc21c20c0abcc8ce4 (diff)
downloadvolse-hubzilla-b2e80efe3f42c6329be7356580d62ea3525717b8.tar.gz
volse-hubzilla-b2e80efe3f42c6329be7356580d62ea3525717b8.tar.bz2
volse-hubzilla-b2e80efe3f42c6329be7356580d62ea3525717b8.zip
files_ng: provide bbcode snippets in the info panel
Diffstat (limited to 'Zotlabs/Storage/Browser.php')
-rw-r--r--Zotlabs/Storage/Browser.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 21190d1bd..7b20e9ddb 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -111,6 +111,19 @@ class Browser extends DAV\Browser\Plugin {
$parent_path = \Sabre\HTTP\encodePath($this->server->getBaseUri() . $parent_uri);
}
+ $embedable_video_types = [
+ 'video/mp4',
+ 'video/ogg',
+ 'video/webm'
+ ];
+
+ $embedable_audio_types = [
+ 'audio/mpeg',
+ 'audio/wav',
+ 'audio/ogg',
+ 'audio/webm'
+ ];
+
$f = [];
foreach ($files as $file) {
@@ -292,6 +305,29 @@ class Browser extends DAV\Browser\Plugin {
$ft['recurse'] = ['recurse_' . $id, t('Set permissions for all files and sub folders'), 0, '', [t('No'), t('Yes')]];
$ft['notify'] = ['notify_edit_' . $id, t('Notify your contacts about this file'), 0, '', [t('No'), t('Yes')]];
+ $embed_bbcode = '';
+ $link_bbcode = '';
+ $attach_bbcode = '';
+
+ if($data['is_photo']) {
+ $embed_bbcode = '[zmg]' . $ft['full_path'] . '[/zmg]';
+ }
+ elseif(strpos($type, 'video') === 0 && in_array($type, $embedable_video_types)) {
+ $embed_bbcode = '[zvideo]' . $ft['full_path'] . '[/zvideo]';
+ }
+ elseif(strpos($type, 'audio') === 0 && in_array($type, $embedable_audio_types)) {
+ $embed_bbcode = '[zaudio]' . $ft['full_path'] . '[/zaudio]';
+ }
+ $ft['embed_bbcode'] = $embed_bbcode;
+
+ if(! $data['is_dir']) {
+ $attach_bbcode = '[attachment]' . $data['hash'] . ',' . $data['revision'] . '[/attachment]';
+ }
+ $ft['attach_bbcode'] = $attach_bbcode;
+
+ $link_bbcode = '[zrl]' . $ft['full_path'] . '[/zrl]';
+ $ft['link_bbcode'] = $link_bbcode;
+
$f[] = $ft;
}