aboutsummaryrefslogtreecommitdiffstats
path: root/include/feedutils.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-02-01 21:26:34 -0800
committerzotlabs <mike@macgirvin.com>2018-02-01 21:26:34 -0800
commit512f3a764361dde44e36fb72c105265d6df298ad (patch)
treebc3c6b600f7949ea3adf6854c0bf1690ae6e772e /include/feedutils.php
parentc1eb796cbdce2546d19716a3fb08ca410f31adc0 (diff)
downloadvolse-hubzilla-512f3a764361dde44e36fb72c105265d6df298ad.tar.gz
volse-hubzilla-512f3a764361dde44e36fb72c105265d6df298ad.tar.bz2
volse-hubzilla-512f3a764361dde44e36fb72c105265d6df298ad.zip
provide summaries in feeds under very limited cases, but never in compat (GNU-Social) mode
Diffstat (limited to 'include/feedutils.php')
-rw-r--r--include/feedutils.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index 03124443c..5ef45a6cd 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -1826,10 +1826,24 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $
create_export_photo_body($item);
- if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])
- $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid);
+ // provide separate summary and content unless compat is true; as summary represents a content-warning on some networks
+
+ $matches = false;
+ if(preg_match('|\[summary\](.*?)\[/summary\]|ism',$item['body'],$matches))
+ $summary = $matches[1];
else
- $body = $item['body'];
+ $summary = '';
+
+ $body = $item['body'];
+
+ if($summary)
+ $body = preg_replace('|^(.*?)\[summary\](.*?)\[/summary\](.*?)$|ism','$1$3',$item['body']);
+
+ if($compat)
+ $summary = '';
+
+ if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])
+ $body = fix_private_photos($body,$owner['uid'],$item,$cid);
if($compat) {
$compat_photos = compat_photos_list($body);
@@ -1870,6 +1884,8 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $
}
else {
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
+ if($summary)
+ $o .= '<summary type="' . $type . '" >' . xmlify(prepare_text($summary,$item['mimetype'])) . '</summary>' . "\r\n";
$o .= '<content type="' . $type . '" >' . xmlify(prepare_text($body,$item['mimetype'])) . '</content>' . "\r\n";
}