kopia lustrzana https://github.com/nextcloud/social
preserve html in content
Signed-off-by: Robin Appelman <robin@icewind.nl>pull/1090/head
rodzic
37fa478048
commit
173b768038
|
@ -61,6 +61,7 @@ class ACore extends Item implements JsonSerializable {
|
|||
const AS_USERNAME = 5;
|
||||
const AS_ACCOUNT = 6;
|
||||
const AS_STRING = 7;
|
||||
const AS_CONTENT = 8;
|
||||
const AS_TAGS = 10;
|
||||
|
||||
const FORMAT_ACTIVITYPUB = 1;
|
||||
|
@ -559,14 +560,16 @@ 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 trim($value);
|
||||
return $value;
|
||||
|
||||
case self::AS_CONTENT:
|
||||
$value = strip_tags($value, ['a', 'p', 'span', 'br']);
|
||||
$value = html_entity_decode($value, ENT_QUOTES | ENT_HTML5);
|
||||
|
||||
return $value;
|
||||
|
||||
case self::AS_USERNAME:
|
||||
$value = strip_tags($value);
|
||||
|
|
|
@ -424,7 +424,7 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
}
|
||||
|
||||
$this->setActivityId($this->validate(self::AS_ID, 'activity_id', $data, ''));
|
||||
$this->setContent($this->validate(self::AS_STRING, 'content', $data, ''));
|
||||
$this->setContent($this->validate(self::AS_CONTENT, 'content', $data, ''));
|
||||
$this->setObjectId($this->validate(self::AS_ID, 'object_id', $data, ''));
|
||||
$this->setAttributedTo($this->validate(self::AS_ID, 'attributed_to', $data, ''));
|
||||
$this->setInReplyTo($this->validate(self::AS_ID, 'in_reply_to', $data));
|
||||
|
|
Ładowanie…
Reference in New Issue