diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-05 02:27:24 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-05 02:27:24 -0700 |
commit | 47ebddf99f5487cbcdfbabaa367c7b09fa0a86e3 (patch) | |
tree | 9574a71abf0ffdb68fc9ba372fd4874ef843b6ed | |
parent | c70ac572fabb7e808adb58ada201aa0e7acf0c36 (diff) | |
download | volse-hubzilla-47ebddf99f5487cbcdfbabaa367c7b09fa0a86e3.tar.gz volse-hubzilla-47ebddf99f5487cbcdfbabaa367c7b09fa0a86e3.tar.bz2 volse-hubzilla-47ebddf99f5487cbcdfbabaa367c7b09fa0a86e3.zip |
markdown autolinks - hubzilla bug #752
-rw-r--r-- | Zotlabs/Lib/MarkdownSoap.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Zotlabs/Lib/MarkdownSoap.php b/Zotlabs/Lib/MarkdownSoap.php index a0214bbe4..534ad819f 100644 --- a/Zotlabs/Lib/MarkdownSoap.php +++ b/Zotlabs/Lib/MarkdownSoap.php @@ -77,15 +77,22 @@ class MarkdownSoap { } function purify($s) { -// $s = str_replace("\n",'<br>',$s); -// $s = str_replace("\t",' ',$s); -// $s = str_replace(' ',' ',$s); + $s = $this->protect_autolinks($s); $s = purify_html($s); -// $s = str_replace([' ', mb_convert_encoding(' ','UTF-8','HTML-ENTITIES')], [ ' ', ' ' ],$s); -// $s = str_replace(['<br>','<br />', '<', '>' ],["\n","\n", '<', '>'],$s); + $s = $this->unprotect_autolinks($s); return $s; } + function protect_autolinks($s) { + $s = preg_replace('/\<(https?\:\/\/)(.*?)\>/','[$1$2]($1$2)',$s); + return $s; + } + + function unprotect_autolinks($s) { + return $s; + + } + function escape($s) { return htmlspecialchars($s,ENT_QUOTES); } |