Commit dd3efe36 authored by Robert Rollins's avatar Robert Rollins

Issue #2565287: Fixed RDATEs and EXDATEs in exported iCal feeds.

I'm not sure what changed to make the old code stop working (updates to the
Date module, perhaps?), but it was definitely not rendering RDATE and EXDATE
properties correctly. Sadly, RDATEs are still broken in all Apple-based calendar
apps, but that's their fault.
parent 4ee80ea0
......@@ -349,7 +349,9 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
$uri = entity_uri($this->entity_type, $entity);
$uri['options']['absolute'] = TRUE;
$event['url'] = url($uri['path'], $uri['options']);
$event['rrule'] = $is_field && array_key_exists('rrule', $date_field) ? $date_field['rrule'] : '';
if ($is_field && !empty($date_field['rrule'])) {
$event['rrule'] = $date_field['rrule'];
}
if ($location) {
$event['location'] = date_ical_sanitize_text($location);
}
......@@ -361,7 +363,7 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
// If we are using a repeat rule (and not just multi-day events) we
// remove the item from the entities list so that its VEVENT won't be
// re-created.
if ($event['rrule']) {
if (!empty($event['rrule'])) {
$this->entities[$id] = NULL;
}
......
......@@ -256,7 +256,7 @@ class date_ical_plugin_style_ical_feed extends views_plugin_style {
$exdates = array();
foreach ($exceptions as $exception) {
$except = date_ical_date($exception, 'UTC');
date_timezone_set($except, $start['tz']);
$except->setTimezone($start['tz']);
$exception_array = $except->toArray();
$exdates[] = array(
'year' => $exception_array['year'],
......@@ -284,7 +284,7 @@ class date_ical_plugin_style_ical_feed extends views_plugin_style {
$rdates = array();
foreach ($additions as $addition) {
$add = date_ical_date($addition, 'UTC');
date_timezone_set($add, $start['tz']);
$add->setTimezone($start['tz']);
$addition_array = $add->toArray();
$rdate = array(
......@@ -293,9 +293,9 @@ class date_ical_plugin_style_ical_feed extends views_plugin_style {
'day' => $addition_array['day'],
// If the user's copy of Date has support for time in RDATEs,
// use that. Otherwise use the time from the start date.
'hour' => isset($addition_array['hour']) ? $addition_array['hour'] : $start['hour'],
'min' => isset($addition_array['minute']) ? $addition_array['minute'] : $start['minute'],
'second' => isset($addition_array['second']) ? $addition_array['second'] : $start['second'],
'hour' => !empty($addition_array['hour']) ? $addition_array['hour'] : $start['hour'],
'min' => !empty($addition_array['minute']) ? $addition_array['minute'] : $start['minute'],
'second' => !empty($addition_array['second']) ? $addition_array['second'] : $start['second'],
'tz' => $start['tz']->getName(),
);
......@@ -310,9 +310,9 @@ class date_ical_plugin_style_ical_feed extends views_plugin_style {
'day' => $addition_array['day'],
// If the user's copy of Date has support for time in RDATEs,
// use that. Otherwise use the time from the end date.
'hour' => isset($addition_array['hour']) ? $addition_array['hour'] : $end['hour'],
'min' => isset($addition_array['minute']) ? $addition_array['minute'] : $end['minute'],
'second' => isset($addition_array['second']) ? $addition_array['second'] : $end['second'],
'hour' => !empty($addition_array['hour']) ? $addition_array['hour'] : $end['hour'],
'min' => !empty($addition_array['minute']) ? $addition_array['minute'] : $end['minute'],
'second' => !empty($addition_array['second']) ? $addition_array['second'] : $end['second'],
'tz' => $end['tz']->getName(),
);
$rdate = $rdate_with_end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment