diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-31 22:16:14 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-31 22:16:14 -0700 |
commit | 84c085dcd7c88fbea1f143f0ee3029685617afe9 (patch) | |
tree | 27c79a160f3a6a0c45428d2207f2219e72ecdb63 | |
parent | 5cc5e0fafdbc1795781b52124a63695ce3e2d49f (diff) | |
download | volse-hubzilla-84c085dcd7c88fbea1f143f0ee3029685617afe9.tar.gz volse-hubzilla-84c085dcd7c88fbea1f143f0ee3029685617afe9.tar.bz2 volse-hubzilla-84c085dcd7c88fbea1f143f0ee3029685617afe9.zip |
bare bones ASLD
-rwxr-xr-x | include/items.php | 48 | ||||
-rw-r--r-- | mod/network.php | 1 |
2 files changed, 44 insertions, 5 deletions
diff --git a/include/items.php b/include/items.php index a04cd1c76..bb7d9e28c 100755 --- a/include/items.php +++ b/include/items.php @@ -4884,6 +4884,17 @@ function comment_local_origin($item) { } +function gen_asld($items) { + $ret = array(); + if(! $items) + return $ret; + foreach($items as $item) { + $ret[] = i2asld($item); + } + return $ret; +} + + function i2asld($i) { if(! $i) @@ -4896,25 +4907,54 @@ function i2asld($i) { $ret['@type'] = ucfirst(basename($i['verb'])); } $ret['@id'] = $i['plink']; + $ret['published'] = datetime_convert('UTC','UTC',$i['created'],ATOM_TIME); - if($i['title']) - $ret['title'] = $i['title']; - $ret['content'] = bbcode($i['body']); + + if($i['obj_type'] === ACTIVITY_OBJ_NOTE) + $ret['object'] = asencode_note($i); + $ret['actor'] = asencode_person($i['author']); - $ret['owner'] = asencode_person($i['owner']); return $ret; } +function asencode_note($i) { + + $ret = array(); + + $ret['@type'] = 'Note'; + $ret['@id'] = $i['plink']; + $ret['@context'] = array('zot' => 'http://purl.org/zot/protocol'); + if($i['title']) + $ret['title'] = bbcode($i['title']); + $ret['content'] = bbcode($i['body']); + $ret['zot:owner'] = asencode_person($i['owner']); + $ret['published'] = datetime_convert('UTC','UTC',$i['created'],ATOM_TIME); + if($i['created'] !== $i['edited']) + $ret['updated'] = datetime_convert('UTC','UTC',$i['edited'],ATOM_TIME); + + return $ret; +} + function asencode_person($p) { $ret = array(); $ret['@type'] = 'Person'; $ret['@id'] = 'acct:' . $p['xchan_addr']; $ret['displayName'] = $p['xchan_name']; + $ret['icon'] = array( + '@type' => 'Link', + 'mediaType' => $p['xchan_photo_mimetype'], + 'href' => $p['xchan_photo_m'] + ); + $ret['url'] = array( + '@type' => 'Link', + 'mediaType' => 'text/html', + 'href' => $p['xchan_url'] + ); return $ret; }
\ No newline at end of file diff --git a/mod/network.php b/mod/network.php index d96c6830d..e8630278a 100644 --- a/mod/network.php +++ b/mod/network.php @@ -506,7 +506,6 @@ function network_content(&$a, $update = 0, $load = false) { $mode = (($nouveau) ? 'network-new' : 'network'); - $o .= conversation($a,$items,$mode,$update,$page_mode); if(($items) && (! $update)) |