aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-18 16:35:40 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-18 16:35:40 -0700
commit1a9c059062eae14a96aac40b2fb4e1efb513dccc (patch)
tree7b142d05b5e52baeec7c538b414cacf6fd14ff4c /include/bb2diaspora.php
parent187a7a56c2f3308521a2f0b407b2518e80a82e70 (diff)
downloadvolse-hubzilla-1a9c059062eae14a96aac40b2fb4e1efb513dccc.tar.gz
volse-hubzilla-1a9c059062eae14a96aac40b2fb4e1efb513dccc.tar.bz2
volse-hubzilla-1a9c059062eae14a96aac40b2fb4e1efb513dccc.zip
issues with markdownify and escaped HTML
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 8129ab5e6..65f8f3ea1 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -413,10 +413,18 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
// Convert it to HTML - don't try oembed
$Text = bbcode($Text, $preserve_nl, false);
+ // Markdownify does not preserve previously escaped html entities such as <> and &.
+
+ $Text = str_replace(array('&lt;','&gt;','&amp;'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
+
// Now convert HTML to Markdown
$md = new Markdownify(false, false, false);
$Text = $md->parseString($Text);
+ // It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason.
+
+ $Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('&lt;','&gt;','&amp;'),$Text);
+
// If the text going into bbcode() has a plain URL in it, i.e.
// with no [url] tags around it, it will come out of parseString()
// looking like: <http://url.com>, which gets removed by strip_tags().