function date_ical_parse_rrule in Date 6.2
Same name and namespace in other branches
- 5.2 date_api_ical.inc \date_ical_parse_rrule()
- 6 date_api_ical.inc \date_ical_parse_rrule()
- 7.3 date_api/date_api_ical.inc \date_ical_parse_rrule()
- 7 date_api/date_api_ical.inc \date_ical_parse_rrule()
- 7.2 date_api/date_api_ical.inc \date_ical_parse_rrule()
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
4 calls to date_ical_parse_rrule()
- date_ical_parse in ./
date_api_ical.inc - Returns an array of iCalendar information from an iCalendar file.
- date_repeat_build_dates in date/
date_repeat.inc - Helper function to build repeating dates from a $node_field.
- date_repeat_split_rrule in date_repeat/
date_repeat.module - Parse an iCal rule into a parsed RRULE array and an EXDATE array.
- _date_repeat_calc in date_repeat/
date_repeat_calc.inc - Private implementation of date_repeat_calc().
File
- ./
date_api_ical.inc, line 464 - Parse iCal data.
Code
function date_ical_parse_rrule($field, $data) {
$data = preg_replace("/RRULE.*:/", '', $data);
$items = array(
'DATA' => $data,
);
$rrule = explode(';', $data);
foreach ($rrule as $key => $value) {
$param = explode('=', $value);
// Must be some kind of invalid data.
if (count($param) != 2) {
continue;
}
if ($param[0] == 'UNTIL') {
$values = date_ical_parse_date('', $param[1]);
}
else {
$values = explode(',', $param[1]);
}
// Treat items differently if they have multiple or single values.
if (in_array($param[0], array(
'FREQ',
'INTERVAL',
'COUNT',
'WKST',
))) {
$items[$param[0]] = $param[1];
}
else {
$items[$param[0]] = $values;
}
}
return $items;
}