aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/MarkdownSoap.php
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-05-05 12:33:39 +0200
committerGitHub <noreply@github.com>2017-05-05 12:33:39 +0200
commitf08001a5a64f58f8d93d4fd395bdcf88326771b3 (patch)
treee22f7bf3307c4d30f28b3385bf3243b9af918a41 /Zotlabs/Lib/MarkdownSoap.php
parente308c3d34afda1c467b049314324faa546294c9a (diff)
parentecbba937845cbd4e8e2ed67020b977e1f19fdbd0 (diff)
downloadvolse-hubzilla-f08001a5a64f58f8d93d4fd395bdcf88326771b3.tar.gz
volse-hubzilla-f08001a5a64f58f8d93d4fd395bdcf88326771b3.tar.bz2
volse-hubzilla-f08001a5a64f58f8d93d4fd395bdcf88326771b3.zip
Merge pull request #753 from zotlabs/mdauto
markdown autolinks - hubzilla bug #752
Diffstat (limited to 'Zotlabs/Lib/MarkdownSoap.php')
-rw-r--r--Zotlabs/Lib/MarkdownSoap.php17
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",'&nbsp;&nbsp;&nbsp;&nbsp;',$s);
-// $s = str_replace(' ','&nbsp;',$s);
+ $s = $this->protect_autolinks($s);
$s = purify_html($s);
-// $s = str_replace(['&nbsp;', mb_convert_encoding('&#x00a0;','UTF-8','HTML-ENTITIES')], [ ' ', ' ' ],$s);
-// $s = str_replace(['<br>','<br />', '&lt;', '&gt;' ],["\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);
}