You are here

public static function DateiCalParse::split_rrule in Date 8

Parse an iCal rule into a parsed RRULE array, along with EXDATE and RDATE arrays.

3 calls to DateiCalParse::split_rrule()
date_repeat_build_dates in date_repeat_field/date_repeat_field.module
Helper function to build repeating dates from an $entity 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_api/lib/Drupal/date_api/DateiCalParse.php, line 660
Parse iCal data.

Class

DateiCalParse
Return an array of iCalendar information from an iCalendar file.

Namespace

Drupal\date_api

Code

public static function split_rrule($rrule) {
  $parts = self::split_multiline_entry($rrule);
  $rrule = array();
  $exceptions = array();
  $additions = array();
  $additions = array();
  foreach ($parts as $part) {
    if (strstr($part, 'RRULE')) {
      $RRULE = str_replace('RRULE:', '', $part);
      $rrule = (array) self::parse_rrule($RRULE);
    }
    elseif (strstr($part, 'EXDATE')) {
      $EXDATE = str_replace('EXDATE:', '', $part);
      $exceptions = (array) DateiCalParse::parse_exceptions($EXDATE);
      unset($exceptions['DATA']);
    }
    elseif (strstr($part, 'RDATE')) {
      $RDATE = str_replace('RDATE:', '', $part);
      $additions = (array) DateiCalParse::parse_exceptions($RDATE);
      unset($additions['DATA']);
    }
  }
  return array(
    $rrule,
    $exceptions,
    $additions,
  );
}