Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi #5

Merged
44 commits merged into from Nov 1, 2010
Merged

Hi #5

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8b5be46
use PHP 5.2+ DateTimeZone objects if available to get active daylight…
tpruvot Oct 29, 2010
760418f
add missing requires
tpruvot Oct 29, 2010
f1ca86f
fix to build Recurrence
tpruvot Oct 29, 2010
decebcd
build.cmd (need gnuwin32)
tpruvot Oct 29, 2010
f28be0b
fix warnings for optional regexp blocks
tpruvot Oct 29, 2010
5b5012f
fix remaining $evs
tpruvot Oct 29, 2010
3181917
variable for build output
tpruvot Oct 29, 2010
107781f
fix recurrent events Between() query, could break $evt->getEnd() but …
tpruvot Oct 29, 2010
67bf66c
i hate private $vars :p replaced by protected
tpruvot Oct 29, 2010
d7bc4df
ignore built file
tpruvot Oct 29, 2010
ab7336d
- new method getRangeEnd() to get end of recurrence of event, fixed B…
tpruvot Oct 29, 2010
43661c4
comment header : added github url and fixed sample
tpruvot Oct 29, 2010
9c3d8d9
fix date format modifier
tpruvot Oct 29, 2010
8ddf2c8
change order of requires
tpruvot Oct 29, 2010
0cd26e1
public objects, they are protected themself
tpruvot Oct 29, 2010
911a6b6
check duration regexp result and ignore only common warning
tpruvot Oct 29, 2010
8719799
added test.sh for unit tests
tpruvot Oct 29, 2010
233c4d9
update test, event getEnd() was modified
tpruvot Oct 29, 2010
3d4447f
fix duration parsing if regexp fails - added some Duration Unit Tests
tpruvot Oct 29, 2010
d363577
keep full string to parse Freq
tpruvot Oct 29, 2010
bd10ff1
add setUntil() method
tpruvot Oct 29, 2010
5b81d5e
fix nextOccurrence() loop
tpruvot Oct 29, 2010
93a165f
set until on unlimited repeats, to be included in Between()
tpruvot Oct 29, 2010
90db32c
Fullcalendar demo with a sample google iCal file
tpruvot Oct 29, 2010
e81a439
nextOccurrence < start check
tpruvot Oct 29, 2010
7ddf89a
fix last occurrence of an event (one was missing)
tpruvot Oct 30, 2010
8f7f806
DateTimeZone class removed, using date_default_timezone_set
tpruvot Oct 30, 2010
f9e8612
add event method : isWholeDay()
tpruvot Oct 30, 2010
e03b95f
code cleanup
tpruvot Oct 30, 2010
dd982d5
fix bad test and link iCalFreq in event to get last occurrence date
tpruvot Oct 30, 2010
ca0dcc1
implement frequency cache, actually only set in some cases : count re…
tpruvot Oct 30, 2010
642115b
new getAllOccurrences() method which also set cache, now use cache in…
tpruvot Oct 30, 2010
5743c62
implement EXDATE exclusions
tpruvot Oct 30, 2010
de4a9e8
v0.7.0
tpruvot Oct 30, 2010
768197b
README v0.7.0
tpruvot Oct 30, 2010
1a63569
fix and reenable cache creation when possible
tpruvot Oct 30, 2010
d156154
some tests for cache
tpruvot Oct 30, 2010
ff9c8e2
updated README
tpruvot Oct 31, 2010
30d1dfa
fix excluded first dates
tpruvot Oct 31, 2010
b7c6351
spaces cleanup
tpruvot Oct 31, 2010
b049433
multiple keys like exdate set in an array
tpruvot Oct 31, 2010
8079db3
add support for EXDATE arrays : EXDATE;VALUE=DATE:20100909,20100910
tpruvot Oct 31, 2010
9536622
updated demo code
tpruvot Oct 31, 2010
1ae7b29
RDATE support
tpruvot Oct 31, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@

/sgical.php
52 changes: 52 additions & 0 deletions README
@@ -0,0 +1,52 @@
A simple and fast iCal parser.
-------------------------------------------------------------------------------
http://github.com/tpruvot/PHP-iCal
fork from http://github.com/fangel/SG-iCalendar
-------------------------------------------------------------------------------

