Hello I have a very simple code
Website
You can use this function as a general if nothing from the array is found in the string append something to it.
function httpify($link, $append = 'http://', $allowed = array('http://', 'https://')){
$found = false;
foreach($allowed as $protocol)
if(strpos($link, $protocol) !== 0)
$found = true;
if($found)
return $link;
return $append.$link;
}