-
Notifications
You must be signed in to change notification settings - Fork 28
/
example.php
54 lines (48 loc) · 1.53 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* This example demonstrates how the Ics-Parser should be used.
*
* PHP Version 5
*
* @category Example
* @package Ics-parser
* @author Martin Thoma <info@martin-thoma.de>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @version SVN: <svn_id>
* @link http://code.google.com/p/ics-parser/
* @example $ical = new ical('MyCal.ics');
* print_r( $ical->get_event_array() );
*/
require 'class.iCalReader.php';
$ical = new ICal('MyCal.ics');
$events = $ical->events();
$date = $events[0]['DTSTART'];
echo "The ical date: ";
echo $date;
echo "<br/>";
echo "The Unix timestamp: ";
echo $ical->iCalDateToUnixTimestamp($date);
echo "<br/>";
echo "The number of events: ";
echo $ical->event_count;
echo "<br/>";
echo "The number of todos: ";
echo $ical->todo_count;
echo "<br/>";
echo "<hr/><hr/>";
foreach ($events as $event) {
echo "SUMMARY: ".$event['SUMMARY']."<br/>";
echo "DTSTART: ".$event['DTSTART']." - UNIX-Time: ".$ical->iCalDateToUnixTimestamp($event['DTSTART'])."<br/>";
echo "DTEND: ".$event['DTEND']."<br/>";
echo "DTSTAMP: ".$event['DTSTAMP']."<br/>";
echo "UID: ".$event['UID']."<br/>";
echo "CREATED: ".$event['CREATED']."<br/>";
echo "DESCRIPTION: ".$event['DESCRIPTION']."<br/>";
echo "LAST-MODIFIED: ".$event['LAST-MODIFIED']."<br/>";
echo "LOCATION: ".$event['LOCATION']."<br/>";
echo "SEQUENCE: ".$event['SEQUENCE']."<br/>";
echo "STATUS: ".$event['STATUS']."<br/>";
echo "TRANSP: ".$event['TRANSP']."<br/>";
echo "<hr/>";
}
?>