[Snippet] Html replacement in word censor

Little Mods and Snips 2

[Snippet] Html replacement in word censor

Postby Sekuro » 05 Jun 2012, 14:21

Html replacement in word censor

With this snippet you can use html for word censor in posts

Requested by: Mike3396
Request topic: http://www.phpbb.com/community/viewtopi ... &t=2157114

ACP > Word Censor

banana_acp_word_censor.png

Result

banana_result.png
banana_result.png (176.48 KiB) Viewed 1625 times

http://4seven.bplaced.net/forum/7test/v ... hp?f=2&t=3

Instruction

open

includes/functions_content.php

find

Code: Select all
    if (sizeof($censors))
    {
        return preg_replace($censors['match'], $censors['replace'], $text);
    }


replace with

Code: Select all
        // Html replacement in word censor / 4seven / 2012
        if (sizeof($censors))
        {

        $script_name = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME);    
        
        if
($script_name == 'viewtopic')
        {
        return preg_replace($censors['match'], str_replace(array('&lt;','&quot;','&gt;'), array('<','"','>'), $censors['replace']), $text);
        }
        else
        
{
        $censors['replace'] = preg_replace('#&lt;(.*?)&gt;#is', '', $censors['replace']);
        return preg_replace($censors['match'], $censors['replace'], $text);
        }

        }
        // Html replacement in word censor / 4seven / 2012          
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900


Return to Snip Cl@ss II

Who is online

Users browsing this forum: No registered users and 1 guest

cron