function content_nofollow($log_content, $domain){
preg_match_all('/href="(.*?)"/', $log_content, $matches);
if ($matches) {
foreach ($matches[1] as $val) {
if (strpos($val, $domain) === false) {
$log_content = str_replace('href="'.$val.'"', 'href="'.$val.'" rel="external nofollow" ', $log_content);
}
}
}
preg_match_all('/src="(.*?)"/', $log_content, $matches);
if ($matches) {
foreach ($matches[1] as $val) {
if (strpos($val, $domain) === false) {
$log_content = str_replace('src="'.$val.'"', 'src="'.$val.'" rel="external nofollow" ', $log_content);
}
}
}
return $log_content;
}