+<!-- begin:parser_nonessential -->
<div class="container containerPadding spoilerBox jsSpoilerBox">
- <!-- begin:parser_nonessential -->
<header class="jsOnly">
<a class="button jsSpoilerToggle">{if $buttonTitle}{$buttonTitle}{else}{lang}wcf.bbcode.spoiler.show{/lang}{/if}</a>
</header>
- <!-- end:parser_nonessential -->
<div style="display: none">
{@$content}
</div>
</div>
-<!-- begin:parser_nonessential -->
<script data-relocate="true">
//<![CDATA[
$(function() {
return $usernames;
}
+
+ /**
+ * Truncates a formatted message and keeps the HTML syntax intact.
+ *
+ * @param string $message string which shall be truncated
+ * @param integer $maxLength string length after truncating
+ * @return string truncated string
+ */
+ public static function truncateFormattedMessage($message, $maxLength = 1000) {
+ $message = Regex::compile('<!-- begin:parser_nonessential -->.*?<!-- end:parser_nonessential -->', Regex::DOT_ALL)->replace($message, '');
+ return StringUtil::truncateHTML($message, $maxLength);
+ }
}