You are here

class ParserIcalFeedsParser in iCal feed parser 7

Same name and namespace in other branches
  1. 6.2 includes/ParserIcalFeedsParser.inc \ParserIcalFeedsParser

Class definition for iCal date module Parser.

Parses iCal feeds using the iCal parser included with the date module.

Hierarchy

Expanded class hierarchy of ParserIcalFeedsParser

2 string references to 'ParserIcalFeedsParser'
ParserIcalFeedsTestCase::createConfiguredFeed in tests/parser_ical_feeds.test
Basic test configured feed item, to import feed into.
parser_ical_feeds_plugins in ./parser_ical.module
Implementation of ctools plugin for feeds hook_feeds_plugins().

File

includes/ParserIcalFeedsParser.inc, line 113

View source
class ParserIcalFeedsParser extends FeedsParser {

  /**
   * Parse content fetched by fetcher.
   */
  public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
    module_load_include('inc', 'parser_ical', 'parser_ical.dateapi');
    $parsed_output = _parser_ical_parse($fetcher_result
      ->getRaw());

    // Construct the standard form of the parsed feed
    $result = new FeedsParserResult();
    $result->title = $parsed_output['title'];
    $result->description = $parsed_output['description'];
    $result->items = $parsed_output['items'];

    // also available calscale, timezone
    return $result;
  }

  /**
   * Return mapping sources.
   *
   * At a future point, we could expose data type information here,
   * storage systems like Data module could use this information to store
   * parsed data automatically in fields with a correct field type.
   */
  public function getMappingSources() {
    return array(
      'title' => array(
        'name' => t('Title'),
        'description' => t('Title of the feed item.'),
      ),
      'description' => array(
        'name' => t('Description'),
        'description' => t('Description of the feed item.'),
      ),
      // 'author' => t('Author'), // not implemented
      'timestamp' => array(
        'name' => t('Published date'),
        'description' => t('Published date as UNIX time UTC of the feed item.'),
      ),
      'url' => array(
        'name' => t('Item URL (link)'),
        'description' => t('URL of the feed item.'),
      ),
      'guid' => array(
        'name' => t('Item GUID'),
        'description' => t('Global Unique Identifier of the feed item.'),
      ),
      'tags' => array(
        'name' => t('Categories'),
        'description' => t('An array of categories that have been assigned to the feed item.'),
      ),
      'ical_date' => array(
        'name' => t('iCal Date'),
        'description' => t('iCal date associated with item as an array.'),
      ),
      'ical_location' => array(
        'name' => t('iCal location string'),
        'description' => t('The location string associated with an item.'),
      ),
    ) + parent::getMappingSources();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParserIcalFeedsParser::getMappingSources public function Return mapping sources.
ParserIcalFeedsParser::parse public function Parse content fetched by fetcher.