function get_events($url, $gmt_start = null, $gmt_end = null, $limit = null) { if ($url == '') { return "<i>" . __('There is no calendar set. Please review the calendar settings.', 'WPICSImporter') . "</i>"; } if (!is_array($url)) { $url = array($url); } $allEvents = array(); $calID = 1; foreach ($url as $u) { $file = ICalEvents::cache_url($u); if (!$file) { return "<i>" . sprintf(__('iCal Events: Error loading [%s]', 'WPICSImporter'), $url) . "</i>"; } $events = ics_import_parse($file); foreach ($events as $k => $na) { $events[$k]['calID'] = $calID; } $allEvents = array_merge($allEvents, $events); $calID++; } $events = $allEvents; $events = ICalEvents::constrain($events, $gmt_start, $gmt_end, $limit); //usort($events, array('ICalEvents', 'sortEvents')); if (!is_array($events) || count($events) <= 0) { return "<i>There are no events.</i>"; //"iCal Events: Error parsing calendar [$url]"; } return $events; }