PluginProbe
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar / 2.0
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar v2.0
2.1.21 2.1.20 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 trunk 1.1 2.0 2.0.1 2.0.10.2 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.17 2.0.18 2.0.2 2.0.20 2.0.21 2.0.22 All 55 releases
booking-manager / assets / libs / icalendar / examples / timezoneevent.php

timezoneevent.php in Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar 2.0, at assets/libs/icalendar/examples/timezoneevent.php

48 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Create Event Example With Local Timezone
5 *
6 */
7
8 require_once("../zapcallib.php");
9
10 $title = "Event in New York timezone";
11 // date/time is in SQL datetime format
12 $event_start = "2020-01-01 12:00:00";
13 $event_end = "2020-01-01 13:00:00";
14 // timezone must be a supported PHP timezone
15 // (see http://php.net/manual/en/timezones.php )
16 // Note: multi-word timezones must use underscore "_" separator
17 $tzid = "America/New_York";
18
19 // create the ical object
20 $icalobj = new ZCiCal();
21
22 // Add timezone data
23 ZCTimeZoneHelper::getTZNode(substr($event_start,0,4),substr($event_end,0,4),$tzid, $icalobj->curnode);
24
25 // create the event within the ical object
26 $eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);
27
28 // add title
29 $eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $title));
30
31 // add start date
32 $eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($event_start)));
33
34 // add end date
35 $eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($event_end)));
36
37 // UID is a required item in VEVENT, create unique string for this event
38 // Adding your domain to the end is a good way of creating uniqueness
39 $uid = date('Y-m-d-H-i-s') . "@demo.icalendar.org";
40 $eventobj->addNode(new ZCiCalDataNode("UID:" . $uid));
41
42 // DTSTAMP is a required item in VEVENT
43 $eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
44
45 // write iCalendar feed to stdout
46 echo $icalobj->export();
47
48