Projet

Général

Profil

Révision a192dc0b

Ajouté par Assos Assos il y a environ 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/feeds/CHANGELOG.txt
1
Feeds 7.x 2.0 Beta 2, 2016-02-17
2
--------------------------------
3

  
4
- By MegaChriz: test dependencies should be specified in the main module.info
5
  file and be in the form project:module (see also issue 2651854).
6
- Issue #2662730 by joachim: 'clear-block' CSS class on admin form should be
7
  'clearfix'.
8
- Issue #2638722 by MegaChriz: Improve documentation for
9
  hook_feeds_processor_targets().
10
- Issue #1183440 by twistor, MegaChriz, stefan.r, drclaw, pcambra,
11
  olofjohansson, Calystod, colan, svendecabooter, Bobík, Manish Jain,
12
  AdamGerthel, mErilainen, kervi, Pocketpain et al: Multilingual Feeds - Make
13
  field import language-aware.
14
- Issue #1428272 by OnkelTem, eosrei, jtsnow, Jerenus, liquidcms, acouch,
15
  derhasi, Niremizov, MegaChriz: Added support of encoding conversions to the
16
  CSV Parser.
17
- Issue #2644868 by diamondsea: Skip verification of the certificate's name when
18
  accepting invalid SSL certificates.
19
- Issue #2309471 by Josh Waihi: File Fetcher doesn't obey allowed extensions.
20
- Issue #2117535 by gbirch, MegaChriz, cbfannin, batje, id.alan: fixed Undefined
21
  variable: original_author in _parser_common_syndication_atom10_parse().
22
- Issue #2636342 by AndyF, MegaChriz: Improved documentation of
23
  FeedsConfigurable::__get().
24
- Issue #2637118 by MegaChriz: Use "plural label" for "label plural" from entity
25
  info if available.
26
- Issue #2602508 by MegaChriz: Fixed clear out boolean field when an empty value
27
  is provided.
28
- Issue #1891404 by MegaChriz, twistor, jenlampton: Add a mapper for Updated
29
  date (changed).
30
- Issue #2147341 by milesw: fixed missing bundle property on entity of type
31
  taxonomy_term when replacing existing terms.
32
- Issue #2624344 by grahamC, MegaChriz: Import via pushImport() keeps looping /
33
  never completes.
34
- Issue #2629620 by GuyPaddock, MegaChriz: Fixed template for TSV contains the
35
  word "TAB" instead of tabs.
36
- Issue #2385601 by GerZah, MegaChriz, Jerenus: Sorting feed importers by
37
  readable names.
38
- Issue #2619788 by pcambra: Get instance info from the entity instead of from
39
  the source for file mappings.
40
- By MegaChriz: add entity_translation as a test dependency for issue #1183440.
41
- Issue #2529538 by twistor, MegaChriz, stefan.r, drclaw, olofjohansson, Manish
42
  Jain, et al: Added generic entity language support.
43
- Issue #1950182 by mikran, MegaChriz, twistor: Only update when mapped fields
44
  are updated.
45
- Issue #2556461 by MegaChriz: Fixed importing two hierarchical vocabularies
46
  with overlapping id's.
47
- Issue #2584443 by zniki.ru: http_request_create_absolute_url() ignore last
48
  path in $base_url.
49
- Issue #2533030 by rrfegade, MegaChriz, twistor: Spelling errors in D7.
50
- Issue #1393898 by MegaChriz, twistor: Order Log view by flid instead of
51
  log_time.
52
- Issue #2581135 by Anas_maw, MegaChriz: views integration for feeds source
53
  import date.
54
- Issue #2584157 by MegaChriz: fixed missing mapping targets in the UI for
55
  contrib processors.
56
- Issue #2574789 by MegaChriz: Wrong processor settings set in
57
  FeedsUIUserInterfaceTestCase::testImporterImport().
58
- Issue #2557581 by joelpittet: CSV column names escaped & upload field double
59
  escaping.
60
- By MegaChriz: add i18n_taxonomy as a test dependency for issue #2529538.
61
- Issue #2542416 by twistor, MegaChriz: Allow sources and targets to be marked
62
  as deprecated and hide them from the UI.
63
- Issue #2530670 by MegaChriz: Filter log in Views by "Message".
64
- Issue #2397151 by Pravin Ajaaz: importer UI for CSVs should quote column names
65
  that contain commas.
66
- Issue #2531858 by twistor: Add a FeedsSource::pushImport() method.
67
- Issue #2531706 by twistor: relation "cache_feeds_http" does not exist.
68
- Issue #2531828 by twistor: Simplify db queries in FeedsProcessor.
69
- Issue #1286298 by fietserwin, Triskelion, MegaChriz, charginghawk, osopolar:
70
  Don't create new items, only update existing.
71

  
72
Feeds 7.x 2.0 Beta 1, 2015-07-02
73
--------------------------------
74

  
75
- Issue #2038525 by twistor, larsdesigns, DamienMcKenna: SimplePie Plugin
76
  Installation Documentation in README.txt.
77
- Issue #1449464 by klausi, cbergmann: Own cache Bin for feeds.
78
- Issue #2515196 by twistor: Only transliterate downloaded files.
79
- Issue #2510788 by twistor: Remove query string from path in FeedsEnclosure.
80
- Issue #2514300 by twistor: Fatal error when I try to import feed items.
81
- Issue #2511738 by deminy: Incorrect File Inclusion.
82
- Issue #2509444 by twistor: Field Feeds Presave Not Importing User Fields.
83
- Issue #2509464 by twistor, joelpittet: Feeds module cannot find its parser
84
  module due to filesystem restriction.
85
- Issue #2509464 by twistor, Max1: Feeds module cannot find its parser module
86
  due to filesystem restriction.
87
- Issue #2364103 by Luxian, MegaChriz: Feeds error log crashes when log messages
88
  are too long.
89
- Issue #1953008 by MegaChriz, twistor, klausi: PHP Fatal error:  Nesting level
90
  too deep - recursive dependency? in FeedsProcessor.inc on line 199.
91
- Issue #1107522 by MegaChriz, twistor, ditcheva, nielsonm, franz, Niklas
92
  Fiekas, cthiebault, Uhkis, gcb, mparker17, guillaumev: Framework for expected
93
  behavior when importing empty/blank values + text field fix.
94
- Issue #2092895 by mikran, MegaChriz, twistor: Block users not included in
95
  feed.
96
- Issue #2500185 by angel.h, MegaChriz: Error when having an entity without base
97
  table.
98
- Issue #2496735 by twistor, diarmy: For PHP 5.6.0 and above, Feeds should allow
99
  the use of cURL if open_basedir is enabled.
100
- Issue #1848498 by twistor: Respect allowed file extensions in file mapper.
101
- Issue #2502419 by klausi: Log messages XSS attack vector.
102
- Issue #2495145 by twistor, cashwilliams, greggles, klausi: Possible XSS in
103
  PuSHSubscriber.inc.
104
- Issue #2488036 by MegaChriz, orannezelehcim: Modules that define both an
105
  importer and a plugin can not be disabled.
106
- Issue #2333029 by twistor, MegaChriz: Extend mapping API to allow for defaults
107
  and multiple callbacks.
108
- Issue #2497507 by twistor: Pass plugin definition to FeedsPlugin objects.
109
- Add test for #2489006.
110
- Issue #2489006 by donquixote: Uninitialized array in
111
  taxonomy_feeds_set_target().
112
- Issue #2497729 by twistor: Implement all methods on FeedsMissingPlugin.
113
- Issue #2469219 by MegaChriz, twistor: Remove the Generic Entity Processor.
114
- Issue #1058424 by thijsvdanker: Port date mapper patch to d7 version to
115
  support dates before 13 Dec 1901.
116
- Issue #2427497 by ttaylor249: Fetching feed via SSL through proxy doesn't
117
  work.
118
- Issue #1978722 by klausi, ultimike: Entity property info for feeds node is
119
  broken.
