*
* @param int $depth
*/
- public function enforceQuoteDepth($depth)
+ public function enforceQuoteDepth($depth, bool $isFullQuote = false)
{
- $this->getHtmlInputNodeProcessor()->enforceQuoteDepth($depth);
+ $this->getHtmlInputNodeProcessor()->enforceQuoteDepth($depth, $isFullQuote);
}
/**
*
* @param int $depth
*/
- public function enforceQuoteDepth($depth)
+ public function enforceQuoteDepth($depth, bool $isFullQuote = false)
{
$quotes = [];
/** @var \DOMElement $quote */
$quotes[] = $quote;
}
+ $checkQuotes = [];
foreach ($quotes as $quote) {
if (!$quote->parentNode) {
continue;
continue;
}
+ $checkQuotes[] = $quote->parentNode;
DOMUtil::removeNode($quote);
}
}
+
+ /**
+ * @var \DOMElement $quote
+ */
+ foreach ($checkQuotes as $quote) {
+ if ($quote->childNodes->length === 0) {
+ $quote->textContent = "[\u{2026}]";
+ }
+ }
+
+ // Check if the quoted message is now empty.
+ if ($depth === 0 && $isFullQuote && \count($quotes) > 0) {
+ /** @var \DOMElement $body */
+ $body = $this->getDocument()->getElementsByTagName('body')[0];
+ if ($body->childElementCount === 0) {
+ $p = $body->ownerDocument->createElement('p');
+ $p->textContent = "[\u{2026}]";
+ $body->appendChild($p);
+ }
+ }
}
/**
$htmlInputProcessor->processIntermediate($fullQuote);
if (MESSAGE_MAX_QUOTE_DEPTH) {
- $htmlInputProcessor->enforceQuoteDepth(MESSAGE_MAX_QUOTE_DEPTH - 1);
+ $htmlInputProcessor->enforceQuoteDepth(MESSAGE_MAX_QUOTE_DEPTH - 1, true);
}
$parameters = ['htmlInputProcessor' => $htmlInputProcessor];