A simple example :
$ical = new SG_iCalReader( "./basic.ics" );
//or
$ical = new SG_iCalReader( "http://example.com/calendar.ics" );
foreach( $ical->getEvents() As $event ) {
// Do stuff with the event $event
}

To check unit tests with phpunit, goto tests/ directory and :
phpunit AllTests
phpunit helpers/FreqTest

-------------------------------------------------------------------------------
CHANGELOG :
-------------------------------------------------------------------------------

current (31 oct 2010)
+ ical RDATE support (added dates in a range)
+ RDATE and EXDATE arrays support

0.7.0-tpr (30 oct 2010)
+ ical EXDATE support (excluded dates in a range)
+ $event->isWholeDay()
+ getAllOccurrences() for repeated events
+ implemented a cache for repeated events

0.6.0-tpr (29 oct 2010)
+ Added demo based on fullcalendar
+ Added duration unit tests
+ Support of Recurrent events in query Between()
* various fixes on actual (5) issues

-------------------------------------------------------------------------------
TODO :
-------------------------------------------------------------------------------

These iCal keywords are not supported for the moment :
- RECURRENCE-ID : to move one event from a recurrence
- EXRULE : to exclude multiple days by a complex rule

Also, multiple RRULE could be specified for an event,
but that is not the case for most calendar applications

-------------------------------------------------------------------------------
To get more information about ical format and rules :
see http://www.ietf.org/rfc/rfc2445.txt
25 changes: 15 additions & 10 deletions SG_iCal.php
@@ -1,17 +1,18 @@
<?php

define('SG_ICALREADER_VERSION', '0.5');
define('SG_ICALREADER_VERSION', '0.7.0-tpruvot');

/**
* A simple iCal parser. Should take care of most stuff for ya
* http://github.com/tpruvot/PHP-iCal
*
* Roadmap:
* * Finish FREQUENCY-parsing.
* * Add API for recurring events
*
* A simple example:
* <?php
* $ical = new SG_iCal("http://example.com/calendar.ics");
* $ical = new SG_iCalReader("http://example.com/calendar.ics");
* foreach( $ical->getEvents() As $event ) {
* // Do stuff with the event $event
* }
Expand All @@ -22,23 +23,27 @@
* @license http://creativecommons.org/licenses/by-sa/2.5/dk/deed.en_GB CC-BY-SA-DK
*/
class SG_iCal {
private $information;
private $events;
private $timezones;

//objects
public $information; //SG_iCal_VCalendar
public $timezones; //SG_iCal_VTimeZone

protected $events; //SG_iCal_VEvent[]

/**
* Constructs a new iCalReader. You can supply the url now, or later using setUrl
* @param $url string
*/
public function __construct($url = false) {
require_once dirname(__FILE__) . '/helpers/SG_iCal_Factory.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Line.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Query.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Duration.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Freq.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Recurrence.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Parser.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Query.php'; // BUILD: Remove line
require_once dirname(__FILE__) . '/helpers/SG_iCal_Factory.php'; // BUILD: Remove line

if( $url !== false ) {
SG_iCal_Parser::Parse($url, $this);
}
$this->setUrl($url);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions blocks/SG_iCal_VCalendar.php
Expand Up @@ -10,17 +10,17 @@
* @license http://creativecommons.org/licenses/by-sa/2.5/dk/deed.en_GB CC-BY-SA-DK
*/
class SG_iCal_VCalendar implements IteratorAggregate {
private $data;
protected $data;

/**
* Creates a new SG_iCal_VCalendar.
*/
public function __construct($data) {
$this->data = $data;
}

/**
* Returns the title of the calendar. If no title is known, NULL
* Returns the title of the calendar. If no title is known, NULL
* will be returned
* @return string
*/
Expand All @@ -31,7 +31,7 @@ public function getTitle() {
return null;
}
}

/**
* Returns the description of the calendar. If no description is
* known, NULL will be returned.
Expand All @@ -44,7 +44,7 @@ public function getDescription() {
return null;
}
}

/**
* @see IteratorAggregate.getIterator()
*/
Expand Down