public function setPreview(&$error = null)
{
$message = $this->message;
$options = \XF::options();
if (
preg_match('#\[(opener|excerpt|)\](.*)\[/\1\]#is', $message, $matches)
)
{
$this->message = trim($matches[2]);
}
elseif (preg_match('#\[snippet\](.*)\[/snippet\]#is', $message, $matches))
{
$this->message = trim(substr($matches[1], 0, $options->xcTopics1SnippetLength)) . " ...";
}
else
{
if ($options->XCTopics1TopicsUseSnippetAlways)
{
$this->message = trim(substr($message, 0, $options->xcTopics1SnippetLength)) . " ...";
}
}
}