no follow callback

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-09-13 04:51:46 +00:00
parent 7cdda656cc
commit 40262adc37
1 changed files with 7 additions and 1 deletions

View File

@ -636,11 +636,17 @@ function wp_rel_nofollow( $text ) {
global $wpdb; global $wpdb;
// This is a pre save filter, so text is already escaped. // This is a pre save filter, so text is already escaped.
$text = stripslashes($text); $text = stripslashes($text);
$text = preg_replace('|<a (.+?)>|ie', "'<a ' . str_replace(' rel=\"nofollow\"','',stripslashes('$1')) . ' rel=\"nofollow\">'", $text); $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
$text = $wpdb->escape($text); $text = $wpdb->escape($text);
return $text; return $text;
} }
function wp_rel_nofollow_callback( $matches ) {
$text = $matches[1];
$text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
return "<a $text rel=\"nofollow\">";
}
function convert_smilies($text) { function convert_smilies($text) {
global $wp_smiliessearch, $wp_smiliesreplace; global $wp_smiliessearch, $wp_smiliesreplace;
$output = ''; $output = '';