/** * check "bad" words by TextRegex extension */ public static function checkBadWords($sText, $where, $split = false) { wfProfileIn(__METHOD__); if (!wfRunHooks('AutoCreateWiki::checkBadWords', array($sText, $where, $split))) { return false; } // TODO: temporary check for Phalanx (don't perform additional filtering when enabled) global $wgEnablePhalanxExt; if (!empty($wgEnablePhalanxExt)) { return true; } $allowed = true; $oRegexCore = new TextRegexCore("creation", 0); if ($oRegexCore instanceof TextRegexCore) { $newText = preg_replace("/[^a-z0-9]/i", "", $sText); #-- if ($split == true) { $aWordsInText = preg_split("/[\\s,]+/", $newText); } else { $aWordsInText = array($newText); } $allowed = $oRegexCore->isAllowedText($aWordsInText, wfMsg('autocreatewiki-regex-error-comment', $where, $sText)); } #--- wfProfileOut(__METHOD__); return $allowed; }