55) ? substr($url, 0 , 39).'...'.substr($url, -10) : $url) : stripslashes($link); if ($bbcode){ if ($full_url == $link) return '[url]'.$link.'[/url]'; else return '[url='.$full_url.']'.$link.'[/url]'; } else return ''.$link.''; } function handle_img_tag($url, $is_signature = false, $alt = null) { if ($alt == null) $alt = $url; $img_tag = ''; return $img_tag; } function do_bbcode($text){ $text=nl2br($text); if (strpos($text, '[quote') !== false){ $text = preg_replace('#\[quote=("|"|\'|)(.*?)\\1\]#e', '"
"', $text); $text = preg_replace('#\[quote\]\s*#', '
', $text); $text = preg_replace('#\s*\[\/quote\]#S', '
', $text); } $pattern[] = '#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e'; $pattern[] = '#\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e'; $replace[] = 'handle_img_tag(\'$1$3\', false)'; $replace[] = 'handle_img_tag(\'$2$4\', false, \'$1\')'; $pattern[] = '#\[b\](.*?)\[/b\]#ms'; $pattern[] = '#\[i\](.*?)\[/i\]#ms'; $pattern[] = '#\[u\](.*?)\[/u\]#ms'; $pattern[] = '#\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]#ms'; $pattern[] = '#\[h\](.*?)\[/h\]#ms'; $replace[] = '$1'; $replace[] = '$1'; $replace[] = '$1'; $replace[] = '$2'; $replace[] = '
$1
'; $pattern[] = '#\[url\]([^\[]*?)\[/url\]#e'; $pattern[] = '#\[url=([^\[]+?)\](.*?)\[/url\]#e'; $pattern[] = '#\[email\]([^\[]*?)\[/email\]#'; $pattern[] = '#\[email=([^\[]+?)\](.*?)\[/email\]#'; $replace[] = 'handle_url_tag(\'$1\')'; $replace[] = 'handle_url_tag(\'$1\', \'$2\')'; $replace[] = '$1'; $replace[] = '$2'; $text = preg_replace($pattern, $replace, $text); return $text; } ?>