X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FText%2FBBCode.php;h=c3453bcf727bda8baf6f51517838e4403e7d43a6;hb=406b46b63531bb45d73eda3badc7ba657c1ab8c0;hp=ef527f802c93b6b65e4cbed3b807f468655e9bf6;hpb=d6adcb973401982e76035ca000130a347391a2be;p=friendica.git diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index ef527f802c..c3453bcf72 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -25,7 +25,6 @@ use Friendica\Util\Map; use Friendica\Util\Network; use Friendica\Util\ParseUrl; use Friendica\Util\Proxy as ProxyUtils; -use League\HTMLToMarkdown\HtmlConverter; class BBCode extends BaseObject { @@ -348,7 +347,7 @@ class BBCode extends BaseObject */ public static function toPlaintext($text, $keep_urls = true) { - $naked_text = preg_replace('/\[(.+?)\]/','', $text); + $naked_text = preg_replace('/\[(.+?)\]\s*/','', $text); if (!$keep_urls) { $naked_text = preg_replace('#https?\://[^\s<]+[^\s\.\)]#i', '', $naked_text); } @@ -1164,21 +1163,6 @@ class BBCode extends BaseObject return $return; } - private static function textHighlightCallback($match) - { - // Fallback in case the language doesn't exist - $return = '[code]' . $match[2] . '[/code]'; - - if (in_array(strtolower($match[1]), - ['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby', - 'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh', 'bash']) - ) { - $return = text_highlight($match[2], strtolower($match[1])); - } - - return $return; - } - /** * @brief Converts a BBCode message to HTML message * @@ -1957,8 +1941,7 @@ class BBCode extends BaseObject $stamp1 = microtime(true); // Now convert HTML to Markdown - $converter = new HtmlConverter(); - $text = $converter->convert($text); + $text = HTML::toMarkdown($text); // unmask the special chars back to HTML $text = str_replace(['&\_lt\_;', '&\_gt\_;', '&\_amp\_;'], ['<', '>', '&'], $text);