Hallo zusammen
vor kurzer Zeit gab es eine Diskussion zu diesem Thema.
Ich habe eine Funktion gefunden (ist von einem Kollegen). Jetzt Frage ich mich, ob diese genügend gut ist, um eingesetzt zu werden.
Was ist eure Meinung?
Gruss Michael
function insert_href($text)
{
//http:
$text=eregi_replace("(^|[[:space:][:blank:][:cntrl:]>])http://([.A-z0-9?_=&/%-]{1,100}[A-z0-9/])([[:space:][:blank:][:cntrl:]<.,;:?-]|$)","\1<a href="http://\2">\2</a>\3" ,$text);
$text=eregi_replace("(^|[[:space:][:blank:][:cntrl:]>])(www.[.A-z0-9?_=&/%-]{1,100}[A-z0-9/])([[:space:][:blank:][:cntrl:]<.,;:?-]|$)","\1<a href="http://\2">\2</a>\3" ,$text);
//ftp
$text=eregi_replace("(^|[[:space:][:blank:][:cntrl:]>])ftp://([.A-z0-9?_=&/@-]{1,100}[A-z0-9/])([[:space:][:blank:][:cntrl:]<.,;:?-]|$)","\1<a href="ftp://\2">\2</a>\3" ,$text);
$text=eregi_replace("(^|[[:space:][:blank:][:cntrl:]>])(ftp.[.A-z0-9?_=&/@-]{1,100}[A-z0-9/])([[:space:][:blank:][:cntrl:]<.,;:?-]|$)","\1<a href="ftp://\2">\2</a>\3" ,$text);
//email
$text=eregi_replace("(^|[[:space:][:blank:][:cntrl:]>])([A-z0-9_.-]{1,100}@[.A-z0-9_-]{1,50}[A-z])([[:space:][:blank:][:cntrl:]<.,;:?-]|$)","\1<a href="mailto:\2">\2</a>\3" ,$text);
return $text;
}