aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-01-16 16:50:44 -0800
committerzotlabs <mike@macgirvin.com>2019-01-16 16:50:44 -0800
commit20eea2184bc1336efb811c29e3fb49262ae02262 (patch)
tree189c92a21b19509a15c681f2aef0f54f3dd06e68 /Zotlabs/Lib/Activity.php
parenteaa375936fc3c23f1b6629cba56fce2eb116a1c6 (diff)
downloadvolse-hubzilla-20eea2184bc1336efb811c29e3fb49262ae02262.tar.gz
volse-hubzilla-20eea2184bc1336efb811c29e3fb49262ae02262.tar.bz2
volse-hubzilla-20eea2184bc1336efb811c29e3fb49262ae02262.zip
more work on z6 events
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index b4c833594..b4d78d809 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -32,6 +32,9 @@ class Activity {
if($x['type'] === ACTIVITY_OBJ_THING) {
return self::fetch_thing($x);
}
+ if($x['type'] === ACTIVITY_OBJ_EVENT) {
+ return self::fetch_event($x);
+ }
return $x;
@@ -99,6 +102,40 @@ class Activity {
}
}
+ static function fetch_event($x) {
+
+ // convert old Zot event objects to ActivityStreams Event objects
+
+ if (array_key_exists('content',$x) && array_key_exists('dtstart',$x)) {
+ $ev = bbtoevent($x['content']);
+ if($ev) {
+
+ $actor = null;
+ if(array_key_exists('author',$x) && array_key_exists('link',$x['author'])) {
+ $actor = $x['author']['link'][0]['href'];
+ }
+ $y = [
+ 'type' => 'Event',
+ 'id' => z_root() . '/event/' . $ev['event_hash'],
+ 'summary' => bbcode($ev['summary']),
+ // RFC3339 Section 4.3
+ 'startTime' => (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')),
+ 'content' => bbcode($ev['description']),
+ 'location' => [ 'type' => 'Place', 'content' => bbcode($ev['location']) ],
+ 'source' => [ 'content' => format_event_bbcode($ev), 'mediaType' => 'text/bbcode' ],
+ 'actor' => $actor,
+ ];
+ if($actor) {
+ return $y;
+ }
+ }
+ }
+
+ return $x;
+
+ }
+
+
static function encode_item_collection($items,$id,$type,$extra = null) {
$ret = [