<?php
# Eksperten Tagster
# Lars B. Jensen, LJWeb GmbH
# ljweb@ljweb.com
function string_tagster($str) {
$str = " ".$str." ";
$str = eregi_replace("([[:space:]{()\"'\[~#=;\&?\_])((ftp|http|https|telnet|news|nttp|nntp|file):\/\/[a-z0-9~#%@æøå\&\(\):;=\?\/\.,_-]+(\\[|\\]|[a-z0-9~#%@æøå\*\&:;.,=\?!'\|\/_\+-])+)", "\\1<A HREF=\"\\2\" TARGET=\"_blank\">\\2</A>", $str);
$str = eregi_replace("([[:space:]{()\"'\[~#;\&?\_])(www\.[a-z0-9~#%@æøå\&\(\):;=\?!'\/\.,_-]+(\\[|\\]|[a-z0-9~#%@æøå\*\&:;.,=\?!'\|\/_\+-])+)", "\\1<A HREF=\"
http://\\2\" TARGET=\"_blank\">\\2</A>", $str);
$str = eregi_replace("([[:space:]{()\"'\[~#=;\&?\_])(ftp\.[a-z0-9~#%@æøå\&\(\):;=\?!'\/\.,_-]+(\\[|\\]|[a-z0-9~#%@æøå\&:;.,=\?!'\|\/_\+-])+)", "\\1<A HREF=\"
ftp://\\2\" TARGET=\"_blank\">\\2</A>", $str);
$str = eregi_replace("(mail:|[[:space:]{()\"'\[~#;\&?])([_\.0-9a-z-]+@([_\.0-9a-z-]+)+\.[a-z]{2,4})","\\1<A HREF=\"mailto:\\2\">\\2</A>", $str);
return substr($str, 1);
}
function format_post2 ($str) {
$str = htmlentities($str);
$str = str_replace(""", "\"", $str);
$str = string_tagster($str);
$str = ereg_replace("'</A>", "</A>'", $str);
$str = ereg_replace("'\" TARGET=\"_blank\">", "\" TARGET=\"_blank\">'", $str);
$str = ereg_replace(" ", " ", $str);
$str = str_replace("\\t", " ", $str);
$str = str_replace("\\r", "", $str);
$str = str_replace("\\n", "<BR>", $str);
# Return the result
return $str;
}
?>
http://www.eksperten.dk/spm/112601