mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Adding raw-parameter for jsonify
This commit is contained in:
parent
b7683db870
commit
530c2ab788
@ -89,10 +89,11 @@ public function getUsername() {
|
||||
/**
|
||||
* Converts this message into json-form.
|
||||
*
|
||||
* @param boolean $raw
|
||||
* @return string
|
||||
*/
|
||||
public function jsonify() {
|
||||
return \wcf\util\JSON::encode(array(
|
||||
public function jsonify($raw = false) {
|
||||
$array = array(
|
||||
'formattedUsername' => $this->getFormattedUsername(),
|
||||
'formattedMessage' => (string) $this,
|
||||
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
|
||||
@ -102,6 +103,9 @@ public function jsonify() {
|
||||
'receiver' => $this->receiver,
|
||||
'type' => $this->type,
|
||||
'roomID' => $this->roomID
|
||||
));
|
||||
);
|
||||
|
||||
if ($raw) return $array;
|
||||
return \wcf\util\JSON::encode($array);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user