Below is code for a filter to apply rel="nofollow" to all links (eg for node bodies and user added blocks).
/*
* Provide a filter to apply rel="nofollow" to all links.
*/
function nofollow_filter($op, $delta = 0, $format = -1, $text = '') {
if ($op == 'list') {
return array(
0 => t('Nofollow'));
}
switch ($op) {
case 'description':
return t('Applies the rel="nofollow" attribute to all link tags.');
case 'prepare':
return $text;
case 'process':
return str_replace('<a', '<a rel="nofollow"', $text);
case 'settings':
return null;
}
}