make_http function

This commit is contained in:
Shish
2009-07-24 08:08:29 +01:00
parent 52ba270e78
commit ecef1edb14
3 changed files with 15 additions and 4 deletions

View File

@ -127,6 +127,19 @@ function make_link($page=null, $query=null) {
}
}
/**
* Turn a relative link into an absolute one, including hostname
*
* @retval string
*/
function make_http($link) {
if(strpos($link, "ttp://") > 0) return $link;
if($link[0] != '/') $link = get_base_href().'/'.$link;
$link = "http://".$_SERVER["HTTP_HOST"].$link;
$link = str_replace("/./", "/", $link);
return $link;
}
/**
* Make a link to a static file in the current theme's
* directory