aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter/s9e
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-05-03 16:06:42 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-05-15 02:10:46 +0200
commitf5ce9f273829ba470a1348b4314cddb58f552da0 (patch)
treeaee0124c7f03c93298c358e77005299eea856f1d /phpBB/phpbb/textformatter/s9e
parent98db63e8ccf7effd4213f3ef2b1152c5f6ef6295 (diff)
downloadforums-f5ce9f273829ba470a1348b4314cddb58f552da0.tar
forums-f5ce9f273829ba470a1348b4314cddb58f552da0.tar.gz
forums-f5ce9f273829ba470a1348b4314cddb58f552da0.tar.bz2
forums-f5ce9f273829ba470a1348b4314cddb58f552da0.tar.xz
forums-f5ce9f273829ba470a1348b4314cddb58f552da0.zip
[ticket/13680] Updated quote notifications
Added get_quote_authors() to text_formatter.utils service to retrieve the names used in first-level quotes PHPBB3-13680
Diffstat (limited to 'phpBB/phpbb/textformatter/s9e')
-rw-r--r--phpBB/phpbb/textformatter/s9e/utils.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php
index 2018bbf519..576ab9481c 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 first level of quotes
+ *
+ * @param string $xml Parsed text
+ * @return string[] List of authors
+ */
+ public function get_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