aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-02-15 08:20:42 +0000
committerMario <mario@mariovavti.com>2021-02-15 08:20:42 +0000
commited993920015cfae7f0e939b1733ab125c85e1dda (patch)
tree4eec16e91ae63acd346cfa01ccfff1194be3ca02 /include/bbcode.php
parent50e9a12ca546a2c9b40839dc7767e22c4caaa270 (diff)
downloadvolse-hubzilla-ed993920015cfae7f0e939b1733ab125c85e1dda.tar.gz
volse-hubzilla-ed993920015cfae7f0e939b1733ab125c85e1dda.tar.bz2
volse-hubzilla-ed993920015cfae7f0e939b1733ab125c85e1dda.zip
move substitution of new lines with <br> to the end of bbcode(). This will fix issue #1512.
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index e1a5c7e47..dfc64f814 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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("&nbsp;&nbsp;&nbsp;&nbsp;", "&nbsp;&nbsp;"), $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;