转移爱吧的数据到了新空间,弄了一下wordpress评论功能

时间: 2010-02-26 / 分类: wordpress / 浏览次数: 4,893 views / 0个评论 发表评论

发现很多机器人发的评论

懒得在后台一个一个的审核了

直接把发表评论的功能修改了一下~

在后台把那个反垃圾评论的的插件关掉

然后修改wp-comments-post.php里面~

先把$comment_author_url?? = null;这样评论的人就没法加连接在头像名称那里了

然后正则替换评论内容

//给我替换,嘿嘿
$comment_content=preg_replace(“|\[url(.*)\[/url\]|”,””,$comment_content) ;
$comment_content=preg_replace(“|\[img\](.*)\[/img\]|”,””,$comment_content) ;
$comment_content=preg_replace(“|\[([^\]]*)\]|”,””,$comment_content) ;
$comment_content=preg_replace(“|<([^>]*)>|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)html|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)php|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)asp|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)com|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)net|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)org|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)cc|”,””,$comment_content) ;
$comment_content=preg_replace(“|http://(.*)info|”,””,$comment_content) ;

把BB代码和HTML全过滤掉

然后统计内容长度

if(strlen($comment_content)<50){
$comment_content=null;
}

太短的直接设置为空

哈哈哈~~~~~~~~

就发不出评论了

发表评论

您的昵称 *

您的邮箱 *

您的网站