class Feed in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/zendframework/zend-feed/src/Writer/Feed.php \Zend\Feed\Writer\Feed
- 8.0 core/modules/aggregator/src/Entity/Feed.php \Drupal\aggregator\Entity\Feed
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php \Zend\Feed\Reader\Extension\Syndication\Feed
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php \Zend\Feed\Reader\Extension\Atom\Feed
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php \Zend\Feed\Reader\Extension\Podcast\Feed
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php \Zend\Feed\Reader\Extension\DublinCore\Feed
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Feed.php \Zend\Feed\Reader\Extension\CreativeCommons\Feed
- 8.0 vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php \Zend\Feed\Writer\Extension\ITunes\Feed
- 8.0 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed
- 8.0 vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php \Zend\Feed\Writer\Extension\Atom\Renderer\Feed
- 8.0 vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php \Zend\Feed\Writer\Extension\DublinCore\Renderer\Feed
- 8.0 vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php \Zend\Feed\Writer\Extension\ITunes\Renderer\Feed
Same name and namespace in other branches
- 8 vendor/zendframework/zend-feed/src/Writer/Feed.php \Zend\Feed\Writer\Feed
Hierarchy
- class \Zend\Feed\Writer\AbstractFeed
- class \Zend\Feed\Writer\Feed implements \Iterator, \Countable
Expanded class hierarchy of Feed
18 string references to 'Feed'
- aggregator.schema.yml in core/
modules/ aggregator/ config/ schema/ aggregator.schema.yml - core/modules/aggregator/config/schema/aggregator.schema.yml
- ExtensionPluginManager::validatePlugin in vendor/
zendframework/ zend-feed/ src/ Writer/ ExtensionPluginManager.php - Validate the plugin
- PreviewTest::testPreviewUI in core/
modules/ views_ui/ src/ Tests/ PreviewTest.php - Tests arguments in the preview form.
- views.view.aggregator_rss_feed.yml in core/
modules/ aggregator/ config/ optional/ views.view.aggregator_rss_feed.yml - core/modules/aggregator/config/optional/views.view.aggregator_rss_feed.yml
- views.view.aggregator_sources.yml in core/
modules/ aggregator/ config/ optional/ views.view.aggregator_sources.yml - core/modules/aggregator/config/optional/views.view.aggregator_sources.yml
File
- vendor/
zendframework/ zend-feed/ src/ Writer/ Feed.php, line 17
Namespace
Zend\Feed\WriterView source
class Feed extends AbstractFeed implements Iterator, Countable {
/**
* Contains all entry objects
*
* @var array
*/
protected $entries = [];
/**
* A pointer for the iterator to keep track of the entries array
*
* @var int
*/
protected $entriesKey = 0;
/**
* Creates a new Zend\Feed\Writer\Entry data container for use. This is NOT
* added to the current feed automatically, but is necessary to create a
* container with some initial values preset based on the current feed data.
*
* @return \Zend\Feed\Writer\Entry
*/
public function createEntry() {
$entry = new Entry();
if ($this
->getEncoding()) {
$entry
->setEncoding($this
->getEncoding());
}
$entry
->setType($this
->getType());
return $entry;
}
/**
* Appends a Zend\Feed\Writer\Deleted object representing a new entry tombstone
* to the feed data container's internal group of entries.
*
* @param Deleted $deleted
* @return void
*/
public function addTombstone(Deleted $deleted) {
$this->entries[] = $deleted;
}
/**
* Creates a new Zend\Feed\Writer\Deleted data container for use. This is NOT
* added to the current feed automatically, but is necessary to create a
* container with some initial values preset based on the current feed data.
*
* @return Deleted
*/
public function createTombstone() {
$deleted = new Deleted();
if ($this
->getEncoding()) {
$deleted
->setEncoding($this
->getEncoding());
}
$deleted
->setType($this
->getType());
return $deleted;
}
/**
* Appends a Zend\Feed\Writer\Entry object representing a new entry/item
* the feed data container's internal group of entries.
*
* @param Entry $entry
* @return Feed
*/
public function addEntry(Entry $entry) {
$this->entries[] = $entry;
return $this;
}
/**
* Removes a specific indexed entry from the internal queue. Entries must be
* added to a feed container in order to be indexed.
*
* @param int $index
* @throws Exception\InvalidArgumentException
* @return Feed
*/
public function removeEntry($index) {
if (!isset($this->entries[$index])) {
throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.');
}
unset($this->entries[$index]);
return $this;
}
/**
* Retrieve a specific indexed entry from the internal queue. Entries must be
* added to a feed container in order to be indexed.
*
* @param int $index
* @throws Exception\InvalidArgumentException
*/
public function getEntry($index = 0) {
if (isset($this->entries[$index])) {
return $this->entries[$index];
}
throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.');
}
/**
* Orders all indexed entries by date, thus offering date ordered readable
* content where a parser (or Homo Sapien) ignores the generic rule that
* XML element order is irrelevant and has no intrinsic meaning.
*
* Using this method will alter the original indexation.
*
* @return Feed
*/
public function orderByDate() {
/**
* Could do with some improvement for performance perhaps
*/
$timestamp = time();
$entries = [];
foreach ($this->entries as $entry) {
if ($entry
->getDateModified()) {
$timestamp = (int) $entry
->getDateModified()
->getTimestamp();
}
elseif ($entry
->getDateCreated()) {
$timestamp = (int) $entry
->getDateCreated()
->getTimestamp();
}
$entries[$timestamp] = $entry;
}
krsort($entries, SORT_NUMERIC);
$this->entries = array_values($entries);
return $this;
}
/**
* Get the number of feed entries.
* Required by the Iterator interface.
*
* @return int
*/
public function count() {
return count($this->entries);
}
/**
* Return the current entry
*
* @return Entry
*/
public function current() {
return $this->entries[$this
->key()];
}
/**
* Return the current feed key
*
* @return mixed
*/
public function key() {
return $this->entriesKey;
}
/**
* Move the feed pointer forward
*
* @return void
*/
public function next() {
++$this->entriesKey;
}
/**
* Reset the pointer in the feed object
*
* @return void
*/
public function rewind() {
$this->entriesKey = 0;
}
/**
* Check to see if the iterator is still valid
*
* @return bool
*/
public function valid() {
return 0 <= $this->entriesKey && $this->entriesKey < $this
->count();
}
/**
* Attempt to build and return the feed resulting from the data set
*
* @param string $type The feed type "rss" or "atom" to export as
* @param bool $ignoreExceptions
* @throws Exception\InvalidArgumentException
* @return string
*/
public function export($type, $ignoreExceptions = false) {
$this
->setType(strtolower($type));
$type = ucfirst($this
->getType());
if ($type !== 'Rss' && $type !== 'Atom') {
throw new Exception\InvalidArgumentException('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".');
}
$renderClass = 'Zend\\Feed\\Writer\\Renderer\\Feed\\' . $type;
$renderer = new $renderClass($this);
if ($ignoreExceptions) {
$renderer
->ignoreExceptions();
}
return $renderer
->render()
->saveXml();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractFeed:: |
protected | property | Contains all Feed level date to append in feed output | |
AbstractFeed:: |
protected | property | ||
AbstractFeed:: |
protected | property | Holds the value "atom" or "rss" depending on the feed type set when when last exported. | |
AbstractFeed:: |
public | function | Set a single author | |
AbstractFeed:: |
public | function | Set an array with feed authors | |
AbstractFeed:: |
public | function | Set an array of feed categories | |
AbstractFeed:: |
public | function | Add a feed category | |
AbstractFeed:: |
public | function | Add a Pubsubhubbub hub endpoint URL | |
AbstractFeed:: |
public | function | Add Pubsubhubbub hub endpoint URLs | |
AbstractFeed:: |
public | function | Get a single author | |
AbstractFeed:: |
public | function | Get an array with feed authors | |
AbstractFeed:: |
public | function | Get the feed's base url | |
AbstractFeed:: |
public | function | Get the feed categories | |
AbstractFeed:: |
public | function | Get the copyright entry | |
AbstractFeed:: |
public | function | Get the feed creation date | |
AbstractFeed:: |
public | function | Get the feed modification date | |
AbstractFeed:: |
public | function | Get the feed description | |
AbstractFeed:: |
public | function | Get the feed character encoding | |
AbstractFeed:: |
public | function | Get a link to the XML feed | |
AbstractFeed:: |
public | function | Get the feed generator entry | |
AbstractFeed:: |
public | function | Get the URLs used as Pubsubhubbub hubs endpoints | |
AbstractFeed:: |
public | function | Get the feed ID | |
AbstractFeed:: |
public | function | Get the feed image URI | |
AbstractFeed:: |
public | function | Get the feed language | |
AbstractFeed:: |
public | function | Get the feed last-build date | |
AbstractFeed:: |
public | function | Get a link to the HTML source | |
AbstractFeed:: |
public | function | Get the feed title | |
AbstractFeed:: |
public | function | Retrieve the current or last feed type exported. | |
AbstractFeed:: |
public | function | Unset a specific data point | |
AbstractFeed:: |
public | function | Resets the instance and deletes all data | |
AbstractFeed:: |
public | function | Set the feed's base URL | |
AbstractFeed:: |
public | function | Set the copyright entry | |
AbstractFeed:: |
public | function | Set the feed creation date | |
AbstractFeed:: |
public | function | Set the feed modification date | |
AbstractFeed:: |
public | function | Set the feed description | |
AbstractFeed:: |
public | function | Set the feed character encoding | |
AbstractFeed:: |
public | function | Set a link to an XML feed for any feed type/version | |
AbstractFeed:: |
public | function | Set the feed generator entry | |
AbstractFeed:: |
public | function | Set the feed ID - URI or URN (via PCRE pattern) supported | |
AbstractFeed:: |
public | function | Set a feed image (URI at minimum). Parameter is a single array with the required key 'uri'. When rendering as RSS, the required keys are 'uri', 'title' and 'link'. RSS also specifies three optional parameters… | |
AbstractFeed:: |
public | function | Set the feed language | |
AbstractFeed:: |
public | function | Set the feed last-build date. Ignored for Atom 1.0. | |
AbstractFeed:: |
public | function | Set a link to the HTML source | |
AbstractFeed:: |
public | function | Set the feed title | |
AbstractFeed:: |
public | function | Set the current feed type being exported to "rss" or "atom". This allows other objects to gracefully choose whether to execute or not, depending on their appropriateness for the current type, e.g. renderers. | |
AbstractFeed:: |
protected | function | Load extensions from Zend\Feed\Writer\Writer | |
AbstractFeed:: |
protected | function | Validate a URI using the tag scheme (RFC 4151) | |
AbstractFeed:: |
public | function | Method overloading: call given method on first extension implementing it | |
AbstractFeed:: |
public | function | Constructor: Primarily triggers the registration of core extensions and loads those appropriate to this data container. | |
Feed:: |
protected | property | Contains all entry objects | |
Feed:: |
protected | property | A pointer for the iterator to keep track of the entries array | |
Feed:: |
public | function | Appends a Zend\Feed\Writer\Entry object representing a new entry/item the feed data container's internal group of entries. | |
Feed:: |
public | function | Appends a Zend\Feed\Writer\Deleted object representing a new entry tombstone to the feed data container's internal group of entries. | |
Feed:: |
public | function | Get the number of feed entries. Required by the Iterator interface. | |
Feed:: |
public | function | Creates a new Zend\Feed\Writer\Entry data container for use. This is NOT added to the current feed automatically, but is necessary to create a container with some initial values preset based on the current feed data. | |
Feed:: |
public | function | Creates a new Zend\Feed\Writer\Deleted data container for use. This is NOT added to the current feed automatically, but is necessary to create a container with some initial values preset based on the current feed data. | |
Feed:: |
public | function | Return the current entry | |
Feed:: |
public | function | Attempt to build and return the feed resulting from the data set | |
Feed:: |
public | function | Retrieve a specific indexed entry from the internal queue. Entries must be added to a feed container in order to be indexed. | |
Feed:: |
public | function | Return the current feed key | |
Feed:: |
public | function | Move the feed pointer forward | |
Feed:: |
public | function | Orders all indexed entries by date, thus offering date ordered readable content where a parser (or Homo Sapien) ignores the generic rule that XML element order is irrelevant and has no intrinsic meaning. | |
Feed:: |
public | function | Removes a specific indexed entry from the internal queue. Entries must be added to a feed container in order to be indexed. | |
Feed:: |
public | function | Reset the pointer in the feed object | |
Feed:: |
public | function | Check to see if the iterator is still valid |