*/ public static function urls(EventData $event, string $permalink, string $ics): array { $daily = ($event->schedule['type'] ?? '') === 'daily'; $allDay = $event->allDay || $daily; $start = $daily ? new \DateTimeImmutable($event->schedule['startDate'], $event->startLocal->getTimezone()) : $event->startLocal; $end = $daily ? new \DateTimeImmutable($event->schedule['endDate'], $event->endLocal->getTimezone()) : $event->endLocal; $zone = new \DateTimeZone('UTC'); $dates = $allDay ? $start->format('Ymd') . '/' . $end->modify('+1 day')->format('Ymd') : $start->setTimezone($zone)->format('Ymd\THis\Z') . '/' . $end->setTimezone($zone)->format('Ymd\THis\Z'); $details = trim(wp_strip_all_tags($event->excerpt) . "\n" . $permalink); $params = ['subject' => $event->title, 'body' => $details, 'startdt' => $start->format(DATE_ATOM), 'enddt' => ($allDay ? $end->modify('+1 day') : $end)->format(DATE_ATOM), 'allday' => $allDay ? 'true' : 'false', 'path' => '/calendar/action/compose', 'rru' => 'addevent']; return [ 'Google Calendar' => 'https://calendar.google.com/calendar/render?' . http_build_query(['action' => 'TEMPLATE', 'text' => $event->title, 'dates' => $dates, 'details' => $details], '', '&', PHP_QUERY_RFC3986), 'Outlook.com' => 'https://outlook.live.com/calendar/0/deeplink/compose?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986), 'Microsoft 365' => 'https://outlook.office.com/calendar/0/deeplink/compose?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986), 'Apple Calendar / ICS' => $ics, ]; } }