*/
public function render(array $data, $supportPaste = false) {
$messages = $this->getMessages($data);
+ $this->overrideIsFullQuote($messages);
+
$userIDs = $userProfiles = [];
foreach ($messages as $message) {
$userID = $message->getUserID();
}
WCF::getTPL()->assign([
- 'messages' => $this->getMessages($data),
+ 'messages' => $messages,
'supportPaste' => $supportPaste,
'userProfiles' => $userProfiles
]);
*/
public function renderQuotes(array $data, $render = true, $renderAsString = true) {
$messages = $this->getMessages($data);
+ $this->overrideIsFullQuote($messages);
$renderedQuotes = [];
foreach ($messages as $message) {
return $renderedQuotes;
}
+ /**
+ * Overrides the full quote flag for given message.
+ *
+ * @param QuotedMessage[] $messages
+ */
+ protected function overrideIsFullQuote(array $messages) {
+ foreach ($messages as $message) {
+ $quoteIDs = $message->getQuoteIDs();
+ foreach ($quoteIDs as $quoteID) {
+ $message->setOverrideIsFullQuote($quoteID, MessageQuoteManager::getInstance()->isFullQuote($quoteID));
+ }
+ }
+ }
+
/**
* Returns a list of QuotedMessage objects.
*
$this->updateSession();
}
+ /**
+ * Returns true if a quote id represents a full quote.
+ *
+ * @param string $quoteID
+ * @return boolean
+ */
+ public function isFullQuote($quoteID) {
+ return isset($this->quoteData[$quoteID . '_fq']);
+ }
+
/**
* Updates data stored in session,
*/
*/
public $object = null;
+ /**
+ * overrides full quote flag
+ * @var boolean[]
+ */
+ public $overrideIsFullQuote = [];
+
/**
* list of quotes (shortened)
* @var string[]
return $this->object->$name();
}
+ /**
+ * Overrides the full quote flag.
+ *
+ * @param string $quoteID
+ * @param boolean $overrideIsFullQuote
+ */
+ public function setOverrideIsFullQuote($quoteID, $overrideIsFullQuote) {
+ $this->overrideIsFullQuote[$quoteID] = $overrideIsFullQuote;
+ }
+
+ /**
+ * Returns the list of quote ids for this message.
+ *
+ * @return string[]
+ */
+ public function getQuoteIDs() {
+ return array_keys($this->quotes);
+ }
+
/**
* Returns the full quote by quote id.
*
* @return boolean
*/
public function isFullQuote($quoteID) {
+ if (isset($this->overrideIsFullQuote[$quoteID])) {
+ return $this->overrideIsFullQuote[$quoteID];
+ }
+
if (isset($this->fullQuotes[$quoteID]) && $this->quotes[$quoteID] != $this->fullQuotes[$quoteID]) {
// full quotes are parsed and differ from their original
return true;