120
- Issue #1988970 by msti: FeedsCSV parser - download template should use the
121
  default delimiter.
122
- Issue #2468401 by jiff: HTTP fetcher does not correctly decode urlencoded
123
  basic auth params.
124
- Issue #1815070 by twistor, joelpittet: No more mapping for numeric (boolean,
125
  decimal, integer, floats, and lists of them) fields.
126
- Issue #2339383 by mikran, MegaChriz, joelpittet: Items missing from feeds do
127
  not affect item hash even when action is taken based on that.
128
- Issue #2333009 by MegaChriz: Add importer validator for Views.
129
- Issue #2415283 by MegaChriz: Some tests are not executed by testbot.
130
- Issue #1829212 by alan-io1, agupta, MegaChriz, ac: SQLSTATE[42S22]: Column not
131
  found: 1054 Unknown column 'feeds_item.entity_type' in 'on clause'.
132
- Issue #2419111 by make77, MegaChriz: Configuration option to allow invalid SSL
133
  certificates is not used when option "Auto detect feeds" is enabled.
134
- Issue #2357981 by MegaChriz: hook_feeds_presave: $entity_id is missing.
135
- Issue #2011240 by ressa, Abelito: How to import the description of a file?.
136
- Issue #2397219 by joachim, MegaChriz: docs for my_module_mapper_unique() don't
137
  match implementation in tests.
138
- Issue #2397199 by joachim, MegaChriz: summary line for
139
  hook_feeds_processor_targets_alter() docs mentions nodes & is too long.
140
- Remove unused code from common_syndication_parser.inc.
141
- Issue #1982286 by AdamPS: Recoverable fatal error.
142
- Issue #2341407 by vinmassaro, twistor: Fix missing file/image mappings caused
143
  by #1080386 by adding :uri to mappings.
144
- Issue #2379915 by hydrant-mark, twistor: Taxonomy Mapper: Assumes there will
145
  only ever be one matching term.
146
- Issue #2387419 by MegaChriz: Auto detect dependencies when putting Feeds
147
  importer in a feature.
148
- Issue #2363779 by Niremizov, MegaChriz: CSVParser Source form translation fix.
149
- Issue #2053355 by ufku, vinmassaro: Notice: Undefined variable: file
150
  FeedsParser.inc:388.
151
- Issue #2390199 by GuyPaddock: Unhelpful failure upon uploading an empty CSV
152
  file.
153
- Issue #2308343 by MegaChriz, twistor, joelpittet, kruser: File upload
154
  disappears with Bootstrap Theme (abuse of #description in
155
  theme_feeds_upload()).
156
- Issue #1887632 by joelpittet: Exception: Empty configuration identifier.
157
- Issue #2379407 by twistor, MegaChriz: Make module required if plugins are in
158
  use.
159
- Issue #2248009 by twistor | djdevin: Fixed Remove the population of
160
  ->source_config from FeedsPlugin.
161
- Issue #2218999 by fietserwin: Fixed Warning: Invalid argument supplied for
162
  foreach() in element_children() (line 6420 of includes\common.inc).
163
- Issue #2349245 by Niremizov: Fixed error on importing empty csv file with no
164
  headers.
165
- Issue #2339983 by mikran: Fixed Unpublished nodes message has a wrong
166
  format_plural() parameter.
167
- Issue #2328605 by ekes, twistor: Fixed Unique item checking:
168
  FeedsProcessor::existingEntityId().
169
- Issue #2305919 by twistor: Fixed Return 404 when trying to edit a non-existent
170
  feed.
171
- Issue #1062178 by mansspams, MegaChriz, gmclelland, specky_rum, Dave Reid |
172
  iccle: Added configuration option to allow invalid/unverified or (self
173
  certified) SSL certificates.
174
- Issue #1470530 by stefan.r, GaëlG, mikran, Cottser, gnucifer, MegaChriz,
175
  vinmassaro, kostajh, Mithrandir, riho, jaanhoinatski, nrambeck, byronveale,
176
  dbassendine, PsycleInteractive, imclean: Added Unpublish/Delete nodes not
177
  included in feed.
178
- Issue #2305929 by twistor, MegaChriz: Show message that mapping settings must
179
  be saved after changes.
180
- Issue #2304247 by MegaChriz, undertext | twistor: Update included Feeds Import
181
  Feature.
182
- Issue #2307379 by twistor: Fixed Add FeedsConfigurable::hasConfigForm().
183
- Issue #661606 by MegaChriz, twistor, Cottser, scottrigby, manojbisht_drupal,
184
  Mohammed J. Razem, agileadam, emilyf, tmsimont, bradjones1, hairqles,
185
  ldavisrobeson, selim13, a.ross, chromix, g089h515r806 | lunk_rat: Added
186
  Support unique targets in mappers.
187
- Issue #2008168 by JeroenT | scottalan: Update included Feeds News Feature.
188
- Issue #2224643 by hanoii, MegaChriz: Added Support for input format
189
  configuration on a per-field basis .
190
- Issue #1981504 by twistor | Dale Baldwin: Fixed Status Report has a
191
  notification to install SimplePie library when SimplePie module isn't even
192
  installed.
193
- Issue #962912 by twistor, MegaChriz, Peacog, Niklas Fiekas | willmoy: Added
194
  Mapping to node summary.
195
- Backport assertFieldByXPath fix from 8.x.
196
- Issue #2175525 by MegaChriz | Max2505: Added User admin is not authorized to
197
  create content type.
198
- Issue #2275893 by twistor, dagomar: Fixed Process in background doesn't work
199
  on non-periodic imports.
200
- Issue #2275893 Add tests for import in background.
201
- Add a long csv file where the guids are ordered.
202
- Fix FeedsWebTestCase::removeMappings.
203
- Issue #1561200 by szt, osopolar: Added Use machine names for better
204
  identification of similar field names.
205
- Issue #2192819 by twistor, klausi: FeedsHTTPFetcherResult should store the
206
  result between batches.
207
- Issue #1231332 by klausi, twistor | nyl auster: Periodic import imports only
208
  one file per cron.
209
- Issue #2192851 by klausi: Hook_feeds_after_import() should have access to
210
  exceptions.
211
- Issue #2190551 by twistor: Hook_feeds_before_import only executes during form
212
  submission.
213
- Issue #1852048 by ianthomas_uk: Comments suggest exceptions are ignore, when
214
  in fact they are rethrown.
215
- Issue #1722180 by pcambra: Clear plugins cache on feeds_cache_clear.
216
- Issue #2093651 by twistor: Simplify target callbacks.
217
- Issue #1305698 by dman: Additional validation when creating terms - assert the
218
  Vocabulary is valid.
219
- Issue #1113312 by Niklas Fiekas: Show import page in admin overlay.
220
- Issue #2053355 by osopolar: Notice: Undefined variable: file
221
  FeedsParser.inc:388.
222
- Issue #1537776 by David_Rothstein | RyFo18: Importing a single 21st century
223
  year defaults to the current year.
224
- Issue #1333266 by dastagg | webchick: Link to feed importers broken when no
225
  feed importers exist.
226
- Issue #1951736 by twistor, John Morahan: Discovery sometimes fails.
227
- Issue #1996240 by msti, MegaChriz: Duplicate fields in CSV template.
228
- Issue #930652 by twistor, tristanoneil | alex_b: Expiry batching broken.
229
- Issue #1884516 by aaronbauman: Import with taxonomy term mapping fails if term
230
  name exceeds db size.
231
- Issue #2046335 by twistor, j0rd: Http:// prefix and error 1002.
232
- Issue #1485870 by brad.bulger, twistor: Remove custom error reporting for
233
  SimplePie.
234
- Issue #2178563 by twistor | alibama: Entityform does not seem to work.
235
- Issue #2174303 by twistor | bdanin: Feeds importer importer -- context and
236
  mapping not working.
