You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sessioncommunities.online/sites/+components/communities-json-ld.php

33 lines
803 B
PHP

<?php
require_once 'php/assets/room-icons.php';
/**
* @var \CommunityRoom[] $rooms
*/
$json_ld_data = array(
'@context' => 'https://www.w3.org/ns/activitystreams',
'summary' => 'Active Session Communities',
'type' => 'Collection',
'totalItems' => count($rooms),
'items' => array_map(function(\CommunityRoom $room) {
$values = array(
'type' => 'Group',
'name' => $room->name,
'summary' => $room->description,
'startTime' => $room->created ? date('Y-m-d\TH:i:s', intval($room->created)) : null,
'url' => $room->get_preview_url(),
'icon' => room_icon($room, '64x64')
);
return array_filter($values, function ($value) {
return $value != null;
});
}, $rooms)
);
?>
<script type="application/ld+json">
<?=json_encode($json_ld_data)?>
</script>