<usetext>1</usetext>
</attribute>
<attribute name="1">
- <validationpattern><![CDATA[^(left|right|none)$]]></validationpattern>
+ <validationpattern><![CDATA[^(left|right|center|none)$]]></validationpattern>
</attribute>
<attribute name="2">
<validationpattern><![CDATA[^(\d+|true|false)$]]></validationpattern>
<validationpattern><![CDATA[^(small|medium|large|original)$]]></validationpattern>
</attribute>
<attribute name="2">
- <validationpattern><![CDATA[^(left|right|none)$]]></validationpattern>
+ <validationpattern><![CDATA[^(left|right|center|none)$]]></validationpattern>
</attribute>
</attributes>
</bbcode>
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
+{if $float === 'center'}<p class="text-center">{/if}
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
{if $media->isImage}
{if $thumbnailSize != 'original'}
</span>
{/if}
</span>
+{if $float === 'center'}</p>{/if}
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
+{if $float === 'center'}<p class="text-center">{/if}
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
{if $media->isImage}
{if $thumbnailSize != 'original'}
</span>
{/if}
</span>
+{if $float === 'center'}</p>{/if}
);
}
- return \sprintf(
+ $span = \sprintf(
'<span title="%s" class="%s" style="width: %s">%s</span>',
$title,
$class,
$width,
$imageElement,
);
+
+ if ($alignment === 'center') {
+ return \sprintf(
+ '<p class="text-center">%s</p>',
+ $span,
+ );
+ }
+ return $span;
}
private function showImageAsThumbnail(Attachment $attachment, string $alignment, bool $hasParentLink, string $width): string
);
if (!$hasParentLink && $attachment->hasThumbnail() && $attachment->canDownload()) {
- return \sprintf(
+ $result = \sprintf(
'<a href="%s" title="%s" class="embeddedAttachmentLink jsImageViewer %s" style="width: %s">%s%s</a>',
StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment])),
StringUtil::encodeHTML($attachment->filename),
$imageElement,
$enlargeImageControls,
);
+ } else {
+ $result = \sprintf(
+ '<span class="%s" stlye="width: %s">%s%s</span>',
+ $class,
+ $width,
+ $imageElement,
+ \str_contains($imageClasses, 'embeddedAttachmentLink') ? $enlargeImageControls : '',
+ );
+ }
+ if ($alignment === 'center') {
+ return \sprintf(
+ '<p class="text-center">%s</p>',
+ $result,
+ );
}
- return \sprintf(
- '<span class="%s" stlye="width: %s">%s%s</span>',
- $class,
- $width,
- $imageElement,
- \str_contains($imageClasses, 'embeddedAttachmentLink') ? $enlargeImageControls : '',
- );
+ return $result;
}
/**
if ($parent->tagName === "figure") {
if (\preg_match('~\b(?<float>image-style-side-left|image-style-side)\b~', $parent->getAttribute('class'), $matches)) {
$float = ($matches['float'] === 'image-style-side-left') ? 'left' : 'right';
+ } else {
+ $float = 'center';
}
$replaceElement = $parent;
if ($parent->tagName === "figure") {
if (\preg_match('~\b(?<float>image-style-side-left|image-style-side)\b~', $parent->getAttribute('class'), $matches)) {
$float = ($matches['float'] === 'image-style-side-left') ? 'left' : 'right';
+ } else {
+ $float = 'center';
}
$replaceElement = $parent;