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;