237
- Issue #1107522 by ditcheva, Uhkis, cthiebault, franz, nielsonm, Niklas Fiekas,
238
  twistor, mparker17, Lasac, guillaumev | jptl: Framework for expected behavior
239
  when importing empty/blank values + text field fix.
240
- Issue #1033202 by jamesdixon, jamsilver, twistor, james.williams, Steven
241
  Jones, vordude, j0rd, mErilainen, gmario, rickmanelius, imclean, dasjo,
242
  guillaumev, jlyon, gilgabar, elliotttf, mukesh.agarwal17, patcon, wesnick,
243
  Bevan, kreynen, Grayside, fago, spotzero: [Meta] Generic entity processor.
244
- Issue #2149829 by chilic: Import/Update 0 value to text field.
245
- Issue #2150989 by chilic | osopolar: SimpleTest fails: Undefined index:
246
  content-type, Notice file: http_request.inc Line: 57.
247
- Issue #1984962 by mvd81NL, redsd, twistor: Fixed Use a 0 as mapping source.
248
- Issue #1159806 by VladimirAus, bigjim | Slim Pickens: Added proxy support.
249
- Issue #1989196 by beeradb: Fixed Never Pass FeedsDateTime objects into
250
  date_create().
251
- Issue #1222750 by Brandonian, twistor, lyricnz: Added SimplePie 1.3 support.
252
- Issue #1080386 by elizzle, twistor, rhouse, AndyF, chadmkidner, retiredpro,
253
  slefevre1, moonray, asgorobets, jwmeyerson: Added How to get title and alt
254
  fields into your image import for drupal 7 feeds.
255
- Use user-supplied id if available on import.
256
- Issue #777888 by WorldFallz, liquidcms, firfin, tmsimont | timwood: Followup
257
  to importing importers.
258
- Fix validation for importing importers.
259

  
1 260
Feeds 7.x 2.0 Alpha 8, 2012-04-22
2 261
---------------------------------
3 262

  
......
412 671
  FeedsSource::state() has changed.
413 672
- Remove 6.x upgrade hooks.
414 673
- #923318: Fix Fatal error: Call to a member function import() on a non-object
415
  occuring on cron.
674
  occurring on cron.
416 675
- Clean up basic settings form.
417 676
- Make getConfig() include configuration defaults.
418 677

  
drupal7/sites/all/modules/feeds/README.txt
209 209
Description: Flag to stop feeds from using its cURL for http requests. See
210 210
             http_request_use_curl().
211 211

  
212
Name:        feeds_use_mbstring
213
Default:     TRUE
214
Description: The extension mbstring is used to convert encodings during parsing.
215
             The reason that this can be turned off is to be able to test Feeds
216
             behavior when the extension is not available.
217

  
212 218
Glossary
213 219
========
214 220

  
drupal7/sites/all/modules/feeds/feeds.api.php
227 227
function hook_feeds_parser_sources_alter(&$sources, $content_type) {
228 228
  $sources['my_source'] = array(
229 229
    'name' => t('Images in description element'),
230
    'description' => t('Images occuring in the description element of a feed item.'),
230
    'description' => t('Images occurring in the description element of a feed item.'),
231 231
    'callback' => 'my_source_get_source',
232 232
  );
233 233
}
......
273 273
 *   The entity bundle to return targets for.
274 274
 *
275 275
 * @return array
276
 *   Array containing the targets to be offered to the user. This function must
277
 *   return an array, even an empty one.
276
 *   An array whose keys are the target name and whose values are arrays
277
 *   containing the following keys:
278
 *   - name: A human readable, translated label for the target.
279
 *   - description: (optional) A human readable, translated description for the
280
 *     target.
281
 *   - callback: The callback used to set the value on the target.
282
 *   - real_target: (optional) the name of the property on the entity that will
283
 *     be set by the callback. Specify this if the target name is not equal to
284
 *     the entity property name. This information will be used to clear the
285
 *     right target at the beginning of the mapping process.
286
 *   - optional_unique: (optional) A boolean that indicates whether or not the
287
 *     target can be used as an unique target. If you set this to TRUE, be sure
288
 *     to also specify "unique_callbacks".
289
 *   - unique_callbacks: (optional) An array of callbacks that are used to
290
 *     retrieve existing entity ids. Existing entities can be updated based on
291
 *     unique targets.
292
 *   - form_callbacks: (optional) An array of callbacks that are used to return
293
 *     a form with additional configuration for a target.
294
 *   - summary_callbacks: (optional) An array of callbacks that are used to
295
 *     display values of additional target configuration.
296
 *   - preprocess_callbacks: (optional) An array of callbacks that are used to
297
 *     set or change mapping options.
298
 *   - deprecated: (optional) A boolean that if TRUE, hides the target from the
299
 *     UI. Use this if you want to rename targets for consistency, but don't
300
 *     want to break importers that are using the old target name. If an
301
 *     importer uses this target it will show up as "DEPRECATED" in the UI.
278 302
 */
