Projet

Général

Profil

Révision 62e0cc08

Ajouté par Assos Assos il y a plus de 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date_ical/libraries/ParserVcalendar.inc
504 504
    $rrule = trim(preg_replace('/\s/', '', $vcalendar_component->createRrule()));
505 505
    $rdate = trim(preg_replace('/\s/', '', $vcalendar_component->createRdate()));
506 506
    $exrule = trim(preg_replace('/\s/', '', $vcalendar_component->createExrule()));
507
    $exdate = trim(preg_replace('/\s/', '', $vcalendar_component->createExdate()));
507

  
508
    // Modules such as Date Repeat, as well as our parsing functions, generally
509
    // expect a single EXDATE entry for optimal operation. If we have multiple
510
    // entries in the data, we should concatenate them here.
511
    $parsed_exdate = trim(preg_replace('/\s/', '', $vcalendar_component->createExdate()));
512

  
513
    // First, get the individual contents of any definitions. It's OK even if
514
    // there is only one.
515
    $exdate_parts = explode('EXDATE;', $parsed_exdate);
516
    array_shift($exdate_parts); // First element always blank.
517

  
518
    // Extended parameters such as VALUE and TZID are set in the first EXDATE
519
    // The other ones must not repeat them. We skip the first entry when
520
    // enforcing this, obviously.
521
    $skip = TRUE;
522
    foreach ($exdate_parts as &$exdate_part) {
523
      if ($skip) {
524
        $skip = FALSE;
525
        continue;
526
      }
527

  
528
      // This strips off the part before the colon, since we only want the value
529
      // from the first EXDATE entry. end() wants a real array, hence why two
530
      // lines.
531
      $exdate_part_parts = explode(':', $exdate_part);
532
      $exdate_part = end($exdate_part_parts);
533
    }
534

  
535
    // Combine the parts back together with an EXDATE; specifier in front.
536
    $exdate = !empty($exdate_parts) ? 'EXDATE;' . implode(',', $exdate_parts) : '';
508 537

  
509 538
    return "$rrule|$rdate|$exrule|$exdate";
510 539
  }

Formats disponibles : Unified diff