diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 4e4abf6564..df24d9a080 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -52,6 +52,12 @@ services: text_formatter.s9e.link_helper: class: phpbb\textformatter\s9e\link_helper + text_formatter.s9e.mention_helper: + class: phpbb\textformatter\s9e\mention_helper + arguments: + - '%core.root_path%' + - '%core.php_ext%' + text_formatter.s9e.parser: class: phpbb\textformatter\s9e\parser arguments: @@ -76,6 +82,7 @@ services: - '@text_formatter.s9e.factory' - '@dispatcher' calls: + - [configure_mention_helper, ['@text_formatter.s9e.mention_helper']] - [configure_quote_helper, ['@text_formatter.s9e.quote_helper']] - [configure_smilies_path, ['@config', '@path_helper']] - [configure_user, ['@user', '@config', '@auth']] diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index be6916442b..1a7d52a38b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -183,6 +183,7 @@ define('BBCODE_ID_LIST', 9); define('BBCODE_ID_EMAIL', 10); define('BBCODE_ID_FLASH', 11); define('BBCODE_ID_ATTACH', 12); +define('BBCODE_ID_MENTION', 13); // BBCode hard limit define('BBCODE_LIMIT', 1511); diff --git a/phpBB/phpbb/textformatter/data_access.php b/phpBB/phpbb/textformatter/data_access.php index 27ce778904..bbb6ba0f0d 100644 --- a/phpBB/phpbb/textformatter/data_access.php +++ b/phpBB/phpbb/textformatter/data_access.php @@ -138,6 +138,7 @@ class data_access 'email' => 10, 'flash' => 11, 'attachment' => 12, + 'mention' => 13, ); $styles = array(); diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 721549cf72..6497f5fd47 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -84,6 +84,12 @@ class factory implements \phpbb\textformatter\cache_interface 'img' => '[IMG src={IMAGEURL;useContent}]', 'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext} #createChild=LI]{TEXT}[/LIST]', 'li' => '[* $tagName=LI]{TEXT}[/*]', + 'mention' => + "[MENTION + group_id={UINT;optional} + profile_url={URL;optional;postFilter=#false} + user_id={UINT;optional} + ]{TEXT}[/MENTION]", 'quote' => "[QUOTE author={TEXT1;optional} diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php index 6fcd2b0a98..cc909ea90c 100644 --- a/phpBB/phpbb/textformatter/s9e/renderer.php +++ b/phpBB/phpbb/textformatter/s9e/renderer.php @@ -28,6 +28,11 @@ class renderer implements \phpbb\textformatter\renderer_interface */ protected $dispatcher; + /** + * @var mention_helper + */ + protected $mention_helper; + /** * @var quote_helper */ @@ -117,6 +122,16 @@ class renderer implements \phpbb\textformatter\renderer_interface extract($dispatcher->trigger_event('core.text_formatter_s9e_renderer_setup', compact($vars))); } + /** + * Configure the mention_helper object used to display extended information in mentions + * + * @param mention_helper $mention_helper + */ + public function configure_mention_helper(mention_helper $mention_helper) + { + $this->mention_helper = $mention_helper; + } + /** * Configure the quote_helper object used to display extended information in quotes * @@ -229,6 +244,11 @@ class renderer implements \phpbb\textformatter\renderer_interface */ public function render($xml) { + if (isset($this->mention_helper)) + { + $xml = $this->mention_helper->inject_metadata($xml); + } + if (isset($this->quote_helper)) { $xml = $this->quote_helper->inject_metadata($xml); diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index 2780d869d2..71e8d2b0d2 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -8,6 +8,22 @@
{USERNAME} {L_WROTE}{L_COLON}