1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/13713] Add mention BBCode

PHPBB3-13713
This commit is contained in:
lavigor
2018-05-30 21:58:28 +03:00
committed by Marc Alexander
parent 41b1b32e29
commit 6c42563b4d
6 changed files with 51 additions and 0 deletions

View File

@@ -138,6 +138,7 @@ class data_access
'email' => 10,
'flash' => 11,
'attachment' => 12,
'mention' => 13,
);
$styles = array();

View File

@@ -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}

View File

@@ -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);