Vynderkind,
private static function highlight_url($var)
{
if (!function_exists('process_url')) {
function process_url($url)
{
if (!isset($url[3])) {
$tmp = parse_url($url[1]);
if ('http://' . $tmp['host'] == core::$system_set['homeurl'] || isset(core::$user_set['direct_url']) && core::$user_set['direct_url']) {
return '<a href="' . $url[1] . '">' . $url[2] . '</a>';
} else {
return '<a href="' . core::$system_set['homeurl'] . '/go.php?url=' . base64_encode($url[1]) . '">' . $url[2] . '</a>';
}
} else {
$tmp = parse_url($url[3]);
$url[3] = str_replace(':', ':', $url[3]);
if ('http://' . $tmp['host'] == core::$system_set['homeurl'] || isset(core::$user_set['direct_url']) && core::$user_set['direct_url']) {
return '<a href="' . $url[3] . '">' . $url[3] . '</a>';
} else {
return '<a href="' . core::$system_set['homeurl'] . '/go.php?url=' . base64_encode($url[3]) . '">' . $url[3] . '</a>';
}
}
}
}
return preg_replace_callback('~\\[url=(https?://.+?)\\](.+?)\\[/url\\]|(https?://(www.)?[0-9a-z\.-]+\.[0-9a-z]{2,6}[0-9a-zA-Z/\?\.\~&_=/%-:#]*)~', 'process_url', $var);
}