<?php
function antispam_help($text)
{
$dom = array('www\.','wap\.'); //поддомены
if(preg_match('#^(https?|ftp)://('.implode('|',$dom).')?'.str_replace('.', '\.', $_SERVER['SERVER_NAME']).'#', $text[0]))
return '<a href="'.$text[0].'">'.$text[0].'</a>';
else
return '[реклама]';
}
function antispam($text)
{
return preg_replace_callback("#(https?|ftp)://\S+[^\s.,>)\];'\"!?]#", 'antispam_help', $text);
}
?>
»Скачать в формате .ТХТ»Скачать в формате .ZIP