From: Alexander Ebert Date: Sat, 22 Oct 2016 16:20:31 +0000 (+0200) Subject: Added missing HD versions for auto-detected smilies X-Git-Tag: 3.0.0_Beta_4~32 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9bc2c29ad37991b6f221803a351e2fa1194d507e;p=GitHub%2FWoltLab%2FWCF.git Added missing HD versions for auto-detected smilies --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 2905f9a6c3..fc41905399 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -39,7 +39,7 @@ class HtmlInputNodeTextParser { /** * list of smilies by smiley code - * @var string[] + * @var Smiley[] */ protected $smilies = []; @@ -92,7 +92,7 @@ class HtmlInputNodeTextParser { /** @var Smiley $smiley */ foreach ($categorySmilies as $smiley) { foreach ($smiley->smileyCodes as $smileyCode) { - $this->smilies[$smileyCode] = $smiley->getURL(); + $this->smilies[$smileyCode] = $smiley; } } } @@ -434,7 +434,7 @@ class HtmlInputNodeTextParser { static $smileyPattern = null; if ($smileyPattern === null) { $difficultCodes = []; - foreach ($this->smilies as $smileyCode => $url) { + foreach ($this->smilies as $smileyCode => $smiley) { $smileyCode = preg_quote($smileyCode, '~'); if (!preg_match('~^\\\:.+\\\:$~', $smileyCode)) { @@ -457,10 +457,15 @@ class HtmlInputNodeTextParser { return preg_replace_callback($smileyPattern, function($matches) use ($text) { $smileyCode = $matches[0]; + $smiley = $this->smilies[$smileyCode]; $element = $text->ownerDocument->createElement('img'); - $element->setAttribute('src', $this->smilies[$smileyCode]); + $element->setAttribute('src', $smiley->getURL()); $element->setAttribute('class', 'smiley'); $element->setAttribute('alt', $smileyCode); + $element->setAttribute('height', $smiley->getHeight()); + if ($smiley->getURL2x()) { + $element->setAttribute('srcset', $smiley->getURL2x() . ' 2x'); + } return $this->addReplacement($text, $element); }, $value);