..., which // is not printed out by this function. // // $cals = The calendars (entire path, e.g. from availableCalendars). function display_ical_list($cals) { global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang; // Print each calendar option. foreach ($cals as $cal_tmp) { // Format the calendar path for display. // // Only display the calendar name, replace all instances of "32" with " ", // and remove the .ics suffix. $cal_displayname_tmp = basename($cal_tmp); $cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp); $cal_displayname_tmp = substr($cal_displayname_tmp, 0, -4); // If this is a webcal, add 'Webcal' to the display name. if (preg_match("/^(https?|webcal):\/\//i", $cal_tmp)) { $cal_displayname_tmp .= " Webcal"; } // Otherwise, remove all the path information, since that should // not be used to identify local calendars. Also add the calendar // label to the display name. else { // Strip path and .ics suffix. $cal_tmp = basename($cal_tmp); $cal_tmp = substr($cal_tmp, 0, -4); // Add calendar label. $cal_displayname_tmp .= " $calendar_lang"; } // Encode the calendar path. $cal_encoded_tmp = urlencode($cal_tmp); // Display the option. // // The submitted calendar will be encoded, and always use http:// // if it is a webcal. So that is how we perform the comparison when // trying to figure out if this is the selected calendar. $cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp); if ($cal_httpPrefix_tmp == urldecode($cal)) { $return .= ""; } else { $return .= ""; } } // option to open all (non-web) calenders together if ($cal == $ALL_CALENDARS_COMBINED) { $return .= ""; } else { $return .= ""; } return $return; }