* Filter external links
* @param array $local_domain Domain name array of this site
* @param string $message Text content
*/
function replace_outer_links($local_domain_arr, $message) {
$pattern= '/<[^>]*href=['"]http[s]?://(?!' ;
$i = 0 ;
foreach ($local_domain_arr as $local_domain){
if($i==0){
$pattern .= 'www.' .$local_domain.'|'.$local_domain.'|[w_]+.'.$local_domain ;
}else{
$pattern .= '|www.' .$local_domain.'|'.$local_domain.'|[w_]+.'.$local_domain ;
}
$i++ ;
}
$pattern .=')[^'^"]*['"][^>]*>(.+?)/is';
return preg_replace($pattern,'$1',$message);
}