1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Fix text/plain output

This commit is contained in:
Tim Düsterhus 2013-04-11 18:00:53 +02:00
parent 4ff62179df
commit 6f02c6c787

View File

@ -57,7 +57,7 @@ public function __toString() {
* @param string $outputType outputtype for messageparser * @param string $outputType outputtype for messageparser
* @return string * @return string
*/ */
public function getFormattedMessage() { public function getFormattedMessage($type = 'text/html') {
$message = $this->message; $message = $this->message;
switch ($this->type) { switch ($this->type) {
@ -77,6 +77,8 @@ public function getFormattedMessage() {
case self::TYPE_NORMAL: case self::TYPE_NORMAL:
case self::TYPE_ME: case self::TYPE_ME:
default: default:
if ($type !== 'text/html') return $message;
$messageParser = \wcf\system\bbcode\MessageParser::getInstance(); $messageParser = \wcf\system\bbcode\MessageParser::getInstance();
$messageParser->setOutputType('text/html'); $messageParser->setOutputType('text/html');
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false); $message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
@ -133,7 +135,7 @@ public function jsonify($raw = false) {
'formattedMessage' => $this->getFormattedMessage(), 'formattedMessage' => $this->getFormattedMessage(),
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
'separator' => $separator, 'separator' => $separator,
'message' => $this->message, 'message' => $this->getFormattedMessage('text/plain'),
'sender' => (int) $this->sender, 'sender' => (int) $this->sender,
'username' => $this->getUsername(), 'username' => $this->getUsername(),
'time' => (int) $this->time, 'time' => (int) $this->time,