You are here

public static function DateiCalParse::parse_location in Date 8

Parse location elements.

Catch situations like the upcoming.org feed that uses LOCATION;VENUE-UID="http://upcoming.yahoo.com/venue/104/":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 DateiCalParse::parse_location()
DateiCalParse::parse in date_api/lib/Drupal/date_api/DateiCalParse.php
Returns an array of iCalendar information from an iCalendar file.

File

date_api/lib/Drupal/date_api/DateiCalParse.php, line 562
Parse iCal data.

Class

DateiCalParse
Return an array of iCalendar information from an iCalendar file.

Namespace

Drupal\date_api

Code

public static function parse_location($data, $field = 'LOCATION:') {
  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;
  }
}