You are here

function date_repeat_split_rrule in Date 6

Same name and namespace in other branches
  1. 5.2 date_repeat/date_repeat.module \date_repeat_split_rrule()
  2. 6.2 date_repeat/date_repeat.module \date_repeat_split_rrule()
  3. 7.3 date_repeat/date_repeat.module \date_repeat_split_rrule()
  4. 7 date_repeat/date_repeat.module \date_repeat_split_rrule()
  5. 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_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.
_date_repeat_widget_validate in date/date_repeat.inc
Validation for date repeat form element.

File

date_repeat/date_repeat.module, line 237
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();
  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']);
    }
  }
  return array(
    $rrule,
    $exceptions,
  );
}