1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Adding method to get the formatted message

This commit is contained in:
Tim Düsterhus 2011-12-04 22:52:57 +01:00
parent e2b7f5df6a
commit adc5b049cc

View File

@ -1,5 +1,6 @@
<?php
namespace wcf\data\chat\message;
use \wcf\system\WCF;
/**
* Represents a chat message.
@ -40,6 +41,22 @@ class ChatMessage extends \wcf\data\DatabaseObject {
* @return string
*/
public function __toString() {
return $this->message;
return $this->getFormattedMessage;
}
/**
* Returns the formatted message.
*
* @return string
*/
public function getFormattedMessage() {
$message = $this->message;
switch ($this->type) {
case self::TYPE_JOIN:
case self::TYPE_LEAVE:
case self::TYPE_BACK:
$message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type);
}
return $message;
}
}