SimplePie::merge_items

Advertisement

Summery Summery

Merge items from several feeds into one

Syntax Syntax

SimplePie::merge_items( array $urls, int $start, int $end, int $limit )

Description Description

If you’re merging multiple feeds together, they need to all have dates for the items or else SimplePie will refuse to sort them.

Parameters Parameters

$urls

(Required) List of SimplePie feed objects to merge

$start

(Required) Starting item

$end

(Required) Number of items to return

$limit

(Required) Maximum number of items per feed

Return Return

(array)

Source Source

File: wp-includes/class-simplepie.php

			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
			{
				$keys = array_keys($items);
				foreach ($keys as $key)
				{
					$this->data['items'][] = $this->registry->create('Item', array($this, $items[$key]));
				}
			}
			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
			{
				$keys = array_keys($items);
				foreach ($keys as $key)
				{
					$this->data['items'][] = $this->registry->create('Item', array($this, $items[$key]));
				}
			}
			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
			{
				$keys = array_keys($items);
				foreach ($keys as $key)
				{
					$this->data['items'][] = $this->registry->create('Item', array($this, $items[$key]));
				}
			}
			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
			{
				$keys = array_keys($items);
				foreach ($keys as $key)
				{
					$this->data['items'][] = $this->registry->create('Item', array($this, $items[$key]));
				}
			}
			if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
			{
				$keys = array_keys($items);
				foreach ($keys as $key)
				{
					$this->data['items'][] = $this->registry->create('Item', array($this, $items[$key]));
				}
			}
		}

		if (empty($this->data['items']))
		{
			return array();
		}

Advertisement

Advertisement

Leave a Reply