Skip to content

Instantly share code, notes, and snippets.

@khoin
Created May 24, 2014 13:47
Show Gist options
  • Save khoin/2fe5d16eca96d901c051 to your computer and use it in GitHub Desktop.
Save khoin/2fe5d16eca96d901c051 to your computer and use it in GitHub Desktop.
Filter for Madlibs (backend)
//Profanity Filtering
$profanities = array(
'cum','cumming','shit','fuck','ass','bitch','cunt','slut','sh!t','sh1t','fuk','b1tch','b!tch','fucking','fuking','fuckin','fukin','shitty','shitass','asshole','whore','rape','raped'
);
$schunks = array("");
function expand($item) {
global $schunks;
foreach(explode(" ",$item) as $i) {
array_push($schunks,$i);
}
}
array_walk($chunks,'expand');
if( count( array_intersect($profanities,$schunks) ) > 0) {
$return['status'] = 4;
echo json_encode($return); die();
}
/**
Paste the code above `after` the Limiter section and before the `Madlibs Processing` section.
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment