diff options
author | JoshyPHP <s9e.dev@gmail.com> | 2015-05-03 16:06:42 +0200 |
---|---|---|
committer | JoshyPHP <s9e.dev@gmail.com> | 2015-05-15 02:10:46 +0200 |
commit | f5ce9f273829ba470a1348b4314cddb58f552da0 (patch) | |
tree | aee0124c7f03c93298c358e77005299eea856f1d /phpBB/phpbb/notification | |
parent | 98db63e8ccf7effd4213f3ef2b1152c5f6ef6295 (diff) | |
download | forums-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/notification')
-rw-r--r-- | phpBB/phpbb/notification/type/quote.php | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 141f90c7ae..1b8efe4c8e 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -21,6 +21,11 @@ namespace phpbb\notification\type; class quote extends \phpbb\notification\type\post { /** + * @var \phpbb\textformatter\utils_interface + */ + protected $utils; + + /** * Get notification type name * * @return string @@ -31,13 +36,6 @@ class quote extends \phpbb\notification\type\post } /** - * regular expression to match to find usernames - * - * @var string - */ - protected static $regular_expression_match = '#\[quote="(.+?)"#'; - - /** * Language key used to output the text * * @var string @@ -77,17 +75,16 @@ class quote extends \phpbb\notification\type\post 'ignore_users' => array(), ), $options); - $usernames = false; - preg_match_all(self::$regular_expression_match, $post['post_text'], $usernames); + $usernames = $this->utils->get_quote_authors($post['post_text']); - if (empty($usernames[1])) + if (empty($usernames)) { return array(); } - $usernames[1] = array_unique($usernames[1]); + $usernames = array_unique($usernames); - $usernames = array_map('utf8_clean_string', $usernames[1]); + $usernames = array_map('utf8_clean_string', $usernames); $users = array(); @@ -187,4 +184,14 @@ class quote extends \phpbb\notification\type\post 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), )); } + + /** + * Set the utils service used to retrieve quote authors + * + * @param \phpbb\textformatter\utils_interface $utils + */ + public function set_utils(\phpbb\textformatter\utils_interface $utils) + { + $this->utils = $utils; + } } |