Experimenting with other fields and handling exceptions if not set.
This commit is contained in:
@@ -13,7 +13,7 @@ $events = json_decode($json, true);
|
|||||||
// Start of the iCalendar content
|
// Start of the iCalendar content
|
||||||
echo "BEGIN:VCALENDAR\r\n";
|
echo "BEGIN:VCALENDAR\r\n";
|
||||||
echo "VERSION:2.0\r\n";
|
echo "VERSION:2.0\r\n";
|
||||||
echo "PRODID:-//HLB//Brisbane Calendar//EN\r\n";
|
echo "PRODID:-//Homelab Brisbane//Event Calendar//EN\r\n";
|
||||||
echo "CALSCALE:GREGORIAN\r\n";
|
echo "CALSCALE:GREGORIAN\r\n";
|
||||||
echo "METHOD:PUBLISH\r\n";
|
echo "METHOD:PUBLISH\r\n";
|
||||||
echo "X-WR-TIMEZONE:Australia/Brisbane\r\n";
|
echo "X-WR-TIMEZONE:Australia/Brisbane\r\n";
|
||||||
@@ -31,12 +31,14 @@ echo "END:VTIMEZONE\r\n";
|
|||||||
|
|
||||||
// Generate VEVENTS
|
// Generate VEVENTS
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$uid = uniqid() . "@yourdomain.com";
|
$uid = uniqid() . "@homelabbrisbane.com.au";
|
||||||
|
|
||||||
$dtstart = date("Ymd\THis", strtotime($event["start"]));
|
$dtstart = date("Ymd\THis", strtotime($event["start"]));
|
||||||
$dtend = date("Ymd\THis", strtotime($event["end"]));
|
$dtend = date("Ymd\THis", strtotime($event["end"]));
|
||||||
$summary = htmlspecialchars($event["title"]);
|
$summary = htmlspecialchars($event["title"]);
|
||||||
$location = htmlspecialchars($event["location"]);
|
$location = htmlspecialchars($event["location"]);
|
||||||
|
$description = isset($event["description"]) ? htmlspecialchars($event["description"]) : '';
|
||||||
|
|
||||||
|
|
||||||
echo "BEGIN:VEVENT\r\n";
|
echo "BEGIN:VEVENT\r\n";
|
||||||
echo "UID:$uid\r\n";
|
echo "UID:$uid\r\n";
|
||||||
@@ -45,6 +47,7 @@ foreach ($events as $event) {
|
|||||||
echo "DTEND;TZID=Australia/Brisbane:$dtend\r\n";
|
echo "DTEND;TZID=Australia/Brisbane:$dtend\r\n";
|
||||||
echo "SUMMARY:$summary\r\n";
|
echo "SUMMARY:$summary\r\n";
|
||||||
echo "LOCATION:$location\r\n";
|
echo "LOCATION:$location\r\n";
|
||||||
|
echo "DESCRIPTION:$description\r\n";
|
||||||
echo "END:VEVENT\r\n";
|
echo "END:VEVENT\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user