Php filters sensitive words
GetList (); if (count ($ keyword) = 0) {$ keyword = self: getBadWords ($ filename);} return strtr ($ content, array_combine ($ keyword, array_fill (0, count ($ keyword), $ target) ;}}/*** sensitive word cache processing Class * Class BadWordsMemcache * User: lsl */class BadWordsMemcache {var $ memcache; var $ key; var $ list; var $ filename; function _ construct ($ filename, $ memconfig) {$ this-> filename = $ filename; if (! Class_exists ("P_Memcache") {require_once DIR. "lib/memcache. class. php ";}$ this-> key =" bad_words "; $ this-> memcache = new P_Memcache (); $ this-> memcache-> config = $ memconfig; $ this-> memcache-> connect (); print_r ($ this-> memcache); $ this-> init ();} function _ destruct () {$ this-> memcache-> close ();}/*** initialize * @ param bool $ isReset */function init ($ isReset = false) {$ this-> list = $ this-> memcache-> get ($ This-> key )? $ This-> memcache-> get ($ this-> key): array (); if (count ($ this-> list) = 0 | $ isReset) {$ this-> list = filterTools: getBadWords ($ this-> filename); $ this-> memcache-> set ($ this-> key, $ this-> list); $ log_data = Log: formatData ($ this-> list); Log: logWrite ($ log_data, 'Bad. words ', 'init') ;}/ *** obtain the list * @ return mixed */function getList () {return $ this-> list ;}}