Make WordPress Core


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

no follow callback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r6102 r6105  
    648648    // This is a pre save filter, so text is already escaped.
    649649    $text = stripslashes($text);
    650     $text = preg_replace('|<a (.+?)>|ie', "'<a ' . str_replace(' rel=\"nofollow\"','',stripslashes('$1')) . ' rel=\"nofollow\">'", $text);
     650    $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
    651651    $text = $wpdb->escape($text);
    652652    return $text;
     653}
     654
     655function wp_rel_nofollow_callback( $matches ) {
     656    $text = $matches[1];
     657    $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
     658    return "<a $text rel=\"nofollow\">";
    653659}
    654660
Note: See TracChangeset for help on using the changeset viewer.