url-pharser
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?
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;
}
?>
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;
}
?>