mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/14366] Add core events to the function decode_message()
Add core event to the function decode_message() in includes/functions_content.php to allow extensions performing additional message handling before/after decoding. PHPBB3-14366
This commit is contained in:
parent
67f3017274
commit
fb78fc7ae0
1 changed files with 27 additions and 1 deletions
|
@ -392,7 +392,7 @@ function phpbb_clean_search_string($search_string)
|
||||||
*/
|
*/
|
||||||
function decode_message(&$message, $bbcode_uid = '')
|
function decode_message(&$message, $bbcode_uid = '')
|
||||||
{
|
{
|
||||||
global $config;
|
global $config, $phpbb_dispatcher;
|
||||||
|
|
||||||
if ($bbcode_uid)
|
if ($bbcode_uid)
|
||||||
{
|
{
|
||||||
|
@ -405,12 +405,38 @@ function decode_message(&$message, $bbcode_uid = '')
|
||||||
$replace = array("\n");
|
$replace = array("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this event to modify the message before it is decoded
|
||||||
|
*
|
||||||
|
* @event core.decode_message_before
|
||||||
|
* @var string message The message content
|
||||||
|
* @var string bbcode_uid The message BBCode UID
|
||||||
|
* @var string match Match pattern to replace
|
||||||
|
* @var int replace Replacement for the matched text
|
||||||
|
* @since 3.1.8-RC1
|
||||||
|
*/
|
||||||
|
$vars = array('message', 'bbcode_uid', 'match', 'replace');
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.decode_message_before', compact($vars)));
|
||||||
|
|
||||||
$message = str_replace($match, $replace, $message);
|
$message = str_replace($match, $replace, $message);
|
||||||
|
|
||||||
$match = get_preg_expression('bbcode_htm');
|
$match = get_preg_expression('bbcode_htm');
|
||||||
$replace = array('\1', '\1', '\2', '\1', '', '');
|
$replace = array('\1', '\1', '\2', '\1', '', '');
|
||||||
|
|
||||||
$message = preg_replace($match, $replace, $message);
|
$message = preg_replace($match, $replace, $message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this event to modify the message after it is decoded
|
||||||
|
*
|
||||||
|
* @event core.decode_message_after
|
||||||
|
* @var string message The message content
|
||||||
|
* @var string bbcode_uid The message BBCode UID
|
||||||
|
* @var string match Match pattern to replace
|
||||||
|
* @var int replace Replacement for the matched text
|
||||||
|
* @since 3.1.8-RC1
|
||||||
|
*/
|
||||||
|
$vars = array('message', 'bbcode_uid', 'match', 'replace');
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.decode_message_after', compact($vars)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue