X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=89a14988a26709663a65043c329b6fca63847d00;hb=be84d51767366c4538a8203f0046cb5ac06396d6;hp=44f571450947858598fec51d00619a405536c075;hpb=89e81862ec316ae41e616dd8b9ddeb6ab18193c7;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index 44f5714509..89a14988a2 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(">", ">", $Text); // Convert new line chars to html
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 = "^\[\]"; @@ -77,7 +80,7 @@ function bbcode($Text) { // Images // [img]pathtoimage[/img] - $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '', $Text); + $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '' . t('Image/photo') . '', $Text); // html5 video and audio