From fa36ccb01dc89881c82d4d39a71c3d93ae65d371 Mon Sep 17 00:00:00 2001
From: Matthew Juhl <mjuhl24@gmail.com>
Date: Fri, 4 Sep 2009 17:41:35 +0000
Subject: [PATCH] Watch for bad language on homepage and filter it out.

---
 unl_theme/scripts/badwordfilter.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 unl_theme/scripts/badwordfilter.php

diff --git a/unl_theme/scripts/badwordfilter.php b/unl_theme/scripts/badwordfilter.php
new file mode 100644
index 00000000..87f72272
--- /dev/null
+++ b/unl_theme/scripts/badwordfilter.php
@@ -0,0 +1,15 @@
+<?php
+/* here is a nice little function we can use to check for dirty words. It's very intolerant and may filter content that
+   doesn't need to be filtered, but it's for use on the home page where we don't want to chance anything.
+   from: http://blog.otaku-anime.com/2008/04/29/filtro-de-palabras-en-php/ 
+	*/
+
+function filtrado($texto, $reemplazo = false) {
+    $filtradas = 'fu?ck,shit,\Wass,damn,piss,cunt,cocksuc?ker,tits,^ass,fag,bitch,bastard,boner,dick,ass*hole,douche,nigger,nig+a,penis,pussy,pric?k,queer,skank,slut';
+    $f = explode(',', $filtradas);
+    $f = array_map('trim', $f);
+    $filtro = implode('|', $f);
+    
+    return ($reemplazo) ? preg_replace("#$filtro#i", $reemplazo, $texto) : preg_match("#$filtro#i", $texto) ;
+}
+?>
\ No newline at end of file
-- 
GitLab