$gmt_start = $_GET['eventsStart']; $gmt_end = $_GET['eventsEnd']; if ($icsOptions['limit_type'] == 'days') { $gmt_start += (int) $icsOptions['event_limit'] * 24 * 3600 * (int) $_GET['eventsPage']; $gmt_end += (int) $icsOptions['event_limit'] * 24 * 3600 * (int) $_GET['eventsPage']; $icsOptions['event_limit'] = 0; $start = 0; } else { $gmt_end = NULL; $start = $icsOptions['event_limit'] * (int) $_GET['eventsPage']; $icsOptions['event_limit'] = $icsOptions['event_limit'] * ((int) $_GET['eventsPage'] + 1); } $output = ICalEvents::display_events(unserialize(base64_decode($_GET['eventsFile'])), $gmt_start, $gmt_end, $icsOptions['event_limit'], $start, $_GET['uuid']); echo $output; exit; } if (isset($_GET['downloadEvent'])) { $options = get_option(ADMIN_OPTIONS_NAME); $calendars = unserialize($options['ics_files']); $events = ICalEvents::get_event($calendars[$_GET['calendarID']], $_GET['downloadEvent']); header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=calendar-event.ics"); echo "BEGIN:VCALENDAR\n"; echo "PRODID:ICS Calendar for Wordpress (fullimpact.net)\n"; foreach ($events as $event) { echo "BEGIN:VEVENT\n"; echo utf8_decode(implode("\n", $event['raw'])) . "\n"; } echo "END:VCALENDAR\n"; exit; }
function display_one_event($url, $UID) { $icsOptions = get_option(ADMIN_OPTIONS_NAME); $date_format = $icsOptions['date_format']; $time_format = $icsOptions['time_format']; $events = ICalEvents::get_event($url, $UID); $event = array_pop($events); $output = '<div class="ics-event-item">'; $output .= '<strong>'; $save_date_format = $date_format; if (date('Y', $event['StartTime']) != date('Y') && $icsOptions['date_format_add_year'] == '1') { if ($icsOptions['date_function'] == 'date') { $date_format .= ', Y'; } else { $date_format .= ', %Y'; } } if (ICalEvents::is_all_day($event['StartTime'], $event['EndTime'])) { $output .= ICalEvents::fdate($date_format, $event['StartTime']); } else { $output .= ICalEvents::format_date_range($event['StartTime'], $event['EndTime'], $event['Untimed'], $date_format, $time_format); } $output .= '</strong>: '; if (!empty($event['Summary'])) { $output .= '<i>'; if ($event['URL']) { $output .= '<a href="' . $event['URL'] . '">'; } $output .= $event['Summary']; if ($event['URL']) { $output .= '</a>'; } $output .= '</i><br />'; } if (!empty($event['Description'])) { $output .= nl2br(trim($event['Description'])); } if (!empty($event['Location'])) { $output .= ' (' . $event['Location'] . ')'; } if (!empty($event['UID'])) { //$output .= '<!-- ' . htmlentities($event['UID']) . ' -->'; } $output .= '</div>' . "\n"; return $output; }