function parse_link_callback($matches) { if (preg_match('/^(?!http).*/i', $matches[1])) { $url = 'http://' . $matches[1]; } else { $url = $matches[1]; } if (is_inside_url($url)) { return '<a href="' . $url . '">' . FORMAT::sub_url($matches[1], 50) . '</a>'; } else { return '<a href="' . $url . '" rel="nofollow" target="_blank">' . FORMAT::sub_url($matches[1], 50) . '</a>'; } }