preserve some of the whitespace from html tags

without the "html whitespace" a hashtag posted after a url will be seen as part of the link by linkify, and then mangled by the hashtagmangler and break the url.

additionally this keeps the appearance of the post closer to the original

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/1028/head
Robin Appelman 2020-09-14 16:20:50 +02:00
rodzic ab2379013a
commit ce1484f1b0
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -557,10 +557,14 @@ class ACore extends Item implements JsonSerializable {
return $value;
case self::AS_STRING:
// try to preserve some whitespace from the html tags
$value = preg_replace("/\<br *\/?\>/", "\n", $value);
$value = preg_replace("/\<\/?p>/", "\n", $value);
$value = strip_tags($value);
$value = html_entity_decode($value, ENT_QUOTES | ENT_HTML5);
return $value;
return trim($value);
case self::AS_USERNAME:
$value = strip_tags($value);