X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FText%2FBBCode.php;h=a38d2de7856ec39f7c24c38c36d7a5af6c92eee2;hb=a8402109b183e81dad4e5443883dd292df094b86;hp=c14f55a709f4e1baeb9ac7aa44af83d3562ffd39;hpb=12d2de2c9345820c39d64d88c2448d5965f4909d;p=friendica.git diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index c14f55a709..a38d2de785 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1312,7 +1312,8 @@ class BBCode "\n[tr]", "[tr]\n", " [tr]", "[tr] ", "\n[/tr]", "[/tr]\n", " [/tr]", "[/tr] ", "\n[hr]", "[hr]\n", " [hr]", "[hr] ", "\n[attachment ", " [attachment ", "\n[/attachment]", "[/attachment]\n", " [/attachment]", "[/attachment] ", - "[table]\n", "[table] ", " [table]", "\n[/table]", " [/table]", "[/table] " + "[table]\n", "[table] ", " [table]", "\n[/table]", " [/table]", "[/table] ", + " \n", "\t\n", "[/li]\n", "\n[li]", "\n[*]", ]; $replace = [ "[th]", "[th]", "[th]", "[/th]", "[/th]", "[/th]", @@ -1320,7 +1321,8 @@ class BBCode "[tr]", "[tr]", "[tr]", "[tr]", "[/tr]", "[/tr]", "[/tr]", "[/tr]", "[hr]", "[hr]", "[hr]", "[hr]", "[attachment ", "[attachment ", "[/attachment]", "[/attachment]", "[/attachment]", "[/attachment]", - "[table]", "[table]", "[table]", "[/table]", "[/table]", "[/table]" + "[table]", "[table]", "[table]", "[/table]", "[/table]", "[/table]", + "\n", "\n", "[/li]", "[li]", "[*]", ]; do { $oldtext = $text; @@ -1338,11 +1340,11 @@ class BBCode // removing multiplicated newlines if (DI::config()->get('system', 'remove_multiplicated_lines')) { $search = [ - "\n\n\n", "\n ", " \n", "\n\t", "\t\n", "\n\r", "\r\n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[*]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n", + "\n\n\n", "[/quote]\n\n", "\n[/quote]", "\n[ul]", "[/ul]\n", "\n[ol]", "[/ol]\n", "\n\n[share ", "[/attachment]\n", "\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n" ]; $replace = [ - "\n\n", "\n", "\n", "\n", "\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[*]", "[ul]", "[/ul]", "\n[share ", "[/attachment]", + "\n\n", "[/quote]\n", "[/quote]", "[ul]", "[/ul]", "[ol]", "[/ol]", "\n[share ", "[/attachment]", "[h1]", "[/h1]", "[h2]", "[/h2]", "[h3]", "[/h3]", "[h4]", "[/h4]", "[h5]", "[/h5]", "[h6]", "[/h6]" ]; do { @@ -1473,8 +1475,8 @@ class BBCode $text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '

', $text); $text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '

', $text); $text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '

', $text); - $text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '

', $text); - $text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '

', $text); + $text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '

', $text); + $text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '

    $1

', $text); $text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '

  • $1
  • ', $text); } @@ -1565,8 +1567,13 @@ class BBCode "/\[[iz]mg\=(.*?)\](.*?)\[\/[iz]mg\]/ism", function ($matches) use ($simple_html, $uriid) { $matches[1] = self::proxyUrl($matches[1], $simple_html, $uriid); - $matches[2] = htmlspecialchars($matches[2], ENT_COMPAT); - return '' . $matches[2] . ''; + $alt = htmlspecialchars($matches[2], ENT_COMPAT); + // Fix for Markdown problems with Diaspora, see issue #12701 + if (($simple_html != self::DIASPORA) || strpos($matches[2], '"') === false) { + return '' . $alt . ''; + } else { + return '' . $alt . ''; + } }, $text );