From d4240a265b6993e8afe0a6f528db3b0d70b6e3e3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 15 May 2013 22:20:06 +0200 Subject: [PATCH] When converting to HTML, hashtag addresses are now removed (only when the message is exported) --- include/bbcode.php | 6 ++++++ include/html2plain.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/bbcode.php b/include/bbcode.php index 01c8f14df..d16dcb6a7 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 1e3f407af..80768ffff 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;