From 25897c2b91119a607fa85dbe2b18e26e6548a2ef Mon Sep 17 00:00:00 2001 From: saxmatt Date: Fri, 21 Jan 2005 18:24:14 +0000 Subject: [PATCH] Adding nofollow support git-svn-id: http://svn.automattic.com/wordpress/trunk@2117 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 2 +- wp-includes/functions-formatting.php | 11 ++++++++--- wp-includes/vars.php | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 51d2865397..400ea9f6bf 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -158,7 +158,7 @@ function get_comment_author_link() { if ( empty( $url ) ) $return = $author; else - $return = "$author"; + $return = "$author"; return apply_filters('get_comment_author_link', $return); } diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index d75f5bfd93..806525242b 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -479,13 +479,18 @@ function antispambot($emailaddy, $mailto=0) { function make_clickable($ret) { $ret = ' ' . $ret . ' '; - $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1$2://$3", $ret); - $ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1www.$2.$3$4", $ret); + $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1$2://$3", $ret); + $ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1www.$2.$3$4", $ret); $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1$2@$3", $ret); $ret = trim($ret); return $ret; } +function wp_rel_nofollow( $text ) { + $text = preg_replace('||i', '', $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; } -?> +?> \ No newline at end of file diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 068dafcf88..1efd7bf90d 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -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