use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
use Friendica\Content\Text\BBCode;
+use Friendica\Content\Text\Plaintext;
use Friendica\Util\JsonLD;
use Friendica\Util\LDSignature;
use Friendica\Model\Profile;
return $data;
}
- $data['summary'] = null; // Ignore by now
+ $data['summary'] = BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB);
if ($item['uri'] != $item['thr-parent']) {
$data['inReplyTo'] = $item['thr-parent'];
if ($type == 'Note') {
$body = self::removePictures($body);
+ } elseif (($type == 'Article') && empty($data['summary'])) {
+ $data['summary'] = Plaintext::shorten(self::removePictures($body), 1000);
}
if ($type == 'Event') {
if (empty($body)) {
$body = trim(XML::getFirstNodeValue($xpath, 'content:encoded/text()', $entry));
}
- if (empty($body)) {
- $body = trim(XML::getFirstNodeValue($xpath, 'description/text()', $entry));
+
+ $summary = trim(XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry));
+
+ if (empty($summary)) {
+ $summary = trim(XML::getFirstNodeValue($xpath, 'description/text()', $entry));
}
+
if (empty($body)) {
- $body = trim(XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry));
+ $body = $summary;
+ $summary = '';
+ }
+
+ if ($body == $summary) {
+ $summary = '';
}
// remove the content of the title if it is identically to the body
$item["object-type"] = ACTIVITY_OBJ_BOOKMARK;
unset($item["attach"]);
} else {
+ if (!empty($summary)) {
+ $item["body"] = '[abstract]' . HTML::toBBCode($summary, $basepath) . "[/abstract]\n" . $item["body"];
+ }
+
if ($contact["fetch_further_information"] == 3) {
if (!empty($tags)) {
$item["tag"] = $tags;