Projet

Général

Profil

Révision ca0757b9

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date_ical/libraries/ParserVcalendar.inc
33 33
  protected $totalComponents = 0;
34 34
  protected $lastComponentParsed = 0;
35 35
  
36
  /**
37
   * This is the list of iCal properties which are allowed to have more than
38
   * one entry in a single VEVENT. If we ever support parsing more than just
39
   * the first one, this listing will be useful.
40
   */
41
  protected $multi_entry_properties = array(
42
    'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION',
43
    'EXDATE', 'EXRULE', 'FREEBUSY', 'RDATE', 'RELATED-TO', 'RESOURCES',
44
    'RRULE', 'REQUEST-STATUS', 'TZNAME', 'X-PROP'
45
  );
46
  
36 47
  /**
37 48
   * Constructor.
38 49
   */
......
123 134
          else {
124 135
            // We can safely ignore certain sources.
125 136
            $known_unknowns = array(
126
              // "Black Source 1" is from Feeds Tamper.
127
              'Blank source 1',
137
              'Blank source 1', // "Black Source 1" is from Feeds Tamper.
138
              'parent:nid', // Defined in FeedsParser
139
              'parent:uid', // Defined in FeedsParser
128 140
            );
129 141
            if (!in_array($property_key, $known_unknowns)) {
130 142
              // Only warn the user if this mapping source is in use.
......
180 192
    return $this->lastComponentParsed;
181 193
  }
182 194
  
195
  /**
196
   * Handler that parses GEO fields.
197
   *
198
   * @return array
199
   *   The latitude and longitude values, keyed by 'lat' and 'lon'.
200
   */
201
  public function parseGeofield($property_key, $vcalendar_component) {
202
    $geo = array();
203
    if (!empty($vcalendar_component->geo['value'])) {
204
      $geo['lat'] = $vcalendar_component->geo['value']['latitude'];
205
      $geo['lon'] = $vcalendar_component->geo['value']['longitude'];
206
    }
207
    return $geo;
208
  }
209
  
183 210
  /**
184 211
   * Handler that parses text fields.
185 212
   *
......
188 215
   */
189 216
  public function parseTextProperty($property_key, $vcalendar_component) {
190 217
    $text = $vcalendar_component->getProperty($property_key);
218
    // In case someone writes a hook that adds a source for a multi-entry
219
    // property and a parameter of that same property, we need to force
220
    // iCalcreator to assume it has not accessed that property, yet.
221
    // TODO: This is really just a hack. If/when multi-entry properties
222
    // become supported, this will need to be redesigned.
223
    if (in_array($property_key, $this->multi_entry_properties)) {
224
      unset($vcalendar_component->propix[$property_key]);
225
    }
226
    
191 227
    if ($text === FALSE) {
192 228
      if ($property_key == 'SUMMARY') {
193 229
        $uid = $vcalendar_component->getProperty('UID');
......
201 237
    return $text;
202 238
  }
203 239
  
204
  /**
205
   * Handler that parses GEO fields.
206
   *
207
   * @return array
208
   *   The latitude and longitude values, keyed by 'lat' and 'lon'.
209
   */
210
  public function parseGeofield($property_key, $vcalendar_component) {
211
    $geo = array();
212
    if (!empty($vcalendar_component->geo['value'])) {
213
      $geo['lat'] = $vcalendar_component->geo['value']['latitude'];
214
      $geo['lon'] = $vcalendar_component->geo['value']['longitude'];
215
    }
216
    return $geo;
217
  }
218
  
219 240
  /**
220 241
   * Handler that parses field parameters.
221 242
   *
......
225 246
  public function parsePropertyParameter($property_key, $vcalendar_component) {
226 247
    list($key, $attr) = explode(':', $property_key);
227 248
    $property = $vcalendar_component->getProperty($key, FALSE, TRUE);
249
    // See parseTextProperty() for why this is here.
250
    if (in_array($property_key, $this->multi_entry_properties)) {
251
      unset($vcalendar_component->propix[$property_key]);
252
    }
253
        
228 254
    if ($property === FALSE) {
229 255
      // If the component doesn't have this property, return NULL.
230 256
      return NULL;
......
422 448
        $rrule_data['value']['INTERVAL'] = '1';
423 449
      }
424 450
      
425
      if (!isset($rrule_data['value']['COUNT']) && !isset($rrule_data['value']['UNTIL'])) {
451
      if ((!isset($rrule_data['value']['COUNT']) && !isset($rrule_data['value']['UNTIL']))) {
426 452
        $msg = "The event with UID %uid has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.
427 453
          As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.";
428 454
        watchdog('date_ical', $msg, array('%uid' => $uid, '@count' => $count), WATCHDOG_WARNING);
429
        drupal_set_message(
430
          t("At least one of the events in this iCal feed has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.<br>
431
            As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.",
432
          array('@count' => $count)),
433
          'warning',
434
          FALSE
435
        );
455
        if ($this->config['indefinite_message_display']) {
456
          drupal_set_message(
457
            t("At least one of the events in this iCal feed has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.<br>
458
              As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.",
459
            array('@count' => $count)),
460
            'warning',
461
            FALSE
462
          );
463
        }
436 464
        $rrule_data['value']['COUNT'] = $this->config['indefinite_count'];
437 465
      }
438 466
    }

Formats disponibles : Unified diff