Make WordPress Core

Changeset 6106


Ignore:
Timestamp:
09/13/2007 04:51:46 AM (17 years ago)
Author:
ryan
Message:

no follow callback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/wp-includes/formatting.php

    r5931 r6106  
    637637    // This is a pre save filter, so text is already escaped.
    638638    $text = stripslashes($text);
    639     $text = preg_replace('|<a (.+?)>|ie', "'<a ' . str_replace(' rel=\"nofollow\"','',stripslashes('$1')) . ' rel=\"nofollow\">'", $text);
     639    $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
    640640    $text = $wpdb->escape($text);
    641641    return $text;
     642}
     643
     644function wp_rel_nofollow_callback( $matches ) {
     645    $text = $matches[1];
     646    $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
     647    return "<a $text rel=\"nofollow\">";
    642648}
    643649
Note: See TracChangeset for help on using the changeset viewer.