279 303
function hook_feeds_processor_targets($entity_type, $bundle) {
280 304
  $targets = array();
281 305

  
282 306
  if ($entity_type == 'node') {
307
    // Example 1: provide the minimal info for a target. Description is
308
    // optional, but recommended.
309
    // @see my_module_set_target()
283 310
    $targets['my_node_field'] = array(
284 311
      'name' => t('My custom node field'),
285 312
      'description' => t('Description of what my custom node field does.'),
286 313
      'callback' => 'my_module_set_target',
287

  
288
      // Specify both summary_callback and form_callback to add a per mapping
289
      // configuration form.
290
      'summary_callbacks' => array('my_module_summary_callback'),
291
      'form_callbacks' => array('my_module_form_callback'),
292 314
    );
293
    $targets['my_node_field2'] = array(
294
      'name' => t('My Second custom node field'),
295
      'description' => t('Description of what my second custom node field does.'),
315

  
316
    // Example 2: specify "real_target" if the target name is different from
317
    // the entity property name.
318
    // Here the target is called "my_node_field2:uri", but the entity property
319
    // is called "my_node_field2". This will ensure that the property
320
    // "my_node_field2" is cleared out that the beginning of the mapping
321
    // process.
322
    $targets['my_node_field2:uri'] = array(
323
      'name' => t('My third custom node field'),
324
      'description' => t('A target that sets a property that does not have the same name as the target.'),
296 325
      'callback' => 'my_module_set_target2',
297
      'real_target' => 'my_node_field_two', // Specify real target field on node.
326
      'real_target' => 'my_node_field2',
298 327
    );
328

  
329
    // Example 3: you can make your target selectable as an unique target by
330
    // setting "optional_unique" to TRUE and specify one or more callbacks to
331
    // retrieve existing entity id's.
332
    // @see my_module_mapper_unique()
299 333
    $targets['my_node_field3'] = array(
300 334
      'name' => t('My third custom node field'),
301
      'description' => t('Description of what my third custom node field does.'),
335
      'description' => t('A field that can be set as an unique target.'),
302 336
      'callback' => 'my_module_set_target3',
303

  
304
      // Set optional_unique to TRUE and specify unique_callbacks to allow the
305
      // target to be unique. Existing entities can be updated based on unique
306
      // targets.
307 337
      'optional_unique' => TRUE,
308 338
      'unique_callbacks' => array('my_module_mapper_unique'),
339
    );
309 340

  
310
      // Preprocess callbacks are called before the actual callback allowing you
311
      // to prepare values on the entity or mapping array.
341
    // Example 4: use the form and summary callbacks to add additional
342
    // configuration options for your target. Use the form callbacks to provide
343
    // a form to set the target configuration. Use the summary callbacks to
344
    // display the target configuration.
345
    // @see my_module_form_callback()
346
    // @see my_module_summary_callback()
347
    $targets['my_node_field4'] = array(
348
      'name' => t('My fourth custom node field'),
349
      'description' => t('A field with additional configuration.'),
350
      'callback' => 'my_module_set_target4',
351
      'form_callbacks' => array('my_module_form_callback'),
352
      'summary_callbacks' => array('my_module_summary_callback'),
353
    );
354

  
355
    // Example 5: use preprocess callbacks to set or change mapping options.
356
    // @see my_module_preprocess_callback()
357
    $targets['my_node_field5'] = array(
358
      'name' => t('My fifth custom node field'),
359
      'description' => t('A field with additional configuration.'),
360
      'callback' => 'my_module_set_target5',
312 361
      'preprocess_callbacks' => array('my_module_preprocess_callback'),
313 362
    );
363

  
364
    // Example 6: when you want to remove or rename previously provided targets,
365
    // you can set "deprecated" to TRUE for the old target name. This will make
366
    // the target to be no longer selectable in the UI. If an importer uses this
367
    // target it will show up as "DEPRECATED" in the UI.
368
    // If you want that the target continues to work, you can still specify the
369
    // callback.
370
    $targets['deprecated_target'] = array(
371
      'name' => t('A target that cannot be chosen in the UI.'),
372
      'deprecated' => TRUE,
373
    );
314 374
  }
315 375

  
316 376
  return $targets;
......
332 392
 * @see hook_feeds_processor_targets()
333 393
 */
334 394
function hook_feeds_processor_targets_alter(array &$targets, $entity_type, $bundle) {
395
  // Example: set an existing target as optional unique.
335 396
  if ($entity_type == 'node' && $bundle == 'article') {
336 397
    if (isset($targets['nid'])) {
337 398
      $targets['nid']['unique_callbacks'][] = 'my_module_mapper_unique';
......
362 423
  }
363 424
}
364 425

  
426
/**
427
 * Example of the form_callback specified in hook_feeds_processor_targets().
428
 *
429
 * The arguments are the same that my_module_summary_callback() gets.
430
 *
431
 * @return array
432
 *   The per mapping configuration form. Once the form is saved, $mapping will
433
 *   be populated with the form values.
434
 *
435
 * @see my_module_summary_callback()
436
 */
437
function my_module_form_callback(array $mapping, $target, array $form, array $form_state) {
438
  return array(
439
    'my_setting' => array(
440
      '#type' => 'checkbox',
441
      '#title' => t('My setting checkbox'),
442
      '#default_value' => !empty($mapping['my_setting']),
443
    ),
444
  );
445
}
446

  
365 447
/**
366 448
 * Example of the summary_callback specified in hook_feeds_processor_targets().
367 449
 *
......
390 472
  }
391 473
}
392 474

  
393
/**
394
 * Example of the form_callback specified in hook_feeds_processor_targets().
395
 *
396
 * The arguments are the same that my_module_summary_callback() gets.
397
 *
398
 * @return array
399
 *   The per mapping configuration form. Once the form is saved, $mapping will
400
 *   be populated with the form values.
401
 *
402
 * @see my_module_summary_callback()
403
 */
404
function my_module_form_callback(array $mapping, $target, array $form, array $form_state) {
405
  return array(
406
    'my_setting' => array(
407
      '#type' => 'checkbox',
408
      '#title' => t('My setting checkbox'),
409
      '#default_value' => !empty($mapping['my_setting']),
410
    ),
411
  );
412
}
413

  
414 475
/**
415 476
 * Example of the unique_callbacks specified in hook_feeds_processor_targets().
416 477
 *
......
449 510
/**
450 511
 * Example of the preprocess_callbacks specified in hook_feeds_processor_targets().
451 512
 *
452
 * @param FeedsSource $source
453
 *   The Feed source.
454
 * @param object $entity
455
 *   The entity being processed.
456 513
 * @param array $target
457 514
 *   The full target definition.
458 515
 * @param array &$mapping
......
460 517
 *
461 518
 * @see hook_feeds_processor_targets()
462 519
 */
463
function my_module_preprocess_callback(FeedsSource $source, $entity, array $target, array &$mapping) {
520
function my_module_preprocess_callback(array $target, array &$mapping) {
464 521
  // Add in default values.
465 522
  $mapping += array('setting_value' => TRUE);
466 523
}
drupal7/sites/all/modules/feeds/feeds.feeds.inc
23 23
function feeds_feeds_processor_targets_alter(array &$targets, $entity_type, $bundle) {
24 24
  // This hook gets called last, so that we normalize the whole array.
25 25
  feeds_normalize_targets($targets);
26

  
27
  // Since a hook can be invoked multiple times during a request, reset the
28
  // "feeds_feeds_processor_targets" variable.
29
  // @see _feeds_feeds_processor_targets_alter()
30
  drupal_static_reset('feeds_feeds_processor_targets');
26 31
}
27 32

  
28 33
/**
drupal7/sites/all/modules/feeds/feeds.info
5 5
dependencies[] = ctools
6 6
dependencies[] = job_scheduler
7 7

  
8
test_dependencies[] = date:date
9
test_dependencies[] = entity_translation:entity_translation
10
test_dependencies[] = feeds_xpathparser:feeds_xpathparser
11
test_dependencies[] = link:link
12
test_dependencies[] = i18n:i18n_taxonomy
13

  
8 14
files[] = includes/FeedsConfigurable.inc
9 15
files[] = includes/FeedsImporter.inc
10 16
files[] = includes/FeedsSource.inc
......
38 44
files[] = tests/feeds_mapper_file.test
39 45
files[] = tests/feeds_mapper_hooks.test
40 46
files[] = tests/feeds_mapper_link.test
47
files[] = tests/feeds_mapper_list.test
48
files[] = tests/feeds_mapper_multilingual_fields.test
41 49
files[] = tests/feeds_mapper_path.test
42 50
files[] = tests/feeds_mapper_profile.test
43 51
files[] = tests/feeds_mapper_unique.test
......
46 54
files[] = tests/feeds_fetcher_file.test
47 55
files[] = tests/feeds_mapper_format_config.test
48 56
files[] = tests/feeds_fetcher_http.test
57
files[] = tests/feeds_i18n.test
58
files[] = tests/feeds_i18n_node.test
59
files[] = tests/feeds_i18n_taxonomy.test
60
files[] = tests/feeds_parser_csv.test
49 61
files[] = tests/feeds_parser_sitemap.test
50 62
files[] = tests/feeds_parser_syndication.test
51 63
files[] = tests/feeds_processor_node.test
......
68 80
files[] = views/feeds_views_handler_filter_severity.inc
69 81
files[] = views/feeds_views_plugin_argument_validate_feed_nid.inc
70 82

  
71
; Information added by Drupal.org packaging script on 2015-07-11
72
version = "7.x-2.0-beta1"
83
; Information added by Drupal.org packaging script on 2016-02-21
84
version = "7.x-2.0-beta2"
73 85
core = "7.x"
74 86
project = "feeds"
75
datestamp = "1436615941"
87
datestamp = "1456055647"
76 88

  
drupal7/sites/all/modules/feeds/feeds.install
60 60
function feeds_uninstall() {
61 61
  variable_del('http_request_timeout');
62 62
  variable_del('feeds_reschedule');
63
  variable_del('feeds_use_mbstring');
63 64
}
64 65

  
65 66
/**
......
689 690
  DrupalQueue::get('feeds_importer_expire')->deleteQueue();
690 691
}
691 692

  
692
/**
693
 * Fix importer mappings for file and image fields to use :uri convention.
694
 */
693
 /**
694
  * Does nothing. Update removed.
695
  */
695 696
function feeds_update_7211(&$sandbox) {
696
  // If this is the first pass through this update function then set some
697
  // variables.
698
  if (!isset($sandbox['progress'])) {
699
    $importers = feeds_importer_load_all(TRUE);
700
    $sandbox['importers'] = array_keys($importers);
701
    $sandbox['progress'] = 0;
702
    $sandbox['updated_count'] = 0;
703
    $sandbox['max'] = count($sandbox['importers']);
704
  }
705

  
706
  if (empty($sandbox['importers'])) {
707
    return t('No importers to process.');
708
  }
709

  
710
  // Load a single importer.
711
  $importer = array_pop($sandbox['importers']);
712
  $importer = feeds_importer($importer);
713
  $mappings = $importer->processor->getMappings();
714

  
715
  foreach ($mappings as $key => $mapping) {
716
    // Act on mappings that do not contain a colon.
717
    if (strpos($mapping['target'], ':') !== FALSE) {
718
      continue;
719
    }
720

  
721
    // Get field data. Check if $info is empty to weed out non-field mappings
722
    // like temporary targets.
723
    if (!$info = field_info_field($mapping['target'])) {
724
      continue;
725
    }
726

  
727
    // Act on file or image fields.
728
    if (in_array($info['type'], array('file', 'image'))) {
729
      // Add ':uri' to fix the mapping.
730
      $mappings[$key]['target'] = $mapping['target'] . ':uri';
731
    }
732
  }
733

  
734
  // If importer has changed, add the updated config and save it.
735
  if ($importer->processor->getMappings() !== $mappings) {
736
    $importer->processor->addConfig(array('mappings' => $mappings));
737
    $importer->save();
738
    $sandbox['updated_count']++;
739
  }
740

  
741
  $sandbox['progress']++;
742

  
743
  // Set the value for finished. If progress == max then finished will be 1,
744
  // signifying we are done.
745
  $sandbox['#finished'] = ($sandbox['progress'] / $sandbox['max']);
746

  
747
  if (empty($sandbox['importers'])) {
748
    $sandbox['#finished'] = 1;
749
    return t('@importers total importers processed, @updated_count with fields that were updated.', array('@importers' => $sandbox['max'], '@updated_count' => $sandbox['updated_count']));
750
  }
751 697
}
752 698

  
753 699
/**
drupal7/sites/all/modules/feeds/feeds.module
634 634
  }
635 635
  $last_title = NULL;
636 636
  $last_feeds = NULL;
637

  
638
  // Update "changed" value if there was mapped to that.
639
  if (isset($node->feeds_item->node_changed)) {
640
    $node->changed = $node->feeds_item->node_changed;
641
  }
637 642
}
638 643

  
639 644
/**
......
830 835
 * Implements hook_flush_caches().
831 836
 */
832 837
function feeds_flush_caches() {
833
  return array('cache_feeds_http');
838
  // The update to add the table needs to have run. Taken from
839
  // https://www.drupal.org/node/2511858
840
  include_once DRUPAL_ROOT . '/includes/install.inc';
841

  
842
  if (drupal_get_installed_schema_version('feeds') >= 7212) {
843
    return array('cache_feeds_http');
844
  }
845
  return array();
834 846
}
835 847

  
836 848
/**
......
864 876
        $feeds[$config->id] = feeds_importer($config->id);
865 877
      }
866 878
    }
879
    uasort($feeds, 'feeds_importer_name_sort');
867 880
  }
868 881
  return $feeds;
869 882
}
870 883

  
884
/**
885
 * Sorts importers by name.
886
 *
887
 * Callback for uasort().
888
 *
889
 * @param FeedsImporter $a
890
 *   The first FeedsImporter for comparison.
891
 * @param FeedsImporter $b
892
 *   The second FeedsImporter for comparison.
893
 *
894
 * @return int
895
 *   The comparison result for uasort().
896
 */
897
function feeds_importer_name_sort(FeedsImporter $a, FeedsImporter $b) {
898
  return strcasecmp($a->config['name'], $b->config['name']);
899
}
900

  
871 901
/**
872 902
 * Gets an array of enabled importer ids.
873 903
 *
drupal7/sites/all/modules/feeds/feeds.pages.inc
354 354
    $summary .= '<div class="feeds-file-info">';
355 355
    $summary .= '<div class="feeds-file-name">';
356 356
    if ($wrapper) {
357
      $summary .= l(check_plain($file->filename), $wrapper->getExternalUrl());
357
      $summary .= l($file->filename, $wrapper->getExternalUrl());
358 358
    }
359 359
    else {
360 360
      $summary .= t('URI scheme %scheme not available.', array('%scheme' =>  file_uri_scheme($uri)));
drupal7/sites/all/modules/feeds/feeds_import/feeds_import.info
10 10
features[feeds_importer][] = user
11 11
files[] = feeds_import.test
12 12

  
13
; Information added by Drupal.org packaging script on 2015-07-11
14
version = "7.x-2.0-beta1"
13
; Information added by Drupal.org packaging script on 2016-02-21
14
version = "7.x-2.0-beta2"
15 15
core = "7.x"
16 16
project = "feeds"
17
datestamp = "1436615941"
17
datestamp = "1456055647"
18 18

  
drupal7/sites/all/modules/feeds/feeds_news/feeds_news.info
19 19
files[] = feeds_news.module
20 20
files[] = feeds_news.test
21 21

  
22
; Information added by Drupal.org packaging script on 2015-07-11
23
version = "7.x-2.0-beta1"
22
; Information added by Drupal.org packaging script on 2016-02-21
23
version = "7.x-2.0-beta2"
24 24
core = "7.x"
25 25
project = "feeds"
26
datestamp = "1436615941"
26
datestamp = "1456055647"
27 27

  
drupal7/sites/all/modules/feeds/feeds_ui/feeds_ui.admin.inc
513 513
  if ($sources = $importer->parser->getMappingSources()) {
514 514
    $source_options = _feeds_ui_format_options($sources);
515 515
    foreach ($sources as $k => $source) {
516
      if (!empty($source['deprecated'])) {
517
        continue;
518
      }
516 519
      $legend['sources'][$k]['name']['#markup'] = empty($source['name']) ? $k : $source['name'];
517 520
      $legend['sources'][$k]['description']['#markup'] = empty($source['description']) ? '' : $source['description'];
518 521
    }
......
524 527
  $target_options = _feeds_ui_format_options($targets);
525 528
  $legend['targets'] = array();
526 529
  foreach ($targets as $k => $target) {
530
    if (!empty($target['deprecated'])) {
531
      continue;
532
    }
527 533
    $legend['targets'][$k]['name']['#markup'] = empty($target['name']) ? $k : $target['name'];
528 534
    $legend['targets'][$k]['description']['#markup'] = empty($target['description']) ? '' : $target['description'];
529 535
  }
......
830 836
 * FeedsProcessor::getMappingTargets() and format them into
831 837
 * a Form API options array.
832 838
 */
833
function _feeds_ui_format_options($options) {
839
function _feeds_ui_format_options($options, $show_deprecated = FALSE) {
834 840
  $result = array();
835 841
  foreach ($options as $k => $v) {
842
    if (!$show_deprecated && is_array($v) && !empty($v['deprecated'])) {
843
      continue;
844
    }
836 845
    if (is_array($v) && !empty($v['name'])) {
837 846
      $result[$k] = $v['name'] . ' (' . $k . ')';
847
      if (!empty($v['deprecated'])) {
848
        $result[$k] .= ' - ' . t('DEPRECATED');
849
      }
838 850
    }
839 851
    elseif (is_array($v)) {
840 852
      $result[$k] = $k;
......
930 942
  drupal_add_css(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.css');
931 943

  
932 944
  // Outer wrapper.
933
  $output = '<div class="feeds-settings clear-block">';
945
  $output = '<div class="feeds-settings clearfix">';
934 946

  
935 947
  // Build left bar.
936 948
  $output .= '<div class="left-bar">';
......
1017 1029
function theme_feeds_ui_mapping_form($variables) {
1018 1030
  $form = $variables['form'];
1019 1031

  
1032
  $targets = feeds_importer($form['#importer'])->processor->getMappingTargets();
1033
  $targets = _feeds_ui_format_options($targets, TRUE);
1034

  
1035
  $sources = feeds_importer($form['#importer'])->parser->getMappingSources();
1036
  // Some parsers do not define source options.
1037
  $sources = $sources ? _feeds_ui_format_options($sources, TRUE) : array();
1038

  
1020 1039
  // Build the actual mapping table.
1021 1040
  $header = array(
1022 1041
    t('Source'),
......
1028 1047
  $rows = array();
1029 1048
  if (is_array($form['#mappings'])) {
1030 1049
    foreach ($form['#mappings'] as $i => $mapping) {
1031
      // Some parsers do not define source options.
1032
      $source = isset($form['source']['#options'][$mapping['source']]) ? $form['source']['#options'][$mapping['source']] : $mapping['source'];
1033
      $target = isset($form['target']['#options'][$mapping['target']]) ? check_plain($form['target']['#options'][$mapping['target']]) : '<em>' . t('Missing') . '</em>';
1050
      $source = isset($sources[$mapping['source']]) ? check_plain($sources[$mapping['source']]) : check_plain($mapping['source']);
1051
      $target = isset($targets[$mapping['target']]) ? check_plain($targets[$mapping['target']]) : '<em>' . t('Missing') . '</em>';
1034 1052
      // Add indicator to target if target configuration changed.
1035 1053
      if (isset($form['#mapping_settings'][$i])) {
1036 1054
        $target .= '<span class="warning">*</span>';
1037 1055
      }
1038 1056
      $rows[] = array(
1039 1057
        'data' => array(
1040
          check_plain($source),
1058
          $source,
1041 1059
          $target,
1042 1060
          drupal_render($form['config'][$i]),
1043 1061
          drupal_render($form['remove_flags'][$i]),
drupal7/sites/all/modules/feeds/feeds_ui/feeds_ui.css
89 89
  background-image: none;
90 90
  margin: 0;
91 91
  padding: 0;
92
  position: relative; /* Fix for IE 7 compatability mode. */
92
  position: relative; /* Fix for IE 7 compatibility mode. */
93 93
}
94 94

  
95 95
ul.container-actions .form-item,
drupal7/sites/all/modules/feeds/feeds_ui/feeds_ui.info
7 7

  
8 8
files[] = feeds_ui.test
9 9

  
10
; Information added by Drupal.org packaging script on 2015-07-11
11
version = "7.x-2.0-beta1"
10
; Information added by Drupal.org packaging script on 2016-02-21
11
version = "7.x-2.0-beta2"
12 12
core = "7.x"
13 13
project = "feeds"
14
datestamp = "1436615941"
14
datestamp = "1456055647"
15 15

  
drupal7/sites/all/modules/feeds/feeds_ui/feeds_ui.test
122 122
    $this->createImporterConfiguration($name, $id);
123 123
    $this->setPlugin($id, 'FeedsCSVParser');
124 124
    $this->setPlugin($id, 'FeedsFileFetcher');
125
    $this->setPlugin($id, 'FeedsTermProcessor');
125
    $this->setPlugin($id, 'FeedsUserProcessor');
126 126

  
127 127
    $this->setSettings($id, 'FeedsFileFetcher', array('allowed_extensions' => 'xml'));
128 128
    $this->setSettings($id, 'FeedsCSVParser', array('delimiter' => '|'));
......
145 145
    $importer = feeds_importer($id);
146 146
    $this->assertEqual('FeedsFileFetcher', get_class($importer->fetcher));
147 147
    $this->assertEqual('FeedsCSVParser', get_class($importer->parser));
148
    $this->assertEqual('FeedsTermProcessor', get_class($importer->processor));
148
    $this->assertEqual('FeedsUserProcessor', get_class($importer->processor));
149 149

  
150 150
    $config = $importer->fetcher->getConfig();
151 151
    $this->assertEqual('xml', $config['allowed_extensions']);
drupal7/sites/all/modules/feeds/includes/FeedsConfigurable.inc
15 15
 * Base class for configurable classes. Captures configuration handling, form
16 16
 * handling and distinguishes between in-memory configuration and persistent
17 17
 * configuration.
18
 *
19
 * Due to the magic method __get(), protected properties from this class and
20
 * from classes that extend this class will be publicly readable (but not
21
 * writeable).
18 22
 */
19 23
abstract class FeedsConfigurable {
20 24

  
......
55 59
    if (!strlen($id)) {
56 60
      throw new InvalidArgumentException(t('Empty configuration identifier.'));
57 61
    }
58
    static $instances = array();
62

  
63
    $instances = &drupal_static(__METHOD__, array());
64

  
59 65
    if (!isset($instances[$class][$id])) {
60 66
      $instances[$class][$id] = new $class($id);
61 67
    }
......
137 143
  }
138 144

  
139 145
  /**
140
   * Override magic method __get(). Make sure that $this->config goes through
141
   * getConfig().
146
   * Overrides magic method __get().
147
   *
148
   * - Makes sure that external reads of FeedsConfigurable::config go through
149
   *   ::getConfig();
150
   * - Makes private and protected properties from this class and protected
151
   *   properties from child classes publicly readable.
152
   * - Prevents warnings when accessing non-existent properties.
142 153
   */
143 154
  public function __get($name) {
144 155
    if ($name == 'config') {
drupal7/sites/all/modules/feeds/includes/FeedsSource.inc
6 6
 */
7 7

  
8 8
/**
9
 * Distinguish exceptions occuring when handling locks.
9
 * Distinguish exceptions occurring when handling locks.
10 10
 */
11 11
class FeedsLockException extends Exception {}
12 12

  
......
134 134
      $this->progress = FEEDS_BATCH_COMPLETE;
135 135
    }
136 136
    elseif ($total) {
137
      $this->progress = $progress / $total;
137
      $this->progress = (float) $progress / $total;
138 138
      if ($this->progress == FEEDS_BATCH_COMPLETE && $total != $progress) {
139 139
        $this->progress = 0.99;
140 140
      }
......
197 197
   */
198 198
  public static function instance($importer_id, $feed_nid) {
199 199
    $class = variable_get('feeds_source_class', 'FeedsSource');
200
    static $instances = array();
200

  
201
    $instances = &drupal_static(__METHOD__, array());
202

  
201 203
    if (!isset($instances[$class][$importer_id][$feed_nid])) {
202 204
      $instances[$class][$importer_id][$feed_nid] = new $class($importer_id, $feed_nid);
203 205
    }
......
406 408
      // occurred in hook_feeds_after_import().
407 409
      $this->exception = $e;
408 410
    }
409
    $this->releaseLock();
410 411

  
411 412
    // Clean up.
412 413
    $result = $this->progressImporting();
413 414
    if ($result == FEEDS_BATCH_COMPLETE || isset($e)) {
414 415
      $this->imported = time();
415
      $this->log('import', 'Imported in !s s', array('!s' => $this->imported - $this->state[FEEDS_START]), WATCHDOG_INFO);
416
      $this->log('import', 'Imported in @s seconds.', array('@s' => $this->imported - $this->state[FEEDS_START]), WATCHDOG_INFO);
416 417
      module_invoke_all('feeds_after_import', $this);
417 418
      unset($this->fetcher_result, $this->state);
418 419
    }
419 420
    $this->save();
421

  
422
    $this->releaseLock();
423

  
420 424
    if (isset($e)) {
421 425
      throw $e;
422 426
    }
427

  
423 428
    return $result;
424 429
  }
425 430

  
431
  /**
432
   * Imports a fetcher result all at once in memory.
433
   *
434
   * @param FeedsFetcherResult $fetcher_result
435
   *   The fetcher result to process.
436
   *
437
   * @throws Exception
438
   *   Thrown if an error occurs when importing.
439
   */
440
  public function pushImport(FeedsFetcherResult $fetcher_result) {
441
    // Since locks only work during a request, check if an import is active.
442
    if (!empty($this->fetcher_result) || !empty($this->state)) {
443
      throw new RuntimeException('The feed is currently importing.');
444
    }
445

  
446
    $this->acquireLock();
447
    $start = time();
448

  
449
    try {
450
      module_invoke_all('feeds_before_import', $this);
451

  
452
      // Parse.
453
      do {
454
        $parser_result = $this->importer->parser->parse($this, $fetcher_result);
455
        module_invoke_all('feeds_after_parse', $this, $parser_result);
456

  
457
        // Process.
458
        $this->importer->processor->process($this, $parser_result);
459

  
460
      } while ($this->progressParsing() !== FEEDS_BATCH_COMPLETE);
461
    }
462
    catch (Exception $e) {
463
      // $e is stored and re-thrown once we've had a chance to log our progress.
464
      // Set the exception so that other modules can check if an exception
465
      // occurred in hook_feeds_after_import().
466
      $this->exception = $e;
467
    }
468

  
469
    module_invoke_all('feeds_after_import', $this);
470

  
471
    $this->imported = time();
472
    $this->log('import', 'Imported in @s seconds.', array('@s' => $this->imported - $start), WATCHDOG_INFO);
473

  
474
    unset($this->fetcher_result, $this->state);
475

  
476
    $this->save();
477

  
478
    $this->releaseLock();
479

  
480
    if (isset($e)) {
481
      throw $e;
482
    }
483
  }
484

  
426 485
  /**
427 486
   * Remove all items from a feed.
428 487
   *
drupal7/sites/all/modules/feeds/libraries/ParserCSV.inc
66 66
 */
67 67
class ParserCSV {
68 68
  private $delimiter;
69
  private $fromEncoding;
70
  private $toEncoding;
69 71
  private $skipFirstLine;
70 72
  private $columnNames;
71 73
  private $timeout;
......
73 75
  private $startByte;
74 76
  private $lineLimit;
75 77
  private $lastLinePos;
78
  private $useMbString;
76 79

  
77 80
  public function __construct() {
78 81
    $this->delimiter = ',';
82
    $this->fromEncoding = 'UTF-8';
83
    $this->toEncoding = 'UTF-8';
79 84
    $this->skipFirstLine = FALSE;
80 85
    $this->columnNames = FALSE;
81 86
    $this->timeout = FALSE;
......
84 89
    $this->lineLimit = 0;
85 90
    $this->lastLinePos = 0;
86 91
    ini_set('auto_detect_line_endings', TRUE);
92
    if (extension_loaded('mbstring') && variable_get('feeds_use_mbstring', TRUE)) {
93
      $this->useMbString = TRUE;
94
    }
87 95
  }
88 96

  
89 97
  /**
......
94 102
    $this->delimiter = $delimiter;
95 103
  }
96 104

  
105
  /**
106
   * Sets the source file encoding.
107
   *
108
   * By default, the encoding is UTF-8.
109
   *
110
   * @param string $encoding
111
   *   The encoding to set.
112
   */
113
  public function setEncoding($encoding) {
114
    $this->fromEncoding = $encoding;
115
  }
116

  
97 117
  /**
98 118
   * Set this to TRUE if the parser should skip the first line of the CSV text,
99 119
   * which might be desired if the first line contains the column names.
......
197 217
    for ($lineIterator->rewind($this->startByte); $lineIterator->valid(); $lineIterator->next()) {
198 218

  
199 219
      // Make really sure we've got lines without trailing newlines.
200
      $line = trim($lineIterator->current(), "\r\n");
220
      $line = trim($this->fixEncoding($lineIterator->current()), "\r\n");
201 221

  
202 222
      // Skip empty lines.
203 223
      if (empty($line)) {
......
237 257
            }
238 258
            // Ok, so, on with fetching the next line, as mentioned above.
239 259
            $currentField .= "\n";
240
            $line = trim($lineIterator->current(), "\r\n");
260
            $line = trim($this->fixEncoding($lineIterator->current()), "\r\n");
241 261
            $currentIndex = 0;
242 262
            continue;
243 263
          }
......
325 345
    }
326 346
    return $rows;
327 347
  }
348

  
349
  /**
350
   * Converts encoding of input data.
351
   *
352
   * @param string $data
353
   *   A chunk of data.
354
   *
355
   * @return string
356
   *   The encoded data.
357
   *
358
   * @throws ParserCSVEncodingException
359
   *   Thrown when a given encoding does not match.
360
   */
361
  public function fixEncoding($data) {
362
    if ($this->useMbString) {
363
      if (mb_check_encoding($data, $this->fromEncoding)) {
364
        if ($this->toEncoding != $this->fromEncoding) {
365
          // Convert encoding. The conversion is to UTF-8 by default to prevent
366
          // SQL errors.
367
          $data = mb_convert_encoding($data, $this->toEncoding, $this->fromEncoding);
368
        }
369
      }
370
      else {
371
        throw new ParserCSVEncodingException(t('Source file is not in %encoding encoding.', array('%encoding' => $this->fromEncoding)));
372
      }
373
    }
374

  
375
    return $data;
376
  }
328 377
}
378

  
379
/**
380
 * Exception thrown when an encoding error occurs during parsing.
381
 */
382
class ParserCSVEncodingException extends Exception {}
drupal7/sites/all/modules/feeds/libraries/common_syndication_parser.inc
165 165
      }
166 166
    }
167 167

  
168
    $author_found = FALSE;
168
    $original_author = '';
169 169
    if (!empty($news->source->author->name)) {
170 170
      $original_author = "{$news->source->author->name}";
171
      $author_found = TRUE;
172 171
    }
173 172
    elseif (!empty($news->author->name)) {
174 173
      $original_author = "{$news->author->name}";
175
      $author_found = TRUE;
176 174
    }
177
    if (!empty($feed_XML->author->name) && !$author_found) {
175
    elseif (!empty($feed_XML->author->name)) {
178 176
      $original_author = "{$feed_XML->author->name}";
179 177
    }
180 178

  
drupal7/sites/all/modules/feeds/libraries/http_request.inc
49 49
    return FALSE;
50 50
  }
51 51

  
52
  // Drop the data into a seperate variable so all manipulations of the html
52
  // Drop the data into a separate variable so all manipulations of the html
53 53
  // will not effect the actual object that exists in the static cache.
54 54
  // @see http_request_get.
55 55
  $downloaded_string = $download->data;
......
196 196

  
197 197
      if ($accept_invalid_cert) {
198 198
        curl_setopt($download, CURLOPT_SSL_VERIFYPEER, 0);
199
        curl_setopt($download, CURLOPT_SSL_VERIFYHOST, 0);
199 200
      }
200 201
      $header = '';
201 202
      $data = curl_exec($download);
......
440 441
    // Produces variables $scheme, $host, $user, $pass, $path, $query and
441 442
    // $fragment.
442 443
    $parsed_url = parse_url($base_url);
444
    if ($parsed_url === FALSE) {
445
      // Invalid $base_url.
446
      return FALSE;
447
    }
443 448

  
444
    $path = dirname($parsed_url['path']);
449
    $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
450
    if (strlen($path) > 0 && substr($path, -1) != '/') {
451
      // Path ends not with '/', so remove all before previous '/'.
452
      $path = dirname($path);
453
    }
445 454

  
446 455
    // Adding to the existing path.
456
    $cparts = array();
447 457
    if ($url{0} == '/') {
448 458
      $cparts = array_filter(explode("/", $url));
449 459
    }
450 460
    else {
451 461
      // Backtracking from the existing path.
452
      $cparts = array_merge(array_filter(explode("/", $path)), array_filter(explode("/", $url)));
453
      foreach ($cparts as $i => $part) {
454
        if ($part == '.') {
455
          $cparts[$i] = NULL;
456
        }
457
        if ($part == '..') {
458
          $cparts[$i - 1] = NULL;
459
          $cparts[$i] = NULL;
460
        }
462
      $path_cparts = array_filter(explode("/", $path));
463
      $url_cparts = array_filter(explode("/", $url));
464
      $cparts = array_merge($path_cparts, $url_cparts);
465
    }
466

  
467
    $remove_parts = 0;
468
    // Start from behind.
469
    $reverse_cparts = array_reverse($cparts);
470
    foreach ($reverse_cparts as $i => &$part) {
471
      if ($part == '.') {
472
        $part = NULL;
473
      }
474
      elseif ($part == '..') {
475
        $part = NULL;
476
        $remove_parts++;
477
      }
478
      elseif ($remove_parts > 0) {
479
        // If the current part isn't "..", and we had ".." before, then delete
480
        // the part.
481
        $part = NULL;
482
        $remove_parts--;
461 483
      }
462
      $cparts = array_filter($cparts);
463 484
    }
485
    $cparts = array_filter(array_reverse($reverse_cparts));
464 486
    $path = implode("/", $cparts);
465 487

  
466 488
    // Build the prefix to the path.
drupal7/sites/all/modules/feeds/mappers/date.inc
37 37
/**
38 38
 * Callback for setting date values.
39 39
 */
40
function date_feeds_set_target(FeedsSource $source, $entity, $target, array $values) {
40
function date_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
41 41
  list($field_name, $sub_field) = explode(':', $target, 2);
42 42

  
43 43
  $delta = 0;
......
56 56
      }
57 57
    }
58 58

  
59
    $value->buildDateField($entity, $field_name, $delta);
59
    $value->buildDateField($entity, $field_name, $delta, $mapping['language']);
60 60
    $delta++;
61 61
  }
62 62
}
drupal7/sites/all/modules/feeds/mappers/entity_translation.inc
1
<?php
2

  
3
/**
4
 * @file
5
 * On behalf implementation of Feeds mapping API for entity_translation.module.
6
 */
7

  
8
/**
9
 * Implements hook_feeds_presave().
10
 */
11
function entity_translation_feeds_presave(FeedsSource $source, $entity, $item, $entity_id) {
12
  $entity_type = $entity->feeds_item->entity_type;
13

  
14
  // Check that it's a real entity type, and translation is enabled.
15
  if (!entity_get_info($entity_type) || !entity_translation_enabled($entity_type, $entity)) {
16
    return;
17
  }
18

  
19
  if (!$handler = entity_translation_get_handler($entity_type, $entity)) {
20
    return;
21
  }
22

  
23
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
24

  
25
  $languages_seen = array();
26

  
27
  foreach (field_info_instances($entity_type, $bundle) as $instance) {
28
    $field_name = $instance['field_name'];
29

  
30
    // No values in this field, skip it.
31
    if (empty($entity->$field_name) || !is_array($entity->$field_name)) {
32
      continue;
33
    }
34

  
35
    // Not translatable.
36
    $info = field_info_field($field_name);
37
    if (!$info || !$info['translatable']) {
38
      continue;
39
    }
40

  
41
    // Init the translation handler.
42
    if (empty($handler->getTranslations()->original)) {
43
      $handler->initTranslations();
44
    }
45

  
46
    // Avoid invalid user configuration. Entity translation does this when
47
    // loading the translation overview page.
48
    if (count($entity->$field_name) === 1 && key($entity->$field_name) === LANGUAGE_NONE && $handler->getLanguage() !== LANGUAGE_NONE) {
49
      $entity->{$field_name}[$handler->getLanguage()] = $entity->{$field_name}[LANGUAGE_NONE];
50
      $entity->{$field_name}[LANGUAGE_NONE] = array();
51
    }
52

  
53
    // Look for languages we haven't created a translation for yet.
54
    foreach (array_diff_key($entity->$field_name, $languages_seen) as $language => $v) {
55
      if ($language === LANGUAGE_NONE) {
56
        continue;
57
      }
58

  
59
      $languages_seen[$language] = TRUE;
60

  
61
      if ($language === $handler->getLanguage()) {
62
        continue;
63
      }
64

  
65
      $translation = array(
66
        'translate' => 0,
67
        'status' => 1,
68
        'language' => $language,
69
        'source' => $handler->getLanguage(),
70
      );
71

  
72
      $handler->setTranslation($translation, $entity);
73
    }
74
  }
75

  
76
  // Loop through every language for the site, and remove translations for the
77
  // ones that don't have any values.
78
  foreach (language_list() as $language) {
79
    if (!isset($languages_seen[$language->language])) {
80
      $handler->removeTranslation($language->language);
81
    }
82
  }
83
}
drupal7/sites/all/modules/feeds/mappers/file.inc
23 23
        'real_target' => $name,
24 24
      );
25 25

  
26
      // Keep the old target name for backwards compatibility, but hide it from
27
      // the UI.
28
      $targets[$name] = $targets[$name . ':uri'];
29
      $targets[$name]['deprecated'] = TRUE;
30

  
26 31
      if ($info['type'] == 'image') {
27 32
        $targets[$name . ':alt'] = array(
28 33
          'name' => t('@label: Alt', array('@label' => $instance['label'])),
......
54 59
/**
55 60
 * Callback for mapping file fields.
56 61
 */
57
function file_feeds_set_target(FeedsSource $source, $entity, $target, array $values) {
62
function file_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
63
  $language = $mapping['language'];
64

  
58 65
  // Add default of uri for backwards compatibility.
59 66
  list($field_name, $sub_field) = explode(':', $target . ':uri');
60 67
  $info = field_info_field($field_name);
......
74 81
      }
75 82
    }
76 83

  
77
    $entity_type = $source->importer->processor->entityType();
78
    $bundle = $source->importer->processor->bundle();
79

  
84
    if ($entity instanceof Entity) {
85
      $entity_type = $entity->entityType();
86
      $bundle = $entity->bundle();
87
    }
88
    else {
89
      $entity_type = $source->importer->processor->entityType();
90
      $bundle = $source->importer->processor->bundle();
91
    }
80 92
    $instance_info = field_info_instance($entity_type, $field_name, $bundle);
81 93

  
82 94
    // Determine file destination.
......
90 102
  }
91 103

  
92 104
  // Populate entity.
93
  $field = isset($entity->$field_name) ? $entity->$field_name : array(LANGUAGE_NONE => array());
105
  $field = isset($entity->$field_name) ? $entity->$field_name : array($language => array());
94 106
  $delta = 0;
95 107
  foreach ($values as $v) {
96 108
    if ($info['cardinality'] == $delta) {
97 109
      break;
98 110
    }
99 111

  
100
    if (!isset($field[LANGUAGE_NONE][$delta])) {
101
      $field[LANGUAGE_NONE][$delta] = array();
112
    if (!isset($field[$language][$delta])) {
113
      $field[$language][$delta] = array();
102 114
    }
103 115

  
104 116
    switch ($sub_field) {
105 117
      case 'alt':
106 118
      case 'title':
107 119
      case 'description':
108
        $field[LANGUAGE_NONE][$delta][$sub_field] = $v;
120
        $field[$language][$delta][$sub_field] = $v;
109 121
        break;
110 122

  
111 123
      case 'uri':
112 124
        if ($v) {
113 125
          try {
114 126
            $v->setAllowedExtensions($instance_info['settings']['file_extensions']);
115
            $field[LANGUAGE_NONE][$delta] += (array) $v->getFile($destination);
127
            $field[$language][$delta] += (array) $v->getFile($destination);
116 128
            // @todo: Figure out how to properly populate this field.
117
            $field[LANGUAGE_NONE][$delta]['display'] = 1;
129
            $field[$language][$delta]['display'] = 1;
118 130
          }
119 131
          catch (Exception $e) {
120 132
            watchdog('feeds', check_plain($e->getMessage()));
drupal7/sites/all/modules/feeds/mappers/link.inc
39 39
/**
40 40
 * Callback for mapping link fields.
41 41
 */
42
function link_feeds_set_target(FeedsSource $source, $entity, $target, array $values) {
42
function link_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
43
  $language = $mapping['language'];
44

  
43 45
  list($field_name, $column) = explode(':', $target);
44 46

  
45
  $field = isset($entity->$field_name) ? $entity->$field_name : array('und' => array());
47
  $field = isset($entity->$field_name) ? $entity->$field_name : array($language => array());
46 48
  $delta = 0;
47 49

  
48 50
  foreach ($values as $value) {
......
51 53
    }
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff