Html replacement in post textWith this snippet you can use html as a kind of word censor in posts
Requested by:
Mike3396Request topic:
http://www.phpbb.com/community/viewtopi ... &t=2157114Instructionopen
includes/functions_content.php
find
Code:
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars)));
after add
[Fix**]
Code:
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/functions_word_censors.' . $phpEx);
load up a file named
functions_word_censors.php
(utf8 without a bom) with following (test)-content to
includes/functions_word_censors.php
Code:
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
$text = @preg_replace('#\bBanana\b#', '<span style="color:red; font-weight: bold;">Banana</span>', $text);
$text = @preg_replace('#\bBanan\b#', '<a href="http://www.google.de">Banan</url>', $text);
$text = @preg_replace('#\Bthinsp\B#', ' ', $text);
?>
Result for "Banana":
NoteEdit Banana
to any word with any html as replacement like
<span style="color:red; font-weight: bold;">Banana</span>
.
Leave all other syntax in place. Make as many "new lines" you want.
\b
is for search > solo words >
test
(boundarys)
\B
is for search > words in words like
testthinsptest
(not bounded)