Révision 55670b15
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/date_ical/includes/DateiCalFeedsParser.inc | ||
---|---|---|
34 | 34 |
throw new DateIcalException(t('Parsing the data from %url failed. Please ensure that this URL leads to a valid iCal feed.', array('%url' => $url))); |
35 | 35 |
} |
36 | 36 |
|
37 |
// Total hack to get around iCalcreator's mistreatment of UID "0". |
|
38 |
if (empty($calendar->components[0]->uid) || empty($calendar->components[0]->uid['value'])) { |
|
39 |
$calendar->components[0]->uid = array('value' => 'zero', 'params' => NULL); |
|
40 |
} |
|
41 |
|
|
37 | 42 |
// Allow modules to alter the vcalendar object before we interpret it. |
38 | 43 |
$context = array( |
39 | 44 |
'source' => $source, |
... | ... | |
69 | 74 |
public function sourceDefaults() { |
70 | 75 |
return array( |
71 | 76 |
'indefinite_count' => $this->config['indefinite_count'], |
77 |
'until_not_utc' => $this->config['until_not_utc'], |
|
78 |
'skip_days' => $this->config['skip_days'], |
|
72 | 79 |
); |
73 | 80 |
} |
74 | 81 |
|
... | ... | |
78 | 85 |
public function configDefaults() { |
79 | 86 |
return array( |
80 | 87 |
'indefinite_count' => '52', |
88 |
'until_not_utc' => FALSE, |
|
89 |
'skip_days' => NULL, |
|
81 | 90 |
); |
82 | 91 |
} |
83 | 92 |
|
... | ... | |
98 | 107 |
'#description' => t('Indefinitely repeating events are not supported. The repeat count will instead be set to this number.'), |
99 | 108 |
'#default_value' => $this->config['indefinite_count'], |
100 | 109 |
); |
110 |
$form['until_not_utc'] = array( |
|
111 |
'#title' => t('RRULE UNTILs are not in UTC'), |
|
112 |
'#type' => 'checkbox', |
|
113 |
'#description' => t('Enable this setting if your reccuring events are not repeating the correct number of times. ' . |
|
114 |
'The iCal spec requires that the UNTIL value in an RRULE almost always be specified in UTC, but some iCal feed creators fail to follow that rule ' . |
|
115 |
'(the UNTIL values in those feeds\' RRULEs don\'t end is "Z"). This causes the UNTIL value to be off by several hours, ' . |
|
116 |
'which can cause the repeat calculator to miss or add repeats.'), |
|
117 |
'#default_value' => $this->config['until_not_utc'], |
|
118 |
); |
|
119 |
$form['skip_days'] = array( |
|
120 |
'#title' => t('Skip events more than X days old'), |
|
121 |
'#type' => 'textfield', |
|
122 |
'#size' => 5, |
|
123 |
'#description' => t('Set this value to any positive integer (or 0) to skip events which ended more than that many days before the import. ' . |
|
124 |
'Leave it blank to import all events.'), |
|
125 |
'#default_value' => $this->config['skip_days'], |
|
126 |
); |
|
101 | 127 |
return $form; |
102 | 128 |
} |
103 | 129 |
|
130 |
/** |
|
131 |
* Validation handler for configForm. |
|
132 |
*/ |
|
133 |
public function configFormValidate(&$source_config) { |
|
134 |
if (!preg_match('/^\d+$/', $source_config['skip_days']) && $source_config['skip_days'] !== '') { |
|
135 |
form_set_error('skip_days', 'You must enter a positive integer.'); |
|
136 |
} |
|
137 |
if ($source_config['skip_days'] === '') { |
|
138 |
$source_config['skip_days'] = NULL; |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
104 | 142 |
/** |
105 | 143 |
* Creates the list of mapping sources offered by DateiCalFeedsParser. |
106 | 144 |
*/ |
... | ... | |
127 | 165 |
'date_ical_parse_handler' => 'parseDateTimeProperty', |
128 | 166 |
); |
129 | 167 |
$sources['RRULE'] = array( |
130 |
'name' => t('Repeat Rule'), |
|
168 |
'name' => t('Date: Repeat Rule'),
|
|
131 | 169 |
'description' => t('The RRULE property. Describes when and how often this event should repeat. |
132 | 170 |
The date field for the target node must be configured to support repeating dates, using the Date Repeat Field module (a submodule of Date).'), |
133 | 171 |
'date_ical_parse_handler' => 'parseRepeatProperty', |
Formats disponibles : Unified diff
Weekly update of contrib modules