Skudd
public text v1 · immutable<?php
function MakeURL($str) {
$words = str_replace("\r\n", " \r\n", $str);
$words = str_replace("\n", " \n", $words);
$words = explode(" ", $words);
foreach($words as $word) {
$_word = trim($word);
$prefix = substr($_word, 0, strpos($_word, '//') + 2);
if($prefix == 'http://' || $prefix == 'ftp://') {
$out .= "<a href=\"$_word\">$word</a> ";
} else {
$out .= "$word ";
}
}
return $out;
}
?>