From 9dc32b2ec96937fff5941b21e7307cd46fc42337 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 7 Oct 2016 12:15:20 +0200 Subject: [PATCH] Added missing img bbcode converter --- .../converter/ImgMetacodeConverter.class.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/html/metacode/converter/ImgMetacodeConverter.class.php diff --git a/wcfsetup/install/files/lib/system/html/metacode/converter/ImgMetacodeConverter.class.php b/wcfsetup/install/files/lib/system/html/metacode/converter/ImgMetacodeConverter.class.php new file mode 100644 index 0000000000..bf2528c7f2 --- /dev/null +++ b/wcfsetup/install/files/lib/system/html/metacode/converter/ImgMetacodeConverter.class.php @@ -0,0 +1,35 @@ +`. + * + * @author Alexander Ebert + * @copyright 2001-2016 WoltLab GmbH + * @license GNU Lesser General Public License + * @package WoltLabSuite\Core\System\Html\Metacode\Converter + * @since 3.0 + */ +class ImgMetacodeConverter extends AbstractMetacodeConverter { + /** + * @inheritDoc + */ + public function convert(\DOMDocumentFragment $fragment, array $attributes) { + $element = $fragment->ownerDocument->createElement('img'); + $element->setAttribute('src', $attributes[0]); + + if (isset($attributes[1]) && in_array($attributes[1], ['left', 'right'])) { + $element->setAttribute('class', 'messageFloatObject'.ucfirst($attributes[1])); + } + + return $element; + } + + /** + * @inheritDoc + */ + public function validateAttributes(array $attributes) { + $count = count($attributes); + return ($count > 0 && $count < 4); + } +} -- 2.20.1