<?php
	function WordFilter($Str)
	{
		$Str = strtolower($Str);
		$WordListDir = "OffensiveWords.txt"; //Location To Words List
		$File = file_get_contents($WordListDir);
		$Words = preg_split("#\r?\n#", $File, -1, PREG_SPLIT_NO_EMPTY);
		$tmp = preg_split('/\s+/', $Str);
		
		$Words = array_filter($Words);
		$pattern = "#\b(". implode('|',$Words).")\b#";
		
		foreach($tmp as $value) {
			if (preg_match($pattern, $value)) {
				return FALSE;
			}
		}
		return TRUE;
	}
?>