if (is_array($field)) { $line .= '"' . str_replace(array("\n", "\r", '"'), array('\\n', '', '""'), join(',', $field)) . '";'; } else { $line .= '"' . str_replace(array("\n", "\r", '"'), array('\\n', '', '""'), $field) . '";'; } } if ($first === true) { echo trim($description, ';') . "\n"; $first = false; } echo trim($line, ';') . "\n"; } } else { // create ical array// $iCal = new File_iCal(); $cal = $iCal->getSkeletonCalendar(); foreach ($events as $event) { $ea = array(); $ea['Summary'] = $event['name']; $ea['dateStart'] = $event['start']; $ea['dateEnd'] = $event['end']; $ea['Description'] = preg_replace('/\\n/', "\\n", strip_tags(TikiLib::lib('parser')->parse_data($event['description'], array('is_html' => $prefs['calendar_description_is_html'] === 'y')))); if ($event['participants']) { $ea['Attendees'] = $event['participants']; } $ea['LastModified'] = $event['lastModif']; // re: Second character of duration value must be a 'P' ?? // jb for tiki 11 - feb 2013 // spec is at: https://tools.ietf.org/html/rfc5545#section-3.3.6, so i tried: // $durationSeconds = $event['end'] - $event['start']; // $duration = $durationSeconds > 0 ? '+' : '-';