use wcf\data\conversation\message\ConversationMessageList;
use wcf\data\object\type\ObjectTypeCache;
use wcf\system\exception\SystemException;
+use wcf\system\html\input\HtmlInputProcessor;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\search\SearchIndexManager;
use wcf\system\WCF;
*/
protected $limit = 500;
+ /**
+ * @var HtmlInputProcessor
+ */
+ protected $htmlInputProcessor;
+
/** @noinspection PhpMissingParentCallCommonInspection */
/**
* @inheritDoc
$row = $attachmentStatement->fetchSingleRow();
$data['attachments'] = $row['attachments'];
- // update embedded objects
- throw new SystemException("TODO: we need the html input processor here");
- $data['hasEmbeddedObjects'] = (MessageEmbeddedObjectManager::getInstance()->registerObjects('com.woltlab.wcf.conversation.message') ? 1 : 0);
+ // update message
+ if (!$message->enableHtml) {
+ $this->getHtmlInputProcessor()->process($message->message, 'com.woltlab.wcf.conversation.message', $message->messageID, true);
+ $data['message'] = $this->getHtmlInputProcessor()->getHtml();
+ $data['enableHtml'] = 1;
+ }
+ else {
+ $this->getHtmlInputProcessor()->processEmbeddedContent($message->message, 'com.woltlab.wcf.conversation.message', $message->messageID);
+ }
+
+ if (MessageEmbeddedObjectManager::getInstance()->registerObjects($this->getHtmlInputProcessor())) {
+ $data['hasEmbeddedObjects'] = 1;
+ }
+ else {
+ $data['hasEmbeddedObjects'] = 0;
+ }
$editor->update($data);
}
}
+
+ /**
+ * @return HtmlInputProcessor
+ */
+ protected function getHtmlInputProcessor() {
+ if ($this->htmlInputProcessor === null) {
+ $this->htmlInputProcessor = new HtmlInputProcessor();
+ }
+
+ return $this->htmlInputProcessor;
+ }
}