View Single Post
Old 03-21-2010, 09:26 PM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,507
So I was bored.

Code:
<?php
/*
Plugin Name: External Nofollow Links
Plugin URI: http://www.gfy.com
Description: Filter all external links to use nofollow
Version: 1.0
Author: fris
Author URI: http://www.gfy.com
*/

function change_links($text) {
    $host = str_replace('.','\.',getenv("HTTP_HOST"));
    return preg_replace('/href=["|\']?(http:\/\/(?!'.$host.')([^"\']*))["|\']?/ui','href="$1" rel="nofollow"',$text);
}

add_filter('the_content','change_links');

?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


My Cam Feeds Script / Free Templates / Gallery Scraper
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote