The url detection in BBCode is too greedy
This commit is contained in:
parent
812cb3b174
commit
b4d14164bb
|
@ -971,11 +971,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
if (!$forplaintext) {
|
if (!$forplaintext) {
|
||||||
// Autolink feature (thanks to http://code.seebz.net/p/autolink-php/)
|
// Autolink feature (thanks to http://code.seebz.net/p/autolink-php/)
|
||||||
$autolink_regex = "`([^\]\=\"']|^)(https?\://[^\s<]+[^\s<\.\)])`ism";
|
$autolink_regex = "`([^\]\=\"']|^)(https?\://[^\s<]+[^\s<\.\)])`ism";
|
||||||
if ($simplehtml != 7) {
|
$autolink_regex = "/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism";
|
||||||
$Text = preg_replace($autolink_regex, '$1<a href="$2" target="_blank">$2</a>', $Text);
|
$Text = preg_replace($autolink_regex, '$1[url]$2[/url]', $Text);
|
||||||
} else {
|
if ($simplehtml == 7) {
|
||||||
$Text = preg_replace($autolink_regex, '$1[url]$2[/url]', $Text);
|
|
||||||
|
|
||||||
$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_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'bb_style_url', $Text);
|
||||||
}
|
}
|
||||||
|
@ -1047,7 +1045,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
$Text = preg_replace($expression, System::baseUrl()."/display/$1", $Text);
|
$Text = preg_replace($expression, System::baseUrl()."/display/$1", $Text);
|
||||||
|
|
||||||
if ($tryoembed) {
|
if ($tryoembed) {
|
||||||
$Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", $tryoembed_callback, $Text);
|
// $Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", $tryoembed_callback, $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Text = preg_replace("/([#])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
$Text = preg_replace("/([#])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||||
|
|
Loading…
Reference in a new issue