From 05f4c9c7bc3a1203a7dd545695c00d9718fb64f1 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Wed, 24 Jun 2020 20:11:37 +0200 Subject: [PATCH] Add audio player for embedded audio attachments Closes #3231 --- .../templates/__audioAttachmentBBCode.tpl | 22 +++++++++++++++++++ .../system/bbcode/AttachmentBBCode.class.php | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 com.woltlab.wcf/templates/__audioAttachmentBBCode.tpl diff --git a/com.woltlab.wcf/templates/__audioAttachmentBBCode.tpl b/com.woltlab.wcf/templates/__audioAttachmentBBCode.tpl new file mode 100644 index 0000000000..1adb76e6ea --- /dev/null +++ b/com.woltlab.wcf/templates/__audioAttachmentBBCode.tpl @@ -0,0 +1,22 @@ + + + + + {$attachment->filename} + + + + diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index c2a28abf6a..8f0503c394 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -163,6 +163,12 @@ class AttachmentBBCode extends AbstractBBCode { 'attachmentIdentifier' => StringUtil::getRandomID(), ]); } + else if (substr($attachment->fileType, 0, 6) === 'audio/' && $parser->getOutputType() == 'text/html') { + return WCF::getTPL()->fetch('__audioAttachmentBBCode', 'wcf', [ + 'attachment' => $attachment, + 'attachmentIdentifier' => StringUtil::getRandomID(), + ]); + } else { // file return StringUtil::getAnchorTag($attachment->getLink(), $attachment->filename); -- 2.20.1