diff options
author | David King <imkingdavid@gmail.com> | 2012-08-21 12:51:41 -0400 |
---|---|---|
committer | David King <imkingdavid@gmail.com> | 2012-08-21 12:55:16 -0400 |
commit | 1e29f064e87dcab1a3bb65c63d254bde03d6422d (patch) | |
tree | e46aa85b89265fdc03076ff197fed0de03744413 /phpBB/includes/functions_content.php | |
parent | a02bfcc83a3c9a107bc2b840d07409a93628bbdc (diff) | |
download | forums-1e29f064e87dcab1a3bb65c63d254bde03d6422d.tar forums-1e29f064e87dcab1a3bb65c63d254bde03d6422d.tar.gz forums-1e29f064e87dcab1a3bb65c63d254bde03d6422d.tar.bz2 forums-1e29f064e87dcab1a3bb65c63d254bde03d6422d.tar.xz forums-1e29f064e87dcab1a3bb65c63d254bde03d6422d.zip |
[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
Diffstat (limited to 'phpBB/includes/functions_content.php')
-rw-r--r-- | phpBB/includes/functions_content.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8b7565d8f1..6bad2111ef 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -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; } |