Projet

Général

Profil

Paste
Télécharger (890 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds / plugins / FeedsOPMLParser.inc @ 3aa14731

1
<?php
2

    
3
/**
4
 * @file
5
 * OPML Parser plugin.
6
 */
7

    
8
/**
9
 * Feeds parser plugin that parses OPML feeds.
10
 */
11
class FeedsOPMLParser extends FeedsParser {
12

    
13
  /**
14
   * Implements FeedsParser::parse().
15
   */
16
  public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
17
    feeds_include_library('opml_parser.inc', 'opml_parser');
18
    $opml = opml_parser_parse($fetcher_result->getRaw());
19
    $result = new FeedsParserResult($opml['items']);
20
    $result->title = $opml['title'];
21
    return $result;
22
  }
23

    
24
  /**
25
   * Return mapping sources.
26
   */
27
  public function getMappingSources() {
28
    return array(
29
      'title' => array(
30
        'name' => t('Feed title'),
31
        'description' => t('Title of the feed.'),
32
      ),
33
      'xmlurl' => array(
34
        'name' => t('Feed URL'),
35
        'description' => t('URL of the feed.'),
36
      ),
37
    ) + parent::getMappingSources();
38
  }
39
}