From: joshuaruesweg Date: Wed, 24 Jun 2020 18:11:37 +0000 (+0200) Subject: Add audio player for embedded audio attachments X-Git-Tag: 5.3.0_Alpha_1~197^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05f4c9c7bc3a1203a7dd545695c00d9718fb64f1;p=GitHub%2FWoltLab%2FWCF.git Add audio player for embedded audio attachments Closes #3231 --- 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);