1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge pull request #3586 from s9e/ticket/13680

[ticket/13680] Updated quote notifications
This commit is contained in:
Nicofuma
2015-05-20 00:38:49 +02:00
9 changed files with 126 additions and 31 deletions

View File

@@ -34,6 +34,31 @@ class utils implements \phpbb\textformatter\utils_interface
return \s9e\TextFormatter\Utils::removeFormatting($xml);
}
/**
* Get a list of quote authors, limited to the outermost quotes
*
* @param string $xml Parsed text
* @return string[] List of authors
*/
public function get_outermost_quote_authors($xml)
{
$authors = array();
if (strpos($xml, '<QUOTE ') === false)
{
return $authors;
}
$dom = new \DOMDocument;
$dom->loadXML($xml);
$xpath = new \DOMXPath($dom);
foreach ($xpath->query('//QUOTE[not(ancestor::QUOTE)]/@author') as $author)
{
$authors[] = $author->textContent;
}
return $authors;
}
/**
* Remove given BBCode and its content, at given nesting depth
*