Forums / Cotonti / Extensions / [Plugin] Wordcensor

Dave
#33475 2012-03-08 13:21

Hi, so as urlkiller asked me to post that in forums, here it is:

setup:

<?PHP
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=wordcensor
Name=Word Censor
Description=neocrome.net
Version=0.9
Date=12-09-2007
Author=urlkiller
Copyright=
Notes=This plugin was coded in 12-09-2007, 23.02.2012 i took it together so people could use it.
SQL=
Auth_guests=RW
Lock_guests=RW
Auth_members=RW
Lock_members=RW
[END_SED_EXTPLUGIN]
==================== */

if ( !defined('SED_CODE') ) { die("Wrong URL."); }

?>

wordcensor.forum.php

<?PHP
/* ====================
[BEGIN_SED]
File=plugins/wordcensor/wordcensor.forum.php
Version=
Updated=
Type=Plugin
Author=urlkiller
Description=
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=wordcensor
Part=forums
File=wordcensor.forum
Hooks=forums.posts.loop
Tags=
Order=10
[END_SED_EXTPLUGIN]
==================== */

// include word list only once ;)
require_once('inc/wordcensor.wordlist.php');

// overwrite the original output from forum posts...
$t->assign(array(
// the posts text itself
"FORUMS_POSTS_ROW_TEXT" => str_replace($wc_censor,$wc_replace,$row['fp_text']),
// the tile of the forums post
"FORUMS_POSTS_PAGETITLE" => str_replace($wc_censor,$wc_replace,$toptitle),
));

wordcensor.page.php:

"PAGE_TEXT" => sed_parse(sed_cc(str_replace($wc_censor,$wc_replace,$pag['page_text']))), $cfg['parsebbcodepages'], $cfg['parsesmiliespages'], 1, 
// comments of a page "PAGE_COMMENTS_DISPLAY" => str_replace($wc_censor,$wc_replace,$comments_display),

// the page title itself "PAGE_TITLE" => str_replace($wc_censor,$wc_replace,$pag['page_fulltitle']),

wordcensor.comments.php:

"COMMENTS_ROW_TEXT" => str_replace($wc_censor,$wc_replace,$com_text),

works good on 0,6,21 except minichat thing however i think it can be replaced by bbcode 'pcre' (preg_replace) i dunno if the part for the bbcode is correct but it works in the minichat

Your advertisement here :-)

Cotonti Genoa based site: forgotten-garage.pl
This post was edited by Dave (2016-02-16 17:25, 8 years ago)