function date_repeat_split_rrule in Date 7
Same name and namespace in other branches
- 5.2 date_repeat/date_repeat.module \date_repeat_split_rrule()
- 6.2 date_repeat/date_repeat.module \date_repeat_split_rrule()
- 6 date_repeat/date_repeat.module \date_repeat_split_rrule()
- 7.3 date_repeat/date_repeat.module \date_repeat_split_rrule()
- 7.2 date_repeat/date_repeat.module \date_repeat_split_rrule()
Parse an iCal rule into a parsed RRULE array and an EXDATE array.
3 calls to date_repeat_split_rrule()
- date_repeat_build_dates in ./
date_repeat.inc - Helper function to build repeating dates from a $node_field.
- date_repeat_rrule_description in date_repeat/
date_repeat.module - Build a description of an iCal rule.
- _date_repeat_rrule_process in date_repeat/
date_repeat_form.inc - Generate the repeat setting form.
File
- date_repeat/
date_repeat.module, line 264 - This module creates a form element that allows users to select repeat rules for a date, and reworks the result into an iCal RRULE string that can be stored in the database.
Code
function date_repeat_split_rrule($rrule) {
$parts = explode("\n", $rrule);
$rrule = array();
$exceptions = array();
$additions = array();
$additions = array();
foreach ($parts as $part) {
if (strstr($part, 'RRULE')) {
$RRULE = str_replace('RRULE:', '', $part);
$rrule = (array) date_ical_parse_rrule('RRULE:', $RRULE);
}
elseif (strstr($part, 'EXDATE')) {
$EXDATE = str_replace('EXDATE:', '', $part);
$exceptions = (array) date_ical_parse_exceptions('EXDATE:', $EXDATE);
unset($exceptions['DATA']);
}
elseif (strstr($part, 'RDATE')) {
$RDATE = str_replace('RDATE:', '', $part);
$additions = (array) date_ical_parse_exceptions('RDATE:', $RDATE);
unset($additions['DATA']);
}
}
return array(
$rrule,
$exceptions,
$additions,
);
}