From 65f833f26a79c2558b461ca1d539fa56eae9bd06 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 6 Jul 2016 15:41:14 +0200 Subject: [PATCH] Added support for [wsm] and partially [wsmg] --- com.woltlab.wcf/objectType.xml | 5 ++ com.woltlab.wcf/templates/mediaBBCodeTag.tpl | 1 + .../js/WoltLab/WCF/Media/Manager/Editor.js | 4 +- .../js/WoltLab/WCF/Ui/Redactor/Metacode.js | 6 +++ .../system/bbcode/HtmlBBCodeParser.class.php | 2 +- .../bbcode/WoltLabSuiteMediaBBCode.class.php | 49 +++++++++++++++++++ .../WoltLabSuiteMediaGalleryBBCode.class.php | 19 +++++++ .../cache/runtime/MediaRuntimeCache.class.php | 24 +++++++++ .../filter/MessageHtmlInputFilter.class.php | 4 ++ ...ediaMessageEmbeddedObjectHandler.class.php | 42 ++++++++++++++++ 10 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 com.woltlab.wcf/templates/mediaBBCodeTag.tpl create mode 100644 wcfsetup/install/files/lib/system/bbcode/WoltLabSuiteMediaBBCode.class.php create mode 100644 wcfsetup/install/files/lib/system/bbcode/WoltLabSuiteMediaGalleryBBCode.class.php create mode 100644 wcfsetup/install/files/lib/system/cache/runtime/MediaRuntimeCache.class.php create mode 100644 wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 57f1adfc65..c27854df96 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -757,6 +757,11 @@ com.woltlab.wcf.message.embeddedObject + + com.woltlab.wcf.media + com.woltlab.wcf.message.embeddedObject + + diff --git a/com.woltlab.wcf/templates/mediaBBCodeTag.tpl b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl new file mode 100644 index 0000000000..448dcfedd1 --- /dev/null +++ b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl @@ -0,0 +1 @@ +{$media->getTitle()} \ No newline at end of file diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js index d0b6fe44ec..c8255cd64a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js @@ -208,7 +208,7 @@ define(['Core', 'Dictionary', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/ }); this._options.editor.buffer.set(); - this._options.editor.insert.text('[wsm]' + mediaIds.join(',') + '[/wsm]'); + this._options.editor.insert.text("[wsmg='" + mediaIds.join(',') + "'][/wsmg]"); }, /** @@ -241,7 +241,7 @@ define(['Core', 'Dictionary', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/ this._options.editor.insert.html(''); } else { - this._options.editor.insert.text('[wsm]' + item.mediaID + '[/wsm]'); + this._options.editor.insert.text("[wsm='" + item.mediaID + "'][/wsm]"); } }, diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Metacode.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Metacode.js index a988193d8d..fba6bb17ba 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Metacode.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Metacode.js @@ -66,6 +66,12 @@ define(['Dom/Util'], function(DomUtil) { var buffer = '[' + name; if (attributes.length) { + for (var i = 0, length = attributes.length; i < length; i++) { + if (!/^'.*'$/.test(attributes[i])) { + attributes[i] = "'" + attributes[i] + "'"; + } + } + buffer += '=' + attributes.join(','); } diff --git a/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php b/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php index 8bb65fbb28..d3acbf260e 100644 --- a/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php @@ -9,7 +9,7 @@ use wcf\util\StringUtil; * that can be safely passed through HTMLPurifier's validation mechanism. * * All though not exactly required for all bbcodes, the actual output of an bbcode - * cannot be forseen and potentially conflict with HTMLPurifier's whitelist. Examples + * cannot be foreseen and potentially conflict with HTMLPurifier's whitelist. Examples * are