Scripts
URL pharser
Omdat ik me dood erger aan links die niet automatische worden omgezet naar domein heb ik deze functie "gemaakt" Functie opvragen doe je met onpost("texthier");
url-pharser
<?
function onpost($content){
$content = preg_replace( "`(http)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"#\" onclick=\"window.open('http://\\0','','')\" onmouseover=\"window.status='\\0';return true\" onmouseout=\"window.status='';return true\">\\0</a>", $content);
return $content;
}
?>
of als je van de simpelere versie houd:
function onpost($content){
$content = preg_replace( "`(http)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?`i", ""<a href=\"\\0" target=\"_blank\">\\0</a>", $content);
return $content;
}
?>
Reacties
0