You are here

class InstagramFeedsPluginsEnclosure in Instagram Feeds 7

Enclosure element, can be part of the result array.

Hierarchy

Expanded class hierarchy of InstagramFeedsPluginsEnclosure

File

modules/instagram_feeds_plugins/plugins/feeds/InstagramFeedsPluginsPager.inc, line 232
Home of the InstagramFeedsPluginsPager.

View source
class InstagramFeedsPluginsEnclosure extends FeedsEnclosure {
  protected $mimetype;

  /**
   * Constructor, requires MIME type.
   *
   * @param string $value
   *   A path to a local file or a URL to a remote document.
   * @param string $mimetype
   *   The mime type of the resource.
   */
  public function __construct($value, $mimetype) {
    parent::__construct($value, $mimetype);
    $this->mimetype = $mimetype;
  }

  /**
   * Get the content of the referenced resource.
   *
   * @return array()
   *   The content of the referenced resource.
   */
  public function getContent() {
    feeds_include_library('http_request.inc', 'http_request');
    $result = http_request_get($this
      ->getUrlEncodedValue(), NULL, NULL, TRUE);
    if ($result->code != 200) {
      throw new Exception(t('Download of @url failed with code !code.', array(
        '@url' => $this
          ->getUrlEncodedValue(),
        '!code' => $result->code,
      )));
    }
    return $result->data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InstagramFeedsPluginsEnclosure::$mimetype protected property
InstagramFeedsPluginsEnclosure::getContent public function Get the content of the referenced resource.
InstagramFeedsPluginsEnclosure::__construct public function Constructor, requires MIME type.