You are here

public function FeedsSyndicationParser::parse in Feeds 6

Same name and namespace in other branches
  1. 7.2 plugins/FeedsSyndicationParser.inc \FeedsSyndicationParser::parse()
  2. 7 plugins/FeedsSyndicationParser.inc \FeedsSyndicationParser::parse()

Implementation of FeedsParser::parse().

Overrides FeedsParser::parse

File

plugins/FeedsSyndicationParser.inc, line 13

Class

FeedsSyndicationParser
Class definition for Common Syndication Parser.

Code

public function parse(FeedsImportBatch $batch, FeedsSource $source) {
  feeds_include_library('common_syndication_parser.inc', 'common_syndication_parser');
  $result = common_syndication_parser_parse($batch
    ->getRaw());
  $batch->title = $result['title'];
  $batch->description = $result['description'];
  $batch->link = $result['link'];
  if (is_array($result['items'])) {
    foreach ($result['items'] as $item) {
      if (isset($item['geolocations'])) {
        foreach ($item['geolocations'] as $k => $v) {
          $item['geolocations'][$k] = new FeedsGeoTermElement($v);
        }
      }
      $batch->items[] = $item;
    }
  }
}