PHP Kod: Kodu kopyalamak için üzerine çift tıklayın!
function formatWebAddress($webAddress) {
$originalWebAddress = $webAddress;
$webAddress = "*" . $webAddress;
$formattedWebAddress = "";
if (stripos($webAddress, "http://") == 1) { //starts with http://
if (substr_count($webAddress, ".") == 1) { //one dot only
$formattedWebAddress = $originalWebAddress;
$formattedWebAddress = insertString($formattedWebAddress, "
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
style="color: #007700">, 7);
}
else
$formattedWebAddress = $originalWebAddress;
}
else { //does not start with http://
if (substr_count($webAddress, ".") == 1) //one dot only
$formattedWebAddress = "
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
style="color: #007700">. $originalWebAddress;
elseif (substr_count($webAddress, ".") >= 2) //two dots only
$formattedWebAddress = "http://" . $originalWebAddress;
else
$formattedWebAddress = $originalWebAddress;
}
// add slash at end
if (substr_count($formattedWebAddress, "/") == 2) //if it has "//" at beginning
$formattedWebAddress .= "/";
$formattedWebAddress = strtolower($formattedWebAddress);
return $formattedWebAddress;
}