pls i want some one to help me correct this code pls
Added after 6 minutes:
i was try to get the title of links posted in my forum but it gave me error,
pls ignore any rubbish i have done there
PHP Code:
private static function highlight_url($var)
{
if (!function_exists('process_url')) {
function process_url($url)
{
function page_title($url) { $page = @file_get_contents($url);
if (empty($page)) return null; $matches = array();
if (preg_match('/<title>(.*?)<\/title>/', $page, $matches))
{
return $matches[1];
}
else
{
return null;
}
}
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] . '">' . $ptitle . '</a>';
} else {
return '<a href="' . core::$system_set['homeurl'] . '/go.php?url=' . base64_encode($url[1]) . '">' . $ptitle . '</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);
}
i was try to get the title of links posted in my forum but it gave me error,
pls ignore any rubbish i have done there
Comment