This commit is contained in:
2026-03-20 17:13:38 +01:00
parent 4c84735b75
commit c043ee9a52
1152 changed files with 317560 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ZContent.net//Zap Calendar 1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
SUMMARY:Abraham Lincoln
UID:2008-04-28-04-15-56-62-@americanhistorycalendar.com
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:TRANSPARENT
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=2;BYMONTHDAY=12
DTSTART:20080212
DTEND:20080213
DTSTAMP:20150421T141403
CATEGORIES:U.S. Presidents,Civil War People
LOCATION:Hodgenville\, Kentucky
GEO:37.5739497;-85.7399606
DESCRIPTION:Born February 12\, 1809\nSixteenth President (1861-1865)\n\n\n
\nhttp://AmericanHistoryCalendar.com
URL:http://americanhistorycalendar.com/peoplecalendar/1,328-abraham-lincol
n
END:VEVENT
END:VCALENDAR
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* parseicalendar.php
*
* @package ZapCalLib
* @author Dan Cogliano <http://zcontent.net>
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://icalendar.org/php-library.html
*/
/**
* Parse iCalendar Example
*
* Enter an ics filename or URL on the command line,
* or leave blank to parse the default file.
*
*/
require_once("../zapcallib.php");
$icalfile = count($argv) > 1 ? $argv[1] : "abrahamlincoln.ics";
$icalfeed = file_get_contents($icalfile);
// create the ical object
$icalobj = new ZCiCal($icalfeed);
echo "Number of events found: " . $icalobj->countEvents() . "\n";
$ecount = 0;
// read back icalendar data that was just parsed
if(isset($icalobj->tree->child))
{
foreach($icalobj->tree->child as $node)
{
if($node->getName() == "VEVENT")
{
$ecount++;
echo "Event $ecount:\n";
foreach($node->data as $key => $value)
{
if(is_array($value))
{
for($i = 0; $i < count($value); $i++)
{
$p = $value[$i]->getParameters();
echo " $key: " . $value[$i]->getValues() . "\n";
}
}
else
{
echo " $key: " . $value->getValues() . "\n";
}
}
}
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
* recurringdate.php
*
* @package ZapCalLib
* @author Dan Cogliano <http://zcontent.net>
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://icalendar.org/php-library.html
*/
/**
* Recurring Date Example
*
* Recurring date examples with RRULE property
*
*/
require_once("../zapcallib.php");
$examples =
array(
array(
"name" => "Abraham Lincon's birthday",
"date" => "2015-02-12",
"rule" => "FREQ=YEARLY;INTERVAL=1;BYMONTH=2;BYMONTHDAY=12"
),
array(
"name" => "Start of U.S. Supreme Court Session (1st Monday in October)",
"date" => "2015-10-01",
"rule" => "FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYDAY=1MO"
)
);
// Use maxdate to limit # of infinitely repeating events
$maxdate = strtotime("2021-01-01");
foreach($examples as $example)
{
echo $example["name"] . ":\n";
$rd = new ZCRecurringDate($example["rule"],strtotime($example["date"]));
$dates = $rd->getDates($maxdate);
foreach($dates as $d)
{
echo " " . date('l, F j, Y ',$d) . "\n";
}
echo "\n";
}
+57
View File
@@ -0,0 +1,57 @@
<?php
/**
* simpleevent.php
*
* @package ZapCalLib
* @author Dan Cogliano <http://zcontent.net>
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://icalendar.org/php-library.html
*/
/**
* Simple Event Example
*
* Create a simple iCalendar event
* No time zone specified, so this event will be in UTC time zone
*
*/
require_once("../zapcallib.php");
$title = "Simple Event";
// date/time is in SQL datetime format
$event_start = "2020-01-01 12:00:00";
$event_end = "2020-01-01 13:00:00";
// create the ical object
$icalobj = new ZCiCal();
// create the event within the ical object
$eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);
// add title
$eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $title));
// add start date
$eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($event_start)));
// add end date
$eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($event_end)));
// UID is a required item in VEVENT, create unique string for this event
// Adding your domain to the end is a good way of creating uniqueness
$uid = date('Y-m-d-H-i-s') . "@demo.icalendar.org";
$eventobj->addNode(new ZCiCalDataNode("UID:" . $uid));
// DTSTAMP is a required item in VEVENT
$eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
// Add description
$eventobj->addNode(new ZCiCalDataNode("Description:" . ZCiCal::formatContent(
"This is a simple event, using the Zap Calendar PHP library. " .
"Visit http://icalendar.org to validate icalendar files.")));
// write iCalendar feed to stdout
echo $icalobj->export();
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* timezoneevent.php
*
* @package ZapCalLib
* @author Dan Cogliano <http://zcontent.net>
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://icalendar.org/php-library.html
*/
/**
* Create Event Example With Local Timezone
*
*/
require_once("../zapcallib.php");
$title = "Event in New York timezone";
// date/time is in SQL datetime format
$event_start = "2020-01-01 12:00:00";
$event_end = "2020-01-01 13:00:00";
// timezone must be a supported PHP timezone
// (see http://php.net/manual/en/timezones.php )
// Note: multi-word timezones must use underscore "_" separator
$tzid = "America/New_York";
// create the ical object
$icalobj = new ZCiCal();
// Add timezone data
ZCTimeZoneHelper::getTZNode(substr($event_start,0,4),substr($event_end,0,4),$tzid, $icalobj->curnode);
// create the event within the ical object
$eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);
// add title
$eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $title));
// add start date
$eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($event_start)));
// add end date
$eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($event_end)));
// UID is a required item in VEVENT, create unique string for this event
// Adding your domain to the end is a good way of creating uniqueness
$uid = date('Y-m-d-H-i-s') . "@demo.icalendar.org";
$eventobj->addNode(new ZCiCalDataNode("UID:" . $uid));
// DTSTAMP is a required item in VEVENT
$eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
// write iCalendar feed to stdout
echo $icalobj->export();