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:
parent
e2b7f5df6a
commit
adc5b049cc
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user