1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

[feature/add_events] Added events for modifying generate_text_for_display()

The events allow you to perform extra functions on the text before nad/or
after it has been parsed for BBCode and Smilies.

PHPBB3-9550
This commit is contained in:
David King 2012-08-21 12:51:41 -04:00
parent a02bfcc83a
commit 1e29f064e8

View File

@ -411,12 +411,26 @@ function strip_bbcode(&$text, $uid = '')
function generate_text_for_display($text, $uid, $bitfield, $flags)
{
static $bbcode;
global $phpbb_dispatcher;
if (!$text)
{
return '';
}
/**
* Use this event to modify the text before it is parsed
*
* @event core.modify_text_for_display_before
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @since 3.1-A1
*/
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars)));
$text = censor_text($text);
// Parse bbcode if bbcode uid stored and bbcode enabled
@ -443,6 +457,19 @@ function generate_text_for_display($text, $uid, $bitfield, $flags)
$text = bbcode_nl2br($text);
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
/**
* Use this event to modify the text after it is parsed
*
* @event core.modify_text_for_display_after
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @since 3.1-A1
*/
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars)));
return $text;
}