aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
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;