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 / simpleevent.php

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

49 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 * Simple Event Example
5 *
6 * Create a simple iCalendar event
7 * No time zone specified, so this event will be in UTC time zone
8 *
9 */
10
11 require_once("../zapcallib.php");
12
13 $title = "Simple Event";
14 // date/time is in SQL datetime format
15 $event_start = "2020-01-01 12:00:00";
16 $event_end = "2020-01-01 13:00:00";
17
18 // create the ical object
19 $icalobj = new ZCiCal();
20
21 // create the event within the ical object
22 $eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);
23
24 // add title
25 $eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $title));
26
27 // add start date
28 $eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($event_start)));
29
30 // add end date
31 $eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($event_end)));
32
33 // UID is a required item in VEVENT, create unique string for this event
34 // Adding your domain to the end is a good way of creating uniqueness
35 $uid = date('Y-m-d-H-i-s') . "@demo.icalendar.org";
36 $eventobj->addNode(new ZCiCalDataNode("UID:" . $uid));
37
38 // DTSTAMP is a required item in VEVENT
39 $eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
40
41 // Add description
42 $eventobj->addNode(new ZCiCalDataNode("Description:" . ZCiCal::formatContent(
43 "This is a simple event, using the Zap Calendar PHP library. " .
44 "Visit http://icalendar.org to validate icalendar files.")));
45
46 // write iCalendar feed to stdout
47 echo $icalobj->export();
48
49