From: Alexander Ebert Date: Fri, 14 Jul 2023 15:35:55 +0000 (+0200) Subject: Slightly improve the consistency of HTML generation X-Git-Tag: 6.0.0_Alpha_6~6^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=680d90e1d3dea61460f86e580d9d5a73b96af77c;p=GitHub%2FWoltLab%2FWCF.git Slightly improve the consistency of HTML generation --- diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index 54228c8cb4..ea111666d8 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -70,7 +70,7 @@ final class AttachmentBBCode extends AbstractBBCode $source = StringUtil::encodeHTML($attachment->getLink()); $title = StringUtil::encodeHTML($attachment->filename); - $image = \sprintf( + $imageElement = \sprintf( '', $source, $attachment->width, @@ -78,27 +78,35 @@ final class AttachmentBBCode extends AbstractBBCode ); if (!$hasParentLink && ($attachment->width > ATTACHMENT_THUMBNAIL_WIDTH || $attachment->height > ATTACHMENT_THUMBNAIL_HEIGHT)) { - $icon = FontAwesomeIcon::fromValues('magnifying-glass')->toHtml(24); - return << - {$image} - - {$icon} - - - HTML; + return \sprintf( + <<<'HTML' + + %s + + %s + + + HTML, + $source, + $title, + $class, + $imageElement, + FontAwesomeIcon::fromValues('magnifying-glass')->toHtml(24), + ); } return \sprintf( '%s', $title, $class, - $image, + $imageElement, ); } - $icon = FontAwesomeIcon::fromValues('magnifying-glass')->toHtml(24); - $enlarge = '' . $icon . ''; + $enlargeImageControls = \sprintf( + '%s', + FontAwesomeIcon::fromValues('magnifying-glass')->toHtml(24), + ); $linkParameters = [ 'object' => $attachment, @@ -121,7 +129,7 @@ final class AttachmentBBCode extends AbstractBBCode $imageClasses .= ' ' . $class; } - $image = \sprintf( + $imageElement = \sprintf( '', StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', $linkParameters)), $imageClasses, @@ -135,16 +143,16 @@ final class AttachmentBBCode extends AbstractBBCode StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment])), StringUtil::encodeHTML($attachment->filename), $class, - $image, - $enlarge, + $imageElement, + $enlargeImageControls, ); } return \sprintf( '%s%s', $class, - $image, - \str_contains($imageClasses, 'embeddedAttachmentLink') ? $enlarge : '', + $imageElement, + \str_contains($imageClasses, 'embeddedAttachmentLink') ? $enlargeImageControls : '', ); }