<?php
function antispam_help($msg)
{
$dom = array('www.','wap.','.ru','.com','.net','.su','.keo.su','.mobi'); //поддомены
if(preg_match('#^(https?|ftp)://('.implode('|',$dom).')?'.str_replace('.', '.', $_SERVER['SERVER_NAME']).'#', $msg[0]))
return '<a href="'.$msg[0].'">'.$msg[0].'</a>';
else
return '[реклама]';
}
function antispam($msg)
{
return preg_replace_callback("#(https?|ftp)://S+[^s.,>)];'"!?]#", 'antispam_help', $msg);
}
?>