mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
move substitution of new lines with <br> to the end of bbcode(). This will fix issue #1512.
This commit is contained in:
@@ -1153,23 +1153,8 @@ function bbcode($Text, $options = []) {
|
||||
|
||||
$Text = preg_replace_callback("/\[table\](.*?)\[\/table\]/ism",'bb_fixtable_lf',$Text);
|
||||
|
||||
// Convert new line chars to html <br /> tags
|
||||
|
||||
// nlbr seems to be hopelessly messed up
|
||||
// $Text = nl2br($Text);
|
||||
|
||||
// We'll emulate it.
|
||||
|
||||
$Text = str_replace("\r\n", "\n", $Text);
|
||||
$Text = str_replace(array("\r", "\n"), array('<br />', '<br />'), $Text);
|
||||
|
||||
if ($preserve_nl)
|
||||
$Text = str_replace(array("\n", "\r"), array('', ''), $Text);
|
||||
|
||||
|
||||
$Text = str_replace(array("\t", " "), array(" ", " "), $Text);
|
||||
|
||||
|
||||
// Check for [code] text
|
||||
if (strpos($Text,'[code]') !== false) {
|
||||
$Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text);
|
||||
@@ -1633,6 +1618,19 @@ function bbcode($Text, $options = []) {
|
||||
|
||||
$Text = bb_replace_images($Text, $saved_images);
|
||||
|
||||
// Convert new line chars to html <br /> tags
|
||||
|
||||
// nlbr seems to be hopelessly messed up
|
||||
// $Text = nl2br($Text);
|
||||
|
||||
// We'll emulate it.
|
||||
|
||||
$Text = str_replace("\r\n", "\n", $Text);
|
||||
$Text = str_replace(array("\r", "\n"), array('<br />', '<br />'), $Text);
|
||||
|
||||
if ($preserve_nl)
|
||||
$Text = str_replace(array("\n", "\r"), array('', ''), $Text);
|
||||
|
||||
call_hooks('bbcode', $Text);
|
||||
|
||||
return $Text;
|
||||
|
||||
Reference in New Issue
Block a user