aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
committerOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
commit85f709320b588f3231875d097217bd9abd223c9f (patch)
tree988f92ae345657ece74dbcc9dd0d8f17d41f20a5 /include/bbcode.php
parent294577a48b2d6356dd7695716ea0379bf3a087df (diff)
parent6da84027afa18633ac5d5dacce99bb244be2aa7b (diff)
downloadvolse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.gz
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.bz2
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.zip
Merge remote branch 'mike/master'
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 44f571450..6fadbaf7e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -3,7 +3,7 @@ require_once("include/oembed.php");
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendika - Mike Macgirvin
-function bbcode($Text) {
+function bbcode($Text,$preserve_nl = false) {
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
@@ -12,7 +12,10 @@ function bbcode($Text) {
$Text = str_replace(">", "&gt;", $Text);
// Convert new line chars to html <br /> tags
+
$Text = nl2br($Text);
+ if($preserve_nl)
+ $Text = str_replace(array("\n","\r"), array('',''),$Text);
// Set up the parameters for a URL search string
$URLSearchString = "^\[\]";