/**
* make_clickable
*/
function make_clickable ($text)
{
global $bb_cfg;
$url_regexp = "#
(?<![\"'=])
\b
(
https?://[\w\#!$%&~/.\-;:=?@а-яА-Я\[\]+]+
)
(?![\"']|\[/url|\[/img|</a)
(?=[,!]?\s|[\)<!])
#xiu";
// pad it with a space so we can match things at the start of the 1st line.
$ret = " $text ";
// hide passkey
$ret = hide_passkey($ret);
// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
$ret = preg_replace_callback($url_regexp, array(&$this, 'make_url_clickable_callback'), $ret);
// Remove our padding..
$ret = substr(substr($ret, 0, -1), 1);
return($ret);
}
/**
* make_url_clickable_callback
*/
function make_url_clickable_callback ($m)
{
$max_len = 70;
$href = $m[1];
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) .'...'. mb_substr($href, -16) : $href;
return "<a href=\"$href\" class=\"postLink\">$name</a>";
}
if(strpos($href, $bb_cfg['server_name']) {
return "<a href=\"$href\" class=\"postLink\">$name</a>";
} else {
return "<noindex><a href=\"$href\" class=\"postLink\" rel=\"nofollow\">$name</a><noindex>";
}
function make_url_clickable_callback ($m)
{
global $bb_cfg;
$max_len = 70;
$href = $m[1];
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) .'...'. mb_substr($href, -16) : $href;
/* return "<a href=\"$href\" class=\"postLink\">$name</a>"; */
if(strpos($href, $bb_cfg['server_name'])) {
return "<a href=\"$href\" class=\"postLink\">$name</a>";
} else {
return "<noindex><a href=\"$href\" class=\"postLink\" rel=\"nofollow\">$name</a><noindex>";
}
}