Adding nofollow support
git-svn-id: http://svn.automattic.com/wordpress/trunk@2117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f6d6435f63
commit
25897c2b91
|
@ -158,7 +158,7 @@ function get_comment_author_link() {
|
|||
if ( empty( $url ) )
|
||||
$return = $author;
|
||||
else
|
||||
$return = "<a href='$url' rel='external'>$author</a>";
|
||||
$return = "<a href='$url' rel='external nofollow'>$author</a>";
|
||||
return apply_filters('get_comment_author_link', $return);
|
||||
}
|
||||
|
||||
|
|
|
@ -479,13 +479,18 @@ function antispambot($emailaddy, $mailto=0) {
|
|||
|
||||
function make_clickable($ret) {
|
||||
$ret = ' ' . $ret . ' ';
|
||||
$ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1<a href='$2://$3'>$2://$3</a>", $ret);
|
||||
$ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1<a href='http://www.$2.$3$4'>www.$2.$3$4</a>", $ret);
|
||||
$ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1<a href='$2://$3' rel='nofollow'>$2://$3</a>", $ret);
|
||||
$ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1<a href='http://www.$2.$3$4' rel='nofollow'>www.$2.$3$4</a>", $ret);
|
||||
$ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $ret);
|
||||
$ret = trim($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function wp_rel_nofollow( $text ) {
|
||||
$text = preg_replace('|<a(.+?)>|i', '<a$1 rel="nofollow">', $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function convert_smilies($text) {
|
||||
global $wp_smiliessearch, $wp_smiliesreplace;
|
||||
$output = '';
|
||||
|
@ -632,4 +637,4 @@ function human_time_diff( $from, $to = '' ) {
|
|||
return $since;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -140,6 +140,7 @@ add_filter('pre_comment_author_url', 'trim');
|
|||
add_filter('pre_comment_author_url', 'clean_url');
|
||||
|
||||
add_filter('pre_comment_content', 'wp_filter_kses');
|
||||
add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
|
||||
add_filter('pre_comment_content', 'balanceTags', 30);
|
||||
|
||||
// Default filters for these functions
|
||||
|
|
Loading…
Reference in New Issue