Validate/fix dates only for event objects; don't export default values
This commit is contained in:
parent
2654abfcaf
commit
17dbcd9c9f
1 changed files with 21 additions and 18 deletions
|
@ -191,7 +191,6 @@ class libvcalendar
|
||||||
'changed' => null,
|
'changed' => null,
|
||||||
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
|
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
|
||||||
// set defaults
|
// set defaults
|
||||||
'free_busy' => 'busy',
|
|
||||||
'priority' => 0,
|
'priority' => 0,
|
||||||
'attendees' => array(),
|
'attendees' => array(),
|
||||||
);
|
);
|
||||||
|
@ -350,6 +349,8 @@ class libvcalendar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate event dates
|
||||||
|
if ($event['_type'] == 'event') {
|
||||||
// check for all-day dates
|
// check for all-day dates
|
||||||
if ($event['start']->_dateonly) {
|
if ($event['start']->_dateonly) {
|
||||||
$event['allday'] = true;
|
$event['allday'] = true;
|
||||||
|
@ -367,6 +368,7 @@ class libvcalendar
|
||||||
else if ($event['end'] < $event['start']) {
|
else if ($event['end'] < $event['start']) {
|
||||||
$event['end'] = clone $event['start'];
|
$event['end'] = clone $event['start'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make organizer part of the attendees list for compatibility reasons
|
// make organizer part of the attendees list for compatibility reasons
|
||||||
if (!empty($event['organizer']) && is_array($event['attendees'])) {
|
if (!empty($event['organizer']) && is_array($event['attendees'])) {
|
||||||
|
@ -610,6 +612,7 @@ class libvcalendar
|
||||||
$ve->add($cat);
|
$ve->add($cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($event['free_busy']))
|
||||||
$ve->add('TRANSP', $event['free_busy'] == 'free' ? 'TRANSPARENT' : 'OPAQUE');
|
$ve->add('TRANSP', $event['free_busy'] == 'free' ? 'TRANSPARENT' : 'OPAQUE');
|
||||||
|
|
||||||
if ($event['priority'])
|
if ($event['priority'])
|
||||||
|
@ -625,7 +628,7 @@ class libvcalendar
|
||||||
if (!empty($event['sensitivity']))
|
if (!empty($event['sensitivity']))
|
||||||
$ve->add('CLASS', strtoupper($event['sensitivity']));
|
$ve->add('CLASS', strtoupper($event['sensitivity']));
|
||||||
|
|
||||||
if (isset($event['complete'])) {
|
if (!empty($event['complete'])) {
|
||||||
$ve->add('PERCENT-COMPLETE', intval($event['complete']));
|
$ve->add('PERCENT-COMPLETE', intval($event['complete']));
|
||||||
// Apple iCal required the COMPLETED date to be set in order to consider a task complete
|
// Apple iCal required the COMPLETED date to be set in order to consider a task complete
|
||||||
if ($event['complete'] == 100)
|
if ($event['complete'] == 100)
|
||||||
|
|
Loading…
Add table
Reference in a new issue