From: Michael Vogel Date: Wed, 15 May 2013 20:20:06 +0000 (+0200) Subject: When converting to HTML, hashtag addresses are now removed (only when the message... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d4240a265b6993e8afe0a6f528db3b0d70b6e3e3;p=friendica.git When converting to HTML, hashtag addresses are now removed (only when the message is exported) --- diff --git a/include/bbcode.php b/include/bbcode.php index 01c8f14df9..d16dcb6a7f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -668,6 +668,12 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES'); //} + // Remove all hashtag addresses + if (!$tryoembed) { + $pattern = '/#(.*?)<\/a>/is'; + $Text = preg_replace($pattern, '#$2', $Text); + } + call_hooks('bbcode',$Text); $a->save_timestamp($stamp1, "parser"); diff --git a/include/html2plain.php b/include/html2plain.php index 1e3f407af4..80768ffff7 100644 --- a/include/html2plain.php +++ b/include/html2plain.php @@ -107,6 +107,10 @@ function html2plain($html, $wraplength = 75, $compact = false) $message = str_replace("\r", "", $html); + // replace all hashtag addresses + $pattern = '/#(.*?)<\/a>/is'; + $message = preg_replace($pattern, '#$2', $message); + $doc = new DOMDocument(); $doc->preserveWhiteSpace = false;