From 6f02c6c7871b8c41b7e37e3872d869cd1c1e3d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 11 Apr 2013 18:00:53 +0200 Subject: [PATCH] Fix text/plain output --- file/lib/data/message/Message.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/file/lib/data/message/Message.class.php b/file/lib/data/message/Message.class.php index cefa8bb..dea41bd 100644 --- a/file/lib/data/message/Message.class.php +++ b/file/lib/data/message/Message.class.php @@ -57,7 +57,7 @@ public function __toString() { * @param string $outputType outputtype for messageparser * @return string */ - public function getFormattedMessage() { + public function getFormattedMessage($type = 'text/html') { $message = $this->message; switch ($this->type) { @@ -77,6 +77,8 @@ public function getFormattedMessage() { case self::TYPE_NORMAL: case self::TYPE_ME: default: + if ($type !== 'text/html') return $message; + $messageParser = \wcf\system\bbcode\MessageParser::getInstance(); $messageParser->setOutputType('text/html'); $message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false); @@ -133,7 +135,7 @@ public function jsonify($raw = false) { 'formattedMessage' => $this->getFormattedMessage(), 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), 'separator' => $separator, - 'message' => $this->message, + 'message' => $this->getFormattedMessage('text/plain'), 'sender' => (int) $this->sender, 'username' => $this->getUsername(), 'time' => (int) $this->time,