From: Alexander Ebert Date: Fri, 7 Oct 2016 10:15:20 +0000 (+0200) Subject: Added missing img bbcode converter X-Git-Tag: 3.0.0_Beta_3~50^2~66 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9dc32b2ec96937fff5941b21e7307cd46fc42337;p=GitHub%2FWoltLab%2FWCF.git Added missing img bbcode converter --- 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); + } +}