This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The banned words helper lets you exclude content based on a list of keywords.  Please note that it does not check substrings or plural values unless you edit the banned words.txt as outlined below.

Loading The Helper

You can load the concrete5 validation helper using the following simple code

$banned = Loader::helper('validation/banned_words');

The $val variable now contains an instance of the banned words helper/validator.

Methods

$val->hasBannedWords($string) 

Checks the $string to see if it contains any banned words. Returns true if it does, false if not.

if($val->hasBannedWords($insult)){ //ban them; }else{ //hug them; }

$val->isBannedWord($word) 

Checks the $word to see if it is a banned word. Returns true if it does, false if not.

if($val->isBannedWord($badWord)){ //ban them; }else{ //hug them; }

Editing Banned Words List

The banned word list is located in concrete/config/banned_words.txt. If you wish to change the list, you can duplicate the list in your local config/ directory, and edit it there.

Loading Conversation