You are here

function _date_ical_parse_repeat_dates in Date iCal 7.3

Parses an iCal RDATE or EXDATE, including multi-property rules.

Parameters

string $repeat_date_string: An RDATE or EXDATE property string, e.g. "EXDATE;TZID=America/Los_Angeles:20130415T180000,20130422T180000" Can be multiple EXDATE or RDATE properties, separated by newlines.

Return value

array An array of dates returned by date_ical_parse_date().

1 call to _date_ical_parse_repeat_dates()
_date_ical_get_repeat_dates in ./date_ical.utils.inc
Parse the repeat data into date values.

File

./date_ical.utils.inc, line 172
Utility functions for Date iCal. Many of these are re-writes of buggy Date module code.

Code

function _date_ical_parse_repeat_dates($repeat_date_string) {
  module_load_include('inc', 'date_api', 'date_api_ical');
  $properties = explode("\n", str_replace("\r\n", "\n", $repeat_date_string));
  $parsed_dates = array();
  foreach ($properties as $property) {
    $matches = array();
    if (preg_match('/(R|EX)DATE([^:]*):(.*)/', $property, $matches)) {
      $params = $matches[2];
      foreach (explode(',', $matches[3]) as $date) {
        $parsed_dates[] = date_ical_parse_date($params, $date);
      }
    }
  }
  return $parsed_dates;
}