Added html_link_email and fixed html_link for absolute URLs

This commit is contained in:
zone 2001-05-25 02:39:54 +00:00
parent 9e5b2795fd
commit 15206d9d78

View File

@ -275,11 +275,17 @@ function html_link ($href = NULL, $text = NULL, $return = 0, $encode = 1)
### ###
$href = preg_replace ("/%2F/", "/", $href); $href = preg_replace ("/%2F/", "/", $href);
$text = trim ($text); $text = trim ($text);
/*
$rstring = "<a href=$href>$text</a>"; /* Auto-detect and don't disturb absolute links */
*/ if (!preg_match ("|^http(.{0,1})://|", $href))
{
$href = $sep . $href; $href = $sep . $href;
$address = $phpgw->link ($href); $address = $phpgw->link ($href);
}
else
{
$address = $href;
}
$rstring = "<a href=$address>$text</a>"; $rstring = "<a href=$address>$text</a>";
return (eor ($rstring, $return)); return (eor ($rstring, $return));
} }
@ -313,6 +319,15 @@ function html_table_begin ($width = NULL, $border = NULL, $cellspacing = NULL, $
return (eor ($rstring, $return)); return (eor ($rstring, $return));
} }
function html_link_email ($address = NULL, $text = NULL, $return = 0, $encode = 1)
{
if ($encode)
$href = string_encode ($href, 1);
$rstring = "<a href=mailto:$address>$text</a>";
return (eor ($rstring, $return));
}
function html_table_end ($return = 0) function html_table_end ($return = 0)
{ {
$rstring = "</table>"; $rstring = "</table>";