File: filter.php

package info (click to toggle)
moodle 1.4.4.dfsg.1-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 57,876 kB
  • ctags: 29,496
  • sloc: php: 271,617; sql: 5,084; xml: 702; perl: 638; sh: 403; java: 283; makefile: 42; pascal: 21
file content (27 lines) | stat: -rw-r--r-- 783 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php // $id$
//////////////////////////////////////////////////////////////
//  Censorship filtering
// 
//  This very simple example of a Text Filter will parse
//  printed text, replacing words with other words
//
//  To activate this filter, add a line like this to your
//  list of filters in your Filter configuration:
//
//  filter/censor/filter.php
//
//////////////////////////////////////////////////////////////

/// 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);
}


?>