mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 00:25:19 +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:
parent
a02bfcc83a
commit
1e29f064e8
@ -411,12 +411,26 @@ function strip_bbcode(&$text, $uid = '')
|
|||||||
function generate_text_for_display($text, $uid, $bitfield, $flags)
|
function generate_text_for_display($text, $uid, $bitfield, $flags)
|
||||||
{
|
{
|
||||||
static $bbcode;
|
static $bbcode;
|
||||||
|
global $phpbb_dispatcher;
|
||||||
|
|
||||||
if (!$text)
|
if (!$text)
|
||||||
{
|
{
|
||||||
return '';
|
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);
|
$text = censor_text($text);
|
||||||
|
|
||||||
// Parse bbcode if bbcode uid stored and bbcode enabled
|
// 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 = bbcode_nl2br($text);
|
||||||
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
|
$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;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user