1
0
Fork 0

More URL can be styled

This commit is contained in:
Michael 2017-05-08 12:35:44 +00:00
parent 2002fc8a2a
commit 3f975f6751

View file

@ -173,9 +173,13 @@ function cleancss($input) {
function bb_style_url($match) { function bb_style_url($match) {
$url = $match[1]; $url = $match[1];
if (isset($match[2]) AND ($match[1] != $match[2])) {
return $match[0];
}
$parts = parse_url($url); $parts = parse_url($url);
if (!isset($parts['scheme'])) { if (!isset($parts['scheme'])) {
return $url; return $match[0];
} }
$styled_url = $url; $styled_url = $url;
@ -988,6 +992,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
if ($simplehtml == 7) { if ($simplehtml == 7) {
$Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'bb_style_url', $Text); $Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'bb_style_url', $Text);
$Text = preg_replace_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'bb_style_url', $Text);
} }
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$1</a>', $Text); $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$1</a>', $Text);