You are here

class FeedsHTTPBatch in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsHTTPFetcher.inc \FeedsHTTPBatch

Definition of the import batch object created on the fetching stage by FeedsHTTPFetcher.

Hierarchy

Expanded class hierarchy of FeedsHTTPBatch

File

plugins/FeedsHTTPFetcher.inc, line 14

View source
class FeedsHTTPBatch extends FeedsImportBatch {
  protected $url;
  protected $file_path;

  /**
   * Constructor.
   */
  public function __construct($url = NULL, $feed_nid) {
    $this->url = $url;
    parent::__construct('', $feed_nid);
  }

  /**
   * Implements FeedsImportBatch::getRaw();
   */
  public function getRaw() {
    feeds_include_library('http_request.inc', 'http_request');
    $result = http_request_get($this->url);
    if (!in_array($result->code, array(
      200,
      201,
      202,
      203,
      204,
      205,
      206,
    ))) {
      throw new Exception(t('Download of @url failed with code !code.', array(
        '@url' => $this->url,
        '!code' => $result->code,
      )));
    }
    return $result->data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsBatch::$progress protected property
FeedsBatch::$total protected property
FeedsBatch::getProgress public function Report progress.
FeedsBatch::getTotal public function Get the total for a stage.
FeedsBatch::setProgress public function Set progress for a stage.
FeedsBatch::setTotal public function Set the total for a stage.
FeedsHTTPBatch::$file_path protected property Overrides FeedsImportBatch::$file_path
FeedsHTTPBatch::$url protected property
FeedsHTTPBatch::getRaw public function Implements FeedsImportBatch::getRaw(); Overrides FeedsImportBatch::getRaw
FeedsHTTPBatch::__construct public function Constructor. Overrides FeedsImportBatch::__construct
FeedsImportBatch::$created public property
FeedsImportBatch::$current_item protected property
FeedsImportBatch::$description protected property
FeedsImportBatch::$feed_nid protected property
FeedsImportBatch::$items protected property
FeedsImportBatch::$link protected property
FeedsImportBatch::$raw protected property
FeedsImportBatch::$title protected property
FeedsImportBatch::$updated public property
FeedsImportBatch::addItem public function Add an item.
FeedsImportBatch::currentItem public function
FeedsImportBatch::feedNode public function Return the feed node related to this batch object.
FeedsImportBatch::getDescription public function
FeedsImportBatch::getFilePath public function Get a path to a temporary file containing the resource provided by the fetcher. 1
FeedsImportBatch::getItemCount public function Get number of items.
FeedsImportBatch::getLink public function
FeedsImportBatch::getTitle public function
FeedsImportBatch::setDescription public function Set description.
FeedsImportBatch::setItems public function Set items.
FeedsImportBatch::setLink public function Set link.
FeedsImportBatch::setTitle public function Set title.
FeedsImportBatch::shiftItem public function @todo Move to a nextItem() based approach, not consuming the item array. Can only be done once we don't cache the entire batch object between page loads for batching anymore.