diff options
| author | Nicofuma <github@nicofuma.fr> | 2015-05-20 00:38:49 +0200 |
|---|---|---|
| committer | Nicofuma <github@nicofuma.fr> | 2015-05-20 00:38:49 +0200 |
| commit | c5493c2bb8e56e59cb3177d62a48a61fadf95303 (patch) | |
| tree | b6ecc2d6e5f1ae51dde98b5f145cb3cac72c0cf5 /phpBB/phpbb/textformatter | |
| parent | fda5a83b6daa66d7080c8de04cfedc15279a1204 (diff) | |
| parent | f7ad2c2b32b309edba006a8d4b58727b50642ea2 (diff) | |
| download | forums-c5493c2bb8e56e59cb3177d62a48a61fadf95303.tar forums-c5493c2bb8e56e59cb3177d62a48a61fadf95303.tar.gz forums-c5493c2bb8e56e59cb3177d62a48a61fadf95303.tar.bz2 forums-c5493c2bb8e56e59cb3177d62a48a61fadf95303.tar.xz forums-c5493c2bb8e56e59cb3177d62a48a61fadf95303.zip | |
Merge pull request #3586 from s9e/ticket/13680
[ticket/13680] Updated quote notifications
Diffstat (limited to 'phpBB/phpbb/textformatter')
| -rw-r--r-- | phpBB/phpbb/textformatter/s9e/utils.php | 25 | ||||
| -rw-r--r-- | phpBB/phpbb/textformatter/utils_interface.php | 8 |
2 files changed, 33 insertions, 0 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php index 2018bbf519..e21dedecc4 100644 --- a/phpBB/phpbb/textformatter/s9e/utils.php +++ b/phpBB/phpbb/textformatter/s9e/utils.php @@ -35,6 +35,31 @@ class utils implements \phpbb\textformatter\utils_interface } /** + * 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 * * @param string $xml Parsed text diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 132dc8ece4..6d3fd13021 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -29,6 +29,14 @@ interface utils_interface public function clean_formatting($text); /** + * Get a list of quote authors, limited to the outermost quotes + * + * @param string $text Parsed text + * @return string[] List of authors + */ + public function get_outermost_quote_authors($text); + + /** * Remove given BBCode and its content, at given nesting depth * * @param string $text Parsed text |
