aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-04-10 03:00:29 -0700
committerFriendika <info@friendika.com>2011-04-10 03:00:29 -0700
commitbf865f0210aee4c6742b10bb63cd05f0de9b9d12 (patch)
tree28fcd894fd9bf0d3f89152e75a842d8248259108 /include/bbcode.php
parent6b66ac818364a4cb5592a0f520396a08feab804f (diff)
downloadvolse-hubzilla-bf865f0210aee4c6742b10bb63cd05f0de9b9d12.tar.gz
volse-hubzilla-bf865f0210aee4c6742b10bb63cd05f0de9b9d12.tar.bz2
volse-hubzilla-bf865f0210aee4c6742b10bb63cd05f0de9b9d12.zip
bug #34, line breaks double in retweet/share
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 = "^\[\]";