You are here

class FeedsSimplePieEnclosure in Feeds 8.2

Hierarchy

Expanded class hierarchy of FeedsSimplePieEnclosure

1 file declares its use of FeedsSimplePieEnclosure
FeedsSimplePieParser.php in lib/Drupal/feeds/Plugin/feeds/parser/FeedsSimplePieParser.php
Contains FeedsSimplePieParser and related classes.

File

lib/Drupal/feeds/FeedsSimplePieEnclosure.php, line 5

Namespace

Drupal\feeds
View source
class FeedsSimplePieEnclosure extends FeedsEnclosure {
  protected $simplepie_enclosure;
  private $_serialized_simplepie_enclosure;

  /**
   * Constructor requires SimplePie enclosure object.
   */
  function __construct(\SimplePie_Enclosure $enclosure) {
    $this->simplepie_enclosure = $enclosure;
  }

  /**
   * Serialization helper.
   *
   * Handle the simplepie enclosure class seperately ourselves.
   */
  public function __sleep() {
    $this->_serialized_simplepie_enclosure = serialize($this->simplepie_enclosure);
    return array(
      '_serialized_simplepie_enclosure',
    );
  }

  /**
   * Unserialization helper.
   *
   * Ensure that the simplepie class definitions are loaded for the enclosure when unserializing.
   */
  public function __wakeup() {
    feeds_include_simplepie();
    $this->simplepie_enclosure = unserialize($this->_serialized_simplepie_enclosure);
  }

  /**
   * Override parent::getValue().
   */
  public function getValue() {
    return $this->simplepie_enclosure
      ->get_link();
  }

  /**
   * Override parent::getMIMEType().
   */
  public function getMIMEType() {
    return $this->simplepie_enclosure
      ->get_real_type();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsElement::$value protected property
FeedsElement::__toString public function Magic method __toString() for printing and string conversion of this object.
FeedsEnclosure::$mime_type protected property
FeedsEnclosure::getContent public function
FeedsEnclosure::getFile public function Get a Drupal file object of the enclosed resource, download if necessary.
FeedsEnclosure::getLocalValue public function Use this method instead of FeedsElement::getValue() to get the file name transformed for better local saving (underscores instead of spaces)
FeedsEnclosure::getUrlEncodedValue public function Use this method instead of FeedsElement::getValue() when fetching the file from the URL.
FeedsSimplePieEnclosure::$simplepie_enclosure protected property
FeedsSimplePieEnclosure::$_serialized_simplepie_enclosure private property
FeedsSimplePieEnclosure::getMIMEType public function Override parent::getMIMEType(). Overrides FeedsEnclosure::getMIMEType
FeedsSimplePieEnclosure::getValue public function Override parent::getValue(). Overrides FeedsElement::getValue
FeedsSimplePieEnclosure::__construct function Constructor requires SimplePie enclosure object. Overrides FeedsEnclosure::__construct
FeedsSimplePieEnclosure::__sleep public function Serialization helper.
FeedsSimplePieEnclosure::__wakeup public function Unserialization helper.