use wcf\data\conversation\Conversation;
use wcf\data\DatabaseObject;
use wcf\data\IMessage;
+use wcf\data\TUserContent;
use wcf\system\bbcode\MessageParser;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\request\LinkHandler;
* @category Community Framework
*/
class ConversationMessage extends DatabaseObject implements IMessage {
+ use TUserContent;
+
/**
- * @see \wcf\data\DatabaseObject::$databaseTableName
+ * @inheritdoc
*/
protected static $databaseTableName = 'conversation_message';
/**
- * @see \wcf\data\DatabaseObject::$databaseIndexName
+ * @inheritdoc
*/
protected static $databaseTableIndexName = 'messageID';
/**
* conversation object
- * @var \wcf\data\conversation\Conversation
+ * @var Conversation
*/
protected $conversation = null;
/**
- * @see \wcf\data\IMessage::getFormattedMessage()
+ * @inheritdoc
*/
public function getFormattedMessage() {
// assign embedded objects
* Assigns and returns the embedded attachments.
*
* @param boolean $ignoreCache
- * @return \wcf\data\attachment\GroupedAttachmentList
+ * @return GroupedAttachmentList
*/
public function getAttachments($ignoreCache = false) {
if (MODULE_ATTACHMENT == 1 && ($this->attachments || $ignoreCache)) {
$attachmentList = new GroupedAttachmentList('com.woltlab.wcf.conversation.message');
- $attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', array($this->messageID));
+ $attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', [$this->messageID]);
$attachmentList->readObjects();
- $attachmentList->setPermissions(array(
+ $attachmentList->setPermissions([
'canDownload' => true,
'canViewPreview' => true
- ));
+ ]);
if ($ignoreCache && !count($attachmentList)) {
return null;
}
/**
- * Returns an excerpt of this message.
- *
- * @param string $maxLength
- * @return string
+ * @inheritdoc
*/
public function getExcerpt($maxLength = 255) {
return StringUtil::truncateHTML($this->getSimplifiedFormattedMessage(), $maxLength);
/**
* Returns the conversation of this message.
*
- * @return \wcf\data\conversation\Conversation
+ * @return Conversation
*/
public function getConversation() {
if ($this->conversation === null) {
/**
* Sets the conversation of this message.
*
- * @param \wcf\data\conversation\Conversation $conversation
+ * @param Conversation $conversation
*/
public function setConversation(Conversation $conversation) {
if ($this->conversationID == $conversation->conversationID) {
}
/**
- * @see \wcf\data\IMessage::getMessage()
+ * @inheritdoc
*/
public function getMessage() {
return $this->message;
}
/**
- * @see \wcf\data\ILinkableObject::getLink()
+ * @inheritdoc
*/
public function getLink() {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->getConversation(),
'messageID' => $this->messageID
- ), '#message'.$this->messageID);
- }
-
- /**
- * @see \wcf\data\IMessage::getTime()
- */
- public function getTime() {
- return $this->time;
+ ], '#message'.$this->messageID);
}
/**
- * @see \wcf\data\ITitledObject::getTitle()
+ * @inheritdoc
*/
public function getTitle() {
if ($this->messageID == $this->getConversation()->firstMessageID) {
}
/**
- * @see \wcf\data\IMessage::getUserID()
- */
- public function getUserID() {
- return $this->userID;
- }
-
- /**
- * @see \wcf\data\IMessage::getUsername()
- */
- public function getUsername() {
- return $this->username;
- }
-
- /**
- * @see \wcf\data\IMessage::isVisible()
+ * @inheritdoc
*/
public function isVisible() {
return true;
}
/**
- * @see \wcf\data\IMessage::__toString()
+ * @inheritdoc
*/
public function __toString() {
return $this->getFormattedMessage();