You are here

function date_ical_parse_rule in Date 5

Parse an ical repeat rule.

Return value

array Array in the form of PROPERTY => array(VALUES) PROPERTIES include FREQ, INTERVAL, COUNT, BYDAY, BYMONTH, BYYEAR, UNTIL

1 call to date_ical_parse_rule()
date_ical_import in ./date_api_ical.inc
Return an array of iCalendar information from an iCalendar file.

File

./date_api_ical.inc, line 398
Parse iCal imports and create iCal exports. This file must be included when these functions are needed.

Code

function date_ical_parse_rule($field, $data) {
  $items = array(
    'DATA' => $data,
  );
  $rule = explode(';', $data);
  foreach ($rule as $key => $value) {
    $param = explode('=', $value);
    if ($param[0] == 'UNTIL') {
      $values = date_ical_parse_date('', $param[1]);
    }
    else {
      $values = explode(',', $param[1]);
    }
    $items[$param[0]] = $values;
  }
  return $items;
}