From 3e6525ba88656b2db96617f565861e3d9bfc6fb9 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 16 Oct 2003 09:33:27 +0000 Subject: [PATCH] A very simple filter to censor "bad" words. Also provides an example of how to write filters. --- filter/censor/censor.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 filter/censor/censor.php diff --git a/filter/censor/censor.php b/filter/censor/censor.php new file mode 100644 index 0000000000..0b79ef7c97 --- /dev/null +++ b/filter/censor/censor.php @@ -0,0 +1,37 @@ +textfilter1 = 'filter/censor/censor.php'; +// +////////////////////////////////////////////////////////////// + +/// These lines are important - the variable must match the name +/// of the actual function below + + $textfilter_function = 'censor_filter'; + + if (function_exists($textfilter_function)) { + return; + } + + +/// This is the filtering function itself. It accepts the +/// courseid and the text to be filtered (in HTML form). + +function censor_filter($courseid, $text) { + + static $search = array('fuck', 'cunt', 'shit', 'wank', 'cock'); + static $replace = array('f***', 'c***', 's***', 'w***', 'c***'); + + return str_ireplace($search, $replace, $text); +} + + +?> -- 2.39.5