SimplePie::merge_items()public staticWP 1.0

Merge items from several feeds into one

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

{} Это метод класса: SimplePie{}

Хуков нет.

Возвращает

Массив.

Использование

$result = SimplePie::merge_items( $urls, $start, $end, $limit );
$urls(массив) (обязательный)
List of SimplePie feed objects to merge
$start(int)
Starting item
$end(int)
Number of items to return
$limit(int)
Maximum number of items per feed

Код SimplePie::merge_items() WP 6.1.1

public static function merge_items($urls, $start = 0, $end = 0, $limit = 0)
{
	if (is_array($urls) && sizeof($urls) > 0)
	{
		$items = array();
		foreach ($urls as $arg)
		{
			if ($arg instanceof SimplePie)
			{
				$items = array_merge($items, $arg->get_items(0, $limit));
			}
			else
			{
				trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
			}
		}

		usort($items, array(get_class($urls[0]), 'sort_items'));

		if ($end === 0)
		{
			return array_slice($items, $start);
		}

		return array_slice($items, $start, $end);
	}

	trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
	return array();
}