X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FText%2FMarkdown.php;h=905860647f0f83a9bb17c13f2e3d2b6a1338c29e;hb=803c1d71de9e6d13da9576660c9ab8b8bb2c19f3;hp=8dfe00190a85ed2c6e4f1f4b7177910a420f1bda;hpb=6f0d40c6c0957751d5f0de844c81a7a140eb7ec7;p=friendica.git diff --git a/src/Content/Text/Markdown.php b/src/Content/Text/Markdown.php index 8dfe00190a..905860647f 100644 --- a/src/Content/Text/Markdown.php +++ b/src/Content/Text/Markdown.php @@ -1,6 +1,6 @@ startRecording('rendering'); $MarkdownParser = new MarkdownParser(); $MarkdownParser->code_class_prefix = 'language-'; $MarkdownParser->hard_wrap = $hardwrap; $MarkdownParser->hashtag_protection = true; - $MarkdownParser->url_filter_func = function ($url) { - if (strpos($url, '#') === 0) { - $url = ltrim($_SERVER['REQUEST_URI'], '/') . $url; + $MarkdownParser->url_filter_func = function ($url) use ($baseuri) { + if (!empty($baseuri) && strpos($url, '#') === 0) { + $url = ltrim($baseuri, '/') . $url; } return $url; }; @@ -57,7 +56,7 @@ class Markdown $html = $MarkdownParser->transform($text); - DI::profiler()->saveTimestamp($stamp1, "parser", System::callstack()); + DI::profiler()->stopRecording(); return $html; } @@ -83,7 +82,7 @@ class Markdown return ''; } - $data = Contact::getDetailsByAddr($matches[3]); + $data = Contact::getByURL($matches[3]); if (empty($data)) { return ''; @@ -109,7 +108,7 @@ class Markdown */ public static function toBBCode($s) { - $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8'); + DI::profiler()->startRecording('rendering'); // The parser cannot handle paragraphs correctly $s = str_replace(['

', '

', '

'], ['
', '
', '
'], $s); @@ -124,9 +123,6 @@ class Markdown // protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands $s = str_replace('♲', html_entity_decode('♲', ENT_QUOTES, 'UTF-8'), $s); - // Convert everything that looks like a link to a link - $s = preg_replace('/([^\]=]|^)(https?\:\/\/)([a-zA-Z0-9:\/\-?&;.=_~#%$!+,@]+(?stopRecording(); return $s; } }