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');
?>