What is the proper order to do the following:
I have data in a mysql database that is simply text. Some things i use nl2br and other things i use a homemade function to do the email links and hyperlinks
this makelinks function seems to be buggy sometimes when mixed with the html_entities function and so on. Is there anyway to simplify how to process input that lays in the database when displayed on the website?PHP Code:function makelinks($data,$br=1) {
// Replace tekstlink with HyperLink
$data = ereg_replace('www+(\.[[:alnum:]~_-]+)+([/\.][[:alnum:]?&=~_-]+)*/*', '<A HREF="http://\\0" TARGET="_blank">\\0</A>', $data);
// Replace mailtext with HyperLink
$data = ereg_replace('[A-Za-z0-9]([A-Za-z0-9._]*[A-Za-z0-9]|())@[A-Za-z0-9]([A-Za-z0-9.\-]*[A-Za-z0-9]|())\.[A-Za-z]+', '<A HREF="mailto:\\0">\\0</A>', $data);
// Insert Break tags before newlines
if ($br == 1) {
$data = nl2br($data);
}
return $data;
}






Bookmarks