FV.Zone Project Code    Posts    Comments

简单的处理留言HTML代码

2008.08.02 星期六

这是一个简单的留言处理,功能是将HTML代码转换为实体,目前应该没有实际的用途,只是记录一下,希望以后用的着的!

<?php
/*
Plugin Name: HtmlCode
Plugin URI:
Description:
Version:
Author:
Author URI:
Contributor:
*/

function HtmlCode($comment) {
		$comment = nl2br(htmlspecialchars($comment));
		$comment = str_replace('&lt;p&gt;', '<p>', $comment);
		$comment = str_replace('&lt;/p&gt;', '</p>', $comment);
		$comment = str_replace('&lt;br /&gt;', '<br />', $comment);
		echo $comment;
}

add_filter('comment_text', 'HtmlCode', 999);
add_filter('comment_excerpt', 'HtmlCode', -999);

?>

2 Responses to “简单的处理留言HTML代码”

  1. seo services »

    感觉多有用,先收藏了。

  2. The rose love »

    Write quite good.Give you to encourage, next time again come to your crest once(*__*)

Leave a Reply

作品展示»