You are here

function date_ical_parse_location in Date 6.2

Same name and namespace in other branches
  1. 5.2 date_api_ical.inc \date_ical_parse_location()
  2. 7.3 date_api/date_api_ical.inc \date_ical_parse_location()
  3. 7 date_api/date_api_ical.inc \date_ical_parse_location()
  4. 7.2 date_api/date_api_ical.inc \date_ical_parse_location()

Parse location elements.

Catch situations like the upcoming.org feed that uses LOCATION;VENUE-UID="http://upcoming.yahoo.com/venue/104/":111 First Street... or more normal LOCATION;UID=123:111 First Street... Upcoming feed would have been improperly broken on the ':' in http:// so we paste the $field and $data back together first.

Use non-greedy check for ':' in case there are more of them in the address.

1 call to date_ical_parse_location()
date_ical_parse in ./date_api_ical.inc
Returns an array of iCalendar information from an iCalendar file.

File

./date_api_ical.inc, line 577
Parse iCal data.

Code

function date_ical_parse_location($field, $data) {
  if (preg_match('/UID=[?"](.+)[?"][*?:](.+)/', $field . ':' . $data, $matches)) {
    $location = array();
    $location['UID'] = $matches[1];
    $location['DESCRIPTION'] = stripslashes($matches[2]);
    return $location;
  }
  else {

    // Remove other escaping.
    $location = stripslashes($data);
    return $location;
  }
}