even better place discovery

This commit is contained in:
Mike Macgirvin 2023-09-11 15:03:18 +10:00
parent 5a2bf9838e
commit 6da1eae78e

View file

@ -3288,13 +3288,18 @@ class Activity
if (is_array($act->tgt) && $act->tgt['type'] === 'Place') {
$location = new Place($act->tgt);
}
elseif (is_array($act->obj) && $act->obj['type'] === 'Place') {
$location = new Place($act->obj);
elseif (is_array($act->obj)) {
if ($act->obj['type'] === 'Place') {
$location = new Place($act->obj);
}
elseif (is_array($act->obj['location'])) {
$location = new Place($act->obj['location']);
}
}
else {
$location = new Place($act->get_property_obj('location'));
}
if ($location->getType() === 'Place') {
if ($location && $location->getType() === 'Place') {
$item['location'] = $location->getName() ? escape_tags($location->getName()) : '';
// Look for something resembling latitude/longitude coordinates in the place name and set the
// coordinates appropriately. This technically isn't supported but is provided as a convenience